summaryrefslogtreecommitdiffstats
path: root/src/test/ui/impl-trait/nested_impl_trait.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/impl-trait/nested_impl_trait.stderr
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/test/ui/impl-trait/nested_impl_trait.stderr70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/test/ui/impl-trait/nested_impl_trait.stderr b/src/test/ui/impl-trait/nested_impl_trait.stderr
new file mode 100644
index 000000000..bb4ae5e82
--- /dev/null
+++ b/src/test/ui/impl-trait/nested_impl_trait.stderr
@@ -0,0 +1,70 @@
+error[E0666]: nested `impl Trait` is not allowed
+ --> $DIR/nested_impl_trait.rs:5:56
+ |
+LL | fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }
+ | ----------^^^^^^^^^^-
+ | | |
+ | | nested `impl Trait` here
+ | outer `impl Trait`
+
+error[E0666]: nested `impl Trait` is not allowed
+ --> $DIR/nested_impl_trait.rs:9:42
+ |
+LL | fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}
+ | ----------^^^^^^^^^^-
+ | | |
+ | | nested `impl Trait` here
+ | outer `impl Trait`
+
+error[E0666]: nested `impl Trait` is not allowed
+ --> $DIR/nested_impl_trait.rs:13:37
+ |
+LL | fn bad_in_arg_position(_: impl Into<impl Debug>) { }
+ | ----------^^^^^^^^^^-
+ | | |
+ | | nested `impl Trait` here
+ | outer `impl Trait`
+
+error[E0666]: nested `impl Trait` is not allowed
+ --> $DIR/nested_impl_trait.rs:18:44
+ |
+LL | fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }
+ | ----------^^^^^^^^^^-
+ | | |
+ | | nested `impl Trait` here
+ | outer `impl Trait`
+
+error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return
+ --> $DIR/nested_impl_trait.rs:9:32
+ |
+LL | fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return
+ --> $DIR/nested_impl_trait.rs:27:42
+ |
+LL | fn allowed_in_ret_type() -> impl Fn() -> impl Into<u32> {
+ | ^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `impl Debug: From<impl Into<u32>>` is not satisfied
+ --> $DIR/nested_impl_trait.rs:5:46
+ |
+LL | fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }
+ | ^^^^^^^^^^^^^^^^^^^^^ the trait `From<impl Into<u32>>` is not implemented for `impl Debug`
+ |
+ = help: the trait `Into<U>` is implemented for `T`
+ = note: required because of the requirements on the impl of `Into<impl Debug>` for `impl Into<u32>`
+
+error[E0277]: the trait bound `impl Debug: From<impl Into<u32>>` is not satisfied
+ --> $DIR/nested_impl_trait.rs:18:34
+ |
+LL | fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }
+ | ^^^^^^^^^^^^^^^^^^^^^ the trait `From<impl Into<u32>>` is not implemented for `impl Debug`
+ |
+ = help: the trait `Into<U>` is implemented for `T`
+ = note: required because of the requirements on the impl of `Into<impl Debug>` for `impl Into<u32>`
+
+error: aborting due to 8 previous errors
+
+Some errors have detailed explanations: E0277, E0562, E0666.
+For more information about an error, try `rustc --explain E0277`.