@@ -1606,7 +1606,8 @@ impl<'tcx> TyCtxt<'tcx> {
16061606 }
16071607
16081608 /// Look up the name of a definition across crates. This does not look at HIR.
1609- pub fn opt_item_name ( self , def_id : DefId ) -> Option < Symbol > {
1609+ pub fn opt_item_name ( self , def_id : impl IntoQueryParam < DefId > ) -> Option < Symbol > {
1610+ let def_id = def_id. into_query_param ( ) ;
16101611 if let Some ( cnum) = def_id. as_crate_root ( ) {
16111612 Some ( self . crate_name ( cnum) )
16121613 } else {
@@ -1626,7 +1627,8 @@ impl<'tcx> TyCtxt<'tcx> {
16261627 /// [`opt_item_name`] instead.
16271628 ///
16281629 /// [`opt_item_name`]: Self::opt_item_name
1629- pub fn item_name ( self , id : DefId ) -> Symbol {
1630+ pub fn item_name ( self , id : impl IntoQueryParam < DefId > ) -> Symbol {
1631+ let id = id. into_query_param ( ) ;
16301632 self . opt_item_name ( id) . unwrap_or_else ( || {
16311633 bug ! ( "item_name: no name for {:?}" , self . def_path( id) ) ;
16321634 } )
@@ -1635,7 +1637,8 @@ impl<'tcx> TyCtxt<'tcx> {
16351637 /// Look up the name and span of a definition.
16361638 ///
16371639 /// See [`item_name`][Self::item_name] for more information.
1638- pub fn opt_item_ident ( self , def_id : DefId ) -> Option < Ident > {
1640+ pub fn opt_item_ident ( self , def_id : impl IntoQueryParam < DefId > ) -> Option < Ident > {
1641+ let def_id = def_id. into_query_param ( ) ;
16391642 let def = self . opt_item_name ( def_id) ?;
16401643 let span = self
16411644 . def_ident_span ( def_id)
@@ -1646,7 +1649,8 @@ impl<'tcx> TyCtxt<'tcx> {
16461649 /// Look up the name and span of a definition.
16471650 ///
16481651 /// See [`item_name`][Self::item_name] for more information.
1649- pub fn item_ident ( self , def_id : DefId ) -> Ident {
1652+ pub fn item_ident ( self , def_id : impl IntoQueryParam < DefId > ) -> Ident {
1653+ let def_id = def_id. into_query_param ( ) ;
16501654 self . opt_item_ident ( def_id) . unwrap_or_else ( || {
16511655 bug ! ( "item_ident: no name for {:?}" , self . def_path( def_id) ) ;
16521656 } )
0 commit comments