diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-02-22 09:22:15 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-02-22 09:22:50 +0000 |
| commit | 9e016a8b847905dfabec3598da3e92c6287473f2 (patch) | |
| tree | 1196314c490a6a7f05df194477bfad43803a69c6 /tests | |
| parent | 66bd6453e033ae3e502a540595a9b31a0f25b55f (diff) | |
| download | rust-9e016a8b847905dfabec3598da3e92c6287473f2.tar.gz rust-9e016a8b847905dfabec3598da3e92c6287473f2.zip | |
Avoid emitting type mismatches against `{type error}`
Diffstat (limited to 'tests')
4 files changed, 14 insertions, 53 deletions
diff --git a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.rs b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.rs index 83c3adca0e1..7a2fddbd2ba 100644 --- a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.rs +++ b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.rs @@ -37,7 +37,6 @@ mod capture_tait_complex_pass { use super::*; type Opq0<'a> = impl Sized; type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'b>>; // <- Note 'b - //~^ ERROR: concrete type differs from previous defining opaque type use type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>; fn test() -> Opq2 {} //~^ ERROR: expected generic lifetime parameter, found `'a` @@ -75,7 +74,6 @@ mod constrain_pass { use super::*; type Opq0<'a, 'b> = impl Sized; type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'a, 'b>>; - //~^ ERROR concrete type differs type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>; fn test() -> Opq2 {} //~^ ERROR: expected generic lifetime parameter, found `'a` diff --git a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr index 65b3a449efb..9db437c902c 100644 --- a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr +++ b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr @@ -27,28 +27,16 @@ LL | fn test() -> Opq2 {} | ^^ error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:42:23 + --> $DIR/higher-ranked-regions-basic.rs:41:23 | LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'b>>; // <- Note 'b | -- this generic parameter must be used with a generic lifetime parameter -... +LL | type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>; LL | fn test() -> Opq2 {} | ^^ -error: concrete type differs from previous defining opaque type use - --> $DIR/higher-ranked-regions-basic.rs:39:21 - | -LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'b>>; // <- Note 'b - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&'a ()`, got `{type error}` - | -note: previous use here - --> $DIR/higher-ranked-regions-basic.rs:41:17 - | -LL | type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - error[E0700]: hidden type for `capture_tait_complex_fail::Opq0<'a>` captures lifetime that does not appear in bounds - --> $DIR/higher-ranked-regions-basic.rs:52:23 + --> $DIR/higher-ranked-regions-basic.rs:51:23 | LL | type Opq0<'a> = impl Sized; | ---------- opaque type defined here @@ -59,19 +47,19 @@ LL | fn test() -> Opq2 {} | ^^ error[E0792]: non-defining opaque type use in defining scope - --> $DIR/higher-ranked-regions-basic.rs:60:41 + --> $DIR/higher-ranked-regions-basic.rs:59:41 | LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'static>> {} | ^^^^^^^^^^^^^^^^^^^^^^ argument `'static` is not a generic parameter | note: for this opaque type - --> $DIR/higher-ranked-regions-basic.rs:59:25 + --> $DIR/higher-ranked-regions-basic.rs:58:25 | LL | type Opq0<'a, 'b> = impl Sized; | ^^^^^^^^^^ error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:60:65 + --> $DIR/higher-ranked-regions-basic.rs:59:65 | LL | type Opq0<'a, 'b> = impl Sized; | -- this generic parameter must be used with a generic lifetime parameter @@ -79,19 +67,19 @@ LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'static>> {} | ^^ error: non-defining opaque type use in defining scope - --> $DIR/higher-ranked-regions-basic.rs:69:41 + --> $DIR/higher-ranked-regions-basic.rs:68:41 | LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'a>> {} | ^^^^^^^^^^^^^^^^^ generic argument `'a` used twice | note: for this opaque type - --> $DIR/higher-ranked-regions-basic.rs:68:25 + --> $DIR/higher-ranked-regions-basic.rs:67:25 | LL | type Opq0<'a, 'b> = impl Sized; | ^^^^^^^^^^ error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:69:60 + --> $DIR/higher-ranked-regions-basic.rs:68:60 | LL | type Opq0<'a, 'b> = impl Sized; | -- this generic parameter must be used with a generic lifetime parameter @@ -99,27 +87,15 @@ LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'a>> {} | ^^ error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:80:23 + --> $DIR/higher-ranked-regions-basic.rs:78:23 | LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'a, 'b>>; | -- this generic parameter must be used with a generic lifetime parameter -... +LL | type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>; LL | fn test() -> Opq2 {} | ^^ -error: concrete type differs from previous defining opaque type use - --> $DIR/higher-ranked-regions-basic.rs:77:21 - | -LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'a, 'b>>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&'a ()`, got `{type error}` - | -note: previous use here - --> $DIR/higher-ranked-regions-basic.rs:79:17 - | -LL | type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 12 previous errors +error: aborting due to 10 previous errors Some errors have detailed explanations: E0700, E0792. For more information about an error, try `rustc --explain E0700`. diff --git a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.rs b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.rs index be7fa1a7c0a..db5e5e05e54 100644 --- a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.rs +++ b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.rs @@ -8,7 +8,6 @@ pub trait Trait { pub type Foo = impl for<'a> Trait<Assoc<'a> = FooAssoc<'a>>; pub type FooAssoc<'a> = impl Sized; -//~^ ERROR: concrete type differs from previous defining opaque type use struct Struct; impl Trait for Struct { diff --git a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.stderr b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.stderr index 2538c4bc225..9b361445f1e 100644 --- a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.stderr +++ b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.stderr @@ -1,5 +1,5 @@ error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-gat.rs:18:18 + --> $DIR/higher-ranked-regions-gat.rs:17:18 | LL | pub type FooAssoc<'a> = impl Sized; | -- this generic parameter must be used with a generic lifetime parameter @@ -7,18 +7,6 @@ LL | pub type FooAssoc<'a> = impl Sized; LL | const FOO: Foo = Struct; | ^^^^^^ -error: concrete type differs from previous defining opaque type use - --> $DIR/higher-ranked-regions-gat.rs:10:25 - | -LL | pub type FooAssoc<'a> = impl Sized; - | ^^^^^^^^^^ expected `&'a u32`, got `{type error}` - | -note: previous use here - --> $DIR/higher-ranked-regions-gat.rs:9:16 - | -LL | pub type Foo = impl for<'a> Trait<Assoc<'a> = FooAssoc<'a>>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0792`. |
