From 2ff14448863ac1a1dd9533461708e29aae170c2d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:06:31 +0200 Subject: Adding debian version 1.65.0+dfsg1-2. Signed-off-by: Daniel Baumann --- src/test/ui/type-alias-impl-trait/closure_args.rs | 16 ++++++ src/test/ui/type-alias-impl-trait/closure_args2.rs | 23 +++++++++ .../ui/type-alias-impl-trait/constrain_inputs.rs | 24 +++++++-- .../type-alias-impl-trait/constrain_inputs.stderr | 58 ++++++++++++++++++++++ .../constrain_inputs_unsound.rs | 31 ++++++++++++ .../constrain_inputs_unsound.stderr | 9 ++++ .../generic_duplicate_param_use5.stderr | 8 +-- .../generic_duplicate_param_use6.stderr | 6 +-- .../generic_duplicate_param_use8.stderr | 4 +- .../generic_duplicate_param_use9.stderr | 8 +-- src/test/ui/type-alias-impl-trait/issue-57961.rs | 2 +- .../ui/type-alias-impl-trait/issue-57961.stderr | 2 +- .../ui/type-alias-impl-trait/issue-60371.stderr | 2 +- .../ui/type-alias-impl-trait/issue-74280.stderr | 2 +- src/test/ui/type-alias-impl-trait/issue-90400-1.rs | 1 - .../ui/type-alias-impl-trait/issue-90400-1.stderr | 4 +- src/test/ui/type-alias-impl-trait/issue-90400-2.rs | 1 - .../ui/type-alias-impl-trait/issue-90400-2.stderr | 6 +-- src/test/ui/type-alias-impl-trait/issue-98604.rs | 6 +-- .../ui/type-alias-impl-trait/issue-98604.stderr | 6 +-- src/test/ui/type-alias-impl-trait/issue-98608.rs | 6 ++- .../ui/type-alias-impl-trait/issue-98608.stderr | 6 +-- .../multiple-def-uses-in-one-fn.stderr | 2 +- .../not_a_defining_use.stderr | 4 +- .../underconstrained_generic.stderr | 2 +- 25 files changed, 195 insertions(+), 44 deletions(-) create mode 100644 src/test/ui/type-alias-impl-trait/closure_args.rs create mode 100644 src/test/ui/type-alias-impl-trait/closure_args2.rs create mode 100644 src/test/ui/type-alias-impl-trait/constrain_inputs.stderr create mode 100644 src/test/ui/type-alias-impl-trait/constrain_inputs_unsound.rs create mode 100644 src/test/ui/type-alias-impl-trait/constrain_inputs_unsound.stderr (limited to 'src/test/ui/type-alias-impl-trait') diff --git a/src/test/ui/type-alias-impl-trait/closure_args.rs b/src/test/ui/type-alias-impl-trait/closure_args.rs new file mode 100644 index 000000000..c5e7af81d --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/closure_args.rs @@ -0,0 +1,16 @@ +// check-pass + +// regression test for https://github.com/rust-lang/rust/issues/100800 + +#![feature(type_alias_impl_trait)] + +trait Anything {} +impl Anything for T {} +type Input = impl Anything; +fn run ()>(f: F, i: Input) { + f(i); +} + +fn main() { + run(|x: u32| {println!("{x}");}, 0); +} diff --git a/src/test/ui/type-alias-impl-trait/closure_args2.rs b/src/test/ui/type-alias-impl-trait/closure_args2.rs new file mode 100644 index 000000000..82386c280 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/closure_args2.rs @@ -0,0 +1,23 @@ +// run-pass + +#![feature(type_alias_impl_trait)] + +trait Foo { + // This was reachable in https://github.com/rust-lang/rust/issues/100800 + fn foo(&self) { unreachable!() } +} +impl Foo for T {} + +struct B; +impl B { + fn foo(&self) {} +} + +type Input = impl Foo; +fn run1(f: F, i: Input) {f(i)} +fn run2(f: F, i: B) {f(i)} + +fn main() { + run1(|x: B| {x.foo()}, B); + run2(|x: B| {x.foo()}, B); +} diff --git a/src/test/ui/type-alias-impl-trait/constrain_inputs.rs b/src/test/ui/type-alias-impl-trait/constrain_inputs.rs index c32174288..03fb64b7b 100644 --- a/src/test/ui/type-alias-impl-trait/constrain_inputs.rs +++ b/src/test/ui/type-alias-impl-trait/constrain_inputs.rs @@ -1,17 +1,33 @@ -// check-pass - #![feature(type_alias_impl_trait)] -mod foo { +mod lifetime_params { type Ty<'a> = impl Sized; fn defining(s: &str) -> Ty<'_> { s } fn execute(ty: Ty<'_>) -> &str { todo!() } + //~^ ERROR return type references an anonymous lifetime, which is not constrained by the fn input types + + type BadFnSig = fn(Ty<'_>) -> &str; + //~^ ERROR return type references an anonymous lifetime, which is not constrained by the fn input types + type BadTraitRef = dyn Fn(Ty<'_>) -> &str; + //~^ ERROR binding for associated type `Output` references an anonymous lifetime } -mod bar { +mod lifetime_params_2 { type Ty<'a> = impl FnOnce() -> &'a str; fn defining(s: &str) -> Ty<'_> { move || s } fn execute(ty: Ty<'_>) -> &str { ty() } + //~^ ERROR return type references an anonymous lifetime, which is not constrained by the fn input types +} + +// regression test for https://github.com/rust-lang/rust/issues/97104 +mod type_params { + type Ty = impl Sized; + fn define(s: T) -> Ty { s } + + type BadFnSig = fn(Ty<&str>) -> &str; + //~^ ERROR return type references an anonymous lifetime, which is not constrained by the fn input types + type BadTraitRef = dyn Fn(Ty<&str>) -> &str; + //~^ ERROR binding for associated type `Output` references an anonymous lifetime } fn main() {} diff --git a/src/test/ui/type-alias-impl-trait/constrain_inputs.stderr b/src/test/ui/type-alias-impl-trait/constrain_inputs.stderr new file mode 100644 index 000000000..93953fd06 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/constrain_inputs.stderr @@ -0,0 +1,58 @@ +error[E0581]: return type references an anonymous lifetime, which is not constrained by the fn input types + --> $DIR/constrain_inputs.rs:6:31 + | +LL | fn execute(ty: Ty<'_>) -> &str { todo!() } + | ^^^^ + | + = note: lifetimes appearing in an associated or opaque type are not considered constrained + = note: consider introducing a named lifetime parameter + +error[E0581]: return type references an anonymous lifetime, which is not constrained by the fn input types + --> $DIR/constrain_inputs.rs:9:35 + | +LL | type BadFnSig = fn(Ty<'_>) -> &str; + | ^^^^ + | + = note: lifetimes appearing in an associated or opaque type are not considered constrained + = note: consider introducing a named lifetime parameter + +error[E0582]: binding for associated type `Output` references an anonymous lifetime, which does not appear in the trait input types + --> $DIR/constrain_inputs.rs:11:42 + | +LL | type BadTraitRef = dyn Fn(Ty<'_>) -> &str; + | ^^^^ + | + = note: lifetimes appearing in an associated or opaque type are not considered constrained + = note: consider introducing a named lifetime parameter + +error[E0581]: return type references an anonymous lifetime, which is not constrained by the fn input types + --> $DIR/constrain_inputs.rs:18:31 + | +LL | fn execute(ty: Ty<'_>) -> &str { ty() } + | ^^^^ + | + = note: lifetimes appearing in an associated or opaque type are not considered constrained + = note: consider introducing a named lifetime parameter + +error[E0581]: return type references an anonymous lifetime, which is not constrained by the fn input types + --> $DIR/constrain_inputs.rs:27:37 + | +LL | type BadFnSig = fn(Ty<&str>) -> &str; + | ^^^^ + | + = note: lifetimes appearing in an associated or opaque type are not considered constrained + = note: consider introducing a named lifetime parameter + +error[E0582]: binding for associated type `Output` references an anonymous lifetime, which does not appear in the trait input types + --> $DIR/constrain_inputs.rs:29:44 + | +LL | type BadTraitRef = dyn Fn(Ty<&str>) -> &str; + | ^^^^ + | + = note: lifetimes appearing in an associated or opaque type are not considered constrained + = note: consider introducing a named lifetime parameter + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0581, E0582. +For more information about an error, try `rustc --explain E0581`. diff --git a/src/test/ui/type-alias-impl-trait/constrain_inputs_unsound.rs b/src/test/ui/type-alias-impl-trait/constrain_inputs_unsound.rs new file mode 100644 index 000000000..3bae0f173 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/constrain_inputs_unsound.rs @@ -0,0 +1,31 @@ +#![feature(type_alias_impl_trait)] + +trait Static: 'static {} +impl Static for () {} + +type Gal = impl Static; +fn _defining() -> Gal {} + +trait Callable { type Output; } + +/// We can infer `>::Output: 'static`, +/// because we know `C: 'static` and `Arg: 'static`, +fn box_str(s: C::Output) -> Box + 'static> +where + Arg: Static, + C: ?Sized + Callable + 'static, + C::Output: AsRef, +{ + Box::new(s) +} + +fn extend_lifetime(s: &str) -> Box + 'static> { + type MalformedTy = dyn for<'a> Callable, Output = &'a str>; + //~^ ERROR binding for associated type `Output` references lifetime `'a` + box_str::(s) +} + +fn main() { + let extended = extend_lifetime(&String::from("hello")); + println!("{}", extended.as_ref().as_ref()); +} diff --git a/src/test/ui/type-alias-impl-trait/constrain_inputs_unsound.stderr b/src/test/ui/type-alias-impl-trait/constrain_inputs_unsound.stderr new file mode 100644 index 000000000..d5fc46cb1 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/constrain_inputs_unsound.stderr @@ -0,0 +1,9 @@ +error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types + --> $DIR/constrain_inputs_unsound.rs:23:58 + | +LL | type MalformedTy = dyn for<'a> Callable, Output = &'a str>; + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0582`. diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use5.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use5.stderr index 2768f0c3a..586ea8234 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use5.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use5.stderr @@ -4,7 +4,7 @@ error[E0277]: `T` doesn't implement `Debug` LL | (t, u) | ^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(T, U)` + = note: required for `(T, U)` to implement `Debug` help: consider restricting type parameter `T` | LL | type Two = impl Debug; @@ -16,7 +16,7 @@ error[E0277]: `U` doesn't implement `Debug` LL | (t, u) | ^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(T, U)` + = note: required for `(T, U)` to implement `Debug` help: consider restricting type parameter `U` | LL | type Two = impl Debug; @@ -28,7 +28,7 @@ error[E0277]: `U` doesn't implement `Debug` LL | (u, t) | ^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(U, T)` + = note: required for `(U, T)` to implement `Debug` help: consider restricting type parameter `U` | LL | type Two = impl Debug; @@ -40,7 +40,7 @@ error[E0277]: `T` doesn't implement `Debug` LL | (u, t) | ^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(U, T)` + = note: required for `(U, T)` to implement `Debug` help: consider restricting type parameter `T` | LL | type Two = impl Debug; diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr index c1712ca2e..cb162d382 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr @@ -4,7 +4,7 @@ error[E0277]: `T` doesn't implement `Debug` LL | (t, t) | ^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(T, T)` + = note: required for `(T, T)` to implement `Debug` help: consider restricting type parameter `T` | LL | type Two = impl Debug; @@ -16,7 +16,7 @@ error[E0277]: `U` doesn't implement `Debug` LL | (u, t) | ^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(U, T)` + = note: required for `(U, T)` to implement `Debug` help: consider restricting type parameter `U` | LL | type Two = impl Debug; @@ -28,7 +28,7 @@ error[E0277]: `T` doesn't implement `Debug` LL | (u, t) | ^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(U, T)` + = note: required for `(U, T)` to implement `Debug` help: consider restricting type parameter `T` | LL | type Two = impl Debug; diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use8.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use8.stderr index b83105c45..14cbfb380 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use8.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use8.stderr @@ -4,7 +4,7 @@ error[E0277]: `T` doesn't implement `Debug` LL | (t, 4u32) | ^^^^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(T, u32)` + = note: required for `(T, u32)` to implement `Debug` help: consider restricting type parameter `T` | LL | type Two = impl Debug; @@ -16,7 +16,7 @@ error[E0277]: `U` doesn't implement `Debug` LL | (u, 4u32) | ^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(U, u32)` + = note: required for `(U, u32)` to implement `Debug` help: consider restricting type parameter `U` | LL | type Two = impl Debug; diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr index 50cf98273..722693e42 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr @@ -15,7 +15,7 @@ error[E0277]: `A` doesn't implement `Debug` LL | (t, u, T::BAR) | ^^^^^^^^^^^^^^ `A` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(A, B, _)` + = note: required for `(A, B, _)` to implement `Debug` help: consider restricting type parameter `A` | LL | type Two = impl Debug; @@ -27,7 +27,7 @@ error[E0277]: `B` doesn't implement `Debug` LL | (t, u, T::BAR) | ^^^^^^^^^^^^^^ `B` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(A, B, _)` + = note: required for `(A, B, _)` to implement `Debug` help: consider restricting type parameter `B` | LL | type Two = impl Debug; @@ -39,7 +39,7 @@ error[E0277]: `A` doesn't implement `Debug` LL | (t, u, 42) | ^^^^^^^^^^ `A` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(A, B, i32)` + = note: required for `(A, B, i32)` to implement `Debug` help: consider restricting type parameter `A` | LL | type Two = impl Debug; @@ -51,7 +51,7 @@ error[E0277]: `B` doesn't implement `Debug` LL | (t, u, 42) | ^^^^^^^^^^ `B` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(A, B, i32)` + = note: required for `(A, B, i32)` to implement `Debug` help: consider restricting type parameter `B` | LL | type Two = impl Debug; diff --git a/src/test/ui/type-alias-impl-trait/issue-57961.rs b/src/test/ui/type-alias-impl-trait/issue-57961.rs index 472886c9c..24b3a0458 100644 --- a/src/test/ui/type-alias-impl-trait/issue-57961.rs +++ b/src/test/ui/type-alias-impl-trait/issue-57961.rs @@ -8,7 +8,7 @@ trait Foo { impl Foo for () { type Bar = std::vec::IntoIter; - //~^ ERROR type mismatch resolving ` as Iterator>::Item == X + //~^ ERROR expected `std::vec::IntoIter` to be an iterator that yields `X`, but it yields `u32` } fn incoherent() { diff --git a/src/test/ui/type-alias-impl-trait/issue-57961.stderr b/src/test/ui/type-alias-impl-trait/issue-57961.stderr index ed4caf6ce..fb40895c4 100644 --- a/src/test/ui/type-alias-impl-trait/issue-57961.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-57961.stderr @@ -1,4 +1,4 @@ -error[E0271]: type mismatch resolving ` as Iterator>::Item == X` +error[E0271]: expected `std::vec::IntoIter` to be an iterator that yields `X`, but it yields `u32` --> $DIR/issue-57961.rs:10:16 | LL | type X = impl Sized; diff --git a/src/test/ui/type-alias-impl-trait/issue-60371.stderr b/src/test/ui/type-alias-impl-trait/issue-60371.stderr index 082b0f0c3..d0c04371b 100644 --- a/src/test/ui/type-alias-impl-trait/issue-60371.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-60371.stderr @@ -11,7 +11,7 @@ error[E0277]: the trait bound `(): Bug` is not satisfied --> $DIR/issue-60371.rs:10:40 | LL | const FUN: fn() -> Self::Item = || (); - | ^ the trait `Bug` is not implemented for `()` + | ^^ the trait `Bug` is not implemented for `()` | = help: the trait `Bug` is implemented for `&()` diff --git a/src/test/ui/type-alias-impl-trait/issue-74280.stderr b/src/test/ui/type-alias-impl-trait/issue-74280.stderr index 5ed29e0ac..66886db6e 100644 --- a/src/test/ui/type-alias-impl-trait/issue-74280.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-74280.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-74280.rs:9:5 | LL | fn test() -> Test { - | ---- expected `_` because of return type + | ---- expected `()` because of return type LL | let y = || -> Test { () }; LL | 7 | ^ expected `()`, found integer diff --git a/src/test/ui/type-alias-impl-trait/issue-90400-1.rs b/src/test/ui/type-alias-impl-trait/issue-90400-1.rs index 8550a3e86..15aead2f6 100644 --- a/src/test/ui/type-alias-impl-trait/issue-90400-1.rs +++ b/src/test/ui/type-alias-impl-trait/issue-90400-1.rs @@ -1,7 +1,6 @@ // Regression test for #90400, // taken from https://github.com/rust-lang/rust/issues/90400#issuecomment-954927836 -#![feature(generic_associated_types)] #![feature(type_alias_impl_trait)] trait Bar { diff --git a/src/test/ui/type-alias-impl-trait/issue-90400-1.stderr b/src/test/ui/type-alias-impl-trait/issue-90400-1.stderr index 428a10740..ead28769f 100644 --- a/src/test/ui/type-alias-impl-trait/issue-90400-1.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-90400-1.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `B: Bar` is not satisfied - --> $DIR/issue-90400-1.rs:23:9 + --> $DIR/issue-90400-1.rs:22:9 | LL | move || bar.bar() | ^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `B` | note: required by a bound in `::foo` - --> $DIR/issue-90400-1.rs:22:15 + --> $DIR/issue-90400-1.rs:21:15 | LL | fn foo(&self, bar: B) -> Self::FooFn { | ^^^ required by this bound in `::foo` diff --git a/src/test/ui/type-alias-impl-trait/issue-90400-2.rs b/src/test/ui/type-alias-impl-trait/issue-90400-2.rs index 2b369bb8a..4c6e893c1 100644 --- a/src/test/ui/type-alias-impl-trait/issue-90400-2.rs +++ b/src/test/ui/type-alias-impl-trait/issue-90400-2.rs @@ -1,7 +1,6 @@ // Regression test for #90400, // taken from https://github.com/rust-lang/rust/issues/90400#issuecomment-954927836 -#![feature(generic_associated_types)] #![feature(type_alias_impl_trait)] trait Bar { diff --git a/src/test/ui/type-alias-impl-trait/issue-90400-2.stderr b/src/test/ui/type-alias-impl-trait/issue-90400-2.stderr index 5da05a439..50b2dc049 100644 --- a/src/test/ui/type-alias-impl-trait/issue-90400-2.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-90400-2.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `B: Bar` is not satisfied - --> $DIR/issue-90400-2.rs:26:9 + --> $DIR/issue-90400-2.rs:25:9 | LL | MyBaz(bar) | ^^^^^^^^^^ the trait `Bar` is not implemented for `B` | -note: required because of the requirements on the impl of `Baz` for `MyBaz` - --> $DIR/issue-90400-2.rs:31:14 +note: required for `MyBaz` to implement `Baz` + --> $DIR/issue-90400-2.rs:30:14 | LL | impl Baz for MyBaz { | ^^^ ^^^^^^^^ diff --git a/src/test/ui/type-alias-impl-trait/issue-98604.rs b/src/test/ui/type-alias-impl-trait/issue-98604.rs index a4fd8a82a..32c2f9ed5 100644 --- a/src/test/ui/type-alias-impl-trait/issue-98604.rs +++ b/src/test/ui/type-alias-impl-trait/issue-98604.rs @@ -1,13 +1,11 @@ // edition:2018 -type AsyncFnPtr = Box< - dyn Fn() -> std::pin::Pin>>, ->; +type AsyncFnPtr = Box std::pin::Pin>>>; async fn test() {} #[allow(unused_must_use)] fn main() { Box::new(test) as AsyncFnPtr; - //~^ ERROR type mismatch + //~^ ERROR expected `fn() -> impl Future {test}` to be a fn item that returns `Pin + 'static)>>`, but it returns `impl Future` } diff --git a/src/test/ui/type-alias-impl-trait/issue-98604.stderr b/src/test/ui/type-alias-impl-trait/issue-98604.stderr index f04d1b4d7..92d01eb0d 100644 --- a/src/test/ui/type-alias-impl-trait/issue-98604.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-98604.stderr @@ -1,11 +1,11 @@ -error[E0271]: type mismatch resolving ` impl Future {test} as FnOnce<()>>::Output == Pin + 'static)>>` - --> $DIR/issue-98604.rs:11:5 +error[E0271]: expected `fn() -> impl Future {test}` to be a fn item that returns `Pin + 'static)>>`, but it returns `impl Future` + --> $DIR/issue-98604.rs:9:5 | LL | Box::new(test) as AsyncFnPtr; | ^^^^^^^^^^^^^^ expected struct `Pin`, found opaque type | note: while checking the return type of the `async fn` - --> $DIR/issue-98604.rs:7:17 + --> $DIR/issue-98604.rs:5:17 | LL | async fn test() {} | ^ checked the `Output` of this `async fn`, found opaque type diff --git a/src/test/ui/type-alias-impl-trait/issue-98608.rs b/src/test/ui/type-alias-impl-trait/issue-98608.rs index d75762a8b..1f89af045 100644 --- a/src/test/ui/type-alias-impl-trait/issue-98608.rs +++ b/src/test/ui/type-alias-impl-trait/issue-98608.rs @@ -1,8 +1,10 @@ -fn hi() -> impl Sized { std::ptr::null::() } +fn hi() -> impl Sized { + std::ptr::null::() +} fn main() { let b: Box Box> = Box::new(hi); - //~^ ERROR type mismatch resolving ` impl Sized {hi} as FnOnce<()>>::Output == Box` + //~^ ERROR expected `fn() -> impl Sized {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/src/test/ui/type-alias-impl-trait/issue-98608.stderr b/src/test/ui/type-alias-impl-trait/issue-98608.stderr index 8f3ec7d9d..916a58451 100644 --- a/src/test/ui/type-alias-impl-trait/issue-98608.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-98608.stderr @@ -1,7 +1,7 @@ -error[E0271]: type mismatch resolving ` impl Sized {hi} as FnOnce<()>>::Output == Box` - --> $DIR/issue-98608.rs:4:39 +error[E0271]: expected `fn() -> impl Sized {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 { std::ptr::null::() } +LL | fn hi() -> impl Sized { | ---------- the found opaque type ... LL | let b: Box Box> = Box::new(hi); diff --git a/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr b/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr index cdaae99e2..66a6b0bbf 100644 --- a/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr +++ b/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `&'static B: From<&A>` is not satisfied LL | fn f(a: &'static A, b: B) -> (X, X) { | ^^^^^^^^^^^^^^^^^^ the trait `From<&A>` is not implemented for `&'static B` | - = note: required because of the requirements on the impl of `Into<&'static B>` for `&A` + = note: required for `&A` to implement `Into<&'static B>` help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | fn f(a: &'static A, b: B) -> (X, X) where &'static B: From<&A> { diff --git a/src/test/ui/type-alias-impl-trait/not_a_defining_use.stderr b/src/test/ui/type-alias-impl-trait/not_a_defining_use.stderr index a5ac38c38..b11198c58 100644 --- a/src/test/ui/type-alias-impl-trait/not_a_defining_use.stderr +++ b/src/test/ui/type-alias-impl-trait/not_a_defining_use.stderr @@ -4,7 +4,7 @@ error[E0277]: `T` doesn't implement `Debug` LL | (t, 5i8) | ^^^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(T, i8)` + = note: required for `(T, i8)` to implement `Debug` help: consider restricting type parameter `T` | LL | type Two = impl Debug; @@ -27,7 +27,7 @@ error[E0277]: `T` doesn't implement `Debug` LL | (t, ::FOO) | ^^^^^^^^^^^^^^^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(T, _)` + = note: required for `(T, _)` to implement `Debug` help: consider restricting type parameter `T` | LL | type Two = impl Debug; diff --git a/src/test/ui/type-alias-impl-trait/underconstrained_generic.stderr b/src/test/ui/type-alias-impl-trait/underconstrained_generic.stderr index e70916573..95fb6f6a5 100644 --- a/src/test/ui/type-alias-impl-trait/underconstrained_generic.stderr +++ b/src/test/ui/type-alias-impl-trait/underconstrained_generic.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `T: Trait` is not satisfied LL | () | ^^ the trait `Trait` is not implemented for `T` | -note: required because of the requirements on the impl of `ProofForConversion` for `()` +note: required for `()` to implement `ProofForConversion` --> $DIR/underconstrained_generic.rs:13:16 | LL | impl ProofForConversion for () { -- cgit v1.2.3