From a4b7ed7a42c716ab9f05e351f003d589124fd55d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:58 +0200 Subject: Adding upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../ui/impl-header-lifetime-elision/assoc-type.rs | 25 --------------- .../impl-header-lifetime-elision/assoc-type.stderr | 15 --------- .../constant-used-as-arraylen.rs | 24 --------------- .../ui/impl-header-lifetime-elision/dyn-trait.rs | 36 ---------------------- .../impl-header-lifetime-elision/dyn-trait.stderr | 16 ---------- .../explicit-and-elided-same-header.rs | 13 -------- .../impl-header-lifetime-elision/inherent-impl.rs | 9 ------ .../ui/impl-header-lifetime-elision/path-elided.rs | 11 ------- .../path-elided.stderr | 15 --------- .../path-underscore.rs | 34 -------------------- .../impl-header-lifetime-elision/ref-underscore.rs | 30 ------------------ .../impl-header-lifetime-elision/trait-elided.rs | 8 ----- .../trait-elided.stderr | 15 --------- .../trait-underscore.rs | 35 --------------------- 14 files changed, 286 deletions(-) delete mode 100644 src/test/ui/impl-header-lifetime-elision/assoc-type.rs delete mode 100644 src/test/ui/impl-header-lifetime-elision/assoc-type.stderr delete mode 100644 src/test/ui/impl-header-lifetime-elision/constant-used-as-arraylen.rs delete mode 100644 src/test/ui/impl-header-lifetime-elision/dyn-trait.rs delete mode 100644 src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr delete mode 100644 src/test/ui/impl-header-lifetime-elision/explicit-and-elided-same-header.rs delete mode 100644 src/test/ui/impl-header-lifetime-elision/inherent-impl.rs delete mode 100644 src/test/ui/impl-header-lifetime-elision/path-elided.rs delete mode 100644 src/test/ui/impl-header-lifetime-elision/path-elided.stderr delete mode 100644 src/test/ui/impl-header-lifetime-elision/path-underscore.rs delete mode 100644 src/test/ui/impl-header-lifetime-elision/ref-underscore.rs delete mode 100644 src/test/ui/impl-header-lifetime-elision/trait-elided.rs delete mode 100644 src/test/ui/impl-header-lifetime-elision/trait-elided.stderr delete mode 100644 src/test/ui/impl-header-lifetime-elision/trait-underscore.rs (limited to 'src/test/ui/impl-header-lifetime-elision') diff --git a/src/test/ui/impl-header-lifetime-elision/assoc-type.rs b/src/test/ui/impl-header-lifetime-elision/assoc-type.rs deleted file mode 100644 index b0089a37a..000000000 --- a/src/test/ui/impl-header-lifetime-elision/assoc-type.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Test that we do not yet support elision in associated types, even -// when there is just one name we could take from the impl header. - -#![allow(warnings)] - -trait MyTrait { - type Output; -} - -impl MyTrait for &i32 { - type Output = &i32; - //~^ ERROR `&` without an explicit lifetime name cannot be used here -} - -impl MyTrait for &u32 { - type Output = &'_ i32; - //~^ ERROR `'_` cannot be used here -} - -// This is what you have to do: -impl<'a> MyTrait for &'a f32 { - type Output = &'a f32; -} - -fn main() { } diff --git a/src/test/ui/impl-header-lifetime-elision/assoc-type.stderr b/src/test/ui/impl-header-lifetime-elision/assoc-type.stderr deleted file mode 100644 index c4f27e0b8..000000000 --- a/src/test/ui/impl-header-lifetime-elision/assoc-type.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/assoc-type.rs:11:19 - | -LL | type Output = &i32; - | ^ explicit lifetime name needed here - -error[E0637]: `'_` cannot be used here - --> $DIR/assoc-type.rs:16:20 - | -LL | type Output = &'_ i32; - | ^^ `'_` is a reserved lifetime name - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0637`. diff --git a/src/test/ui/impl-header-lifetime-elision/constant-used-as-arraylen.rs b/src/test/ui/impl-header-lifetime-elision/constant-used-as-arraylen.rs deleted file mode 100644 index 929b82bfc..000000000 --- a/src/test/ui/impl-header-lifetime-elision/constant-used-as-arraylen.rs +++ /dev/null @@ -1,24 +0,0 @@ -// check-pass -// Verify that we do not ICE when anonymous lifetimes appear inside an AnonConst. - -pub struct EntriesBuffer(Box<[[u8; HashesEntry::LEN]; 5]>); - -impl EntriesBuffer { - pub fn iter_child_buffers(&mut self) -> impl Iterator { - self.0.iter_mut() - } - - pub fn iter_child_buffers_explicit( - &mut self, - ) -> impl Iterator::LEN]> { - self.0.iter_mut() - } -} - -pub struct HashesEntry<'a>(&'a [u8]); - -impl HashesEntry<'_> { - pub const LEN: usize = 1; -} - -fn main() {} diff --git a/src/test/ui/impl-header-lifetime-elision/dyn-trait.rs b/src/test/ui/impl-header-lifetime-elision/dyn-trait.rs deleted file mode 100644 index 359c08c98..000000000 --- a/src/test/ui/impl-header-lifetime-elision/dyn-trait.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Test that `impl MyTrait<'_> for &i32` is equivalent to `impl<'a, -// 'b> MyTrait<'a> for &'b i32`. - -#![allow(warnings)] - -use std::fmt::Debug; - -// Equivalent to `Box`: -trait StaticTrait { } -impl StaticTrait for Box { } - -// Equivalent to `Box`: -trait NotStaticTrait { } -impl NotStaticTrait for Box { } - -// Check that we don't err when the trait has a lifetime parameter. -trait TraitWithLifetime<'a> { } -impl NotStaticTrait for &dyn TraitWithLifetime<'_> { } - -fn static_val(_: T) { -} - -fn with_dyn_debug_static<'a>(x: Box) { - static_val(x); - //~^ ERROR borrowed data escapes outside of function -} - -fn not_static_val(_: T) { -} - -fn with_dyn_debug_not_static<'a>(x: Box) { - not_static_val(x); // OK -} - -fn main() { -} diff --git a/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr b/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr deleted file mode 100644 index 762698c4f..000000000 --- a/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0521]: borrowed data escapes outside of function - --> $DIR/dyn-trait.rs:24:5 - | -LL | fn with_dyn_debug_static<'a>(x: Box) { - | -- - `x` is a reference that is only valid in the function body - | | - | lifetime `'a` defined here -LL | static_val(x); - | ^^^^^^^^^^^^^ - | | - | `x` escapes the function body here - | argument requires that `'a` must outlive `'static` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0521`. diff --git a/src/test/ui/impl-header-lifetime-elision/explicit-and-elided-same-header.rs b/src/test/ui/impl-header-lifetime-elision/explicit-and-elided-same-header.rs deleted file mode 100644 index 6301ac4a3..000000000 --- a/src/test/ui/impl-header-lifetime-elision/explicit-and-elided-same-header.rs +++ /dev/null @@ -1,13 +0,0 @@ -// run-pass - -#![allow(warnings)] - -// This works for functions... -fn foo<'a>(x: &str, y: &'a str) {} - -// ...so this should work for impls -impl<'a> Foo<&str> for &'a str {} -trait Foo {} - -fn main() { -} diff --git a/src/test/ui/impl-header-lifetime-elision/inherent-impl.rs b/src/test/ui/impl-header-lifetime-elision/inherent-impl.rs deleted file mode 100644 index 9d7b2f2d0..000000000 --- a/src/test/ui/impl-header-lifetime-elision/inherent-impl.rs +++ /dev/null @@ -1,9 +0,0 @@ -// build-pass (FIXME(62277): could be check-pass?) - -struct Foo<'a>(&'a u8); - -impl Foo<'_> { - fn x() {} -} - -fn main() {} diff --git a/src/test/ui/impl-header-lifetime-elision/path-elided.rs b/src/test/ui/impl-header-lifetime-elision/path-elided.rs deleted file mode 100644 index 40a52efc7..000000000 --- a/src/test/ui/impl-header-lifetime-elision/path-elided.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![allow(warnings)] - -trait MyTrait { } - -struct Foo<'a> { x: &'a u32 } - -impl MyTrait for Foo { - //~^ ERROR implicit elided lifetime not allowed here -} - -fn main() {} diff --git a/src/test/ui/impl-header-lifetime-elision/path-elided.stderr b/src/test/ui/impl-header-lifetime-elision/path-elided.stderr deleted file mode 100644 index 0b7d3f1e8..000000000 --- a/src/test/ui/impl-header-lifetime-elision/path-elided.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0726]: implicit elided lifetime not allowed here - --> $DIR/path-elided.rs:7:18 - | -LL | impl MyTrait for Foo { - | ^^^ expected lifetime parameter - | - = note: assuming a `'static` lifetime... -help: indicate the anonymous lifetime - | -LL | impl MyTrait for Foo<'_> { - | ++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0726`. diff --git a/src/test/ui/impl-header-lifetime-elision/path-underscore.rs b/src/test/ui/impl-header-lifetime-elision/path-underscore.rs deleted file mode 100644 index f39ba5733..000000000 --- a/src/test/ui/impl-header-lifetime-elision/path-underscore.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Test that `impl MyTrait for Foo<'_>` works. - -// run-pass - -#![allow(warnings)] - -trait MyTrait { } - -struct Foo<'a> { x: &'a u32 } - -impl MyTrait for Foo<'_> { -} - -fn impls_my_trait() { } - -fn impls_my_trait_val(_: T) { - impls_my_trait::(); -} - -fn random_where_clause() -where for<'a> Foo<'a>: MyTrait { } - -fn main() { - let x = 22; - let f = Foo { x: &x }; - - // This type is `Foo<'x>` for a local lifetime `'x`; so the impl - // must apply to any lifetime to apply to this. - impls_my_trait_val(f); - - impls_my_trait::>(); - - random_where_clause(); -} diff --git a/src/test/ui/impl-header-lifetime-elision/ref-underscore.rs b/src/test/ui/impl-header-lifetime-elision/ref-underscore.rs deleted file mode 100644 index 5be04d08a..000000000 --- a/src/test/ui/impl-header-lifetime-elision/ref-underscore.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Test that `impl MyTrait for &i32` works and is equivalent to any lifetime. - -// run-pass - -#![allow(warnings)] - -trait MyTrait { } - -impl MyTrait for &i32 { -} - -fn impls_my_trait() { } - -fn impls_my_trait_val(_: T) { - impls_my_trait::(); -} - -fn random_where_clause() -where for<'a> &'a i32: MyTrait { } - -fn main() { - let x = 22; - let f = &x; - - impls_my_trait_val(f); - - impls_my_trait::<&'static i32>(); - - random_where_clause(); -} diff --git a/src/test/ui/impl-header-lifetime-elision/trait-elided.rs b/src/test/ui/impl-header-lifetime-elision/trait-elided.rs deleted file mode 100644 index c3e76d9cb..000000000 --- a/src/test/ui/impl-header-lifetime-elision/trait-elided.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![allow(warnings)] - -trait MyTrait<'a> {} - -impl MyTrait for u32 {} -//~^ ERROR implicit elided lifetime not allowed here - -fn main() {} diff --git a/src/test/ui/impl-header-lifetime-elision/trait-elided.stderr b/src/test/ui/impl-header-lifetime-elision/trait-elided.stderr deleted file mode 100644 index 412bba6be..000000000 --- a/src/test/ui/impl-header-lifetime-elision/trait-elided.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0726]: implicit elided lifetime not allowed here - --> $DIR/trait-elided.rs:5:6 - | -LL | impl MyTrait for u32 {} - | ^^^^^^^ expected lifetime parameter - | - = note: assuming a `'static` lifetime... -help: indicate the anonymous lifetime - | -LL | impl MyTrait<'_> for u32 {} - | ++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0726`. diff --git a/src/test/ui/impl-header-lifetime-elision/trait-underscore.rs b/src/test/ui/impl-header-lifetime-elision/trait-underscore.rs deleted file mode 100644 index 3e13b0426..000000000 --- a/src/test/ui/impl-header-lifetime-elision/trait-underscore.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Test that `impl MyTrait<'_> for &i32` is equivalent to `impl<'a, -// 'b> MyTrait<'a> for &'b i32`. -// -// run-pass - -#![allow(warnings)] - -trait MyTrait<'a> { } - -// This is equivalent to `MyTrait<'a> for &'b i32`, which is proven by -// the code below. -impl MyTrait<'_> for &i32 { -} - -// When called, T will be `&'x i32` for some `'x`, so since we can -// prove that `&'x i32: for<'a> MyTrait<'a>, then we know that the -// lifetime parameter above is disconnected. -fn impls_my_trait MyTrait<'a>>() { } - -fn impls_my_trait_val MyTrait<'a>>(_: T) { - impls_my_trait::(); -} - -fn random_where_clause() -where for<'a, 'b> &'a i32: MyTrait<'b> { } - -fn main() { - let x = 22; - let f = &x; - impls_my_trait_val(f); - - impls_my_trait::<&'static i32>(); - - random_where_clause(); -} -- cgit v1.2.3