Skip to content

Commit e2e751e

Browse files
committed
Merge various rustc_attr based tests
1 parent 4279da5 commit e2e751e

File tree

6 files changed

+136
-142
lines changed

6 files changed

+136
-142
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

+66-66
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,69 @@
1+
error: [*, o]
2+
--> $DIR/variance.rs:8:29
3+
|
4+
LL | type NotCapturedEarly<'a> = impl Sized;
5+
| ^^^^^^^^^^
6+
7+
error: [*, o]
8+
--> $DIR/variance.rs:11:26
9+
|
10+
LL | type CapturedEarly<'a> = impl Sized + Captures<'a>;
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error: [*, o, o]
14+
--> $DIR/variance.rs:14:56
15+
|
16+
LL | type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>;
17+
| ^^^^^^^^^^
18+
19+
error: [*, o, o]
20+
--> $DIR/variance.rs:18:49
21+
|
22+
LL | type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>;
23+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
24+
25+
error: [*, *, o, o, o]
26+
--> $DIR/variance.rs:22:27
27+
|
28+
LL | type Bar<'a, 'b: 'b, T> = impl Sized;
29+
| ^^^^^^^^^^
30+
31+
error: [*, *, o, o]
32+
--> $DIR/variance.rs:34:32
33+
|
34+
LL | type ImplicitCapture<'a> = impl Sized;
35+
| ^^^^^^^^^^
36+
37+
error: [*, *, o, o]
38+
--> $DIR/variance.rs:37:42
39+
|
40+
LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>;
41+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
42+
43+
error: [*, *, o, o]
44+
--> $DIR/variance.rs:40:39
45+
|
46+
LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>;
47+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
48+
49+
error: [*, *, o, o]
50+
--> $DIR/variance.rs:45:32
51+
|
52+
LL | type ImplicitCapture<'a> = impl Sized;
53+
| ^^^^^^^^^^
54+
55+
error: [*, *, o, o]
56+
--> $DIR/variance.rs:48:42
57+
|
58+
LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>;
59+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
60+
61+
error: [*, *, o, o]
62+
--> $DIR/variance.rs:51:39
63+
|
64+
LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>;
65+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
66+
167
error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from `dyn` type
268
--> $DIR/variance.rs:14:56
369
|
@@ -110,72 +176,6 @@ LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>;
110176
|
111177
= note: `ExplicitCaptureFromGat` must be used in combination with a concrete type within the same impl
112178

113-
error: [*, o]
114-
--> $DIR/variance.rs:8:29
115-
|
116-
LL | type NotCapturedEarly<'a> = impl Sized;
117-
| ^^^^^^^^^^
118-
119-
error: [*, o]
120-
--> $DIR/variance.rs:11:26
121-
|
122-
LL | type CapturedEarly<'a> = impl Sized + Captures<'a>;
123-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
124-
125-
error: [*, o, o]
126-
--> $DIR/variance.rs:14:56
127-
|
128-
LL | type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>;
129-
| ^^^^^^^^^^
130-
131-
error: [*, o, o]
132-
--> $DIR/variance.rs:18:49
133-
|
134-
LL | type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>;
135-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
136-
137-
error: [*, *, o, o, o]
138-
--> $DIR/variance.rs:22:27
139-
|
140-
LL | type Bar<'a, 'b: 'b, T> = impl Sized;
141-
| ^^^^^^^^^^
142-
143-
error: [*, *, o, o]
144-
--> $DIR/variance.rs:34:32
145-
|
146-
LL | type ImplicitCapture<'a> = impl Sized;
147-
| ^^^^^^^^^^
148-
149-
error: [*, *, o, o]
150-
--> $DIR/variance.rs:37:42
151-
|
152-
LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>;
153-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
154-
155-
error: [*, *, o, o]
156-
--> $DIR/variance.rs:40:39
157-
|
158-
LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>;
159-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
160-
161-
error: [*, *, o, o]
162-
--> $DIR/variance.rs:45:32
163-
|
164-
LL | type ImplicitCapture<'a> = impl Sized;
165-
| ^^^^^^^^^^
166-
167-
error: [*, *, o, o]
168-
--> $DIR/variance.rs:48:42
169-
|
170-
LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>;
171-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
172-
173-
error: [*, *, o, o]
174-
--> $DIR/variance.rs:51:39
175-
|
176-
LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>;
177-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
178-
179179
error: aborting due to 24 previous errors
180180

181181
For more information about this error, try `rustc --explain E0657`.
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`.
+24-24
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
error: [+, +]
2+
--> $DIR/variance-trait-bounds.rs:16:1
3+
|
4+
LL | struct TestStruct<U,T:Setter<U>> {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
error: [*, +]
8+
--> $DIR/variance-trait-bounds.rs:21:1
9+
|
10+
LL | enum TestEnum<U,T:Setter<U>> {
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error: [*, +]
14+
--> $DIR/variance-trait-bounds.rs:27:1
15+
|
16+
LL | struct TestContraStruct<U,T:Setter<U>> {
17+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18+
19+
error: [*, +]
20+
--> $DIR/variance-trait-bounds.rs:33:1
21+
|
22+
LL | struct TestBox<U,T:Getter<U>+Setter<U>> {
23+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24+
125
error[E0392]: type parameter `U` is never used
226
--> $DIR/variance-trait-bounds.rs:21:15
327
|
@@ -25,30 +49,6 @@ LL | struct TestBox<U,T:Getter<U>+Setter<U>> {
2549
= help: consider removing `U`, referring to it in a field, or using a marker such as `PhantomData`
2650
= help: if you intended `U` to be a const parameter, use `const U: /* Type */` instead
2751

28-
error: [+, +]
29-
--> $DIR/variance-trait-bounds.rs:16:1
30-
|
31-
LL | struct TestStruct<U,T:Setter<U>> {
32-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33-
34-
error: [*, +]
35-
--> $DIR/variance-trait-bounds.rs:21:1
36-
|
37-
LL | enum TestEnum<U,T:Setter<U>> {
38-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39-
40-
error: [*, +]
41-
--> $DIR/variance-trait-bounds.rs:27:1
42-
|
43-
LL | struct TestContraStruct<U,T:Setter<U>> {
44-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45-
46-
error: [*, +]
47-
--> $DIR/variance-trait-bounds.rs:33:1
48-
|
49-
LL | struct TestBox<U,T:Getter<U>+Setter<U>> {
50-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
51-
5252
error: aborting due to 7 previous errors
5353

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

0 commit comments

Comments
 (0)