Rollup merge of #58906 - Nemo157:generator-state-debug-info, r=Zoxc

Monomorphize generator field types for debuginfo

Fixes #58888

r? @Zoxc
This commit is contained in:
Pietro Albini 2019-03-08 09:41:52 +01:00 committed by GitHub
commit 4083c698e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 0 deletions

View File

@ -679,6 +679,7 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
.zip(state_tys)
.enumerate()
.filter_map(move |(i, (decl, ty))| {
let ty = fx.monomorphize(&ty);
decl.name.map(|name| (i + upvar_count + 1, name, false, ty))
})
}).into_iter().flatten();

View File

@ -0,0 +1,27 @@
// run-pass
// compile-flags: -g
#![feature(generators, generator_trait)]
use std::ops::Generator;
struct Database;
impl Database {
fn get_connection(&self) -> impl Iterator<Item = ()> {
Some(()).into_iter()
}
fn check_connection(&self) -> impl Generator<Yield = (), Return = ()> + '_ {
move || {
let iter = self.get_connection();
for i in iter {
yield i
}
}
}
}
fn main() {
Database.check_connection();
}