Skip to content

Commit

Permalink
Monomorphize generator field types for debuginfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemo157 committed Mar 3, 2019
1 parent 61097bc commit 41e60d1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/librustc_codegen_ssa/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,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();
Expand Down
27 changes: 27 additions & 0 deletions src/test/run-pass/generator/issue-58888.rs
Original file line number Diff line number Diff line change
@@ -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();
}

0 comments on commit 41e60d1

Please sign in to comment.