@@ -1606,7 +1606,8 @@ impl<'tcx> TyCtxt<'tcx> {
1606
1606
}
1607
1607
1608
1608
/// 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 ( ) ;
1610
1611
if let Some ( cnum) = def_id. as_crate_root ( ) {
1611
1612
Some ( self . crate_name ( cnum) )
1612
1613
} else {
@@ -1626,7 +1627,8 @@ impl<'tcx> TyCtxt<'tcx> {
1626
1627
/// [`opt_item_name`] instead.
1627
1628
///
1628
1629
/// [`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 ( ) ;
1630
1632
self . opt_item_name ( id) . unwrap_or_else ( || {
1631
1633
bug ! ( "item_name: no name for {:?}" , self . def_path( id) ) ;
1632
1634
} )
@@ -1635,7 +1637,8 @@ impl<'tcx> TyCtxt<'tcx> {
1635
1637
/// Look up the name and span of a definition.
1636
1638
///
1637
1639
/// 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 ( ) ;
1639
1642
let def = self . opt_item_name ( def_id) ?;
1640
1643
let span = self
1641
1644
. def_ident_span ( def_id)
@@ -1646,7 +1649,8 @@ impl<'tcx> TyCtxt<'tcx> {
1646
1649
/// Look up the name and span of a definition.
1647
1650
///
1648
1651
/// 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 ( ) ;
1650
1654
self . opt_item_ident ( def_id) . unwrap_or_else ( || {
1651
1655
bug ! ( "item_ident: no name for {:?}" , self . def_path( def_id) ) ;
1652
1656
} )
0 commit comments