-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
suggest
const_in_array_repeat_expression
flag
This commit adds a suggestion to add the `#![feature(const_in_array_repeat_expression)]` attribute to the crate when a promotable expression is used in a repeat expression. Signed-off-by: David Wood <david@davidtw.co>
- Loading branch information
Showing
8 changed files
with
83 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 14 additions & 2 deletions
16
src/test/ui/feature-gates/feature-gate-const_in_array_repeat_expressions.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
error[E0277]: the trait bound `std::option::Option<std::string::String>: std::marker::Copy` is not satisfied | ||
--> $DIR/feature-gate-const_in_array_repeat_expressions.rs:7:36 | ||
--> $DIR/feature-gate-const_in_array_repeat_expressions.rs:8:36 | ||
| | ||
LL | let arr: [Option<String>; 2] = [None::<String>; 2]; | ||
| ^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::option::Option<std::string::String>` | ||
| | ||
= help: the following implementations were found: | ||
<std::option::Option<T> as std::marker::Copy> | ||
= note: the `Copy` trait is required because the repeated element will be copied | ||
= note: this array initializer can be evaluated at compile-time, for more information, see issue https://github.com/rust-lang/rust/issues/49147 | ||
= help: add `#![feature(const_in_array_repeat_expression)]` to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
error[E0277]: the trait bound `std::option::Option<std::string::String>: std::marker::Copy` is not satisfied | ||
--> $DIR/feature-gate-const_in_array_repeat_expressions.rs:14:36 | ||
| | ||
LL | let arr: [Option<String>; 2] = [Some("foo".to_string()); 2]; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::option::Option<std::string::String>` | ||
| | ||
= help: the following implementations were found: | ||
<std::option::Option<T> as std::marker::Copy> | ||
= note: the `Copy` trait is required because the repeated element will be copied | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0277`. |