@@ -1589,7 +1589,8 @@ impl<'tcx> TyCtxt<'tcx> {
1589
1589
}
1590
1590
1591
1591
/// 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 ( ) ;
1593
1594
if let Some ( cnum) = def_id. as_crate_root ( ) {
1594
1595
Some ( self . crate_name ( cnum) )
1595
1596
} else {
@@ -1609,7 +1610,8 @@ impl<'tcx> TyCtxt<'tcx> {
1609
1610
/// [`opt_item_name`] instead.
1610
1611
///
1611
1612
/// [`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 ( ) ;
1613
1615
self . opt_item_name ( id) . unwrap_or_else ( || {
1614
1616
bug ! ( "item_name: no name for {:?}" , self . def_path( id) ) ;
1615
1617
} )
@@ -1618,7 +1620,8 @@ impl<'tcx> TyCtxt<'tcx> {
1618
1620
/// Look up the name and span of a definition.
1619
1621
///
1620
1622
/// 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 ( ) ;
1622
1625
let def = self . opt_item_name ( def_id) ?;
1623
1626
let span = self
1624
1627
. def_ident_span ( def_id)
@@ -1629,7 +1632,8 @@ impl<'tcx> TyCtxt<'tcx> {
1629
1632
/// Look up the name and span of a definition.
1630
1633
///
1631
1634
/// 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 ( ) ;
1633
1637
self . opt_item_ident ( def_id) . unwrap_or_else ( || {
1634
1638
bug ! ( "item_ident: no name for {:?}" , self . def_path( def_id) ) ;
1635
1639
} )
0 commit comments