IdentitySubsts::identity_for_item takes Into<DefId>
This commit is contained in:
parent
979ef5981f
commit
7e6506764b
14 changed files with 27 additions and 28 deletions
|
@ -2525,7 +2525,7 @@ impl<'tcx> ConstantKind<'tcx> {
|
|||
let parent_substs = if let Some(parent_hir_id) = tcx.hir().opt_parent_id(hir_id)
|
||||
&& let Some(parent_did) = parent_hir_id.as_owner()
|
||||
{
|
||||
InternalSubsts::identity_for_item(tcx, parent_did.to_def_id())
|
||||
InternalSubsts::identity_for_item(tcx, parent_did)
|
||||
} else {
|
||||
List::empty()
|
||||
};
|
||||
|
@ -2554,7 +2554,7 @@ impl<'tcx> ConstantKind<'tcx> {
|
|||
Self::Unevaluated(
|
||||
UnevaluatedConst {
|
||||
def: def.to_global(),
|
||||
substs: InternalSubsts::identity_for_item(tcx, def.did.to_def_id()),
|
||||
substs: InternalSubsts::identity_for_item(tcx, def.did),
|
||||
promoted: None,
|
||||
},
|
||||
ty,
|
||||
|
|
|
@ -83,7 +83,7 @@ impl<'tcx> Const<'tcx> {
|
|||
None => tcx.mk_const(
|
||||
ty::UnevaluatedConst {
|
||||
def: def.to_global(),
|
||||
substs: InternalSubsts::identity_for_item(tcx, def.did.to_def_id()),
|
||||
substs: InternalSubsts::identity_for_item(tcx, def.did),
|
||||
},
|
||||
ty,
|
||||
),
|
||||
|
|
|
@ -1385,7 +1385,7 @@ impl<'tcx> OpaqueHiddenType<'tcx> {
|
|||
// lifetimes with 'static and remapping only those used in the
|
||||
// `impl Trait` return type, resulting in the parameters
|
||||
// shifting.
|
||||
let id_substs = InternalSubsts::identity_for_item(tcx, def_id.to_def_id());
|
||||
let id_substs = InternalSubsts::identity_for_item(tcx, def_id);
|
||||
debug!(?id_substs);
|
||||
|
||||
// This zip may have several times the same lifetime in `substs` paired with a different
|
||||
|
|
|
@ -302,8 +302,8 @@ impl<'tcx> InternalSubsts<'tcx> {
|
|||
}
|
||||
|
||||
/// Creates an `InternalSubsts` that maps each generic parameter to itself.
|
||||
pub fn identity_for_item(tcx: TyCtxt<'tcx>, def_id: DefId) -> SubstsRef<'tcx> {
|
||||
Self::for_item(tcx, def_id, |param, _| tcx.mk_param_from_def(param))
|
||||
pub fn identity_for_item(tcx: TyCtxt<'tcx>, def_id: impl Into<DefId>) -> SubstsRef<'tcx> {
|
||||
Self::for_item(tcx, def_id.into(), |param, _| tcx.mk_param_from_def(param))
|
||||
}
|
||||
|
||||
/// Creates an `InternalSubsts` for generic parameter definitions,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue