Skip to content

Commit 2503db8

Browse files
authored
Rollup merge of rust-lang#54789 - scalexm:unnormalized, r=nikomatsakis
Introduce `TyKind::UnnormalizedProjection` Introduce a new variant used for lazy normalization in chalk integration. Mostly `bug!` everywhere. r? @nikomatsakis
2 parents bc2859d + edb3f97 commit 2503db8

File tree

28 files changed

+58
-11
lines changed

28 files changed

+58
-11
lines changed

src/librustc/ich/impls_ty.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -873,8 +873,8 @@ for ty::TyKind<'gcx>
873873
Tuple(inner_tys) => {
874874
inner_tys.hash_stable(hcx, hasher);
875875
}
876-
Projection(ref projection_ty) => {
877-
projection_ty.hash_stable(hcx, hasher);
876+
Projection(ref data) | UnnormalizedProjection(ref data) => {
877+
data.hash_stable(hcx, hasher);
878878
}
879879
Opaque(def_id, substs) => {
880880
def_id.hash_stable(hcx, hasher);

src/librustc/infer/canonical/canonicalizer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx>
283283
| ty::Never
284284
| ty::Tuple(..)
285285
| ty::Projection(..)
286+
| ty::UnnormalizedProjection(..)
286287
| ty::Foreign(..)
287288
| ty::Param(..)
288289
| ty::Opaque(..) => {

src/librustc/infer/freshen.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> {
193193
ty::Never |
194194
ty::Tuple(..) |
195195
ty::Projection(..) |
196+
ty::UnnormalizedProjection(..) |
196197
ty::Foreign(..) |
197198
ty::Param(..) |
198199
ty::Closure(..) |

src/librustc/traits/coherence.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ fn ty_is_local_constructor(ty: Ty<'_>, in_crate: InCrate) -> bool {
475475

476476
ty::Error => true,
477477

478+
ty::UnnormalizedProjection(..) |
478479
ty::Closure(..) |
479480
ty::Generator(..) |
480481
ty::GeneratorWitness(..) |

src/librustc/traits/error_reporting.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
269269
ty::Generator(..) => Some(18),
270270
ty::Foreign(..) => Some(19),
271271
ty::GeneratorWitness(..) => Some(20),
272-
ty::Infer(..) | ty::Error => None
272+
ty::Infer(..) | ty::Error => None,
273+
ty::UnnormalizedProjection(..) => bug!("only used with chalk-engine"),
273274
}
274275
}
275276

src/librustc/traits/query/dropck_outlives.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,5 +253,7 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) ->
253253
| ty::Opaque(..)
254254
| ty::Infer(_)
255255
| ty::Generator(..) => false,
256+
257+
ty::UnnormalizedProjection(..) => bug!("only used with chalk-engine"),
256258
}
257259
}

src/librustc/traits/select.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2283,6 +2283,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
22832283
ty::Projection(_) | ty::Param(_) | ty::Opaque(..) => None,
22842284
ty::Infer(ty::TyVar(_)) => Ambiguous,
22852285

2286+
ty::UnnormalizedProjection(..) |
22862287
ty::Infer(ty::CanonicalTy(_)) |
22872288
ty::Infer(ty::FreshTy(_)) |
22882289
ty::Infer(ty::FreshIntTy(_)) |
@@ -2355,6 +2356,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
23552356
Ambiguous
23562357
}
23572358

2359+
ty::UnnormalizedProjection(..) |
23582360
ty::Infer(ty::CanonicalTy(_)) |
23592361
ty::Infer(ty::FreshTy(_)) |
23602362
ty::Infer(ty::FreshIntTy(_)) |
@@ -2393,6 +2395,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
23932395
Vec::new()
23942396
}
23952397

2398+
ty::UnnormalizedProjection(..) |
23962399
ty::Dynamic(..) |
23972400
ty::Param(..) |
23982401
ty::Foreign(..) |

src/librustc/ty/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2234,7 +2234,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
22342234
self,
22352235
Adt, Array, Slice, RawPtr, Ref, FnDef, FnPtr,
22362236
Generator, GeneratorWitness, Dynamic, Closure, Tuple,
2237-
Param, Infer, Projection, Opaque, Foreign);
2237+
Param, Infer, UnnormalizedProjection, Projection, Opaque, Foreign);
22382238

22392239
println!("Substs interner: #{}", self.interners.substs.borrow().len());
22402240
println!("Region interner: #{}", self.interners.region.borrow().len());

src/librustc/ty/error.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> {
222222
ty::Infer(ty::FreshIntTy(_)) => "skolemized integral type".to_string(),
223223
ty::Infer(ty::FreshFloatTy(_)) => "skolemized floating-point type".to_string(),
224224
ty::Projection(_) => "associated type".to_string(),
225+
ty::UnnormalizedProjection(_) => "non-normalized associated type".to_string(),
225226
ty::Param(ref p) => {
226227
if p.is_self() {
227228
"Self".to_string()

src/librustc/ty/fast_reject.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
103103
ty::FnPtr(ref f) => {
104104
Some(FunctionSimplifiedType(f.skip_binder().inputs().len()))
105105
}
106+
ty::UnnormalizedProjection(..) => bug!("only used with chalk-engine"),
106107
ty::Projection(_) | ty::Param(_) => {
107108
if can_simplify_params {
108109
// In normalized types, projections don't unify with

0 commit comments

Comments
 (0)