Skip to content

Commit c678103

Browse files
committed
article and descr for closures
1 parent 66500ef commit c678103

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/librustc/ty/context.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1520,10 +1520,11 @@ impl<'tcx> TyCtxt<'tcx> {
15201520
let kind = self.def_kind(def_id).unwrap();
15211521
(kind.article(), kind.descr(def_id))
15221522
}
1523-
DefPathData::ClosureExpr => {
1524-
// TODO
1525-
todo!();
1526-
}
1523+
DefPathData::ClosureExpr => match self.generator_kind(def_id) {
1524+
None => ("a", "closure"),
1525+
Some(rustc_hir::GeneratorKind::Async(..)) => ("an", "async closure"),
1526+
Some(rustc_hir::GeneratorKind::Gen) => ("a", "generator"),
1527+
},
15271528
_ => bug!("article_and_description called on def_id {:?}", def_id),
15281529
}
15291530
}

0 commit comments

Comments
 (0)