Skip to content

Commit add21c4

Browse files
committed
add debuginfo in generator_interior
1 parent fa0f7d0 commit add21c4

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/librustc/hir/mod.rs

+10
Original file line numberDiff line numberDiff line change
@@ -1833,6 +1833,16 @@ impl fmt::Display for YieldSource {
18331833
}
18341834
}
18351835

1836+
impl core::convert::From<GeneratorKind> for YieldSource {
1837+
fn from(gen_kind: GeneratorKind) -> Self {
1838+
match gen_kind {
1839+
// Guess based on the kind of the current generator.
1840+
GeneratorKind::Gen => Self::Yield,
1841+
GeneratorKind::Async(_) => Self::Await,
1842+
}
1843+
}
1844+
}
1845+
18361846
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug, HashStable)]
18371847
pub enum CaptureClause {
18381848
CaptureByValue,

src/librustc_typeck/check/generator_interior.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ impl<'a, 'tcx> InteriorVisitor<'a, 'tcx> {
3131
debug!("generator_interior: attempting to record type {:?} {:?} {:?} {:?}",
3232
ty, scope, expr, source_span);
3333

34-
3534
let live_across_yield = scope.map(|s| {
3635
self.region_scope_tree.yield_in_scope(s).and_then(|yield_data| {
3736
// If we are recording an expression that is the last yield
@@ -53,15 +52,11 @@ impl<'a, 'tcx> InteriorVisitor<'a, 'tcx> {
5352
}).unwrap_or_else(|| Some(YieldData {
5453
span: DUMMY_SP,
5554
expr_and_pat_count: 0,
56-
source: match self.kind { // Guess based on the kind of the current generator.
57-
hir::GeneratorKind::Gen => hir::YieldSource::Yield,
58-
hir::GeneratorKind::Async(_) => hir::YieldSource::Await,
59-
},
55+
source: self.kind.into(),
6056
}));
6157

6258
if let Some(yield_data) = live_across_yield {
6359
let ty = self.fcx.resolve_vars_if_possible(&ty);
64-
6560
debug!("type in expr = {:?}, scope = {:?}, type = {:?}, count = {}, yield_span = {:?}",
6661
expr, scope, ty, self.expr_count, yield_data.span);
6762

@@ -93,6 +88,11 @@ impl<'a, 'tcx> InteriorVisitor<'a, 'tcx> {
9388
} else {
9489
debug!("no type in expr = {:?}, count = {:?}, span = {:?}",
9590
expr, self.expr_count, expr.map(|e| e.span));
91+
let ty = self.fcx.resolve_vars_if_possible(&ty);
92+
if let Some((unresolved_type, unresolved_type_span)) = self.fcx.unresolved_type_vars(&ty) {
93+
debug!("remained unresolved_type = {:?}, unresolved_type_span: {:?}",
94+
unresolved_type, unresolved_type_span);
95+
}
9696
}
9797
}
9898
}

0 commit comments

Comments
 (0)