summaryrefslogtreecommitdiffstats
path: root/src/test/ui/type-alias-impl-trait
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/type-alias-impl-trait')
-rw-r--r--src/test/ui/type-alias-impl-trait/closure_args.rs16
-rw-r--r--src/test/ui/type-alias-impl-trait/closure_args2.rs23
-rw-r--r--src/test/ui/type-alias-impl-trait/constrain_inputs.rs24
-rw-r--r--src/test/ui/type-alias-impl-trait/constrain_inputs.stderr58
-rw-r--r--src/test/ui/type-alias-impl-trait/constrain_inputs_unsound.rs31
-rw-r--r--src/test/ui/type-alias-impl-trait/constrain_inputs_unsound.stderr9
-rw-r--r--src/test/ui/type-alias-impl-trait/generic_duplicate_param_use5.stderr8
-rw-r--r--src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr6
-rw-r--r--src/test/ui/type-alias-impl-trait/generic_duplicate_param_use8.stderr4
-rw-r--r--src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr8
-rw-r--r--src/test/ui/type-alias-impl-trait/issue-57961.rs2
-rw-r--r--src/test/ui/type-alias-impl-trait/issue-57961.stderr2
-rw-r--r--src/test/ui/type-alias-impl-trait/issue-60371.stderr2
-rw-r--r--src/test/ui/type-alias-impl-trait/issue-74280.stderr2
-rw-r--r--src/test/ui/type-alias-impl-trait/issue-90400-1.rs1
-rw-r--r--src/test/ui/type-alias-impl-trait/issue-90400-1.stderr4
-rw-r--r--src/test/ui/type-alias-impl-trait/issue-90400-2.rs1
-rw-r--r--src/test/ui/type-alias-impl-trait/issue-90400-2.stderr6
-rw-r--r--src/test/ui/type-alias-impl-trait/issue-98604.rs6
-rw-r--r--src/test/ui/type-alias-impl-trait/issue-98604.stderr6
-rw-r--r--src/test/ui/type-alias-impl-trait/issue-98608.rs6
-rw-r--r--src/test/ui/type-alias-impl-trait/issue-98608.stderr6
-rw-r--r--src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr2
-rw-r--r--src/test/ui/type-alias-impl-trait/not_a_defining_use.stderr4
-rw-r--r--src/test/ui/type-alias-impl-trait/underconstrained_generic.stderr2
25 files changed, 195 insertions, 44 deletions
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<T> Anything for T {}
+type Input = impl Anything;
+fn run<F: FnOnce(Input) -> ()>(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<T> Foo for T {}
+
+struct B;
+impl B {
+ fn foo(&self) {}
+}
+
+type Input = impl Foo;
+fn run1<F: FnOnce(Input)>(f: F, i: Input) {f(i)}
+fn run2<F: FnOnce(B)>(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<T> = impl Sized;
+ fn define<T>(s: T) -> Ty<T> { 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<T> = impl Static;
+fn _defining<T>() -> Gal<T> {}
+
+trait Callable<Arg> { type Output; }
+
+/// We can infer `<C as Callable<Arg>>::Output: 'static`,
+/// because we know `C: 'static` and `Arg: 'static`,
+fn box_str<C, Arg>(s: C::Output) -> Box<dyn AsRef<str> + 'static>
+where
+ Arg: Static,
+ C: ?Sized + Callable<Arg> + 'static,
+ C::Output: AsRef<str>,
+{
+ Box::new(s)
+}
+
+fn extend_lifetime(s: &str) -> Box<dyn AsRef<str> + 'static> {
+ type MalformedTy = dyn for<'a> Callable<Gal<&'a ()>, Output = &'a str>;
+ //~^ ERROR binding for associated type `Output` references lifetime `'a`
+ box_str::<MalformedTy, _>(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<Gal<&'a ()>, 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<T: std::fmt::Debug, U> = 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<T, U: std::fmt::Debug> = 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<T, U: std::fmt::Debug> = 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<T: std::fmt::Debug, U> = 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<T: std::fmt::Debug, U> = 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<T, U: std::fmt::Debug> = 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<T: std::fmt::Debug, U> = 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<T: std::fmt::Debug, U> = 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<T, U: std::fmt::Debug> = 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<A: std::fmt::Debug, B> = 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<A, B: std::fmt::Debug> = 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<A: std::fmt::Debug, B> = 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<A, B: std::fmt::Debug> = 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<u32>;
- //~^ ERROR type mismatch resolving `<std::vec::IntoIter<u32> as Iterator>::Item == X
+ //~^ ERROR expected `std::vec::IntoIter<u32>` 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 `<std::vec::IntoIter<u32> as Iterator>::Item == X`
+error[E0271]: expected `std::vec::IntoIter<u32>` 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 `<MyFoo as Foo>::foo`
- --> $DIR/issue-90400-1.rs:22:15
+ --> $DIR/issue-90400-1.rs:21:15
|
LL | fn foo<B: Bar>(&self, bar: B) -> Self::FooFn<B> {
| ^^^ required by this bound in `<MyFoo as Foo>::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<B>`
- --> $DIR/issue-90400-2.rs:31:14
+note: required for `MyBaz<B>` to implement `Baz`
+ --> $DIR/issue-90400-2.rs:30:14
|
LL | impl<B: Bar> Baz for MyBaz<B> {
| ^^^ ^^^^^^^^
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<Box<dyn std::future::Future<Output = ()>>>,
->;
+type AsyncFnPtr = Box<dyn Fn() -> std::pin::Pin<Box<dyn std::future::Future<Output = ()>>>>;
async fn test() {}
#[allow(unused_must_use)]
fn main() {
Box::new(test) as AsyncFnPtr;
- //~^ ERROR type mismatch
+ //~^ ERROR expected `fn() -> impl Future<Output = ()> {test}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
}
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 `<fn() -> impl Future<Output = ()> {test} as FnOnce<()>>::Output == Pin<Box<(dyn Future<Output = ()> + 'static)>>`
- --> $DIR/issue-98604.rs:11:5
+error[E0271]: expected `fn() -> impl Future<Output = ()> {test}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
+ --> $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::<u8>() }
+fn hi() -> impl Sized {
+ std::ptr::null::<u8>()
+}
fn main() {
let b: Box<dyn Fn() -> Box<u8>> = Box::new(hi);
- //~^ ERROR type mismatch resolving `<fn() -> impl Sized {hi} as FnOnce<()>>::Output == Box<u8>`
+ //~^ ERROR expected `fn() -> impl Sized {hi}` to be a fn item that returns `Box<u8>`, 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 `<fn() -> impl Sized {hi} as FnOnce<()>>::Output == Box<u8>`
- --> $DIR/issue-98608.rs:4:39
+error[E0271]: expected `fn() -> impl Sized {hi}` to be a fn item that returns `Box<u8>`, but it returns `impl Sized`
+ --> $DIR/issue-98608.rs:6:39
|
-LL | fn hi() -> impl Sized { std::ptr::null::<u8>() }
+LL | fn hi() -> impl Sized {
| ---------- the found opaque type
...
LL | let b: Box<dyn Fn() -> Box<u8>> = 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, B: 'static>(a: &'static A, b: B) -> (X<A, B>, X<B, A>) {
| ^^^^^^^^^^^^^^^^^^ 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, B: 'static>(a: &'static A, b: B) -> (X<A, B>, X<B, A>) 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<T: std::fmt::Debug, U> = impl Debug;
@@ -27,7 +27,7 @@ error[E0277]: `T` doesn't implement `Debug`
LL | (t, <U as Bar>::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<T: std::fmt::Debug, U> = 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<T>` for `()`
+note: required for `()` to implement `ProofForConversion<T>`
--> $DIR/underconstrained_generic.rs:13:16
|
LL | impl<X: Trait> ProofForConversion<X> for () {