Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upICE with generators: `Broken MIR: generator contains type ... in MIR, but typeck only knows about ...` #44184
Comments
nagisa
added
A-mir
I-ICE
T-compiler
labels
Aug 30, 2017
This comment has been minimized.
This comment has been minimized.
|
cc @Zoxc |
aturon
referenced this issue
Aug 30, 2017
Open
Tracking issue for RFC 2033: Experimentally add coroutines to Rust #43122
alexcrichton
added
the
A-generators
label
Aug 30, 2017
This comment has been minimized.
This comment has been minimized.
|
So this the annoying The problem is that bindings in match command {
Command::A(_name) => {}
Command::B => {}
}is lowered into this (pre-drop-elaboration): switch command {
Command::A => {
storagelive(_name);
_name = (command as Command::A).0;
}
Command::B = {}
}
drop(_name);
storagedead(_name);Here It does not cause unsoundness because drop elaboration inserts a drop flag, but it does cause liveness to leak across the loop and make I think there's a way to solve the |
This comment has been minimized.
This comment has been minimized.
|
If we don't want to do that, another way would be to take a trick from LLVM, and use |
This comment has been minimized.
This comment has been minimized.
|
@arielb1 By that do you mean adding |
This comment has been minimized.
This comment has been minimized.
|
Adding a But what I meant was that |
shepmaster
added
the
C-bug
label
Sep 1, 2017
This comment has been minimized.
This comment has been minimized.
rushmorem
commented
Sep 2, 2017
|
I'm running into this issue while playing with |
This comment has been minimized.
This comment has been minimized.
|
I'm also running into this playing with FWIW, because this is caused by drop logic for variables bound in match arms, it can be worked around (ownership needs of your code permitting) by adding "ref" to variable bindings in match patterns. |
This comment has been minimized.
This comment has been minimized.
Arnavion
commented
Sep 10, 2017
|
And if you do want to move the binding and thus can't use Command::A(_name) => {
return;
}to Command::A(_name) => {
let _name = _name;
return;
} |
Eroc33 commentedAug 30, 2017
•
edited
This seems to be some sort of interaction with the
Stringinside theCommandenum in the following code as removing either variant stops the ICE from occuring.Example:
https://play.rust-lang.org/?gist=1d2672fd04e7df3dccbaf140f99fa7f6&version=nightly
Gives an ICE
internal compiler error: /checkout/src/librustc_mir/transform/generator.rs:340: Broken MIR: generator contains type std::string::String in MIR, but typeck only knows about ((), std::option::Option<Command>, Command)Meta
rustc --version --verbose:Backtrace: