Skip to content

Commit 7436057

Browse files
committed
address some review comments/bugs
1 parent c678103 commit 7436057

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/librustc/ty/context.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1525,6 +1525,8 @@ impl<'tcx> TyCtxt<'tcx> {
15251525
Some(rustc_hir::GeneratorKind::Async(..)) => ("an", "async closure"),
15261526
Some(rustc_hir::GeneratorKind::Gen) => ("a", "generator"),
15271527
},
1528+
DefPathData::LifetimeNs(..) => ("a", "lifetime"),
1529+
DefPathData::Impl => ("an", "implementation"),
15281530
_ => bug!("article_and_description called on def_id {:?}", def_id),
15291531
}
15301532
}

src/librustc_typeck/collect.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -2148,9 +2148,10 @@ fn static_mutability(tcx: TyCtxt<'_>, def_id: DefId) -> Option<hir::Mutability>
21482148

21492149
fn generator_kind(tcx: TyCtxt<'_>, def_id: DefId) -> Option<hir::GeneratorKind> {
21502150
match tcx.hir().get_if_local(def_id) {
2151-
Some(Node::Item(&hir::Item { kind: hir::ItemKind::Fn(_, _, body_id), .. })) => {
2152-
tcx.hir().body(body_id).generator_kind()
2153-
}
2151+
Some(Node::Expr(&rustc_hir::Expr {
2152+
kind: rustc_hir::ExprKind::Closure(_, _, body_id, _, _),
2153+
..
2154+
})) => tcx.hir().body(body_id).generator_kind(),
21542155
Some(_) => None,
21552156
_ => bug!("generator_kind applied to non-local def-id {:?}", def_id),
21562157
}

0 commit comments

Comments
 (0)