File tree 1 file changed +2
-6
lines changed
compiler/rustc_middle/src/ty
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> {
1996
1996
. filter ( |item| item. kind == AssocKind :: Fn && item. defaultness . has_value ( ) )
1997
1997
}
1998
1998
1999
+ /// Look up the name of a definition across crates. This does not look at HIR.
1999
2000
fn opt_item_name ( self , def_id : DefId ) -> Option < Symbol > {
2000
2001
if let Some ( cnum) = def_id. as_crate_root ( ) {
2001
2002
Some ( self . crate_name ( cnum) )
@@ -2016,16 +2017,11 @@ impl<'tcx> TyCtxt<'tcx> {
2016
2017
2017
2018
/// Look up the name of a definition across crates. This does not look at HIR.
2018
2019
///
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
2023
2021
/// [`opt_item_name`] instead.
2024
2022
///
2025
2023
/// [`opt_item_name`]: Self::opt_item_name
2026
2024
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.
2029
2025
self . opt_item_name ( id) . unwrap_or_else ( || {
2030
2026
bug ! ( "item_name: no name for {:?}" , self . def_path( id) ) ;
2031
2027
} )
You can’t perform that action at this time.
0 commit comments