Skip to content

Commit 1025f61

Browse files
committed
Named variance fallout
1 parent 32e218b commit 1025f61

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

tests/ui/impl-trait/in-trait/variance.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ impl<T> Captures<'_> for T {}
77

88
trait Foo<'i> {
99
fn implicit_capture_early<'a: 'a>() -> impl Sized {}
10-
//~^ [Self: o, 'i: *, 'a: *, 'a: o, 'i: o]
10+
//~^ [Self: o, 'i: *, 'a: *, 'i: o, 'a: o]
1111

1212
fn explicit_capture_early<'a: 'a>() -> impl Sized + Captures<'a> {}
13-
//~^ [Self: o, 'i: *, 'a: *, 'a: o, 'i: o]
13+
//~^ [Self: o, 'i: *, 'a: *, 'i: o, 'a: o]
1414

1515
fn implicit_capture_late<'a>(_: &'a ()) -> impl Sized {}
16-
//~^ [Self: o, 'i: *, 'a: o, 'i: o]
16+
//~^ [Self: o, 'i: *, 'i: o, 'a: o]
1717

1818
fn explicit_capture_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {}
19-
//~^ [Self: o, 'i: *, 'a: o, 'i: o]
19+
//~^ [Self: o, 'i: *, 'i: o, 'a: o]
2020
}
2121

2222
fn main() {}

tests/ui/impl-trait/in-trait/variance.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
error: [Self: o, 'i: *, 'a: *, 'a: o, 'i: o]
1+
error: [Self: o, 'i: *, 'a: *, 'i: o, 'a: o]
22
--> $DIR/variance.rs:9:44
33
|
44
LL | fn implicit_capture_early<'a: 'a>() -> impl Sized {}
55
| ^^^^^^^^^^
66

7-
error: [Self: o, 'i: *, 'a: *, 'a: o, 'i: o]
7+
error: [Self: o, 'i: *, 'a: *, 'i: o, 'a: o]
88
--> $DIR/variance.rs:12:44
99
|
1010
LL | fn explicit_capture_early<'a: 'a>() -> impl Sized + Captures<'a> {}
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^
1212

13-
error: [Self: o, 'i: *, 'a: o, 'i: o]
13+
error: [Self: o, 'i: *, 'i: o, 'a: o]
1414
--> $DIR/variance.rs:15:48
1515
|
1616
LL | fn implicit_capture_late<'a>(_: &'a ()) -> impl Sized {}
1717
| ^^^^^^^^^^
1818

19-
error: [Self: o, 'i: *, 'a: o, 'i: o]
19+
error: [Self: o, 'i: *, 'i: o, 'a: o]
2020
--> $DIR/variance.rs:18:48
2121
|
2222
LL | fn explicit_capture_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {}

tests/ui/type-alias-impl-trait/variance.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ type NotCapturedEarly<'a> = impl Sized; //~ ['a: *, 'a: o]
1111
type CapturedEarly<'a> = impl Sized + Captures<'a>; //~ ['a: *, 'a: o]
1212
//~^ ERROR: unconstrained opaque type
1313

14-
type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>; //~ ['a: *, 'b: o, 'a: o]
14+
type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>; //~ ['a: *, 'a: o, 'b: o]
1515
//~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from `dyn` type
1616
//~| ERROR: unconstrained opaque type
1717

18-
type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>; //~ ['a: *, 'b: o, 'a: o]
18+
type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>; //~ ['a: *, 'a: o, 'b: o]
1919
//~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from `dyn` type
2020
//~| ERROR: unconstrained opaque type
2121

@@ -31,24 +31,24 @@ trait Foo<'i> {
3131
}
3232

3333
impl<'i> Foo<'i> for &'i () {
34-
type ImplicitCapture<'a> = impl Sized; //~ ['i: *, 'a: *, 'a: o, 'i: o]
34+
type ImplicitCapture<'a> = impl Sized; //~ ['i: *, 'a: *, 'i: o, 'a: o]
3535
//~^ ERROR: unconstrained opaque type
3636

37-
type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ ['i: *, 'a: *, 'a: o, 'i: o]
37+
type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ ['i: *, 'a: *, 'i: o, 'a: o]
3838
//~^ ERROR: unconstrained opaque type
3939

40-
type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ ['i: *, 'a: *, 'a: o, 'i: o]
40+
type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ ['i: *, 'a: *, 'i: o, 'a: o]
4141
//~^ ERROR: unconstrained opaque type
4242
}
4343

4444
impl<'i> Foo<'i> for () {
45-
type ImplicitCapture<'a> = impl Sized; //~ ['i: *, 'a: *, 'a: o, 'i: o]
45+
type ImplicitCapture<'a> = impl Sized; //~ ['i: *, 'a: *, 'i: o, 'a: o]
4646
//~^ ERROR: unconstrained opaque type
4747

48-
type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ ['i: *, 'a: *, 'a: o, 'i: o]
48+
type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ ['i: *, 'a: *, 'i: o, 'a: o]
4949
//~^ ERROR: unconstrained opaque type
5050

51-
type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ ['i: *, 'a: *, 'a: o, 'i: o]
51+
type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ ['i: *, 'a: *, 'i: o, 'a: o]
5252
//~^ ERROR: unconstrained opaque type
5353
}
5454

tests/ui/type-alias-impl-trait/variance.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,13 @@ error: ['a: *, 'a: o]
122122
LL | type CapturedEarly<'a> = impl Sized + Captures<'a>;
123123
| ^^^^^^^^^^^^^^^^^^^^^^^^^
124124

125-
error: ['a: *, 'b: o, 'a: o]
125+
error: ['a: *, 'a: o, 'b: o]
126126
--> $DIR/variance.rs:14:56
127127
|
128128
LL | type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>;
129129
| ^^^^^^^^^^
130130

131-
error: ['a: *, 'b: o, 'a: o]
131+
error: ['a: *, 'a: o, 'b: o]
132132
--> $DIR/variance.rs:18:49
133133
|
134134
LL | type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>;
@@ -140,37 +140,37 @@ error: ['a: *, 'b: *, T: o, 'a: o, 'b: o]
140140
LL | type Bar<'a, 'b: 'b, T> = impl Sized;
141141
| ^^^^^^^^^^
142142

143-
error: ['i: *, 'a: *, 'a: o, 'i: o]
143+
error: ['i: *, 'a: *, 'i: o, 'a: o]
144144
--> $DIR/variance.rs:34:32
145145
|
146146
LL | type ImplicitCapture<'a> = impl Sized;
147147
| ^^^^^^^^^^
148148

149-
error: ['i: *, 'a: *, 'a: o, 'i: o]
149+
error: ['i: *, 'a: *, 'i: o, 'a: o]
150150
--> $DIR/variance.rs:37:42
151151
|
152152
LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>;
153153
| ^^^^^^^^^^^^^^^^^^^^^^^^^
154154

155-
error: ['i: *, 'a: *, 'a: o, 'i: o]
155+
error: ['i: *, 'a: *, 'i: o, 'a: o]
156156
--> $DIR/variance.rs:40:39
157157
|
158158
LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>;
159159
| ^^^^^^^^^^^^^^^^^^^^^^^^^
160160

161-
error: ['i: *, 'a: *, 'a: o, 'i: o]
161+
error: ['i: *, 'a: *, 'i: o, 'a: o]
162162
--> $DIR/variance.rs:45:32
163163
|
164164
LL | type ImplicitCapture<'a> = impl Sized;
165165
| ^^^^^^^^^^
166166

167-
error: ['i: *, 'a: *, 'a: o, 'i: o]
167+
error: ['i: *, 'a: *, 'i: o, 'a: o]
168168
--> $DIR/variance.rs:48:42
169169
|
170170
LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>;
171171
| ^^^^^^^^^^^^^^^^^^^^^^^^^
172172

173-
error: ['i: *, 'a: *, 'a: o, 'i: o]
173+
error: ['i: *, 'a: *, 'i: o, 'a: o]
174174
--> $DIR/variance.rs:51:39
175175
|
176176
LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>;

0 commit comments

Comments
 (0)