From 4f9fe856a25ab29345b90e7725509e9ee38a37be Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:41 +0200 Subject: Adding upstream version 1.69.0+dfsg1. Signed-off-by: Daniel Baumann --- .../ui/type-alias-impl-trait/bounds-are-checked.rs | 3 +- .../bounds-are-checked.stderr | 15 +++------- .../generic_nondefining_use.rs | 2 +- .../generic_nondefining_use.stderr | 2 +- .../generic_type_does_not_live_long_enough.rs | 2 +- .../generic_type_does_not_live_long_enough.stderr | 2 +- .../implied_lifetime_wf_check3.rs | 3 -- .../implied_lifetime_wf_check3.stderr | 34 ++++------------------ .../imply_bounds_from_bounds_param.stderr | 4 ++- tests/ui/type-alias-impl-trait/issue-63279.rs | 2 -- tests/ui/type-alias-impl-trait/issue-63279.stderr | 12 ++++---- .../issue-65679-inst-opaque-ty-from-val-twice.rs | 1 - tests/ui/type-alias-impl-trait/issue-98604.rs | 2 +- tests/ui/type-alias-impl-trait/issue-98604.stderr | 11 ++----- tests/ui/type-alias-impl-trait/issue-98608.rs | 2 +- tests/ui/type-alias-impl-trait/issue-98608.stderr | 4 +-- .../ui/type-alias-impl-trait/match-unification.rs | 14 +++++++++ .../missing_lifetime_bound.stderr | 2 ++ .../type-alias-impl-trait-fn-type.stderr | 2 +- .../type-alias-impl-trait/unnameable_type.stderr | 2 +- 20 files changed, 47 insertions(+), 74 deletions(-) create mode 100644 tests/ui/type-alias-impl-trait/match-unification.rs (limited to 'tests/ui/type-alias-impl-trait') diff --git a/tests/ui/type-alias-impl-trait/bounds-are-checked.rs b/tests/ui/type-alias-impl-trait/bounds-are-checked.rs index 83d22161e..7c3a3a844 100644 --- a/tests/ui/type-alias-impl-trait/bounds-are-checked.rs +++ b/tests/ui/type-alias-impl-trait/bounds-are-checked.rs @@ -6,9 +6,8 @@ type X<'a> = impl Into<&'static str> + From<&'a str>; fn f<'a: 'static>(t: &'a str) -> X<'a> { - //~^ WARNING unnecessary lifetime parameter t - //~^ ERROR non-defining opaque type use + //~^ ERROR expected generic lifetime parameter, found `'static` } fn extend_lt<'a>(o: &'a str) -> &'static str { diff --git a/tests/ui/type-alias-impl-trait/bounds-are-checked.stderr b/tests/ui/type-alias-impl-trait/bounds-are-checked.stderr index 920eef11d..962dedde0 100644 --- a/tests/ui/type-alias-impl-trait/bounds-are-checked.stderr +++ b/tests/ui/type-alias-impl-trait/bounds-are-checked.stderr @@ -1,13 +1,5 @@ -warning: unnecessary lifetime parameter `'a` - --> $DIR/bounds-are-checked.rs:8:6 - | -LL | fn f<'a: 'static>(t: &'a str) -> X<'a> { - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'a` - -error: non-defining opaque type use in defining scope - --> $DIR/bounds-are-checked.rs:10:5 +error[E0792]: expected generic lifetime parameter, found `'static` + --> $DIR/bounds-are-checked.rs:9:5 | LL | type X<'a> = impl Into<&'static str> + From<&'a str>; | -- cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type @@ -15,5 +7,6 @@ LL | type X<'a> = impl Into<&'static str> + From<&'a str>; LL | t | ^ -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs b/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs index f5045d382..e7b8567b9 100644 --- a/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs +++ b/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs @@ -19,7 +19,7 @@ fn concrete_ty() -> OneTy { fn concrete_lifetime() -> OneLifetime<'static> { 6u32 - //~^ ERROR non-defining opaque type use in defining scope + //~^ ERROR expected generic lifetime parameter, found `'static` } fn concrete_const() -> OneConst<{ 123 }> { diff --git a/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr b/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr index 564648630..966fe823f 100644 --- a/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr +++ b/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr @@ -7,7 +7,7 @@ LL | type OneTy = impl Debug; LL | 5u32 | ^^^^ -error: non-defining opaque type use in defining scope +error[E0792]: expected generic lifetime parameter, found `'static` --> $DIR/generic_nondefining_use.rs:21:5 | LL | type OneLifetime<'a> = impl Debug; diff --git a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs index d3e169a70..cdd8f6f19 100644 --- a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs +++ b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs @@ -4,7 +4,7 @@ fn main() { let y = 42; let x = wrong_generic(&y); let z: i32 = x; - //~^ ERROR expected generic type parameter, found `&'static i32 + //~^ ERROR expected generic type parameter, found `&i32` } type WrongGeneric = impl 'static; diff --git a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr index 19115fd28..fa79e51e9 100644 --- a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr +++ b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr @@ -4,7 +4,7 @@ error: at least one trait must be specified LL | type WrongGeneric = impl 'static; | ^^^^^^^^^^^^ -error[E0792]: expected generic type parameter, found `&'static i32` +error[E0792]: expected generic type parameter, found `&i32` --> $DIR/generic_type_does_not_live_long_enough.rs:6:18 | LL | let z: i32 = x; diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs index 07f825aea..6f9434255 100644 --- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs +++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs @@ -4,7 +4,6 @@ mod test_lifetime_param { type Ty<'a> = impl Sized + 'a; fn defining(a: &str) -> Ty<'_> { a } fn assert_static<'a: 'static>() {} - //~^ WARN: unnecessary lifetime parameter `'a` fn test<'a>() where Ty<'a>: 'static { assert_static::<'a>() } //~^ ERROR: lifetime may not live long enough } @@ -13,14 +12,12 @@ mod test_higher_kinded_lifetime_param { type Ty<'a> = impl Sized + 'a; fn defining(a: &str) -> Ty<'_> { a } fn assert_static<'a: 'static>() {} - //~^ WARN: unnecessary lifetime parameter `'a` fn test<'a>() where for<'b> Ty<'b>: 'a { assert_static::<'a>() } //~^ ERROR: lifetime may not live long enough } mod test_higher_kinded_lifetime_param2 { fn assert_static<'a: 'static>() {} - //~^ WARN: unnecessary lifetime parameter `'a` fn test<'a>() { assert_static::<'a>() } //~^ ERROR: lifetime may not live long enough } diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr index 887620a4d..399775641 100644 --- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr +++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr @@ -1,41 +1,17 @@ -warning: unnecessary lifetime parameter `'a` - --> $DIR/implied_lifetime_wf_check3.rs:6:22 - | -LL | fn assert_static<'a: 'static>() {} - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'a` - -warning: unnecessary lifetime parameter `'a` - --> $DIR/implied_lifetime_wf_check3.rs:15:22 - | -LL | fn assert_static<'a: 'static>() {} - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'a` - -warning: unnecessary lifetime parameter `'a` - --> $DIR/implied_lifetime_wf_check3.rs:22:22 - | -LL | fn assert_static<'a: 'static>() {} - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'a` - error: lifetime may not live long enough - --> $DIR/implied_lifetime_wf_check3.rs:8:43 + --> $DIR/implied_lifetime_wf_check3.rs:7:43 | LL | fn test<'a>() where Ty<'a>: 'static { assert_static::<'a>() } | -- lifetime `'a` defined here ^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/implied_lifetime_wf_check3.rs:17:46 + --> $DIR/implied_lifetime_wf_check3.rs:15:46 | LL | fn test<'a>() where for<'b> Ty<'b>: 'a { assert_static::<'a>() } | -- lifetime `'a` defined here ^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/implied_lifetime_wf_check3.rs:24:21 + --> $DIR/implied_lifetime_wf_check3.rs:21:21 | LL | fn test<'a>() { assert_static::<'a>() } | -- ^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` @@ -43,7 +19,7 @@ LL | fn test<'a>() { assert_static::<'a>() } | lifetime `'a` defined here error[E0310]: the parameter type `A` may not live long enough - --> $DIR/implied_lifetime_wf_check3.rs:32:41 + --> $DIR/implied_lifetime_wf_check3.rs:29:41 | LL | fn test() where Ty: 'static { assert_static::() } | ^^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds @@ -53,6 +29,6 @@ help: consider adding an explicit lifetime bound... LL | fn test() where Ty: 'static { assert_static::() } | +++++++++ -error: aborting due to 4 previous errors; 3 warnings emitted +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0310`. diff --git a/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.stderr b/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.stderr index 0ed8a703b..e52d5f9de 100644 --- a/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.stderr +++ b/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.stderr @@ -2,7 +2,9 @@ error[E0700]: hidden type for `impl PlusOne` captures lifetime that does not app --> $DIR/imply_bounds_from_bounds_param.rs:24:5 | LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne { - | -- hidden type `<&'a mut i32 as Callable>::Output` captures the lifetime `'a` as defined here + | -- ------------ opaque type defined here + | | + | hidden type `<&'a mut i32 as Callable>::Output` captures the lifetime `'a` as defined here LL | <&'a mut i32 as Callable>::call(y) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/type-alias-impl-trait/issue-63279.rs b/tests/ui/type-alias-impl-trait/issue-63279.rs index 97332e16d..0e46745c6 100644 --- a/tests/ui/type-alias-impl-trait/issue-63279.rs +++ b/tests/ui/type-alias-impl-trait/issue-63279.rs @@ -1,5 +1,3 @@ -// compile-flags: -Zsave-analysis - #![feature(type_alias_impl_trait)] type Closure = impl FnOnce(); diff --git a/tests/ui/type-alias-impl-trait/issue-63279.stderr b/tests/ui/type-alias-impl-trait/issue-63279.stderr index 110b8d1ee..a4f6359b9 100644 --- a/tests/ui/type-alias-impl-trait/issue-63279.stderr +++ b/tests/ui/type-alias-impl-trait/issue-63279.stderr @@ -1,5 +1,5 @@ error[E0277]: expected a `FnOnce<()>` closure, found `()` - --> $DIR/issue-63279.rs:7:11 + --> $DIR/issue-63279.rs:5:11 | LL | fn c() -> Closure { | ^^^^^^^ expected an `FnOnce<()>` closure, found `()` @@ -8,7 +8,7 @@ LL | fn c() -> Closure { = note: wrap the `()` in a closure with no arguments: `|| { /* code */ }` error[E0277]: expected a `FnOnce<()>` closure, found `()` - --> $DIR/issue-63279.rs:9:11 + --> $DIR/issue-63279.rs:7:11 | LL | || -> Closure { || () } | ^^^^^^^ expected an `FnOnce<()>` closure, found `()` @@ -17,26 +17,26 @@ LL | || -> Closure { || () } = note: wrap the `()` in a closure with no arguments: `|| { /* code */ }` error[E0308]: mismatched types - --> $DIR/issue-63279.rs:9:21 + --> $DIR/issue-63279.rs:7:21 | LL | || -> Closure { || () } | ^^^^^ expected `()`, found closure | = note: expected unit type `()` - found closure `[closure@$DIR/issue-63279.rs:9:21: 9:23]` + found closure `[closure@$DIR/issue-63279.rs:7:21: 7:23]` help: use parentheses to call this closure | LL | || -> Closure { (|| ())() } | + +++ error[E0308]: mismatched types - --> $DIR/issue-63279.rs:9:5 + --> $DIR/issue-63279.rs:7:5 | LL | || -> Closure { || () } | ^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found closure | = note: expected unit type `()` - found closure `[closure@$DIR/issue-63279.rs:9:5: 9:18]` + found closure `[closure@$DIR/issue-63279.rs:7:5: 7:18]` help: use parentheses to call this closure | LL | (|| -> Closure { || () })() diff --git a/tests/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs b/tests/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs index 72c22827f..b91cbce37 100644 --- a/tests/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs +++ b/tests/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs @@ -1,4 +1,3 @@ -// compile-flags: -Zsave-analysis // check-pass #![feature(type_alias_impl_trait, rustc_attrs)] diff --git a/tests/ui/type-alias-impl-trait/issue-98604.rs b/tests/ui/type-alias-impl-trait/issue-98604.rs index 32c2f9ed5..d07fc9822 100644 --- a/tests/ui/type-alias-impl-trait/issue-98604.rs +++ b/tests/ui/type-alias-impl-trait/issue-98604.rs @@ -7,5 +7,5 @@ async fn test() {} #[allow(unused_must_use)] fn main() { Box::new(test) as AsyncFnPtr; - //~^ ERROR expected `fn() -> impl Future {test}` to be a fn item that returns `Pin + 'static)>>`, but it returns `impl Future` + //~^ ERROR expected `test` to be a fn item that returns `Pin>>`, but it returns `impl Future } diff --git a/tests/ui/type-alias-impl-trait/issue-98604.stderr b/tests/ui/type-alias-impl-trait/issue-98604.stderr index 92d01eb0d..fa16d3218 100644 --- a/tests/ui/type-alias-impl-trait/issue-98604.stderr +++ b/tests/ui/type-alias-impl-trait/issue-98604.stderr @@ -1,16 +1,9 @@ -error[E0271]: expected `fn() -> impl Future {test}` to be a fn item that returns `Pin + 'static)>>`, but it returns `impl Future` +error[E0271]: expected `test` to be a fn item that returns `Pin>>`, but it returns `impl Future` --> $DIR/issue-98604.rs:9:5 | LL | Box::new(test) as AsyncFnPtr; - | ^^^^^^^^^^^^^^ expected struct `Pin`, found opaque type + | ^^^^^^^^^^^^^^ expected `Pin>>`, found future | -note: while checking the return type of the `async fn` - --> $DIR/issue-98604.rs:5:17 - | -LL | async fn test() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected struct `Pin + 'static)>>` - found opaque type `impl Future` = note: required for the cast from `fn() -> impl Future {test}` to the object type `dyn Fn() -> Pin + 'static)>>` error: aborting due to previous error diff --git a/tests/ui/type-alias-impl-trait/issue-98608.rs b/tests/ui/type-alias-impl-trait/issue-98608.rs index 1f89af045..5e026ea40 100644 --- a/tests/ui/type-alias-impl-trait/issue-98608.rs +++ b/tests/ui/type-alias-impl-trait/issue-98608.rs @@ -4,7 +4,7 @@ fn hi() -> impl Sized { fn main() { let b: Box Box> = Box::new(hi); - //~^ ERROR expected `fn() -> impl Sized {hi}` to be a fn item that returns `Box`, but it returns `impl Sized` + //~^ ERROR expected `hi` to be a fn item that returns `Box`, but it returns `impl Sized` let boxed = b(); let null = *boxed; println!("{null:?}"); diff --git a/tests/ui/type-alias-impl-trait/issue-98608.stderr b/tests/ui/type-alias-impl-trait/issue-98608.stderr index 916a58451..506d40cb7 100644 --- a/tests/ui/type-alias-impl-trait/issue-98608.stderr +++ b/tests/ui/type-alias-impl-trait/issue-98608.stderr @@ -1,11 +1,11 @@ -error[E0271]: expected `fn() -> impl Sized {hi}` to be a fn item that returns `Box`, but it returns `impl Sized` +error[E0271]: expected `hi` to be a fn item that returns `Box`, but it returns `impl Sized` --> $DIR/issue-98608.rs:6:39 | LL | fn hi() -> impl Sized { | ---------- the found opaque type ... LL | let b: Box Box> = Box::new(hi); - | ^^^^^^^^^^^^ expected struct `Box`, found opaque type + | ^^^^^^^^^^^^ expected `Box`, found opaque type | = note: expected struct `Box` found opaque type `impl Sized` diff --git a/tests/ui/type-alias-impl-trait/match-unification.rs b/tests/ui/type-alias-impl-trait/match-unification.rs new file mode 100644 index 000000000..f5c2abc0e --- /dev/null +++ b/tests/ui/type-alias-impl-trait/match-unification.rs @@ -0,0 +1,14 @@ +use std::fmt::Debug; + +// check-pass + +fn bar() -> impl Debug {} + +fn baz(b: bool) -> Option { + match b { + true => baz(false), + false => Some(bar()), + } +} + +fn main() {} diff --git a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr index 65a0af0d2..d666e668d 100644 --- a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr +++ b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr @@ -1,6 +1,8 @@ error[E0700]: hidden type for `Opaque<'a, T>` captures lifetime that does not appear in bounds --> $DIR/missing_lifetime_bound.rs:4:47 | +LL | type Opaque<'a, T> = impl Sized; + | ---------- opaque type defined here LL | fn defining<'a, T>(x: &'a i32) -> Opaque { x } | -- ^ | | diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.stderr b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.stderr index a31cf1a51..ff375b2ff 100644 --- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.stderr +++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.stderr @@ -1,4 +1,4 @@ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types --> $DIR/type-alias-impl-trait-fn-type.rs:6:20 | LL | type Foo = fn() -> impl Send; diff --git a/tests/ui/type-alias-impl-trait/unnameable_type.stderr b/tests/ui/type-alias-impl-trait/unnameable_type.stderr index 7dc6efc4b..e90324334 100644 --- a/tests/ui/type-alias-impl-trait/unnameable_type.stderr +++ b/tests/ui/type-alias-impl-trait/unnameable_type.stderr @@ -15,7 +15,7 @@ LL | type MyPrivate = impl Sized; LL | fn dont_define_this(_private: MyPrivate) {} | ^^^^^^^^^ | | - | expected struct `Private`, found opaque type + | expected `Private`, found opaque type | help: change the parameter type to match the trait: `Private` | note: type in trait -- cgit v1.2.3