diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
commit | dc0db358abe19481e475e10c32149b53370f1a1c (patch) | |
tree | ab8ce99c4b255ce46f99ef402c27916055b899ee /tests/ui/underscore-lifetime | |
parent | Releasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff) | |
download | rustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip |
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/underscore-lifetime')
14 files changed, 144 insertions, 53 deletions
diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.fixed b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.fixed new file mode 100644 index 000000000..5be6ff8e7 --- /dev/null +++ b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.fixed @@ -0,0 +1,17 @@ +// run-rustfix + +trait WithType<T> {} +trait WithRegion<'a> { } + +#[allow(dead_code)] +struct Foo<T> { + t: T +} + +impl<T> Foo<T> +where + T: for<'a> WithType<&'a u32> +//~^ ERROR `&` without an explicit lifetime name cannot be used here +{ } + +fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.rs b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.rs new file mode 100644 index 000000000..d7072aa11 --- /dev/null +++ b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.rs @@ -0,0 +1,17 @@ +// run-rustfix + +trait WithType<T> {} +trait WithRegion<'a> { } + +#[allow(dead_code)] +struct Foo<T> { + t: T +} + +impl<T> Foo<T> +where + T: WithType<&u32> +//~^ ERROR `&` without an explicit lifetime name cannot be used here +{ } + +fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rust2015.stderr b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.stderr index 63fc1a19b..3e197dc9a 100644 --- a/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rust2015.stderr +++ b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.stderr @@ -1,14 +1,13 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/where-clause-trait-impl-region.rs:11:17 + --> $DIR/where-clause-inherent-impl-ampersand-rust2015.rs:13:17 | LL | T: WithType<&u32> | ^ explicit lifetime name needed here | -help: consider introducing a higher-ranked lifetime here with `for<'a>` - --> $DIR/where-clause-trait-impl-region.rs:11:8 +help: consider introducing a higher-ranked lifetime here | -LL | T: WithType<&u32> - | ^ +LL | T: for<'a> WithType<&'a u32> + | +++++++ ++ error: aborting due to previous error diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.fixed b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.fixed new file mode 100644 index 000000000..0f1be5865 --- /dev/null +++ b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.fixed @@ -0,0 +1,18 @@ +// edition:2018 +// run-rustfix + +trait WithType<T> {} +trait WithRegion<'a> { } + +#[allow(dead_code)] +struct Foo<T> { + t: T +} + +impl<T> Foo<T> +where + T: for<'a> WithType<&'a u32> +//~^ ERROR `&` without an explicit lifetime name cannot be used here +{ } + +fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.rs b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.rs new file mode 100644 index 000000000..59f7e472e --- /dev/null +++ b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.rs @@ -0,0 +1,18 @@ +// edition:2018 +// run-rustfix + +trait WithType<T> {} +trait WithRegion<'a> { } + +#[allow(dead_code)] +struct Foo<T> { + t: T +} + +impl<T> Foo<T> +where + T: WithType<&u32> +//~^ ERROR `&` without an explicit lifetime name cannot be used here +{ } + +fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rust2018.stderr b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.stderr index 63fc1a19b..08b4268e5 100644 --- a/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rust2018.stderr +++ b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.stderr @@ -1,14 +1,13 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/where-clause-trait-impl-region.rs:11:17 + --> $DIR/where-clause-inherent-impl-ampersand-rust2018.rs:14:17 | LL | T: WithType<&u32> | ^ explicit lifetime name needed here | -help: consider introducing a higher-ranked lifetime here with `for<'a>` - --> $DIR/where-clause-trait-impl-region.rs:11:8 +help: consider introducing a higher-ranked lifetime here | -LL | T: WithType<&u32> - | ^ +LL | T: for<'a> WithType<&'a u32> + | +++++++ ++ error: aborting due to previous error diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rs b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rs deleted file mode 100644 index 43de30944..000000000 --- a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rs +++ /dev/null @@ -1,18 +0,0 @@ -// revisions: rust2015 rust2018 -//[rust2018] edition:2018 - -trait WithType<T> {} -trait WithRegion<'a> { } - -struct Foo<T> { - t: T -} - -impl<T> Foo<T> -where - T: WithType<&u32> -//[rust2015]~^ ERROR `&` without an explicit lifetime name cannot be used here -//[rust2018]~^^ ERROR `&` without an explicit lifetime name cannot be used here -{ } - -fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.fixed b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.fixed new file mode 100644 index 000000000..55c747096 --- /dev/null +++ b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.fixed @@ -0,0 +1,14 @@ +// run-rustfix + +trait WithType<T> {} +trait WithRegion<'a> { } + +trait Foo { } + +impl<T> Foo for Vec<T> +where + T: for<'a> WithType<&'a u32> +//~^ ERROR `&` without an explicit lifetime name cannot be used here +{ } + +fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.rs b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.rs new file mode 100644 index 000000000..42a35b021 --- /dev/null +++ b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.rs @@ -0,0 +1,14 @@ +// run-rustfix + +trait WithType<T> {} +trait WithRegion<'a> { } + +trait Foo { } + +impl<T> Foo for Vec<T> +where + T: WithType<&u32> +//~^ ERROR `&` without an explicit lifetime name cannot be used here +{ } + +fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2015.stderr b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.stderr index f4d14b5f8..8c5bbb631 100644 --- a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2015.stderr +++ b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.stderr @@ -1,14 +1,13 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/where-clause-inherent-impl-ampersand.rs:13:17 + --> $DIR/where-clause-trait-impl-region-2015.rs:10:17 | LL | T: WithType<&u32> | ^ explicit lifetime name needed here | -help: consider introducing a higher-ranked lifetime here with `for<'a>` - --> $DIR/where-clause-inherent-impl-ampersand.rs:13:8 +help: consider introducing a higher-ranked lifetime here | -LL | T: WithType<&u32> - | ^ +LL | T: for<'a> WithType<&'a u32> + | +++++++ ++ error: aborting due to previous error diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.fixed b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.fixed new file mode 100644 index 000000000..09b96fe5e --- /dev/null +++ b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.fixed @@ -0,0 +1,15 @@ +// run-rustfix +// edition:2018 + +trait WithType<T> {} +trait WithRegion<'a> { } + +trait Foo { } + +impl<T> Foo for Vec<T> +where + T: for<'a> WithType<&'a u32> +//~^ ERROR `&` without an explicit lifetime name cannot be used here +{ } + +fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.rs b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.rs new file mode 100644 index 000000000..445f38cbe --- /dev/null +++ b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.rs @@ -0,0 +1,15 @@ +// run-rustfix +// edition:2018 + +trait WithType<T> {} +trait WithRegion<'a> { } + +trait Foo { } + +impl<T> Foo for Vec<T> +where + T: WithType<&u32> +//~^ ERROR `&` without an explicit lifetime name cannot be used here +{ } + +fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2018.stderr b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.stderr index f4d14b5f8..0268c59fa 100644 --- a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2018.stderr +++ b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.stderr @@ -1,14 +1,13 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/where-clause-inherent-impl-ampersand.rs:13:17 + --> $DIR/where-clause-trait-impl-region-2018.rs:11:17 | LL | T: WithType<&u32> | ^ explicit lifetime name needed here | -help: consider introducing a higher-ranked lifetime here with `for<'a>` - --> $DIR/where-clause-inherent-impl-ampersand.rs:13:8 +help: consider introducing a higher-ranked lifetime here | -LL | T: WithType<&u32> - | ^ +LL | T: for<'a> WithType<&'a u32> + | +++++++ ++ error: aborting due to previous error diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rs b/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rs deleted file mode 100644 index 09e5bbd84..000000000 --- a/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rs +++ /dev/null @@ -1,15 +0,0 @@ -// revisions: rust2015 rust2018 -//[rust2018] edition:2018 - -trait WithType<T> {} -trait WithRegion<'a> { } - -trait Foo { } - -impl<T> Foo for Vec<T> -where - T: WithType<&u32> -//[rust2015,rust2018]~^ ERROR `&` without an explicit lifetime name cannot be used here -{ } - -fn main() {} |