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