[Thank you, gmail send hotkey. So, as I was saying...]

I just pushed something that will make the following program valid:

    fn main() {
        let x = 10;
        let x = x + 10;
        log x;
    }

let bindings now have a scope starting from their definition, and may
shadow each other (you'll still get an unused variable warning if you
shadow something without using it first). My main motivation was to
make destructuring more powerful -- you can't assign to arbitrary
lvalues in destructuring patterns, only introduce new variables. So,
for example, with trans' result records, you can now (after next
snapshot) do...

    let {bcx, val} = trans_something(bcx, something);
    let {bcx, _} = trans_something_else(bcx, val);

... without making up new variable names at every assignment.

There was a bug in which sully expressed the expectation that things
work this way (https://github.com/graydon/rust/issues/649), an no one
objected. If someone wants to object post-hoc, now is the time.

Also, since the other passes use the results of resolve, I assumed
that just changing resolve would be enough (and this seems to be the
case in practice). If you can think of another pass that might be
affected by this change, let me know.

(As an aside, I really wouldn't mind if more people dumped summaries
of semantic changes they make to the list like this. I have only a
vague idea what is going on with move semantics, kinds, and the task
system at the moment. I'd like to know, but I don't want to constantly
pester individual people with questions.)

Best,
Marijn
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to