@@ -1590,7 +1590,8 @@ impl<'tcx> TyCtxt<'tcx> {
15901590 }
15911591
15921592 /// Look up the name of a definition across crates. This does not look at HIR.
1593- pub fn opt_item_name ( self , def_id : DefId ) -> Option < Symbol > {
1593+ pub fn opt_item_name ( self , def_id : impl IntoQueryParam < DefId > ) -> Option < Symbol > {
1594+ let def_id = def_id. into_query_param ( ) ;
15941595 if let Some ( cnum) = def_id. as_crate_root ( ) {
15951596 Some ( self . crate_name ( cnum) )
15961597 } else {
@@ -1610,7 +1611,8 @@ impl<'tcx> TyCtxt<'tcx> {
16101611 /// [`opt_item_name`] instead.
16111612 ///
16121613 /// [`opt_item_name`]: Self::opt_item_name
1613- pub fn item_name ( self , id : DefId ) -> Symbol {
1614+ pub fn item_name ( self , id : impl IntoQueryParam < DefId > ) -> Symbol {
1615+ let id = id. into_query_param ( ) ;
16141616 self . opt_item_name ( id) . unwrap_or_else ( || {
16151617 bug ! ( "item_name: no name for {:?}" , self . def_path( id) ) ;
16161618 } )
@@ -1619,7 +1621,8 @@ impl<'tcx> TyCtxt<'tcx> {
16191621 /// Look up the name and span of a definition.
16201622 ///
16211623 /// See [`item_name`][Self::item_name] for more information.
1622- pub fn opt_item_ident ( self , def_id : DefId ) -> Option < Ident > {
1624+ pub fn opt_item_ident ( self , def_id : impl IntoQueryParam < DefId > ) -> Option < Ident > {
1625+ let def_id = def_id. into_query_param ( ) ;
16231626 let def = self . opt_item_name ( def_id) ?;
16241627 let span = self
16251628 . def_ident_span ( def_id)
@@ -1630,7 +1633,8 @@ impl<'tcx> TyCtxt<'tcx> {
16301633 /// Look up the name and span of a definition.
16311634 ///
16321635 /// See [`item_name`][Self::item_name] for more information.
1633- pub fn item_ident ( self , def_id : DefId ) -> Ident {
1636+ pub fn item_ident ( self , def_id : impl IntoQueryParam < DefId > ) -> Ident {
1637+ let def_id = def_id. into_query_param ( ) ;
16341638 self . opt_item_ident ( def_id) . unwrap_or_else ( || {
16351639 bug ! ( "item_ident: no name for {:?}" , self . def_path( def_id) ) ;
16361640 } )
0 commit comments