Skip to content

Commit

Permalink
Merge various rustc_attr based tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Mar 11, 2024
1 parent 4279da5 commit e2e751e
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 142 deletions.
10 changes: 2 additions & 8 deletions compiler/rustc_hir_analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ pub fn check_crate(tcx: TyCtxt<'_>) {

if tcx.features().rustc_attrs {
tcx.sess.time("outlives_testing", || outlives::test::test_inferred_outlives(tcx));
tcx.sess.time("variance_testing", || variance::test::test_variance(tcx));
collect::test_opaque_hidden_types(tcx);
}

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

if tcx.features().rustc_attrs {
tcx.sess.time("variance_testing", || variance::test::test_variance(tcx));
}

if tcx.features().rustc_attrs {
collect::test_opaque_hidden_types(tcx);
}

// Make sure we evaluate all static and (non-associated) const items, even if unused.
// If any of these fail to evaluate, we do not want this crate to pass compilation.
tcx.hir().par_body_owners(|item_def_id| {
Expand Down
132 changes: 66 additions & 66 deletions tests/ui/type-alias-impl-trait/variance.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,69 @@
error: [*, o]
--> $DIR/variance.rs:8:29
|
LL | type NotCapturedEarly<'a> = impl Sized;
| ^^^^^^^^^^

error: [*, o]
--> $DIR/variance.rs:11:26
|
LL | type CapturedEarly<'a> = impl Sized + Captures<'a>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^

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

error: [*, o, o]
--> $DIR/variance.rs:18:49
|
LL | type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error: [*, *, o, o, o]
--> $DIR/variance.rs:22:27
|
LL | type Bar<'a, 'b: 'b, T> = impl Sized;
| ^^^^^^^^^^

error: [*, *, o, o]
--> $DIR/variance.rs:34:32
|
LL | type ImplicitCapture<'a> = impl Sized;
| ^^^^^^^^^^

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

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

error: [*, *, o, o]
--> $DIR/variance.rs:45:32
|
LL | type ImplicitCapture<'a> = impl Sized;
| ^^^^^^^^^^

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

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

error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from `dyn` type
--> $DIR/variance.rs:14:56
|
Expand Down Expand Up @@ -110,72 +176,6 @@ LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>;
|
= note: `ExplicitCaptureFromGat` must be used in combination with a concrete type within the same impl

error: [*, o]
--> $DIR/variance.rs:8:29
|
LL | type NotCapturedEarly<'a> = impl Sized;
| ^^^^^^^^^^

error: [*, o]
--> $DIR/variance.rs:11:26
|
LL | type CapturedEarly<'a> = impl Sized + Captures<'a>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^

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

error: [*, o, o]
--> $DIR/variance.rs:18:49
|
LL | type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error: [*, *, o, o, o]
--> $DIR/variance.rs:22:27
|
LL | type Bar<'a, 'b: 'b, T> = impl Sized;
| ^^^^^^^^^^

error: [*, *, o, o]
--> $DIR/variance.rs:34:32
|
LL | type ImplicitCapture<'a> = impl Sized;
| ^^^^^^^^^^

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

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

error: [*, *, o, o]
--> $DIR/variance.rs:45:32
|
LL | type ImplicitCapture<'a> = impl Sized;
| ^^^^^^^^^^

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

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

error: aborting due to 24 previous errors

For more information about this error, try `rustc --explain E0657`.
12 changes: 6 additions & 6 deletions tests/ui/variance/variance-associated-consts.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
error: [o]
--> $DIR/variance-associated-consts.rs:13:1
|
LL | struct Foo<T: Trait> {
| ^^^^^^^^^^^^^^^^^^^^

error: unconstrained generic constant
--> $DIR/variance-associated-consts.rs:14:12
|
Expand All @@ -6,11 +12,5 @@ LL | field: [u8; <T as Trait>::Const]
|
= help: try adding a `where` bound using this expression: `where [(); <T as Trait>::Const]:`

error: [o]
--> $DIR/variance-associated-consts.rs:13:1
|
LL | struct Foo<T: Trait> {
| ^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

16 changes: 8 additions & 8 deletions tests/ui/variance/variance-regions-direct.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
error[E0392]: lifetime parameter `'a` is never used
--> $DIR/variance-regions-direct.rs:52:14
|
LL | struct Test7<'a> {
| ^^ unused lifetime parameter
|
= help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`

error: [+, +, +]
--> $DIR/variance-regions-direct.rs:9:1
|
Expand Down Expand Up @@ -48,6 +40,14 @@ error: [-, +, o]
LL | enum Test8<'a, 'b, 'c:'b> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0392]: lifetime parameter `'a` is never used
--> $DIR/variance-regions-direct.rs:52:14
|
LL | struct Test7<'a> {
| ^^ unused lifetime parameter
|
= help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`

error: aborting due to 8 previous errors

For more information about this error, try `rustc --explain E0392`.
60 changes: 30 additions & 30 deletions tests/ui/variance/variance-regions-indirect.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
error: [-, +, o, *]
--> $DIR/variance-regions-indirect.rs:8:1
|
LL | enum Base<'a, 'b, 'c:'b, 'd> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: [*, o, +, -]
--> $DIR/variance-regions-indirect.rs:16:1
|
LL | struct Derived1<'w, 'x:'y, 'y, 'z> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: [o, o, *]
--> $DIR/variance-regions-indirect.rs:22:1
|
LL | struct Derived2<'a, 'b:'a, 'c> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: [o, +, *]
--> $DIR/variance-regions-indirect.rs:28:1
|
LL | struct Derived3<'a:'b, 'b, 'c> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: [-, +, o]
--> $DIR/variance-regions-indirect.rs:34:1
|
LL | struct Derived4<'a, 'b, 'c:'b> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0392]: lifetime parameter `'d` is never used
--> $DIR/variance-regions-indirect.rs:8:26
|
Expand Down Expand Up @@ -30,36 +60,6 @@ LL | struct Derived3<'a:'b, 'b, 'c> {
|
= help: consider removing `'c`, referring to it in a field, or using a marker such as `PhantomData`

error: [-, +, o, *]
--> $DIR/variance-regions-indirect.rs:8:1
|
LL | enum Base<'a, 'b, 'c:'b, 'd> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: [*, o, +, -]
--> $DIR/variance-regions-indirect.rs:16:1
|
LL | struct Derived1<'w, 'x:'y, 'y, 'z> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: [o, o, *]
--> $DIR/variance-regions-indirect.rs:22:1
|
LL | struct Derived2<'a, 'b:'a, 'c> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: [o, +, *]
--> $DIR/variance-regions-indirect.rs:28:1
|
LL | struct Derived3<'a:'b, 'b, 'c> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: [-, +, o]
--> $DIR/variance-regions-indirect.rs:34:1
|
LL | struct Derived4<'a, 'b, 'c:'b> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 9 previous errors

For more information about this error, try `rustc --explain E0392`.
48 changes: 24 additions & 24 deletions tests/ui/variance/variance-trait-bounds.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
error: [+, +]
--> $DIR/variance-trait-bounds.rs:16:1
|
LL | struct TestStruct<U,T:Setter<U>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: [*, +]
--> $DIR/variance-trait-bounds.rs:21:1
|
LL | enum TestEnum<U,T:Setter<U>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: [*, +]
--> $DIR/variance-trait-bounds.rs:27:1
|
LL | struct TestContraStruct<U,T:Setter<U>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: [*, +]
--> $DIR/variance-trait-bounds.rs:33:1
|
LL | struct TestBox<U,T:Getter<U>+Setter<U>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0392]: type parameter `U` is never used
--> $DIR/variance-trait-bounds.rs:21:15
|
Expand Down Expand Up @@ -25,30 +49,6 @@ LL | struct TestBox<U,T:Getter<U>+Setter<U>> {
= help: consider removing `U`, referring to it in a field, or using a marker such as `PhantomData`
= help: if you intended `U` to be a const parameter, use `const U: /* Type */` instead

error: [+, +]
--> $DIR/variance-trait-bounds.rs:16:1
|
LL | struct TestStruct<U,T:Setter<U>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: [*, +]
--> $DIR/variance-trait-bounds.rs:21:1
|
LL | enum TestEnum<U,T:Setter<U>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: [*, +]
--> $DIR/variance-trait-bounds.rs:27:1
|
LL | struct TestContraStruct<U,T:Setter<U>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: [*, +]
--> $DIR/variance-trait-bounds.rs:33:1
|
LL | struct TestBox<U,T:Getter<U>+Setter<U>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 7 previous errors

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

0 comments on commit e2e751e

Please sign in to comment.