diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/impl-trait/precise-capturing/bad-params.rs | 6 | ||||
| -rw-r--r-- | tests/ui/impl-trait/precise-capturing/bad-params.stderr | 32 |
2 files changed, 24 insertions, 14 deletions
diff --git a/tests/ui/impl-trait/precise-capturing/bad-params.rs b/tests/ui/impl-trait/precise-capturing/bad-params.rs index c600fa96f79..195bd1b67ae 100644 --- a/tests/ui/impl-trait/precise-capturing/bad-params.rs +++ b/tests/ui/impl-trait/precise-capturing/bad-params.rs @@ -2,15 +2,15 @@ //~^ WARN the feature `precise_capturing` is incomplete fn missing() -> impl use<T> Sized {} -//~^ ERROR could not find type or const parameter +//~^ ERROR cannot find type `T` in this scope fn missing_self() -> impl use<Self> Sized {} -//~^ ERROR could not find type or const parameter +//~^ ERROR cannot find type `Self` in this scope struct MyType; impl MyType { fn self_is_not_param() -> impl use<Self> Sized {} - //~^ ERROR `Self` cannot be captured because it is not a type parameter + //~^ ERROR `Self` can't be captured in `use<...>` precise captures list, since it is an alias } fn main() {} diff --git a/tests/ui/impl-trait/precise-capturing/bad-params.stderr b/tests/ui/impl-trait/precise-capturing/bad-params.stderr index bb5fe76ae3e..09694a800c4 100644 --- a/tests/ui/impl-trait/precise-capturing/bad-params.stderr +++ b/tests/ui/impl-trait/precise-capturing/bad-params.stderr @@ -1,20 +1,21 @@ -error[E0433]: failed to resolve: could not find type or const parameter +error[E0412]: cannot find type `T` in this scope --> $DIR/bad-params.rs:4:26 | LL | fn missing() -> impl use<T> Sized {} - | ^ could not find type or const parameter + | ^ not found in this scope + | +help: you might be missing a type parameter + | +LL | fn missing<T>() -> impl use<T> Sized {} + | +++ -error[E0433]: failed to resolve: could not find type or const parameter +error[E0411]: cannot find type `Self` in this scope --> $DIR/bad-params.rs:7:31 | LL | fn missing_self() -> impl use<Self> Sized {} - | ^^^^ could not find type or const parameter - -error[E0433]: failed to resolve: `Self` cannot be captured because it is not a type parameter - --> $DIR/bad-params.rs:12:40 - | -LL | fn self_is_not_param() -> impl use<Self> Sized {} - | ^^^^ `Self` cannot be captured because it is not a type parameter + | ------------ ^^^^ `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 @@ -25,6 +26,15 @@ 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: aborting due to 3 previous errors; 1 warning emitted -For more information about this error, try `rustc --explain E0433`. +Some errors have detailed explanations: E0411, E0412. +For more information about an error, try `rustc --explain E0411`. |
