diff options
Diffstat (limited to 'src/test/ui/impl-trait')
| -rw-r--r-- | src/test/ui/impl-trait/bindings.rs | 30 | ||||
| -rw-r--r-- | src/test/ui/impl-trait/bindings.stderr | 37 |
2 files changed, 35 insertions, 32 deletions
diff --git a/src/test/ui/impl-trait/bindings.rs b/src/test/ui/impl-trait/bindings.rs deleted file mode 100644 index fd79ba68fbd..00000000000 --- a/src/test/ui/impl-trait/bindings.rs +++ /dev/null @@ -1,30 +0,0 @@ -#![feature(impl_trait_in_bindings)] -//~^ WARN the feature `impl_trait_in_bindings` is incomplete - -fn a<T: Clone>(x: T) { - const foo: impl Clone = x; - //~^ ERROR attempt to use a non-constant value in a constant -} - -fn b<T: Clone>(x: T) { - let _ = move || { - const foo: impl Clone = x; - //~^ ERROR attempt to use a non-constant value in a constant - }; -} - -trait Foo<T: Clone> { - fn a(x: T) { - const foo: impl Clone = x; - //~^ ERROR attempt to use a non-constant value in a constant - } -} - -impl<T: Clone> Foo<T> for i32 { - fn a(x: T) { - const foo: impl Clone = x; - //~^ ERROR attempt to use a non-constant value in a constant - } -} - -fn main() { } diff --git a/src/test/ui/impl-trait/bindings.stderr b/src/test/ui/impl-trait/bindings.stderr index 4da49f4dc7d..05f3f2e0d3e 100644 --- a/src/test/ui/impl-trait/bindings.stderr +++ b/src/test/ui/impl-trait/bindings.stderr @@ -30,6 +30,38 @@ LL | const foo: impl Clone = x; | | | help: consider using `let` instead of `const`: `let foo` +error[E0562]: `impl Trait` not allowed outside of function and inherent method return types + --> $DIR/bindings.rs:5:16 + | +LL | const foo: impl Clone = x; + | ^^^^^^^^^^ + | + = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable + +error[E0562]: `impl Trait` not allowed outside of function and inherent method return types + --> $DIR/bindings.rs:11:20 + | +LL | const foo: impl Clone = x; + | ^^^^^^^^^^ + | + = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable + +error[E0562]: `impl Trait` not allowed outside of function and inherent method return types + --> $DIR/bindings.rs:18:20 + | +LL | const foo: impl Clone = x; + | ^^^^^^^^^^ + | + = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable + +error[E0562]: `impl Trait` not allowed outside of function and inherent method return types + --> $DIR/bindings.rs:25:20 + | +LL | const foo: impl Clone = x; + | ^^^^^^^^^^ + | + = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable + warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/bindings.rs:1:12 | @@ -39,6 +71,7 @@ LL | #![feature(impl_trait_in_bindings)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information -error: aborting due to 4 previous errors; 1 warning emitted +error: aborting due to 8 previous errors; 1 warning emitted -For more information about this error, try `rustc --explain E0435`. +Some errors have detailed explanations: E0435, E0562. +For more information about an error, try `rustc --explain E0435`. |
