about summary refs log tree commit diff
path: root/tests/ui/impl-trait/precise-capturing/bad-params.stderr
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/impl-trait/precise-capturing/bad-params.stderr')
-rw-r--r--tests/ui/impl-trait/precise-capturing/bad-params.stderr46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/precise-capturing/bad-params.stderr b/tests/ui/impl-trait/precise-capturing/bad-params.stderr
new file mode 100644
index 00000000000..27bf05302f9
--- /dev/null
+++ b/tests/ui/impl-trait/precise-capturing/bad-params.stderr
@@ -0,0 +1,46 @@
+error[E0412]: cannot find type `T` in this scope
+  --> $DIR/bad-params.rs:4:26
+   |
+LL | fn missing() -> impl use<T> Sized {}
+   |                          ^ not found in this scope
+   |
+help: you might be missing a type parameter
+   |
+LL | fn missing<T>() -> impl use<T> Sized {}
+   |           +++
+
+error[E0411]: cannot find type `Self` in this scope
+  --> $DIR/bad-params.rs:7:31
+   |
+LL | fn missing_self() -> impl use<Self> Sized {}
+   |    ------------               ^^^^ `Self` is only available in impls, traits, and type definitions
+   |    |
+   |    `Self` not allowed in a function
+
+warning: the feature `precise_capturing` is incomplete and may not be safe to use and/or cause compiler crashes
+  --> $DIR/bad-params.rs:1:12
+   |
+LL | #![feature(precise_capturing)]
+   |            ^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #123432 <https://github.com/rust-lang/rust/issues/123432> for more information
+   = note: `#[warn(incomplete_features)]` on by default
+
+error: `Self` can't be captured in `use<...>` precise captures list, since it is an alias
+  --> $DIR/bad-params.rs:12:40
+   |
+LL | impl MyType {
+   | ----------- `Self` is not a generic argument, but an alias to the type of the implementation
+LL |     fn self_is_not_param() -> impl use<Self> Sized {}
+   |                                        ^^^^
+
+error: expected type or const parameter in `use<...>` precise captures list, found function
+  --> $DIR/bad-params.rs:16:24
+   |
+LL | fn hello() -> impl use<hello> Sized {}
+   |                        ^^^^^
+
+error: aborting due to 4 previous errors; 1 warning emitted
+
+Some errors have detailed explanations: E0411, E0412.
+For more information about an error, try `rustc --explain E0411`.