Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e618cba

Browse files
BoxyUwUMark-Simulacrum
authored andcommitted
oops...
1 parent ef1a3b9 commit e618cba

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

‎compiler/rustc_typeck/src/check/dropck.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,12 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
239239
ty::PredicateKind::ConstEvaluatable(a),
240240
ty::PredicateKind::ConstEvaluatable(b),
241241
) => tcx.try_unify_abstract_consts((a, b)),
242-
(ty::PredicateKind::TypeOutlives(a), ty::PredicateKind::TypeOutlives(b)) => {
243-
relator.relate(predicate.rebind(a.0), p.rebind(b.0)).is_ok()
242+
(
243+
ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(ty_a, lt_a)),
244+
ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(ty_b, lt_b)),
245+
) => {
246+
relator.relate(predicate.rebind(ty_a), p.rebind(ty_b)).is_ok()
247+
&& relator.relate(predicate.rebind(lt_a), p.rebind(lt_b)).is_ok()
244248
}
245249
_ => predicate == p,
246250
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
struct Wrapper<'a, T>(&'a T)
2+
where
3+
T: 'a;
4+
5+
impl<'a, T> Drop for Wrapper<'a, T>
6+
where
7+
T: 'static,
8+
//~^ error: `Drop` impl requires `T: 'static` but the struct it is implemented for does not
9+
{
10+
fn drop(&mut self) {}
11+
}
12+
13+
fn main() {}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error[E0367]: `Drop` impl requires `T: 'static` but the struct it is implemented for does not
2+
--> $DIR/relate_lt_in_type_outlives_bound.rs:7:8
3+
|
4+
LL | T: 'static,
5+
| ^^^^^^^
6+
|
7+
note: the implementor must specify the same requirement
8+
--> $DIR/relate_lt_in_type_outlives_bound.rs:1:1
9+
|
10+
LL | / struct Wrapper<'a, T>(&'a T)
11+
LL | | where
12+
LL | | T: 'a;
13+
| |__________^
14+
15+
error: aborting due to previous error
16+
17+
For more information about this error, try `rustc --explain E0367`.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /