Skip to content

Commit cf0ce2d

Browse files
committed
Simplify
1 parent edd1d86 commit cf0ce2d

File tree

2 files changed

+7
-46
lines changed

2 files changed

+7
-46
lines changed

chalk-solve/src/clauses.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -322,15 +322,7 @@ fn program_clauses_that_could_match<I: Interner>(
322322
.opaque_ty_data(opaque_ty.opaque_ty_id)
323323
.to_program_clauses(builder),
324324
},
325-
DomainGoal::Holds(WhereClause::LifetimeOutlives(a, b)) => {
326-
builder.push_clause(
327-
DomainGoal::Holds(WhereClause::LifetimeOutlives(a.clone(), b.clone())),
328-
Some(DomainGoal::Holds(WhereClause::LifetimeOutlives(
329-
a.clone(),
330-
b.clone(),
331-
))),
332-
);
333-
}
325+
DomainGoal::Holds(WhereClause::LifetimeOutlives(_, _)) => {}
334326
DomainGoal::WellFormed(WellFormed::Trait(trait_ref))
335327
| DomainGoal::LocalImplAllowed(trait_ref) => {
336328
db.trait_datum(trait_ref.trait_id)

chalk-solve/src/solve/slg/resolvent.rs

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -92,26 +92,6 @@ impl<I: Interner> context::ResolventOps<I, SlgContext<I>> for TruncatingInferenc
9292
debug!("consequence = {:?}", consequence);
9393
debug!("conditions = {:?}", conditions);
9494

95-
let constraints = conditions
96-
.iter(interner)
97-
.filter_map(|c| match c.data(interner) {
98-
GoalData::DomainGoal(DomainGoal::Holds(WhereClause::LifetimeOutlives(a, b))) => {
99-
Some(InEnvironment::new(
100-
environment,
101-
Constraint::Outlives(a.clone(), b.clone()),
102-
))
103-
}
104-
GoalData::Not(c1) => match c1.data(interner) {
105-
GoalData::DomainGoal(DomainGoal::Holds(WhereClause::LifetimeOutlives(
106-
_a,
107-
_b,
108-
))) => panic!("Not allowed."),
109-
_ => None,
110-
},
111-
_ => None,
112-
})
113-
.collect();
114-
11595
// Unify the selected literal Li with C'.
11696
let unification_result = self
11797
.infer
@@ -121,7 +101,7 @@ impl<I: Interner> context::ResolventOps<I, SlgContext<I>> for TruncatingInferenc
121101
let mut ex_clause = ExClause {
122102
subst: subst.clone(),
123103
ambiguous: false,
124-
constraints,
104+
constraints: vec![],
125105
subgoals: vec![],
126106
delayed_subgoals: vec![],
127107
answer_time: TimeStamp::default(),
@@ -131,26 +111,15 @@ impl<I: Interner> context::ResolventOps<I, SlgContext<I>> for TruncatingInferenc
131111
// Add the subgoals/region-constraints that unification gave us.
132112
slg::into_ex_clause(interner, unification_result, &mut ex_clause);
133113

134-
let conditions_iter = conditions
135-
.iter(interner)
136-
.filter(|c| match c.data(interner) {
137-
GoalData::DomainGoal(DomainGoal::Holds(WhereClause::LifetimeOutlives(..))) => false,
138-
GoalData::Not(c1) => match c1.data(interner) {
139-
GoalData::DomainGoal(DomainGoal::Holds(WhereClause::LifetimeOutlives(..))) => {
140-
false
141-
}
142-
_ => true,
143-
},
144-
_ => true,
145-
})
146-
.map(|c| match c.data(interner) {
114+
// Add the `conditions` from the program clause into the result too.
115+
ex_clause
116+
.subgoals
117+
.extend(conditions.iter(interner).map(|c| match c.data(interner) {
147118
GoalData::Not(c1) => {
148119
Literal::Negative(InEnvironment::new(environment, Goal::clone(c1)))
149120
}
150121
_ => Literal::Positive(InEnvironment::new(environment, Goal::clone(c))),
151-
});
152-
// Add the `conditions` from the program clause into the result too.
153-
ex_clause.subgoals.extend(conditions_iter);
122+
}));
154123

155124
Ok(ex_clause)
156125
}

0 commit comments

Comments
 (0)