1
Fork 0

Auto merge of #107753 - kylematsuda:type-of, r=BoxyUwU

Switch to `EarlyBinder` for `type_of` query

Part of the work to finish #105779 and implement https://github.com/rust-lang/types-team/issues/78.

Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `type_of` query and removes `bound_type_of`.

r? `@lcnr`
This commit is contained in:
bors 2023-02-17 04:45:15 +00:00
commit 9556b56dbd
164 changed files with 443 additions and 334 deletions

View file

@ -557,7 +557,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
ty::INNERMOST,
ty::BoundVar::from_usize(bound_vars.len() - 1),
),
tcx.type_of(param.def_id),
tcx.type_of(param.def_id)
.no_bound_vars()
.expect("const parameter types cannot be generic"),
)
.into()
}
@ -1073,7 +1075,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
.fields
.last()
.expect("expected unsized ADT to have a tail field");
let tail_field_ty = tcx.bound_type_of(tail_field.did);
let tail_field_ty = tcx.type_of(tail_field.did);
// Extract `TailField<T>` and `TailField<U>` from `Struct<T>` and `Struct<U>`,
// normalizing in the process, since `type_of` returns something directly from

View file

@ -2350,7 +2350,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// We can resolve the `impl Trait` to its concrete type,
// which enforces a DAG between the functions requiring
// the auto trait bounds in question.
t.rebind(vec![self.tcx().bound_type_of(def_id).subst(self.tcx(), substs)])
t.rebind(vec![self.tcx().type_of(def_id).subst(self.tcx(), substs)])
}
}
}