Skip to content

Commit 2ff8beb

Browse files
committed
Merge various rustc_attr based tests
1 parent e98e424 commit 2ff8beb

File tree

6 files changed

+114
-120
lines changed

6 files changed

+114
-120
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| {
+44-44
Original file line numberDiff line numberDiff line change
@@ -1,156 +1,156 @@
1-
error: unconstrained opaque type
1+
error: [o]
22
--> $DIR/variance.rs:8:29
33
|
44
LL | type NotCapturedEarly<'a> = impl Sized;
55
| ^^^^^^^^^^
6-
|
7-
= note: `NotCapturedEarly` must be used in combination with a concrete type within the same module
86

9-
error: unconstrained opaque type
7+
error: [o]
108
--> $DIR/variance.rs:11:26
119
|
1210
LL | type CapturedEarly<'a> = impl Sized + Captures<'a>;
1311
| ^^^^^^^^^^^^^^^^^^^^^^^^^
14-
|
15-
= note: `CapturedEarly` must be used in combination with a concrete type within the same module
1612

17-
error: unconstrained opaque type
13+
error: [o]
1814
--> $DIR/variance.rs:15:56
1915
|
2016
LL | type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>;
2117
| ^^^^^^^^^^
22-
|
23-
= note: `NotCapturedLate` must be used in combination with a concrete type within the same module
2418

25-
error: unconstrained opaque type
19+
error: [o]
2620
--> $DIR/variance.rs:19:49
2721
|
2822
LL | type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>;
2923
| ^^^^^^^^^^^^^^^^^^^^^^^^^
30-
|
31-
= note: `Captured` must be used in combination with a concrete type within the same module
3224

33-
error: unconstrained opaque type
25+
error: [o, o, o]
3426
--> $DIR/variance.rs:22:27
3527
|
3628
LL | type Bar<'a, 'b: 'b, T> = impl Sized;
3729
| ^^^^^^^^^^
38-
|
39-
= note: `Bar` must be used in combination with a concrete type within the same module
4030

41-
error: unconstrained opaque type
31+
error: [o, o]
4232
--> $DIR/variance.rs:34:32
4333
|
4434
LL | type ImplicitCapture<'a> = impl Sized;
4535
| ^^^^^^^^^^
46-
|
47-
= note: `ImplicitCapture` must be used in combination with a concrete type within the same impl
4836

49-
error: unconstrained opaque type
37+
error: [o, o]
5038
--> $DIR/variance.rs:37:42
5139
|
5240
LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>;
5341
| ^^^^^^^^^^^^^^^^^^^^^^^^^
54-
|
55-
= note: `ExplicitCaptureFromHeader` must be used in combination with a concrete type within the same impl
5642

57-
error: unconstrained opaque type
43+
error: [o, o]
5844
--> $DIR/variance.rs:40:39
5945
|
6046
LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>;
6147
| ^^^^^^^^^^^^^^^^^^^^^^^^^
62-
|
63-
= note: `ExplicitCaptureFromGat` must be used in combination with a concrete type within the same impl
6448

65-
error: unconstrained opaque type
49+
error: [o, o]
6650
--> $DIR/variance.rs:45:32
6751
|
6852
LL | type ImplicitCapture<'a> = impl Sized;
6953
| ^^^^^^^^^^
70-
|
71-
= note: `ImplicitCapture` must be used in combination with a concrete type within the same impl
7254

73-
error: unconstrained opaque type
55+
error: [o, o]
7456
--> $DIR/variance.rs:48:42
7557
|
7658
LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>;
7759
| ^^^^^^^^^^^^^^^^^^^^^^^^^
78-
|
79-
= note: `ExplicitCaptureFromHeader` must be used in combination with a concrete type within the same impl
8060

81-
error: unconstrained opaque type
61+
error: [o, o]
8262
--> $DIR/variance.rs:51:39
8363
|
8464
LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>;
8565
| ^^^^^^^^^^^^^^^^^^^^^^^^^
86-
|
87-
= note: `ExplicitCaptureFromGat` must be used in combination with a concrete type within the same impl
8866

89-
error: [o]
67+
error: unconstrained opaque type
9068
--> $DIR/variance.rs:8:29
9169
|
9270
LL | type NotCapturedEarly<'a> = impl Sized;
9371
| ^^^^^^^^^^
72+
|
73+
= note: `NotCapturedEarly` must be used in combination with a concrete type within the same module
9474

95-
error: [o]
75+
error: unconstrained opaque type
9676
--> $DIR/variance.rs:11:26
9777
|
9878
LL | type CapturedEarly<'a> = impl Sized + Captures<'a>;
9979
| ^^^^^^^^^^^^^^^^^^^^^^^^^
80+
|
81+
= note: `CapturedEarly` must be used in combination with a concrete type within the same module
10082

101-
error: [o]
83+
error: unconstrained opaque type
10284
--> $DIR/variance.rs:15:56
10385
|
10486
LL | type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>;
10587
| ^^^^^^^^^^
88+
|
89+
= note: `NotCapturedLate` must be used in combination with a concrete type within the same module
10690

107-
error: [o]
91+
error: unconstrained opaque type
10892
--> $DIR/variance.rs:19:49
10993
|
11094
LL | type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>;
11195
| ^^^^^^^^^^^^^^^^^^^^^^^^^
96+
|
97+
= note: `Captured` must be used in combination with a concrete type within the same module
11298

113-
error: [o, o, o]
99+
error: unconstrained opaque type
114100
--> $DIR/variance.rs:22:27
115101
|
116102
LL | type Bar<'a, 'b: 'b, T> = impl Sized;
117103
| ^^^^^^^^^^
104+
|
105+
= note: `Bar` must be used in combination with a concrete type within the same module
118106

119-
error: [o, o]
107+
error: unconstrained opaque type
120108
--> $DIR/variance.rs:34:32
121109
|
122110
LL | type ImplicitCapture<'a> = impl Sized;
123111
| ^^^^^^^^^^
112+
|
113+
= note: `ImplicitCapture` must be used in combination with a concrete type within the same impl
124114

125-
error: [o, o]
115+
error: unconstrained opaque type
126116
--> $DIR/variance.rs:37:42
127117
|
128118
LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>;
129119
| ^^^^^^^^^^^^^^^^^^^^^^^^^
120+
|
121+
= note: `ExplicitCaptureFromHeader` must be used in combination with a concrete type within the same impl
130122

131-
error: [o, o]
123+
error: unconstrained opaque type
132124
--> $DIR/variance.rs:40:39
133125
|
134126
LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>;
135127
| ^^^^^^^^^^^^^^^^^^^^^^^^^
128+
|
129+
= note: `ExplicitCaptureFromGat` must be used in combination with a concrete type within the same impl
136130

137-
error: [o, o]
131+
error: unconstrained opaque type
138132
--> $DIR/variance.rs:45:32
139133
|
140134
LL | type ImplicitCapture<'a> = impl Sized;
141135
| ^^^^^^^^^^
136+
|
137+
= note: `ImplicitCapture` must be used in combination with a concrete type within the same impl
142138

143-
error: [o, o]
139+
error: unconstrained opaque type
144140
--> $DIR/variance.rs:48:42
145141
|
146142
LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>;
147143
| ^^^^^^^^^^^^^^^^^^^^^^^^^
144+
|
145+
= note: `ExplicitCaptureFromHeader` must be used in combination with a concrete type within the same impl
148146

149-
error: [o, o]
147+
error: unconstrained opaque type
150148
--> $DIR/variance.rs:51:39
151149
|
152150
LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>;
153151
| ^^^^^^^^^^^^^^^^^^^^^^^^^
152+
|
153+
= note: `ExplicitCaptureFromGat` must be used in combination with a concrete type within the same impl
154154

155155
error: aborting due to 22 previous errors
156156

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)