Correct comment.
This commit is contained in:
parent
dde7bff574
commit
ecbda428ec
1 changed files with 2 additions and 6 deletions
|
@ -1996,6 +1996,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
.filter(|item| item.kind == AssocKind::Fn && item.defaultness.has_value())
|
.filter(|item| item.kind == AssocKind::Fn && item.defaultness.has_value())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Look up the name of a definition across crates. This does not look at HIR.
|
||||||
fn opt_item_name(self, def_id: DefId) -> Option<Symbol> {
|
fn opt_item_name(self, def_id: DefId) -> Option<Symbol> {
|
||||||
if let Some(cnum) = def_id.as_crate_root() {
|
if let Some(cnum) = def_id.as_crate_root() {
|
||||||
Some(self.crate_name(cnum))
|
Some(self.crate_name(cnum))
|
||||||
|
@ -2016,16 +2017,11 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
|
|
||||||
/// Look up the name of a definition across crates. This does not look at HIR.
|
/// Look up the name of a definition across crates. This does not look at HIR.
|
||||||
///
|
///
|
||||||
/// When possible, this function should be used for cross-crate lookups over
|
/// This method will ICE if the corresponding item does not have a name. In these cases, use
|
||||||
/// [`opt_item_name`] to avoid invalidating the incremental cache. If you
|
|
||||||
/// need to handle items without a name, or HIR items that will not be
|
|
||||||
/// serialized cross-crate, or if you need the span of the item, use
|
|
||||||
/// [`opt_item_name`] instead.
|
/// [`opt_item_name`] instead.
|
||||||
///
|
///
|
||||||
/// [`opt_item_name`]: Self::opt_item_name
|
/// [`opt_item_name`]: Self::opt_item_name
|
||||||
pub fn item_name(self, id: DefId) -> Symbol {
|
pub fn item_name(self, id: DefId) -> Symbol {
|
||||||
// Look at cross-crate items first to avoid invalidating the incremental cache
|
|
||||||
// unless we have to.
|
|
||||||
self.opt_item_name(id).unwrap_or_else(|| {
|
self.opt_item_name(id).unwrap_or_else(|| {
|
||||||
bug!("item_name: no name for {:?}", self.def_path(id));
|
bug!("item_name: no name for {:?}", self.def_path(id));
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue