Skip to content

Commit 517f861

Browse files
committed
Remove ty::Predicate::Equate and ty::EquatePredicate (dead code)
1 parent c9b86a9 commit 517f861

File tree

19 files changed

+1
-148
lines changed

19 files changed

+1
-148
lines changed

src/librustc/ich/impls_ty.rs

-4
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ impl_stable_hash_for!(enum ty::Visibility {
244244

245245
impl_stable_hash_for!(struct ty::TraitRef<'tcx> { def_id, substs });
246246
impl_stable_hash_for!(struct ty::TraitPredicate<'tcx> { trait_ref });
247-
impl_stable_hash_for!(tuple_struct ty::EquatePredicate<'tcx> { t1, t2 });
248247
impl_stable_hash_for!(struct ty::SubtypePredicate<'tcx> { a_is_expected, a, b });
249248

250249
impl<'gcx, A, B> HashStable<StableHashingContext<'gcx>>
@@ -274,9 +273,6 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::Predicate<'gcx> {
274273
ty::Predicate::Trait(ref pred) => {
275274
pred.hash_stable(hcx, hasher);
276275
}
277-
ty::Predicate::Equate(ref pred) => {
278-
pred.hash_stable(hcx, hasher);
279-
}
280276
ty::Predicate::Subtype(ref pred) => {
281277
pred.hash_stable(hcx, hasher);
282278
}

src/librustc/infer/error_reporting/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1183,7 +1183,6 @@ impl<'tcx> ObligationCause<'tcx> {
11831183
}),
11841184
IfExpression => Error0308("if and else have incompatible types"),
11851185
IfExpressionWithNoElse => Error0317("if may be missing an else clause"),
1186-
EquatePredicate => Error0308("equality predicate not satisfied"),
11871186
MainFunctionType => Error0580("main function has wrong type"),
11881187
StartFunctionType => Error0308("start function has wrong type"),
11891188
IntrinsicType => Error0308("intrinsic has wrong type"),
@@ -1212,7 +1211,6 @@ impl<'tcx> ObligationCause<'tcx> {
12121211
},
12131212
IfExpression => "if and else have compatible types",
12141213
IfExpressionWithNoElse => "if missing an else returns ()",
1215-
EquatePredicate => "equality where clause is satisfied",
12161214
MainFunctionType => "`main` function has the correct type",
12171215
StartFunctionType => "`start` function has the correct type",
12181216
IntrinsicType => "intrinsic has the correct type",

src/librustc/infer/mod.rs

-17
Original file line numberDiff line numberDiff line change
@@ -943,23 +943,6 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
943943
self.borrow_region_constraints().make_subregion(origin, a, b);
944944
}
945945

946-
pub fn equality_predicate(&self,
947-
cause: &ObligationCause<'tcx>,
948-
param_env: ty::ParamEnv<'tcx>,
949-
predicate: &ty::PolyEquatePredicate<'tcx>)
950-
-> InferResult<'tcx, ()>
951-
{
952-
self.commit_if_ok(|snapshot| {
953-
let (ty::EquatePredicate(a, b), skol_map) =
954-
self.skolemize_late_bound_regions(predicate, snapshot);
955-
let cause_span = cause.span;
956-
let eqty_ok = self.at(cause, param_env).eq(b, a)?;
957-
self.leak_check(false, cause_span, &skol_map, snapshot)?;
958-
self.pop_skolemized(skol_map, snapshot);
959-
Ok(eqty_ok.unit())
960-
})
961-
}
962-
963946
pub fn subtype_predicate(&self,
964947
cause: &ObligationCause<'tcx>,
965948
param_env: ty::ParamEnv<'tcx>,

src/librustc/infer/outlives/bounds.rs

-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
117117
assert!(!obligation.has_escaping_regions());
118118
match obligation.predicate {
119119
ty::Predicate::Trait(..) |
120-
ty::Predicate::Equate(..) |
121120
ty::Predicate::Subtype(..) |
122121
ty::Predicate::Projection(..) |
123122
ty::Predicate::ClosureKind(..) |
@@ -204,7 +203,6 @@ pub fn explicit_outlives_bounds<'tcx>(
204203
.filter_map(move |predicate| match predicate {
205204
ty::Predicate::Projection(..) |
206205
ty::Predicate::Trait(..) |
207-
ty::Predicate::Equate(..) |
208206
ty::Predicate::Subtype(..) |
209207
ty::Predicate::WellFormed(..) |
210208
ty::Predicate::ObjectSafe(..) |

src/librustc/traits/error_reporting.rs

-11
Original file line numberDiff line numberDiff line change
@@ -631,16 +631,6 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
631631
span_bug!(span, "subtype requirement gave wrong error: `{:?}`", predicate)
632632
}
633633

634-
ty::Predicate::Equate(ref predicate) => {
635-
let predicate = self.resolve_type_vars_if_possible(predicate);
636-
let err = self.equality_predicate(&obligation.cause,
637-
obligation.param_env,
638-
&predicate).err().unwrap();
639-
struct_span_err!(self.tcx.sess, span, E0278,
640-
"the requirement `{}` is not satisfied (`{}`)",
641-
predicate, err)
642-
}
643-
644634
ty::Predicate::RegionOutlives(ref predicate) => {
645635
let predicate = self.resolve_type_vars_if_possible(predicate);
646636
let err = self.region_outlives_predicate(&obligation.cause,
@@ -1270,7 +1260,6 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
12701260
ObligationCauseCode::MatchExpressionArm { .. } |
12711261
ObligationCauseCode::IfExpression |
12721262
ObligationCauseCode::IfExpressionWithNoElse |
1273-
ObligationCauseCode::EquatePredicate |
12741263
ObligationCauseCode::MainFunctionType |
12751264
ObligationCauseCode::StartFunctionType |
12761265
ObligationCauseCode::IntrinsicType |

src/librustc/traits/fulfill.rs

+1-12
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use infer::{RegionObligation, InferCtxt, InferOk};
11+
use infer::{RegionObligation, InferCtxt};
1212
use ty::{self, Ty, TypeFoldable, ToPolyTraitRef, ToPredicate};
1313
use ty::error::ExpectedFound;
1414
use rustc_data_structures::obligation_forest::{ObligationForest, Error};
@@ -380,17 +380,6 @@ fn process_predicate<'a, 'gcx, 'tcx>(
380380
}
381381
}
382382

383-
ty::Predicate::Equate(ref binder) => {
384-
match selcx.infcx().equality_predicate(&obligation.cause,
385-
obligation.param_env,
386-
binder) {
387-
Ok(InferOk { obligations, value: () }) => {
388-
Ok(Some(obligations))
389-
},
390-
Err(_) => Err(CodeSelectionError(Unimplemented)),
391-
}
392-
}
393-
394383
ty::Predicate::RegionOutlives(ref binder) => {
395384
match selcx.infcx().region_outlives_predicate(&obligation.cause, binder) {
396385
Ok(()) => Ok(Some(Vec::new())),

src/librustc/traits/mod.rs

-3
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,6 @@ pub enum ObligationCauseCode<'tcx> {
204204
/// Computing common supertype of an if expression with no else counter-part
205205
IfExpressionWithNoElse,
206206

207-
/// `where a == b`
208-
EquatePredicate,
209-
210207
/// `main` has wrong type
211208
MainFunctionType,
212209

src/librustc/traits/object_safety.rs

-2
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
175175
ty::Predicate::RegionOutlives(..) |
176176
ty::Predicate::ClosureKind(..) |
177177
ty::Predicate::Subtype(..) |
178-
ty::Predicate::Equate(..) |
179178
ty::Predicate::ConstEvaluatable(..) => {
180179
false
181180
}
@@ -204,7 +203,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
204203
}
205204
ty::Predicate::Projection(..) |
206205
ty::Predicate::Trait(..) |
207-
ty::Predicate::Equate(..) |
208206
ty::Predicate::Subtype(..) |
209207
ty::Predicate::RegionOutlives(..) |
210208
ty::Predicate::WellFormed(..) |

src/librustc/traits/select.rs

-11
Original file line numberDiff line numberDiff line change
@@ -691,17 +691,6 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
691691
self.evaluate_trait_predicate_recursively(previous_stack, obligation)
692692
}
693693

694-
ty::Predicate::Equate(ref p) => {
695-
// does this code ever run?
696-
match self.infcx.equality_predicate(&obligation.cause, obligation.param_env, p) {
697-
Ok(InferOk { obligations, .. }) => {
698-
self.inferred_obligations.extend(obligations);
699-
EvaluatedToOk
700-
},
701-
Err(_) => EvaluatedToErr
702-
}
703-
}
704-
705694
ty::Predicate::Subtype(ref p) => {
706695
// does this code ever run?
707696
match self.infcx.subtype_predicate(&obligation.cause, obligation.param_env, p) {

src/librustc/traits/structural_impls.rs

-3
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> {
236236
}
237237
super::IfExpression => Some(super::IfExpression),
238238
super::IfExpressionWithNoElse => Some(super::IfExpressionWithNoElse),
239-
super::EquatePredicate => Some(super::EquatePredicate),
240239
super::MainFunctionType => Some(super::MainFunctionType),
241240
super::StartFunctionType => Some(super::StartFunctionType),
242241
super::IntrinsicType => Some(super::IntrinsicType),
@@ -512,7 +511,6 @@ impl<'tcx> TypeFoldable<'tcx> for traits::ObligationCauseCode<'tcx> {
512511
super::MatchExpressionArm { arm_span: _, source: _ } |
513512
super::IfExpression |
514513
super::IfExpressionWithNoElse |
515-
super::EquatePredicate |
516514
super::MainFunctionType |
517515
super::StartFunctionType |
518516
super::IntrinsicType |
@@ -561,7 +559,6 @@ impl<'tcx> TypeFoldable<'tcx> for traits::ObligationCauseCode<'tcx> {
561559
super::MatchExpressionArm { arm_span: _, source: _ } |
562560
super::IfExpression |
563561
super::IfExpressionWithNoElse |
564-
super::EquatePredicate |
565562
super::MainFunctionType |
566563
super::StartFunctionType |
567564
super::IntrinsicType |

src/librustc/traits/util.rs

-8
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ fn anonymize_predicate<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
2525
ty::Predicate::Trait(ref data) =>
2626
ty::Predicate::Trait(tcx.anonymize_late_bound_regions(data)),
2727

28-
ty::Predicate::Equate(ref data) =>
29-
ty::Predicate::Equate(tcx.anonymize_late_bound_regions(data)),
30-
3128
ty::Predicate::RegionOutlives(ref data) =>
3229
ty::Predicate::RegionOutlives(tcx.anonymize_late_bound_regions(data)),
3330

@@ -163,11 +160,6 @@ impl<'cx, 'gcx, 'tcx> Elaborator<'cx, 'gcx, 'tcx> {
163160
// Currently, we do not elaborate object-safe
164161
// predicates.
165162
}
166-
ty::Predicate::Equate(..) => {
167-
// Currently, we do not "elaborate" predicates like
168-
// `X == Y`, though conceivably we might. For example,
169-
// `&X == &Y` implies that `X == Y`.
170-
}
171163
ty::Predicate::Subtype(..) => {
172164
// Currently, we do not "elaborate" predicates like `X
173165
// <: Y`, though conceivably we might.

src/librustc/ty/mod.rs

-20
Original file line numberDiff line numberDiff line change
@@ -912,9 +912,6 @@ pub enum Predicate<'tcx> {
912912
/// would be the type parameters.
913913
Trait(PolyTraitPredicate<'tcx>),
914914

915-
/// where `T1 == T2`.
916-
Equate(PolyEquatePredicate<'tcx>),
917-
918915
/// where 'a : 'b
919916
RegionOutlives(PolyRegionOutlivesPredicate<'tcx>),
920917

@@ -1023,8 +1020,6 @@ impl<'a, 'gcx, 'tcx> Predicate<'tcx> {
10231020
match *self {
10241021
Predicate::Trait(ty::Binder(ref data)) =>
10251022
Predicate::Trait(ty::Binder(data.subst(tcx, substs))),
1026-
Predicate::Equate(ty::Binder(ref data)) =>
1027-
Predicate::Equate(ty::Binder(data.subst(tcx, substs))),
10281023
Predicate::Subtype(ty::Binder(ref data)) =>
10291024
Predicate::Subtype(ty::Binder(data.subst(tcx, substs))),
10301025
Predicate::RegionOutlives(ty::Binder(ref data)) =>
@@ -1072,10 +1067,6 @@ impl<'tcx> PolyTraitPredicate<'tcx> {
10721067
}
10731068
}
10741069

1075-
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)]
1076-
pub struct EquatePredicate<'tcx>(pub Ty<'tcx>, pub Ty<'tcx>); // `0 == 1`
1077-
pub type PolyEquatePredicate<'tcx> = ty::Binder<EquatePredicate<'tcx>>;
1078-
10791070
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)]
10801071
pub struct OutlivesPredicate<A,B>(pub A, pub B); // `A : B`
10811072
pub type PolyOutlivesPredicate<A,B> = ty::Binder<OutlivesPredicate<A,B>>;
@@ -1166,12 +1157,6 @@ impl<'tcx> ToPredicate<'tcx> for PolyTraitRef<'tcx> {
11661157
}
11671158
}
11681159

1169-
impl<'tcx> ToPredicate<'tcx> for PolyEquatePredicate<'tcx> {
1170-
fn to_predicate(&self) -> Predicate<'tcx> {
1171-
Predicate::Equate(self.clone())
1172-
}
1173-
}
1174-
11751160
impl<'tcx> ToPredicate<'tcx> for PolyRegionOutlivesPredicate<'tcx> {
11761161
fn to_predicate(&self) -> Predicate<'tcx> {
11771162
Predicate::RegionOutlives(self.clone())
@@ -1199,9 +1184,6 @@ impl<'tcx> Predicate<'tcx> {
11991184
ty::Predicate::Trait(ref data) => {
12001185
data.skip_binder().input_types().collect()
12011186
}
1202-
ty::Predicate::Equate(ty::Binder(ref data)) => {
1203-
vec![data.0, data.1]
1204-
}
12051187
ty::Predicate::Subtype(ty::Binder(SubtypePredicate { a, b, a_is_expected: _ })) => {
12061188
vec![a, b]
12071189
}
@@ -1242,7 +1224,6 @@ impl<'tcx> Predicate<'tcx> {
12421224
Some(t.to_poly_trait_ref())
12431225
}
12441226
Predicate::Projection(..) |
1245-
Predicate::Equate(..) |
12461227
Predicate::Subtype(..) |
12471228
Predicate::RegionOutlives(..) |
12481229
Predicate::WellFormed(..) |
@@ -1262,7 +1243,6 @@ impl<'tcx> Predicate<'tcx> {
12621243
}
12631244
Predicate::Trait(..) |
12641245
Predicate::Projection(..) |
1265-
Predicate::Equate(..) |
12661246
Predicate::Subtype(..) |
12671247
Predicate::RegionOutlives(..) |
12681248
Predicate::WellFormed(..) |

src/librustc/ty/structural_impls.rs

-24
Original file line numberDiff line numberDiff line change
@@ -282,14 +282,6 @@ impl<'a, 'tcx> Lift<'tcx> for ty::TraitPredicate<'a> {
282282
}
283283
}
284284

285-
impl<'a, 'tcx> Lift<'tcx> for ty::EquatePredicate<'a> {
286-
type Lifted = ty::EquatePredicate<'tcx>;
287-
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>)
288-
-> Option<ty::EquatePredicate<'tcx>> {
289-
tcx.lift(&(self.0, self.1)).map(|(a, b)| ty::EquatePredicate(a, b))
290-
}
291-
}
292-
293285
impl<'a, 'tcx> Lift<'tcx> for ty::SubtypePredicate<'a> {
294286
type Lifted = ty::SubtypePredicate<'tcx>;
295287
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>)
@@ -355,9 +347,6 @@ impl<'a, 'tcx> Lift<'tcx> for ty::Predicate<'a> {
355347
ty::Predicate::Trait(ref binder) => {
356348
tcx.lift(binder).map(ty::Predicate::Trait)
357349
}
358-
ty::Predicate::Equate(ref binder) => {
359-
tcx.lift(binder).map(ty::Predicate::Equate)
360-
}
361350
ty::Predicate::Subtype(ref binder) => {
362351
tcx.lift(binder).map(ty::Predicate::Subtype)
363352
}
@@ -1049,8 +1038,6 @@ impl<'tcx> TypeFoldable<'tcx> for ty::Predicate<'tcx> {
10491038
match *self {
10501039
ty::Predicate::Trait(ref a) =>
10511040
ty::Predicate::Trait(a.fold_with(folder)),
1052-
ty::Predicate::Equate(ref binder) =>
1053-
ty::Predicate::Equate(binder.fold_with(folder)),
10541041
ty::Predicate::Subtype(ref binder) =>
10551042
ty::Predicate::Subtype(binder.fold_with(folder)),
10561043
ty::Predicate::RegionOutlives(ref binder) =>
@@ -1073,7 +1060,6 @@ impl<'tcx> TypeFoldable<'tcx> for ty::Predicate<'tcx> {
10731060
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
10741061
match *self {
10751062
ty::Predicate::Trait(ref a) => a.visit_with(visitor),
1076-
ty::Predicate::Equate(ref binder) => binder.visit_with(visitor),
10771063
ty::Predicate::Subtype(ref binder) => binder.visit_with(visitor),
10781064
ty::Predicate::RegionOutlives(ref binder) => binder.visit_with(visitor),
10791065
ty::Predicate::TypeOutlives(ref binder) => binder.visit_with(visitor),
@@ -1111,16 +1097,6 @@ BraceStructTypeFoldableImpl! {
11111097
}
11121098
}
11131099

1114-
impl<'tcx> TypeFoldable<'tcx> for ty::EquatePredicate<'tcx> {
1115-
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
1116-
ty::EquatePredicate(self.0.fold_with(folder), self.1.fold_with(folder))
1117-
}
1118-
1119-
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
1120-
self.0.visit_with(visitor) || self.1.visit_with(visitor)
1121-
}
1122-
}
1123-
11241100
impl<'tcx> TypeFoldable<'tcx> for ty::SubtypePredicate<'tcx> {
11251101
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
11261102
ty::SubtypePredicate {

src/librustc/ty/util.rs

-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
385385
match predicate {
386386
ty::Predicate::Projection(..) |
387387
ty::Predicate::Trait(..) |
388-
ty::Predicate::Equate(..) |
389388
ty::Predicate::Subtype(..) |
390389
ty::Predicate::WellFormed(..) |
391390
ty::Predicate::ObjectSafe(..) |

src/librustc/ty/wf.rs

-4
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@ pub fn predicate_obligations<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
7777
ty::Predicate::Trait(ref t) => {
7878
wf.compute_trait_ref(&t.skip_binder().trait_ref, Elaborate::None); // (*)
7979
}
80-
ty::Predicate::Equate(ref t) => {
81-
wf.compute(t.skip_binder().0);
82-
wf.compute(t.skip_binder().1);
83-
}
8480
ty::Predicate::RegionOutlives(..) => {
8581
}
8682
ty::Predicate::TypeOutlives(ref t) => {

0 commit comments

Comments
 (0)