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

Lines changed: 0 additions & 4 deletions
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

Lines changed: 0 additions & 2 deletions
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

Lines changed: 0 additions & 17 deletions
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

Lines changed: 0 additions & 2 deletions
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

Lines changed: 0 additions & 11 deletions
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

Lines changed: 1 addition & 12 deletions
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

Lines changed: 0 additions & 3 deletions
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

Lines changed: 0 additions & 2 deletions
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

Lines changed: 0 additions & 11 deletions
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

Lines changed: 0 additions & 3 deletions
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 |

0 commit comments

Comments
 (0)