Skip to content

Commit 0d8f3b3

Browse files
committed
we now get 2 extra mismatched type errors
These new errors actually seem a *tad* clearer than the old one, so that's good, but now there are 3. Maybe call it a wash?
1 parent 0e47a4a commit 0d8f3b3

File tree

2 files changed

+69
-4
lines changed

2 files changed

+69
-4
lines changed

src/test/ui/issue-20831-debruijn.rs

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ impl<'a> Publisher<'a> for MyStruct<'a> {
3838
fn subscribe(&mut self, t : Box<Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
3939
// Not obvious, but there is an implicit lifetime here -------^
4040
//~^^ ERROR cannot infer
41+
//~| ERROR mismatched types
42+
//~| ERROR mismatched types
4143
//
4244
// The fact that `Publisher` is using an implicit lifetime is
4345
// what was causing the debruijn accounting to be off, so

src/test/ui/issue-20831-debruijn.stderr

+67-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,72 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/issue-20831-debruijn.rs:38:5
3+
|
4+
LL | / fn subscribe(&mut self, t : Box<Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
5+
LL | | // Not obvious, but there is an implicit lifetime here -------^
6+
LL | | //~^^ ERROR cannot infer
7+
LL | | //~| ERROR mismatched types
8+
... |
9+
LL | | self.sub = t;
10+
LL | | }
11+
| |_____^ lifetime mismatch
12+
|
13+
= note: expected type `'a`
14+
found type ``
15+
note: the anonymous lifetime #2 defined on the method body at 38:5...
16+
--> $DIR/issue-20831-debruijn.rs:38:5
17+
|
18+
LL | / fn subscribe(&mut self, t : Box<Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
19+
LL | | // Not obvious, but there is an implicit lifetime here -------^
20+
LL | | //~^^ ERROR cannot infer
21+
LL | | //~| ERROR mismatched types
22+
... |
23+
LL | | self.sub = t;
24+
LL | | }
25+
| |_____^
26+
note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 36:6
27+
--> $DIR/issue-20831-debruijn.rs:36:6
28+
|
29+
LL | impl<'a> Publisher<'a> for MyStruct<'a> {
30+
| ^^
31+
32+
error[E0308]: mismatched types
33+
--> $DIR/issue-20831-debruijn.rs:38:5
34+
|
35+
LL | / fn subscribe(&mut self, t : Box<Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
36+
LL | | // Not obvious, but there is an implicit lifetime here -------^
37+
LL | | //~^^ ERROR cannot infer
38+
LL | | //~| ERROR mismatched types
39+
... |
40+
LL | | self.sub = t;
41+
LL | | }
42+
| |_____^ lifetime mismatch
43+
|
44+
= note: expected type `'a`
45+
found type ``
46+
note: the lifetime 'a as defined on the impl at 36:6...
47+
--> $DIR/issue-20831-debruijn.rs:36:6
48+
|
49+
LL | impl<'a> Publisher<'a> for MyStruct<'a> {
50+
| ^^
51+
note: ...does not necessarily outlive the anonymous lifetime #2 defined on the method body at 38:5
52+
--> $DIR/issue-20831-debruijn.rs:38:5
53+
|
54+
LL | / fn subscribe(&mut self, t : Box<Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
55+
LL | | // Not obvious, but there is an implicit lifetime here -------^
56+
LL | | //~^^ ERROR cannot infer
57+
LL | | //~| ERROR mismatched types
58+
... |
59+
LL | | self.sub = t;
60+
LL | | }
61+
| |_____^
62+
163
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
264
--> $DIR/issue-20831-debruijn.rs:38:5
365
|
466
LL | / fn subscribe(&mut self, t : Box<Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
567
LL | | // Not obvious, but there is an implicit lifetime here -------^
668
LL | | //~^^ ERROR cannot infer
7-
LL | | //
69+
LL | | //~| ERROR mismatched types
870
... |
971
LL | | self.sub = t;
1072
LL | | }
@@ -16,7 +78,7 @@ note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on th
1678
LL | / fn subscribe(&mut self, t : Box<Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
1779
LL | | // Not obvious, but there is an implicit lifetime here -------^
1880
LL | | //~^^ ERROR cannot infer
19-
LL | | //
81+
LL | | //~| ERROR mismatched types
2082
... |
2183
LL | | self.sub = t;
2284
LL | | }
@@ -30,6 +92,7 @@ LL | impl<'a> Publisher<'a> for MyStruct<'a> {
3092
expected Publisher<'_>
3193
found Publisher<'_>
3294

33-
error: aborting due to previous error
95+
error: aborting due to 3 previous errors
3496

35-
For more information about this error, try `rustc --explain E0495`.
97+
Some errors occurred: E0308, E0495.
98+
For more information about an error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)