#local works on function and types but not on constants or variables:
#local
const MY_CONSTANT = "value" // error: the label can only be applied to type alias or fn
#local
var my_variable = "value" // same error
Not sure whether or not this is done on purpose.
@weiwenhao are you open to proposals to improve this? I am not against #local but I think there are some other options worth considering.