Rollup merge of #136114 - compiler-errors:more-idents, r=jieyouxu
Use identifiers more in diagnostics code This should make the diagnostics code slightly more correct when rendering idents in mixed crate edition situations. Kinda a no-op, but a cleanup regardless. r? oli-obk or reassign
This commit is contained in:
commit
03fdcffa1e
31 changed files with 97 additions and 90 deletions
|
@ -1596,6 +1596,15 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
Some(Ident::new(def, span))
|
||||
}
|
||||
|
||||
/// Look up the name and span of a definition.
|
||||
///
|
||||
/// See [`item_name`][Self::item_name] for more information.
|
||||
pub fn item_ident(self, def_id: DefId) -> Ident {
|
||||
self.opt_item_ident(def_id).unwrap_or_else(|| {
|
||||
bug!("item_ident: no name for {:?}", self.def_path(def_id));
|
||||
})
|
||||
}
|
||||
|
||||
pub fn opt_associated_item(self, def_id: DefId) -> Option<AssocItem> {
|
||||
if let DefKind::AssocConst | DefKind::AssocFn | DefKind::AssocTy = self.def_kind(def_id) {
|
||||
Some(self.associated_item(def_id))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue