-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NLL ignores lifetimes bounds derived from Sized
requirements
#50716
Comments
Hmm. Probably we need to add code to the MIR type-checker that checks |
It's sort of semi-debatable if this is a bug, but I suppose that it is. (In practice, So, the general way to fix this is that in the NLL type check we have to check that all local variables have Let's say for now we will do it at each place where the variable is assigned, though one could imagine other places. So e.g. if you have This will be quite similar to the code that (for example) proves that all input types are well-formed when calling a function: rust/src/librustc_mir/borrow_check/nll/type_check/mod.rs Lines 957 to 960 in 68e0e58
Except that you may want to use the rust/src/librustc_mir/borrow_check/nll/type_check/mod.rs Lines 1513 to 1520 in 68e0e58
We would insert these calls when checking rust/src/librustc_mir/borrow_check/nll/type_check/mod.rs Lines 778 to 794 in 68e0e58
|
Fix NLL issue 50716 and add a regression test. Fix for NLL issue #50716. r? @nikomatsakis
Fixed in #51139, no? |
This code incorrectly(?) compiles with NLL. Alternatively we could say that Sized bounds are assumed to be lifetime-independent.
The text was updated successfully, but these errors were encountered: