@@ -1589,7 +1589,8 @@ impl<'tcx> TyCtxt<'tcx> {
15891589 }
15901590
15911591 /// Look up the name of a definition across crates. This does not look at HIR.
1592- pub fn opt_item_name ( self , def_id : DefId ) -> Option < Symbol > {
1592+ pub fn opt_item_name ( self , def_id : impl IntoQueryParam < DefId > ) -> Option < Symbol > {
1593+ let def_id = def_id. into_query_param ( ) ;
15931594 if let Some ( cnum) = def_id. as_crate_root ( ) {
15941595 Some ( self . crate_name ( cnum) )
15951596 } else {
@@ -1609,7 +1610,8 @@ impl<'tcx> TyCtxt<'tcx> {
16091610 /// [`opt_item_name`] instead.
16101611 ///
16111612 /// [`opt_item_name`]: Self::opt_item_name
1612- pub fn item_name ( self , id : DefId ) -> Symbol {
1613+ pub fn item_name ( self , id : impl IntoQueryParam < DefId > ) -> Symbol {
1614+ let id = id. into_query_param ( ) ;
16131615 self . opt_item_name ( id) . unwrap_or_else ( || {
16141616 bug ! ( "item_name: no name for {:?}" , self . def_path( id) ) ;
16151617 } )
@@ -1618,7 +1620,8 @@ impl<'tcx> TyCtxt<'tcx> {
16181620 /// Look up the name and span of a definition.
16191621 ///
16201622 /// See [`item_name`][Self::item_name] for more information.
1621- pub fn opt_item_ident ( self , def_id : DefId ) -> Option < Ident > {
1623+ pub fn opt_item_ident ( self , def_id : impl IntoQueryParam < DefId > ) -> Option < Ident > {
1624+ let def_id = def_id. into_query_param ( ) ;
16221625 let def = self . opt_item_name ( def_id) ?;
16231626 let span = self
16241627 . def_ident_span ( def_id)
@@ -1629,7 +1632,8 @@ impl<'tcx> TyCtxt<'tcx> {
16291632 /// Look up the name and span of a definition.
16301633 ///
16311634 /// See [`item_name`][Self::item_name] for more information.
1632- pub fn item_ident ( self , def_id : DefId ) -> Ident {
1635+ pub fn item_ident ( self , def_id : impl IntoQueryParam < DefId > ) -> Ident {
1636+ let def_id = def_id. into_query_param ( ) ;
16331637 self . opt_item_ident ( def_id) . unwrap_or_else ( || {
16341638 bug ! ( "item_ident: no name for {:?}" , self . def_path( def_id) ) ;
16351639 } )
0 commit comments