mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
add debuginfo in generator_interior
This commit is contained in:
parent
3ed3b8bb7b
commit
c1241bf7a7
@ -1857,6 +1857,22 @@ impl fmt::Display for YieldSource {
|
||||
}
|
||||
}
|
||||
|
||||
impl core::convert::From<GeneratorKind> for YieldSource {
|
||||
fn from(gen_kind: GeneratorKind) -> Self {
|
||||
match gen_kind {
|
||||
// Guess based on the kind of the current generator.
|
||||
GeneratorKind::Gen => Self::Yield,
|
||||
GeneratorKind::Async(_) => Self::Await,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug, HashStable)]
|
||||
pub enum CaptureClause {
|
||||
CaptureByValue,
|
||||
CaptureByRef,
|
||||
}
|
||||
|
||||
// N.B., if you change this, you'll probably want to change the corresponding
|
||||
// type structure in middle/ty.rs as well.
|
||||
#[derive(RustcEncodable, RustcDecodable, Debug, HashStable)]
|
||||
|
@ -32,7 +32,6 @@ impl<'a, 'tcx> InteriorVisitor<'a, 'tcx> {
|
||||
debug!("generator_interior: attempting to record type {:?} {:?} {:?} {:?}",
|
||||
ty, scope, expr, source_span);
|
||||
|
||||
|
||||
let live_across_yield = scope.map(|s| {
|
||||
self.region_scope_tree.yield_in_scope(s).and_then(|yield_data| {
|
||||
// If we are recording an expression that is the last yield
|
||||
@ -54,15 +53,11 @@ impl<'a, 'tcx> InteriorVisitor<'a, 'tcx> {
|
||||
}).unwrap_or_else(|| Some(YieldData {
|
||||
span: DUMMY_SP,
|
||||
expr_and_pat_count: 0,
|
||||
source: match self.kind { // Guess based on the kind of the current generator.
|
||||
hir::GeneratorKind::Gen => hir::YieldSource::Yield,
|
||||
hir::GeneratorKind::Async(_) => hir::YieldSource::Await,
|
||||
},
|
||||
source: self.kind.into(),
|
||||
}));
|
||||
|
||||
if let Some(yield_data) = live_across_yield {
|
||||
let ty = self.fcx.resolve_vars_if_possible(&ty);
|
||||
|
||||
debug!("type in expr = {:?}, scope = {:?}, type = {:?}, count = {}, yield_span = {:?}",
|
||||
expr, scope, ty, self.expr_count, yield_data.span);
|
||||
|
||||
@ -94,6 +89,11 @@ impl<'a, 'tcx> InteriorVisitor<'a, 'tcx> {
|
||||
} else {
|
||||
debug!("no type in expr = {:?}, count = {:?}, span = {:?}",
|
||||
expr, self.expr_count, expr.map(|e| e.span));
|
||||
let ty = self.fcx.resolve_vars_if_possible(&ty);
|
||||
if let Some((unresolved_type, unresolved_type_span)) = self.fcx.unresolved_type_vars(&ty) {
|
||||
debug!("remained unresolved_type = {:?}, unresolved_type_span: {:?}",
|
||||
unresolved_type, unresolved_type_span);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user