diff options
| author | Henry Boisdequin <65845077+henryboisdequin@users.noreply.github.com> | 2021-02-14 10:08:37 +0530 |
|---|---|---|
| committer | Henry Boisdequin <65845077+henryboisdequin@users.noreply.github.com> | 2021-02-14 10:08:37 +0530 |
| commit | 64fe2c183d722ef3d2e9dee312de4b98aa6af9a0 (patch) | |
| tree | f388bc53c77c5d756c03b8208a3dc7022bd59eaa /src/test | |
| parent | c2e849c0221bbaf1106884cd776e375168a95323 (diff) | |
update message
Diffstat (limited to 'src/test')
| -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 | 4 | ||||
| -rw-r--r-- | src/test/ui/consts/const-fn-in-vec.stderr | 1 |
3 files changed, 4 insertions, 2 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 661f279e6be..303de078013 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: consider creating a new `const` item and initializing with the result of the function call to be used in the repeat position, like `const VAL: Type = const_fn();` and `let x = [VAL; 42];` = 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 index edf29015200..a40290eca09 100644 --- a/src/test/ui/consts/const-fn-in-vec.rs +++ b/src/test/ui/consts/const-fn-in-vec.rs @@ -1,6 +1,6 @@ fn main() { - // should hint to create an inline const block - // as all tests are on "nightly" + // should hint to create an inline `const` block + // or to create a new `const` item 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 index c477605842d..f9f184dfc06 100644 --- a/src/test/ui/consts/const-fn-in-vec.stderr +++ b/src/test/ui/consts/const-fn-in-vec.stderr @@ -5,6 +5,7 @@ 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: consider creating a new `const` item and initializing with the result of the function call to be used in the repeat position, like `const VAL: Type = const_fn();` and `let x = [VAL; 42];` = 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 |
