Rollup merge of #131049 - compiler-errors:more-validation, r=spastorino
Validate args are correct for `UnevaluatedConst`, `ExistentialTraitRef`/`ExistentialProjection` For the `Existential*` ones, we have to do some adjustment to the args list to deal with the missing `Self` type, so we introduce a `debug_assert_existential_args_compatible` function to the interner as well.
This commit is contained in:
commit
3f15d296f4
11 changed files with 104 additions and 32 deletions
|
@ -380,11 +380,12 @@ impl RustcInternal for ExistentialProjection {
|
|||
type T<'tcx> = rustc_ty::ExistentialProjection<'tcx>;
|
||||
|
||||
fn internal<'tcx>(&self, tables: &mut Tables<'_>, tcx: TyCtxt<'tcx>) -> Self::T<'tcx> {
|
||||
rustc_ty::ExistentialProjection {
|
||||
def_id: self.def_id.0.internal(tables, tcx),
|
||||
args: self.generic_args.internal(tables, tcx),
|
||||
term: self.term.internal(tables, tcx),
|
||||
}
|
||||
rustc_ty::ExistentialProjection::new_from_args(
|
||||
tcx,
|
||||
self.def_id.0.internal(tables, tcx),
|
||||
self.generic_args.internal(tables, tcx),
|
||||
self.term.internal(tables, tcx),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -403,10 +404,11 @@ impl RustcInternal for ExistentialTraitRef {
|
|||
type T<'tcx> = rustc_ty::ExistentialTraitRef<'tcx>;
|
||||
|
||||
fn internal<'tcx>(&self, tables: &mut Tables<'_>, tcx: TyCtxt<'tcx>) -> Self::T<'tcx> {
|
||||
rustc_ty::ExistentialTraitRef {
|
||||
def_id: self.def_id.0.internal(tables, tcx),
|
||||
args: self.generic_args.internal(tables, tcx),
|
||||
}
|
||||
rustc_ty::ExistentialTraitRef::new_from_args(
|
||||
tcx,
|
||||
self.def_id.0.internal(tables, tcx),
|
||||
self.generic_args.internal(tables, tcx),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ impl<'tcx> Stable<'tcx> for ty::ExistentialTraitRef<'tcx> {
|
|||
type T = stable_mir::ty::ExistentialTraitRef;
|
||||
|
||||
fn stable(&self, tables: &mut Tables<'_>) -> Self::T {
|
||||
let ty::ExistentialTraitRef { def_id, args } = self;
|
||||
let ty::ExistentialTraitRef { def_id, args, .. } = self;
|
||||
stable_mir::ty::ExistentialTraitRef {
|
||||
def_id: tables.trait_def(*def_id),
|
||||
generic_args: args.stable(tables),
|
||||
|
@ -95,7 +95,7 @@ impl<'tcx> Stable<'tcx> for ty::ExistentialProjection<'tcx> {
|
|||
type T = stable_mir::ty::ExistentialProjection;
|
||||
|
||||
fn stable(&self, tables: &mut Tables<'_>) -> Self::T {
|
||||
let ty::ExistentialProjection { def_id, args, term } = self;
|
||||
let ty::ExistentialProjection { def_id, args, term, .. } = self;
|
||||
stable_mir::ty::ExistentialProjection {
|
||||
def_id: tables.trait_def(*def_id),
|
||||
generic_args: args.stable(tables),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue