diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/consts/const-blocks/fn-call-in-non-const.stderr | 1 | ||||
| -rw-r--r-- | src/test/ui/consts/const-fn-in-vec.rs | 7 | ||||
| -rw-r--r-- | src/test/ui/consts/const-fn-in-vec.stderr | 12 |
3 files changed, 20 insertions, 0 deletions
diff --git a/src/test/ui/consts/const-blocks/fn-call-in-non-const.stderr b/src/test/ui/consts/const-blocks/fn-call-in-non-const.stderr index b75452cd217..661f279e6be 100644 --- a/src/test/ui/consts/const-blocks/fn-call-in-non-const.stderr +++ b/src/test/ui/consts/const-blocks/fn-call-in-non-const.stderr @@ -7,6 +7,7 @@ LL | let _: [Option<Bar>; 2] = [no_copy(); 2]; = help: the following implementations were found: <Option<T> as Copy> = note: the `Copy` trait is required because the repeated element will be copied + = help: create an inline `const` block, see PR #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information error: aborting due to previous error diff --git a/src/test/ui/consts/const-fn-in-vec.rs b/src/test/ui/consts/const-fn-in-vec.rs new file mode 100644 index 00000000000..edf29015200 --- /dev/null +++ b/src/test/ui/consts/const-fn-in-vec.rs @@ -0,0 +1,7 @@ +fn main() { + // should hint to create an inline const block + // as all tests are on "nightly" + let strings: [String; 5] = [String::new(); 5]; + //~^ ERROR the trait bound `String: Copy` is not satisfied + println!("{:?}", strings); +} diff --git a/src/test/ui/consts/const-fn-in-vec.stderr b/src/test/ui/consts/const-fn-in-vec.stderr new file mode 100644 index 00000000000..c477605842d --- /dev/null +++ b/src/test/ui/consts/const-fn-in-vec.stderr @@ -0,0 +1,12 @@ +error[E0277]: the trait bound `String: Copy` is not satisfied + --> $DIR/const-fn-in-vec.rs:4:32 + | +LL | let strings: [String; 5] = [String::new(); 5]; + | ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` + | + = note: the `Copy` trait is required because the repeated element will be copied + = help: create an inline `const` block, see PR #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. |
