Skip to content

Commit c1bc7c9

Browse files
committed
Merge various rustc_attr based tests
1 parent 968bcf6 commit c1bc7c9

File tree

6 files changed

+125
-131
lines changed

6 files changed

+125
-131
lines changed

compiler/rustc_hir_analysis/src/lib.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
160160

161161
if tcx.features().rustc_attrs {
162162
tcx.sess.time("outlives_testing", || outlives::test::test_inferred_outlives(tcx));
163+
tcx.sess.time("variance_testing", || variance::test::test_variance(tcx));
164+
collect::test_opaque_hidden_types(tcx);
163165
}
164166

165167
tcx.sess.time("coherence_checking", || {
@@ -175,14 +177,6 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
175177
let _ = tcx.ensure().crate_inherent_impls_overlap_check(());
176178
});
177179

178-
if tcx.features().rustc_attrs {
179-
tcx.sess.time("variance_testing", || variance::test::test_variance(tcx));
180-
}
181-
182-
if tcx.features().rustc_attrs {
183-
collect::test_opaque_hidden_types(tcx);
184-
}
185-
186180
// Make sure we evaluate all static and (non-associated) const items, even if unused.
187181
// If any of these fail to evaluate, we do not want this crate to pass compilation.
188182
tcx.hir().par_body_owners(|item_def_id| {

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

+55-55
Original file line numberDiff line numberDiff line change
@@ -1,168 +1,168 @@
1-
error[E0657]: `impl Trait` can only capture lifetimes bound at the fn or impl level
2-
--> $DIR/variance.rs:14:36
3-
|
4-
LL | type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>;
5-
| ^^
6-
7-
error[E0657]: `impl Trait` can only capture lifetimes bound at the fn or impl level
8-
--> $DIR/variance.rs:18:29
9-
|
10-
LL | type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>;
11-
| ^^
12-
13-
error: unconstrained opaque type
1+
error: [*, o]
142
--> $DIR/variance.rs:8:29
153
|
164
LL | type NotCapturedEarly<'a> = impl Sized;
175
| ^^^^^^^^^^
18-
|
19-
= note: `NotCapturedEarly` must be used in combination with a concrete type within the same module
206

21-
error: unconstrained opaque type
7+
error: [*, o]
228
--> $DIR/variance.rs:11:26
239
|
2410
LL | type CapturedEarly<'a> = impl Sized + Captures<'a>;
2511
| ^^^^^^^^^^^^^^^^^^^^^^^^^
26-
|
27-
= note: `CapturedEarly` must be used in combination with a concrete type within the same module
2812

29-
error: unconstrained opaque type
13+
error: [*, o, o]
3014
--> $DIR/variance.rs:14:56
3115
|
3216
LL | type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>;
3317
| ^^^^^^^^^^
34-
|
35-
= note: `NotCapturedLate` must be used in combination with a concrete type within the same module
3618

37-
error: unconstrained opaque type
19+
error: [*, o, o]
3820
--> $DIR/variance.rs:18:49
3921
|
4022
LL | type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>;
4123
| ^^^^^^^^^^^^^^^^^^^^^^^^^
42-
|
43-
= note: `Captured` must be used in combination with a concrete type within the same module
4424

45-
error: unconstrained opaque type
25+
error: [*, *, o, o, o]
4626
--> $DIR/variance.rs:22:27
4727
|
4828
LL | type Bar<'a, 'b: 'b, T> = impl Sized;
4929
| ^^^^^^^^^^
50-
|
51-
= note: `Bar` must be used in combination with a concrete type within the same module
5230

53-
error: unconstrained opaque type
31+
error: [*, *, o, o]
5432
--> $DIR/variance.rs:34:32
5533
|
5634
LL | type ImplicitCapture<'a> = impl Sized;
5735
| ^^^^^^^^^^
58-
|
59-
= note: `ImplicitCapture` must be used in combination with a concrete type within the same impl
6036

61-
error: unconstrained opaque type
37+
error: [*, *, o, o]
6238
--> $DIR/variance.rs:37:42
6339
|
6440
LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>;
6541
| ^^^^^^^^^^^^^^^^^^^^^^^^^
66-
|
67-
= note: `ExplicitCaptureFromHeader` must be used in combination with a concrete type within the same impl
6842

69-
error: unconstrained opaque type
43+
error: [*, *, o, o]
7044
--> $DIR/variance.rs:40:39
7145
|
7246
LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>;
7347
| ^^^^^^^^^^^^^^^^^^^^^^^^^
74-
|
75-
= note: `ExplicitCaptureFromGat` must be used in combination with a concrete type within the same impl
7648

77-
error: unconstrained opaque type
49+
error: [*, *, o, o]
7850
--> $DIR/variance.rs:45:32
7951
|
8052
LL | type ImplicitCapture<'a> = impl Sized;
8153
| ^^^^^^^^^^
82-
|
83-
= note: `ImplicitCapture` must be used in combination with a concrete type within the same impl
8454

85-
error: unconstrained opaque type
55+
error: [*, *, o, o]
8656
--> $DIR/variance.rs:48:42
8757
|
8858
LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>;
8959
| ^^^^^^^^^^^^^^^^^^^^^^^^^
90-
|
91-
= note: `ExplicitCaptureFromHeader` must be used in combination with a concrete type within the same impl
9260

93-
error: unconstrained opaque type
61+
error: [*, *, o, o]
9462
--> $DIR/variance.rs:51:39
9563
|
9664
LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>;
9765
| ^^^^^^^^^^^^^^^^^^^^^^^^^
66+
67+
error[E0657]: `impl Trait` can only capture lifetimes bound at the fn or impl level
68+
--> $DIR/variance.rs:14:36
9869
|
99-
= note: `ExplicitCaptureFromGat` must be used in combination with a concrete type within the same impl
70+
LL | type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>;
71+
| ^^
10072

101-
error: [*, o]
73+
error[E0657]: `impl Trait` can only capture lifetimes bound at the fn or impl level
74+
--> $DIR/variance.rs:18:29
75+
|
76+
LL | type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>;
77+
| ^^
78+
79+
error: unconstrained opaque type
10280
--> $DIR/variance.rs:8:29
10381
|
10482
LL | type NotCapturedEarly<'a> = impl Sized;
10583
| ^^^^^^^^^^
84+
|
85+
= note: `NotCapturedEarly` must be used in combination with a concrete type within the same module
10686

107-
error: [*, o]
87+
error: unconstrained opaque type
10888
--> $DIR/variance.rs:11:26
10989
|
11090
LL | type CapturedEarly<'a> = impl Sized + Captures<'a>;
11191
| ^^^^^^^^^^^^^^^^^^^^^^^^^
92+
|
93+
= note: `CapturedEarly` must be used in combination with a concrete type within the same module
11294

113-
error: [*, o, o]
95+
error: unconstrained opaque type
11496
--> $DIR/variance.rs:14:56
11597
|
11698
LL | type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>;
11799
| ^^^^^^^^^^
100+
|
101+
= note: `NotCapturedLate` must be used in combination with a concrete type within the same module
118102

119-
error: [*, o, o]
103+
error: unconstrained opaque type
120104
--> $DIR/variance.rs:18:49
121105
|
122106
LL | type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>;
123107
| ^^^^^^^^^^^^^^^^^^^^^^^^^
108+
|
109+
= note: `Captured` must be used in combination with a concrete type within the same module
124110

125-
error: [*, *, o, o, o]
111+
error: unconstrained opaque type
126112
--> $DIR/variance.rs:22:27
127113
|
128114
LL | type Bar<'a, 'b: 'b, T> = impl Sized;
129115
| ^^^^^^^^^^
116+
|
117+
= note: `Bar` must be used in combination with a concrete type within the same module
130118

131-
error: [*, *, o, o]
119+
error: unconstrained opaque type
132120
--> $DIR/variance.rs:34:32
133121
|
134122
LL | type ImplicitCapture<'a> = impl Sized;
135123
| ^^^^^^^^^^
124+
|
125+
= note: `ImplicitCapture` must be used in combination with a concrete type within the same impl
136126

137-
error: [*, *, o, o]
127+
error: unconstrained opaque type
138128
--> $DIR/variance.rs:37:42
139129
|
140130
LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>;
141131
| ^^^^^^^^^^^^^^^^^^^^^^^^^
132+
|
133+
= note: `ExplicitCaptureFromHeader` must be used in combination with a concrete type within the same impl
142134

143-
error: [*, *, o, o]
135+
error: unconstrained opaque type
144136
--> $DIR/variance.rs:40:39
145137
|
146138
LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>;
147139
| ^^^^^^^^^^^^^^^^^^^^^^^^^
140+
|
141+
= note: `ExplicitCaptureFromGat` must be used in combination with a concrete type within the same impl
148142

149-
error: [*, *, o, o]
143+
error: unconstrained opaque type
150144
--> $DIR/variance.rs:45:32
151145
|
152146
LL | type ImplicitCapture<'a> = impl Sized;
153147
| ^^^^^^^^^^
148+
|
149+
= note: `ImplicitCapture` must be used in combination with a concrete type within the same impl
154150

155-
error: [*, *, o, o]
151+
error: unconstrained opaque type
156152
--> $DIR/variance.rs:48:42
157153
|
158154
LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>;
159155
| ^^^^^^^^^^^^^^^^^^^^^^^^^
156+
|
157+
= note: `ExplicitCaptureFromHeader` must be used in combination with a concrete type within the same impl
160158

161-
error: [*, *, o, o]
159+
error: unconstrained opaque type
162160
--> $DIR/variance.rs:51:39
163161
|
164162
LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>;
165163
| ^^^^^^^^^^^^^^^^^^^^^^^^^
164+
|
165+
= note: `ExplicitCaptureFromGat` must be used in combination with a concrete type within the same impl
166166

167167
error: aborting due to 24 previous errors
168168

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
error: [o]
2+
--> $DIR/variance-associated-consts.rs:13:1
3+
|
4+
LL | struct Foo<T: Trait> {
5+
| ^^^^^^^^^^^^^^^^^^^^
6+
17
error: unconstrained generic constant
28
--> $DIR/variance-associated-consts.rs:14:12
39
|
@@ -6,11 +12,5 @@ LL | field: [u8; <T as Trait>::Const]
612
|
713
= help: try adding a `where` bound using this expression: `where [(); <T as Trait>::Const]:`
814

9-
error: [o]
10-
--> $DIR/variance-associated-consts.rs:13:1
11-
|
12-
LL | struct Foo<T: Trait> {
13-
| ^^^^^^^^^^^^^^^^^^^^
14-
1515
error: aborting due to 2 previous errors
1616

tests/ui/variance/variance-regions-direct.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
error[E0392]: lifetime parameter `'a` is never used
2-
--> $DIR/variance-regions-direct.rs:52:14
3-
|
4-
LL | struct Test7<'a> {
5-
| ^^ unused lifetime parameter
6-
|
7-
= help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`
8-
91
error: [+, +, +]
102
--> $DIR/variance-regions-direct.rs:9:1
113
|
@@ -48,6 +40,14 @@ error: [-, +, o]
4840
LL | enum Test8<'a, 'b, 'c:'b> {
4941
| ^^^^^^^^^^^^^^^^^^^^^^^^^
5042

43+
error[E0392]: lifetime parameter `'a` is never used
44+
--> $DIR/variance-regions-direct.rs:52:14
45+
|
46+
LL | struct Test7<'a> {
47+
| ^^ unused lifetime parameter
48+
|
49+
= help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`
50+
5151
error: aborting due to 8 previous errors
5252

5353
For more information about this error, try `rustc --explain E0392`.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
error: [-, +, o, *]
2+
--> $DIR/variance-regions-indirect.rs:8:1
3+
|
4+
LL | enum Base<'a, 'b, 'c:'b, 'd> {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
error: [*, o, +, -]
8+
--> $DIR/variance-regions-indirect.rs:16:1
9+
|
10+
LL | struct Derived1<'w, 'x:'y, 'y, 'z> {
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error: [o, o, *]
14+
--> $DIR/variance-regions-indirect.rs:22:1
15+
|
16+
LL | struct Derived2<'a, 'b:'a, 'c> {
17+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18+
19+
error: [o, +, *]
20+
--> $DIR/variance-regions-indirect.rs:28:1
21+
|
22+
LL | struct Derived3<'a:'b, 'b, 'c> {
23+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24+
25+
error: [-, +, o]
26+
--> $DIR/variance-regions-indirect.rs:34:1
27+
|
28+
LL | struct Derived4<'a, 'b, 'c:'b> {
29+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30+
131
error[E0392]: lifetime parameter `'d` is never used
232
--> $DIR/variance-regions-indirect.rs:8:26
333
|
@@ -30,36 +60,6 @@ LL | struct Derived3<'a:'b, 'b, 'c> {
3060
|
3161
= help: consider removing `'c`, referring to it in a field, or using a marker such as `PhantomData`
3262

33-
error: [-, +, o, *]
34-
--> $DIR/variance-regions-indirect.rs:8:1
35-
|
36-
LL | enum Base<'a, 'b, 'c:'b, 'd> {
37-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38-
39-
error: [*, o, +, -]
40-
--> $DIR/variance-regions-indirect.rs:16:1
41-
|
42-
LL | struct Derived1<'w, 'x:'y, 'y, 'z> {
43-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44-
45-
error: [o, o, *]
46-
--> $DIR/variance-regions-indirect.rs:22:1
47-
|
48-
LL | struct Derived2<'a, 'b:'a, 'c> {
49-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50-
51-
error: [o, +, *]
52-
--> $DIR/variance-regions-indirect.rs:28:1
53-
|
54-
LL | struct Derived3<'a:'b, 'b, 'c> {
55-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56-
57-
error: [-, +, o]
58-
--> $DIR/variance-regions-indirect.rs:34:1
59-
|
60-
LL | struct Derived4<'a, 'b, 'c:'b> {
61-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
62-
6363
error: aborting due to 9 previous errors
6464

6565
For more information about this error, try `rustc --explain E0392`.

0 commit comments

Comments
 (0)