article and descr for closures

This commit is contained in:
Mark Mansi 2020-01-25 19:31:38 -06:00 committed by mark
parent 66500effea
commit c6781037eb

View file

@ -1520,10 +1520,11 @@ impl<'tcx> TyCtxt<'tcx> {
let kind = self.def_kind(def_id).unwrap();
(kind.article(), kind.descr(def_id))
}
DefPathData::ClosureExpr => {
// TODO
todo!();
}
DefPathData::ClosureExpr => match self.generator_kind(def_id) {
None => ("a", "closure"),
Some(rustc_hir::GeneratorKind::Async(..)) => ("an", "async closure"),
Some(rustc_hir::GeneratorKind::Gen) => ("a", "generator"),
},
_ => bug!("article_and_description called on def_id {:?}", def_id),
}
}