remove bound_type_of query; make type_of return EarlyBinder; change type_of in metadata

This commit is contained in:
Kyle Matsuda
2023-02-07 01:29:48 -07:00
parent d822b97a27
commit c183110cc2
164 changed files with 325 additions and 380 deletions

View File

@@ -101,7 +101,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
let inferred_start = self.terms_cx.inferred_starts[&def_id];
let current_item = &CurrentItem { inferred_start };
match tcx.bound_type_of(def_id).subst_identity().kind() {
match tcx.type_of(def_id).subst_identity().kind() {
ty::Adt(def, _) => {
// Not entirely obvious: constraints on structs/enums do not
// affect the variance of their type parameters. See discussion
@@ -112,7 +112,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
for field in def.all_fields() {
self.add_constraints_from_ty(
current_item,
tcx.bound_type_of(field.did).subst_identity(),
tcx.type_of(field.did).subst_identity(),
self.covariant,
);
}

View File

@@ -103,7 +103,7 @@ impl<'a, 'tcx> SolveContext<'a, 'tcx> {
self.enforce_const_invariance(generics, variances);
// Functions are permitted to have unused generic parameters: make those invariant.
if let ty::FnDef(..) = tcx.bound_type_of(def_id).subst_identity().kind() {
if let ty::FnDef(..) = tcx.type_of(def_id).subst_identity().kind() {
for variance in variances.iter_mut() {
if *variance == ty::Bivariant {
*variance = ty::Invariant;