@@ -1590,7 +1590,8 @@ impl<'tcx> TyCtxt<'tcx> {
1590
1590
}
1591
1591
1592
1592
/// Look up the name of a definition across crates. This does not look at HIR.
1593
- pub fn opt_item_name ( self , def_id : DefId ) -> Option < Symbol > {
1593
+ pub fn opt_item_name ( self , def_id : impl IntoQueryParam < DefId > ) -> Option < Symbol > {
1594
+ let def_id = def_id. into_query_param ( ) ;
1594
1595
if let Some ( cnum) = def_id. as_crate_root ( ) {
1595
1596
Some ( self . crate_name ( cnum) )
1596
1597
} else {
@@ -1610,7 +1611,8 @@ impl<'tcx> TyCtxt<'tcx> {
1610
1611
/// [`opt_item_name`] instead.
1611
1612
///
1612
1613
/// [`opt_item_name`]: Self::opt_item_name
1613
- pub fn item_name ( self , id : DefId ) -> Symbol {
1614
+ pub fn item_name ( self , id : impl IntoQueryParam < DefId > ) -> Symbol {
1615
+ let id = id. into_query_param ( ) ;
1614
1616
self . opt_item_name ( id) . unwrap_or_else ( || {
1615
1617
bug ! ( "item_name: no name for {:?}" , self . def_path( id) ) ;
1616
1618
} )
@@ -1619,7 +1621,8 @@ impl<'tcx> TyCtxt<'tcx> {
1619
1621
/// Look up the name and span of a definition.
1620
1622
///
1621
1623
/// See [`item_name`][Self::item_name] for more information.
1622
- pub fn opt_item_ident ( self , def_id : DefId ) -> Option < Ident > {
1624
+ pub fn opt_item_ident ( self , def_id : impl IntoQueryParam < DefId > ) -> Option < Ident > {
1625
+ let def_id = def_id. into_query_param ( ) ;
1623
1626
let def = self . opt_item_name ( def_id) ?;
1624
1627
let span = self
1625
1628
. def_ident_span ( def_id)
@@ -1630,7 +1633,8 @@ impl<'tcx> TyCtxt<'tcx> {
1630
1633
/// Look up the name and span of a definition.
1631
1634
///
1632
1635
/// See [`item_name`][Self::item_name] for more information.
1633
- pub fn item_ident ( self , def_id : DefId ) -> Ident {
1636
+ pub fn item_ident ( self , def_id : impl IntoQueryParam < DefId > ) -> Ident {
1637
+ let def_id = def_id. into_query_param ( ) ;
1634
1638
self . opt_item_ident ( def_id) . unwrap_or_else ( || {
1635
1639
bug ! ( "item_ident: no name for {:?}" , self . def_path( def_id) ) ;
1636
1640
} )
0 commit comments