mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
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:
commit
4083c698e5
@ -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();
|
||||
|
27
src/test/run-pass/generator/issue-58888.rs
Normal file
27
src/test/run-pass/generator/issue-58888.rs
Normal 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();
|
||||
}
|
Loading…
Reference in New Issue
Block a user