@@ -1593,7 +1593,8 @@ impl<'tcx> TyCtxt<'tcx> {
15931593 }
15941594
15951595 /// Look up the name of a definition across crates. This does not look at HIR.
1596- pub fn opt_item_name ( self , def_id : DefId ) -> Option < Symbol > {
1596+ pub fn opt_item_name ( self , def_id : impl IntoQueryParam < DefId > ) -> Option < Symbol > {
1597+ let def_id = def_id. into_query_param ( ) ;
15971598 if let Some ( cnum) = def_id. as_crate_root ( ) {
15981599 Some ( self . crate_name ( cnum) )
15991600 } else {
@@ -1613,7 +1614,8 @@ impl<'tcx> TyCtxt<'tcx> {
16131614 /// [`opt_item_name`] instead.
16141615 ///
16151616 /// [`opt_item_name`]: Self::opt_item_name
1616- pub fn item_name ( self , id : DefId ) -> Symbol {
1617+ pub fn item_name ( self , id : impl IntoQueryParam < DefId > ) -> Symbol {
1618+ let id = id. into_query_param ( ) ;
16171619 self . opt_item_name ( id) . unwrap_or_else ( || {
16181620 bug ! ( "item_name: no name for {:?}" , self . def_path( id) ) ;
16191621 } )
@@ -1622,7 +1624,8 @@ impl<'tcx> TyCtxt<'tcx> {
16221624 /// Look up the name and span of a definition.
16231625 ///
16241626 /// See [`item_name`][Self::item_name] for more information.
1625- pub fn opt_item_ident ( self , def_id : DefId ) -> Option < Ident > {
1627+ pub fn opt_item_ident ( self , def_id : impl IntoQueryParam < DefId > ) -> Option < Ident > {
1628+ let def_id = def_id. into_query_param ( ) ;
16261629 let def = self . opt_item_name ( def_id) ?;
16271630 let span = self
16281631 . def_ident_span ( def_id)
@@ -1633,7 +1636,8 @@ impl<'tcx> TyCtxt<'tcx> {
16331636 /// Look up the name and span of a definition.
16341637 ///
16351638 /// See [`item_name`][Self::item_name] for more information.
1636- pub fn item_ident ( self , def_id : DefId ) -> Ident {
1639+ pub fn item_ident ( self , def_id : impl IntoQueryParam < DefId > ) -> Ident {
1640+ let def_id = def_id. into_query_param ( ) ;
16371641 self . opt_item_ident ( def_id) . unwrap_or_else ( || {
16381642 bug ! ( "item_ident: no name for {:?}" , self . def_path( def_id) ) ;
16391643 } )
0 commit comments