Skip to content

Commit 0c73b41

Browse files
remove TypeWellFormedFromEnv
1 parent c6fcbaa commit 0c73b41

File tree

23 files changed

+18
-73
lines changed

23 files changed

+18
-73
lines changed

compiler/rustc_hir_analysis/src/astconv/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -983,8 +983,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
983983
ty::ClauseKind::RegionOutlives(_)
984984
| ty::ClauseKind::ConstArgHasType(..)
985985
| ty::ClauseKind::WellFormed(_)
986-
| ty::ClauseKind::ConstEvaluatable(_)
987-
| ty::ClauseKind::TypeWellFormedFromEnv(_) => {
986+
| ty::ClauseKind::ConstEvaluatable(_) => {
988987
bug!()
989988
}
990989
}

compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,6 @@ fn trait_predicate_kind<'tcx>(
551551
| ty::PredicateKind::ClosureKind(..)
552552
| ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..))
553553
| ty::PredicateKind::ConstEquate(..)
554-
| ty::PredicateKind::Ambiguous
555-
| ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => None,
554+
| ty::PredicateKind::Ambiguous => None,
556555
}
557556
}

compiler/rustc_hir_analysis/src/outlives/explicit.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ impl<'tcx> ExplicitPredicatesMap<'tcx> {
5353
| ty::ClauseKind::Projection(_)
5454
| ty::ClauseKind::ConstArgHasType(_, _)
5555
| ty::ClauseKind::WellFormed(_)
56-
| ty::ClauseKind::ConstEvaluatable(_)
57-
| ty::ClauseKind::TypeWellFormedFromEnv(_) => {}
56+
| ty::ClauseKind::ConstEvaluatable(_) => {}
5857
}
5958
}
6059

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
685685
// inference variable.
686686
| ty::PredicateKind::ClosureKind(..)
687687
| ty::PredicateKind::Ambiguous
688-
| ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => None,
688+
=> None,
689689
},
690690
)
691691
}

compiler/rustc_hir_typeck/src/method/probe.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -847,8 +847,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
847847
| ty::ClauseKind::Projection(_)
848848
| ty::ClauseKind::ConstArgHasType(_, _)
849849
| ty::ClauseKind::WellFormed(_)
850-
| ty::ClauseKind::ConstEvaluatable(_)
851-
| ty::ClauseKind::TypeWellFormedFromEnv(_) => None,
850+
| ty::ClauseKind::ConstEvaluatable(_) => None,
852851
}
853852
});
854853

compiler/rustc_infer/src/infer/outlives/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ pub fn explicit_outlives_bounds<'tcx>(
3131
| ty::ClauseKind::Projection(_)
3232
| ty::ClauseKind::ConstArgHasType(_, _)
3333
| ty::ClauseKind::WellFormed(_)
34-
| ty::ClauseKind::ConstEvaluatable(_)
35-
| ty::ClauseKind::TypeWellFormedFromEnv(_) => None,
34+
| ty::ClauseKind::ConstEvaluatable(_) => None,
3635
})
3736
}
3837

compiler/rustc_infer/src/traits/util.rs

-3
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,6 @@ impl<'tcx, O: Elaboratable<'tcx>> Elaborator<'tcx, O> {
370370
}),
371371
);
372372
}
373-
ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
374-
// Nothing to elaborate
375-
}
376373
ty::PredicateKind::Ambiguous => {}
377374
ty::PredicateKind::AliasRelate(..) => {
378375
// No

compiler/rustc_lint/src/builtin.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1606,8 +1606,7 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
16061606
// Ignore bounds that a user can't type
16071607
| ClauseKind::WellFormed(..)
16081608
// FIXME(generic_const_exprs): `ConstEvaluatable` can be written
1609-
| ClauseKind::ConstEvaluatable(..)
1610-
| ClauseKind::TypeWellFormedFromEnv(_) => continue,
1609+
| ClauseKind::ConstEvaluatable(..) => continue,
16111610
};
16121611
if predicate.is_global() {
16131612
cx.emit_spanned_lint(

compiler/rustc_middle/src/ty/flags.rs

-3
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,6 @@ impl FlagComputation {
287287
self.add_const(expected);
288288
self.add_const(found);
289289
}
290-
ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(ty)) => {
291-
self.add_ty(ty);
292-
}
293290
ty::PredicateKind::Ambiguous => {}
294291
ty::PredicateKind::AliasRelate(t1, t2, _) => {
295292
self.add_term(t1);

compiler/rustc_middle/src/ty/mod.rs

+4-13
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,7 @@ impl<'tcx> Predicate<'tcx> {
554554
| PredicateKind::Coerce(_)
555555
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(_))
556556
| PredicateKind::ConstEquate(_, _)
557-
| PredicateKind::Ambiguous
558-
| PredicateKind::Clause(ClauseKind::TypeWellFormedFromEnv(_)) => true,
557+
| PredicateKind::Ambiguous => true,
559558
}
560559
}
561560
}
@@ -661,11 +660,6 @@ pub enum ClauseKind<'tcx> {
661660

662661
/// Constant initializer must evaluate successfully.
663662
ConstEvaluatable(ty::Const<'tcx>),
664-
665-
/// Represents a type found in the environment that we can use for implied bounds.
666-
///
667-
/// Only used for Chalk.
668-
TypeWellFormedFromEnv(Ty<'tcx>),
669663
}
670664

671665
#[derive(Clone, Copy, PartialEq, Eq, Hash, TyEncodable, TyDecodable)]
@@ -1424,8 +1418,7 @@ impl<'tcx> Predicate<'tcx> {
14241418
| PredicateKind::Clause(ClauseKind::TypeOutlives(..))
14251419
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(..))
14261420
| PredicateKind::ConstEquate(..)
1427-
| PredicateKind::Ambiguous
1428-
| PredicateKind::Clause(ClauseKind::TypeWellFormedFromEnv(..)) => None,
1421+
| PredicateKind::Ambiguous => None,
14291422
}
14301423
}
14311424

@@ -1445,8 +1438,7 @@ impl<'tcx> Predicate<'tcx> {
14451438
| PredicateKind::Clause(ClauseKind::TypeOutlives(..))
14461439
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(..))
14471440
| PredicateKind::ConstEquate(..)
1448-
| PredicateKind::Ambiguous
1449-
| PredicateKind::Clause(ClauseKind::TypeWellFormedFromEnv(..)) => None,
1441+
| PredicateKind::Ambiguous => None,
14501442
}
14511443
}
14521444

@@ -1466,8 +1458,7 @@ impl<'tcx> Predicate<'tcx> {
14661458
| PredicateKind::ClosureKind(..)
14671459
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(..))
14681460
| PredicateKind::ConstEquate(..)
1469-
| PredicateKind::Ambiguous
1470-
| PredicateKind::Clause(ClauseKind::TypeWellFormedFromEnv(..)) => None,
1461+
| PredicateKind::Ambiguous => None,
14711462
}
14721463
}
14731464

compiler/rustc_middle/src/ty/print/pretty.rs

-3
Original file line numberDiff line numberDiff line change
@@ -2888,9 +2888,6 @@ define_print_and_forward_display! {
28882888
ty::ClauseKind::ConstEvaluatable(ct) => {
28892889
p!("the constant `", print(ct), "` can be evaluated")
28902890
}
2891-
ty::ClauseKind::TypeWellFormedFromEnv(ty) => {
2892-
p!("the type `", print(ty), "` is found in the environment")
2893-
}
28942891
}
28952892
}
28962893

compiler/rustc_middle/src/ty/structural_impls.rs

-3
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,6 @@ impl<'tcx> fmt::Debug for ty::ClauseKind<'tcx> {
189189
ty::ClauseKind::ConstEvaluatable(ct) => {
190190
write!(f, "ConstEvaluatable({ct:?})")
191191
}
192-
ty::ClauseKind::TypeWellFormedFromEnv(ty) => {
193-
write!(f, "TypeWellFormedFromEnv({:?})", ty)
194-
}
195192
}
196193
}
197194
}

compiler/rustc_privacy/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ where
174174
}
175175
ty::ClauseKind::ConstEvaluatable(ct) => ct.visit_with(self),
176176
ty::ClauseKind::WellFormed(arg) => arg.visit_with(self),
177-
ty::ClauseKind::TypeWellFormedFromEnv(_) => bug!("unexpected clause: {clause}"),
178177
}
179178
}
180179

compiler/rustc_trait_selection/src/solve/eval_ctxt.rs

-3
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,6 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
435435
ty::PredicateKind::ConstEquate(_, _) => {
436436
bug!("ConstEquate should not be emitted when `-Ztrait-solver=next` is active")
437437
}
438-
ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
439-
bug!("TypeWellFormedFromEnv is only used for Chalk")
440-
}
441438
ty::PredicateKind::AliasRelate(lhs, rhs, direction) => self
442439
.compute_alias_relate_goal(Goal {
443440
param_env,

compiler/rustc_trait_selection/src/traits/auto_trait.rs

-3
Original file line numberDiff line numberDiff line change
@@ -836,9 +836,6 @@ impl<'tcx> AutoTraitFinder<'tcx> {
836836
// FIXME(generic_const_exprs): you can absolutely add this as a where clauses
837837
| ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..))
838838
| ty::PredicateKind::Coerce(..) => {}
839-
ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
840-
bug!("predicate should only exist in the environment: {bound_predicate:?}")
841-
}
842839
ty::PredicateKind::Ambiguous => return false,
843840
};
844841
}

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

-7
Original file line numberDiff line numberDiff line change
@@ -1094,13 +1094,6 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
10941094

10951095
ty::PredicateKind::Ambiguous => span_bug!(span, "ambiguous"),
10961096

1097-
ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
1098-
span_bug!(
1099-
span,
1100-
"TypeWellFormedFromEnv predicate should only exist in the environment"
1101-
)
1102-
}
1103-
11041097
ty::PredicateKind::AliasRelate(..) => span_bug!(
11051098
span,
11061099
"AliasRelate predicate should never be the predicate cause of a SelectionError"

compiler/rustc_trait_selection/src/traits/fulfill.rs

-6
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,6 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
359359
ProcessResult::Changed(mk_pending(vec![obligation.with(infcx.tcx, pred)]))
360360
}
361361
ty::PredicateKind::Ambiguous => ProcessResult::Unchanged,
362-
ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
363-
bug!("TypeWellFormedFromEnv is only used for Chalk")
364-
}
365362
ty::PredicateKind::AliasRelate(..) => {
366363
bug!("AliasRelate is only used for new solver")
367364
}
@@ -627,9 +624,6 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
627624
}
628625
}
629626
ty::PredicateKind::Ambiguous => ProcessResult::Unchanged,
630-
ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
631-
bug!("TypeWellFormedFromEnv is only used for Chalk")
632-
}
633627
ty::PredicateKind::AliasRelate(..) => {
634628
bug!("AliasRelate is only used for new solver")
635629
}

compiler/rustc_trait_selection/src/traits/object_safety.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ fn predicate_references_self<'tcx>(
311311
| ty::ClauseKind::RegionOutlives(..)
312312
// FIXME(generic_const_exprs): this can mention `Self`
313313
| ty::ClauseKind::ConstEvaluatable(..)
314-
| ty::ClauseKind::TypeWellFormedFromEnv(_) => None,
314+
=> None,
315315
}
316316
}
317317

@@ -351,8 +351,7 @@ fn generics_require_sized_self(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
351351
| ty::ClauseKind::Projection(_)
352352
| ty::ClauseKind::ConstArgHasType(_, _)
353353
| ty::ClauseKind::WellFormed(_)
354-
| ty::ClauseKind::ConstEvaluatable(_)
355-
| ty::ClauseKind::TypeWellFormedFromEnv(_) => false,
354+
| ty::ClauseKind::ConstEvaluatable(_) => false,
356355
})
357356
}
358357

compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ pub fn compute_implied_outlives_bounds_inner<'tcx>(
134134
| ty::PredicateKind::ConstEquate(..)
135135
| ty::PredicateKind::Ambiguous
136136
| ty::PredicateKind::AliasRelate(..)
137-
| ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {}
137+
=> {}
138138

139139
// We need to search through *all* WellFormed predicates
140140
ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(arg)) => {

compiler/rustc_trait_selection/src/traits/select/mod.rs

-3
Original file line numberDiff line numberDiff line change
@@ -972,9 +972,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
972972
}
973973
}
974974
}
975-
ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
976-
bug!("TypeWellFormedFromEnv is only used for chalk")
977-
}
978975
ty::PredicateKind::AliasRelate(..) => {
979976
bug!("AliasRelate is only used for new solver")
980977
}

compiler/rustc_trait_selection/src/traits/wf.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,7 @@ pub fn predicate_obligations<'tcx>(
184184
| ty::PredicateKind::Coerce(..)
185185
| ty::PredicateKind::ConstEquate(..)
186186
| ty::PredicateKind::Ambiguous
187-
| ty::PredicateKind::AliasRelate(..)
188-
| ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
187+
| ty::PredicateKind::AliasRelate(..) => {
189188
bug!("We should only wf check where clauses, unexpected predicate: {predicate:?}")
190189
}
191190
}
@@ -1005,8 +1004,7 @@ pub(crate) fn required_region_bounds<'tcx>(
10051004
| ty::ClauseKind::Projection(_)
10061005
| ty::ClauseKind::ConstArgHasType(_, _)
10071006
| ty::ClauseKind::WellFormed(_)
1008-
| ty::ClauseKind::ConstEvaluatable(_)
1009-
| ty::ClauseKind::TypeWellFormedFromEnv(_) => None,
1007+
| ty::ClauseKind::ConstEvaluatable(_) => None,
10101008
}
10111009
})
10121010
.collect()

compiler/rustc_traits/src/normalize_erasing_regions.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ fn not_outlives_predicate(p: ty::Predicate<'_>) -> bool {
6969
| ty::PredicateKind::Coerce(..)
7070
| ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..))
7171
| ty::PredicateKind::ConstEquate(..)
72-
| ty::PredicateKind::Ambiguous
73-
| ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => true,
72+
| ty::PredicateKind::Ambiguous => true,
7473
}
7574
}

src/librustdoc/clean/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,7 @@ pub(crate) fn clean_predicate<'tcx>(
342342
// FIXME(generic_const_exprs): should this do something?
343343
ty::ClauseKind::ConstEvaluatable(..)
344344
| ty::ClauseKind::WellFormed(..)
345-
| ty::ClauseKind::ConstArgHasType(..)
346-
| ty::ClauseKind::TypeWellFormedFromEnv(..) => None,
345+
| ty::ClauseKind::ConstArgHasType(..) => None,
347346
}
348347
}
349348

0 commit comments

Comments
 (0)