Make borrowck's notion of scopes consistent with trans's notion of scopes
This eliminates an ICE in trans where the scope for a particular borrow was a statement ID, but the code in trans that does cleanups wasn't finding the block with that scope. As per #3860 preserve looks at a node ID to see if it's for a statement -- if it is, it uses the enclosing scope instead when updating the map that trans looks at later. I added a comment noting that this is not the best fix (since it may cause boxes to be frozen for longer than necessary) and referring to #3511. r=nmatsakis
This commit is contained in:
parent
519b60f313
commit
9d672671e2
6 changed files with 47 additions and 11 deletions
|
|
@ -8,7 +8,6 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-test
|
||||
struct Foo { x: int }
|
||||
|
||||
impl Foo {
|
||||
|
|
@ -19,11 +18,7 @@ impl Foo {
|
|||
|
||||
fn main() {
|
||||
let mut x = @mut Foo { x: 3 };
|
||||
x.stuff(); // error: internal compiler error: no enclosing scope with id 49
|
||||
// storing the result removes the error, so replacing the above
|
||||
// with the following, works:
|
||||
// let _y = x.stuff()
|
||||
|
||||
// also making 'stuff()' not return anything fixes it
|
||||
// I guess the "dangling &ptr" cuases issues?
|
||||
}
|
||||
// Neither of the next two lines should cause an error
|
||||
let _ = x.stuff();
|
||||
x.stuff();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue