1
Fork 0

check if the type of a local variable contains illegal region

also, try to suppress some of the duplicate errors---in general
more work is needed to make these error messages comprehensible
to ordinary humans
This commit is contained in:
Niko Matsakis 2012-05-15 21:19:35 -07:00
parent 7df7a9d8ac
commit 9c7b74b025
8 changed files with 115 additions and 71 deletions

View file

@ -0,0 +1,14 @@
fn main() {
let x = 3;
// Here, the variable `p` gets inferred to a type with a lifetime
// of the loop body. The regionck then determines that this type
// is invalid.
let mut p = //! ERROR reference is not valid
&x;
loop {
let x = 1 + *p;
p = &x;
}
}