Skip to content

Commit d8b49f0

Browse files
add test for issue-93278, bless
1 parent 4774597 commit d8b49f0

File tree

2 files changed

+44
-17
lines changed

2 files changed

+44
-17
lines changed

src/test/ui/generic-associated-types/self-outlives-lint.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#![feature(generic_associated_types)]
22

3-
// check-fail
4-
53
use std::fmt::Debug;
64

75
// We have a `&'a self`, so we need a `Self: 'a`
@@ -117,7 +115,6 @@ trait TraitLifetime<'a> {
117115
}
118116

119117
// Like above, but we have a where clause that can prove what we want
120-
// FIXME: we require two bounds (`where Self: 'a, Self: 'b`) when we should only require one
121118
trait TraitLifetimeWhere<'a> where Self: 'a {
122119
type Bar<'b>;
123120
//~^ missing required
@@ -140,11 +137,19 @@ trait NotInReturn {
140137
// We obviously error for `Iterator`, but we should also error for `Item`
141138
trait IterableTwo {
142139
type Item<'a>;
140+
//~^ missing required
143141
type Iterator<'a>: Iterator<Item = Self::Item<'a>>;
144142
//~^ missing required
145143
fn iter<'a>(&'a self) -> Self::Iterator<'a>;
146144
}
147145

146+
trait IterableTwoWhere {
147+
type Item<'a>;
148+
//~^ missing required
149+
type Iterator<'a>: Iterator<Item = Self::Item<'a>> where Self: 'a;
150+
fn iter<'a>(&'a self) -> Self::Iterator<'a>;
151+
}
152+
148153
// We also should report region outlives clauses. Here, we know that `'y: 'x`,
149154
// because of `&'x &'y`, so we require that `'b: 'a`.
150155
trait RegionOutlives {

src/test/ui/generic-associated-types/self-outlives-lint.stderr

+36-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: missing required bound on `Item`
2-
--> $DIR/self-outlives-lint.rs:9:5
2+
--> $DIR/self-outlives-lint.rs:7:5
33
|
44
LL | type Item<'x>;
55
| ^^^^^^^^^^^^^-
@@ -10,7 +10,7 @@ LL | type Item<'x>;
1010
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
1111

1212
error: missing required bound on `Out`
13-
--> $DIR/self-outlives-lint.rs:25:5
13+
--> $DIR/self-outlives-lint.rs:23:5
1414
|
1515
LL | type Out<'x>;
1616
| ^^^^^^^^^^^^-
@@ -21,7 +21,7 @@ LL | type Out<'x>;
2121
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
2222

2323
error: missing required bound on `Out`
24-
--> $DIR/self-outlives-lint.rs:39:5
24+
--> $DIR/self-outlives-lint.rs:37:5
2525
|
2626
LL | type Out<'x>;
2727
| ^^^^^^^^^^^^-
@@ -32,7 +32,7 @@ LL | type Out<'x>;
3232
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
3333

3434
error: missing required bounds on `Out`
35-
--> $DIR/self-outlives-lint.rs:46:5
35+
--> $DIR/self-outlives-lint.rs:44:5
3636
|
3737
LL | type Out<'x, 'y>;
3838
| ^^^^^^^^^^^^^^^^-
@@ -43,7 +43,7 @@ LL | type Out<'x, 'y>;
4343
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
4444

4545
error: missing required bound on `Out`
46-
--> $DIR/self-outlives-lint.rs:61:5
46+
--> $DIR/self-outlives-lint.rs:59:5
4747
|
4848
LL | type Out<'x, D>;
4949
| ^^^^^^^^^^^^^^^-
@@ -54,7 +54,7 @@ LL | type Out<'x, D>;
5454
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
5555

5656
error: missing required bound on `Out`
57-
--> $DIR/self-outlives-lint.rs:77:5
57+
--> $DIR/self-outlives-lint.rs:75:5
5858
|
5959
LL | type Out<'x, D>;
6060
| ^^^^^^^^^^^^^^^-
@@ -65,7 +65,7 @@ LL | type Out<'x, D>;
6565
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
6666

6767
error: missing required bound on `Out`
68-
--> $DIR/self-outlives-lint.rs:92:5
68+
--> $DIR/self-outlives-lint.rs:90:5
6969
|
7070
LL | type Out<'x, D>;
7171
| ^^^^^^^^^^^^^^^-
@@ -76,7 +76,7 @@ LL | type Out<'x, D>;
7676
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
7777

7878
error: missing required bounds on `Bar`
79-
--> $DIR/self-outlives-lint.rs:114:5
79+
--> $DIR/self-outlives-lint.rs:112:5
8080
|
8181
LL | type Bar<'b>;
8282
| ^^^^^^^^^^^^-
@@ -87,7 +87,7 @@ LL | type Bar<'b>;
8787
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
8888

8989
error: missing required bound on `Bar`
90-
--> $DIR/self-outlives-lint.rs:122:5
90+
--> $DIR/self-outlives-lint.rs:119:5
9191
|
9292
LL | type Bar<'b>;
9393
| ^^^^^^^^^^^^-
@@ -98,7 +98,7 @@ LL | type Bar<'b>;
9898
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
9999

100100
error: missing required bound on `Bar`
101-
--> $DIR/self-outlives-lint.rs:129:5
101+
--> $DIR/self-outlives-lint.rs:126:5
102102
|
103103
LL | type Bar<'b>;
104104
| ^^^^^^^^^^^^-
@@ -108,8 +108,19 @@ LL | type Bar<'b>;
108108
= note: this bound is currently required to ensure that impls have maximum flexibility
109109
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
110110

111+
error: missing required bound on `Item`
112+
--> $DIR/self-outlives-lint.rs:139:5
113+
|
114+
LL | type Item<'a>;
115+
| ^^^^^^^^^^^^^-
116+
| |
117+
| help: add the required where clause: `where Self: 'a`
118+
|
119+
= note: this bound is currently required to ensure that impls have maximum flexibility
120+
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
121+
111122
error: missing required bound on `Iterator`
112-
--> $DIR/self-outlives-lint.rs:143:5
123+
--> $DIR/self-outlives-lint.rs:141:5
113124
|
114125
LL | type Iterator<'a>: Iterator<Item = Self::Item<'a>>;
115126
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
@@ -119,8 +130,19 @@ LL | type Iterator<'a>: Iterator<Item = Self::Item<'a>>;
119130
= note: this bound is currently required to ensure that impls have maximum flexibility
120131
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
121132

133+
error: missing required bound on `Item`
134+
--> $DIR/self-outlives-lint.rs:147:5
135+
|
136+
LL | type Item<'a>;
137+
| ^^^^^^^^^^^^^-
138+
| |
139+
| help: add the required where clause: `where Self: 'a`
140+
|
141+
= note: this bound is currently required to ensure that impls have maximum flexibility
142+
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
143+
122144
error: missing required bound on `Bar`
123-
--> $DIR/self-outlives-lint.rs:151:5
145+
--> $DIR/self-outlives-lint.rs:156:5
124146
|
125147
LL | type Bar<'a, 'b>;
126148
| ^^^^^^^^^^^^^^^^-
@@ -131,7 +153,7 @@ LL | type Bar<'a, 'b>;
131153
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
132154

133155
error: missing required bound on `Fut`
134-
--> $DIR/self-outlives-lint.rs:167:5
156+
--> $DIR/self-outlives-lint.rs:172:5
135157
|
136158
LL | type Fut<'out>;
137159
| ^^^^^^^^^^^^^^-
@@ -141,5 +163,5 @@ LL | type Fut<'out>;
141163
= note: this bound is currently required to ensure that impls have maximum flexibility
142164
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
143165

144-
error: aborting due to 13 previous errors
166+
error: aborting due to 15 previous errors
145167

0 commit comments

Comments
 (0)