Closed
Description
The following tests report the lifetime mismatches nicely under AST borrowck but fail to do so under NLL.
Tests:
- lifetime-errors/ex3-both-anon-regions-2.rs
(This list of tests is drawn from an informal paper document that I have been using to keep notes for myself as I work on this...)
Example (ex3-both-anon-regions-2.rs)
AST diagnostic:
error[E0623]: lifetime mismatch
--> $DIR/ex3-both-anon-regions-2.rs:12:9
|
LL | fn foo((v, w): (&u8, &u8), x: &u8) {
| --- --- these two types are declared with different lifetimes...
LL | v = x; //~ ERROR lifetime mismatch
| ^ ...but data from `x` flows here
NLL diagnostic:
warning: not reporting region error due to nll
--> $DIR/ex3-both-anon-regions-2.rs:12:9
|
LL | v = x; //~ ERROR lifetime mismatch
| ^
Update (pnkfelix)
- Wait, is this assignment actually legal under NLL? Seems like it shouldn't be legal. But the test could be made more robust to actually illustrate why such an assignment would be broken.