This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed
compiler/rustc_middle/src/ty Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -1996,6 +1996,7 @@ impl<'tcx> TyCtxt<'tcx> {
19961996 . filter ( |item| item. kind == AssocKind :: Fn && item. defaultness . has_value ( ) )
19971997 }
19981998
1999+ /// Look up the name of a definition across crates. This does not look at HIR.
19992000 fn opt_item_name ( self , def_id : DefId ) -> Option < Symbol > {
20002001 if let Some ( cnum) = def_id. as_crate_root ( ) {
20012002 Some ( self . crate_name ( cnum) )
@@ -2016,16 +2017,11 @@ impl<'tcx> TyCtxt<'tcx> {
20162017
20172018 /// Look up the name of a definition across crates. This does not look at HIR.
20182019 ///
2019- /// When possible, this function should be used for cross-crate lookups over
2020- /// [`opt_item_name`] to avoid invalidating the incremental cache. If you
2021- /// need to handle items without a name, or HIR items that will not be
2022- /// serialized cross-crate, or if you need the span of the item, use
2020+ /// This method will ICE if the corresponding item does not have a name. In these cases, use
20232021 /// [`opt_item_name`] instead.
20242022 ///
20252023 /// [`opt_item_name`]: Self::opt_item_name
20262024 pub fn item_name ( self , id : DefId ) -> Symbol {
2027- // Look at cross-crate items first to avoid invalidating the incremental cache
2028- // unless we have to.
20292025 self . opt_item_name ( id) . unwrap_or_else ( || {
20302026 bug ! ( "item_name: no name for {:?}" , self . def_path( id) ) ;
20312027 } )
You can’t perform that action at this time.
0 commit comments