Closed
Description
For example:
fn main() {
let _ = async {
let mut s = (String::new(),);
s.0.push_str("abc");
std::mem::drop(s);
async {}.await;
};
}
$ rustc +nightly-2022-01-22 --edition=2021 b.rs
error: internal compiler error: compiler/rustc_mir_transform/src/generator.rs:755:13: Broken MIR: generator contains type (String,) in MIR, but typeck only knows about {ResumeTy, impl Future<Output = [async output]>, ()} and []
The TryFrom<&PlaceWithHirId<'_>> for TrackedValue
fails for places with projections, so in that case borrow is never recorded:
rust/compiler/rustc_typeck/src/check/generator_interior/drop_ranges.rs
Lines 133 to 143 in 4c55c83