-
Notifications
You must be signed in to change notification settings - Fork 13k
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: unconstrained lifetimes can be returned via associated types #47470
Comments
I'm guessing the problem has to do with the MIR type checker and how it relates the return type found in the MIR to the declared types. I don't quite see what's going wrong, but here are some pointers to the relevant code. This function is responsible for relating things properly:
You can see that for input types, it normalizes the input type declared in the function signature ( rust/src/librustc_mir/borrow_check/nll/type_check/input_output.rs Lines 58 to 60 in da569fa
It seems like we do the same thing for the return type here: rust/src/librustc_mir/borrow_check/nll/type_check/input_output.rs Lines 97 to 99 in da569fa
But something is going wrong. |
OK, digging a bit further, I see the problem, but I'm not sure yet how to fix it. It has to do with the projection cache. In particular, the first time we normalize The "long term" fix I had planned for this was to refactor how projection and normalization work into queries. These queries would produce region constraints as part of their result that would get replayed. This feels like a good way to do it, but it rests on the idea of converting trait operations into queries, which I haven't had time to pursue, and I'd rather not have as a blocker for NLL. I'm not sure what the better option is, though. I can of course disable the projection cache but that seems unwise. Will ponder a bit. |
Clearing the projection cache when moving between locations should at least keep the exponential cases within control. I think it's probably good enough for the NLL POC. |
IIRC the main motivations for the projection cache were:
|
Yes that's true; we can do that for now. On Jan 22, 2018 15:40, Ariel Ben-Yehuda <notifications@github.com> wrote:@nikomatsakis
Clearing the projection cache when moving between locations should at least keep the exponential cases within control.
—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.
|
This is fixed by #48411 |
This compiles, runs, and is UB (with NLL) - it errors correctly the return type is specified explicitly.
cc @nikomatsakis
The text was updated successfully, but these errors were encountered: