-
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
Broken MIR: generator contains type &str in MIR, but typeck only knows about {std::future::ResumeTy, impl std::future::Future, ()} #71793
Comments
Could this be a result of inlining? (cc @rust-lang/wg-mir-opt) Some context:
|
@rustbot claim I'll do some investigating here, to find out more about what's going on (and probably stop after that). |
The MIR inliner certainly seems implicated:
I seem to recall similar issues with the rust/src/librustc_mir/transform/const_prop.rs Lines 80 to 85 in f8d394e
A similar thing might be needed here. It would be great though if we could get the MIR optimizations to work correctly with generators as that might lead to us being able to remove some local variables and shrink the size of the generator. |
Lol, in #70073 we spent a lot of time making sure that optimizations like inlining do run on Maybe
That seems odd, given that this runs after |
IIRC the cycle in |
I'd be ok with banning inlining for now, but I would like to have a precise picture, though, of how things are going wrong. |
Spent some time digging into this today.
I've attached the MIR CFG, the local in question is |
@tmandry so we generate an explicit |
And what does this have to do with the optimization level btw? |
Perhaps the drop is from a |
Ah, yes, sounds likely. |
We should be able to ignore drops of copy types. |
We should also be able to do a peephole optimization to convert them to no-ops. |
Sorry, yes we are generating an explicit drop, and it seems to be the inliner which puts it there when inlining |
Triage: Removing |
One solution would be to generate |
Code
Using
-Zmir-opt-level=2
:Meta
rustc --version --verbose
:Error
Backtrace
The issue occurs with nightly, but the backtrace is from locally build
19ae74d0d
.The text was updated successfully, but these errors were encountered: