Skip to content

Correct const_in_array_repeat_expressions feature name #66435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/librustc/traits/error_reporting.rs
Original file line number Diff line number Diff line change
@@ -2176,15 +2176,15 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
err.note(&format!("required by cast to type `{}`",
self.ty_to_string(target)));
}
ObligationCauseCode::RepeatVec(suggest_const_in_array_repeat_expression) => {
ObligationCauseCode::RepeatVec(suggest_const_in_array_repeat_expressions) => {
err.note("the `Copy` trait is required because the \
repeated element will be copied");
if suggest_const_in_array_repeat_expression {
if suggest_const_in_array_repeat_expressions {
err.note("this array initializer can be evaluated at compile-time, for more \
information, see issue \
https://github.com/rust-lang/rust/issues/49147");
if tcx.sess.opts.unstable_features.is_nightly_build() {
err.help("add `#![feature(const_in_array_repeat_expression)]` to the \
err.help("add `#![feature(const_in_array_repeat_expressions)]` to the \
crate attributes to enable");
}
}
2 changes: 1 addition & 1 deletion src/librustc/traits/mod.rs
Original file line number Diff line number Diff line change
@@ -206,7 +206,7 @@ pub enum ObligationCauseCode<'tcx> {
SizedReturnType,
/// Yield type must be Sized
SizedYieldType,
/// [T,..n] --> T must be Copy. If `true`, suggest `const_in_array_repeat_expression` feature
/// [T,..n] --> T must be Copy. If `true`, suggest `const_in_array_repeat_expressions` feature
/// flag.
RepeatVec(bool),

2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/nll/type_check/mod.rs
Original file line number Diff line number Diff line change
@@ -1987,7 +1987,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
let span = body.source_info(location).span;
let ty = operand.ty(body, tcx);
if !self.infcx.type_is_copy_modulo_regions(self.param_env, ty, span) {
// To determine if `const_in_array_repeat_expression` feature gate should
// To determine if `const_in_array_repeat_expressions` feature gate should
// be mentioned, need to check if the rvalue is promotable.
let should_suggest =
should_suggest_const_in_array_repeat_expressions_attribute(
2 changes: 1 addition & 1 deletion src/librustc_mir/transform/promote_consts.rs
Original file line number Diff line number Diff line change
@@ -1185,7 +1185,7 @@ pub fn promote_candidates<'tcx>(
promotions
}

/// This function returns `true` if the `const_in_array_repeat_expression` feature attribute should
/// This function returns `true` if the `const_in_array_repeat_expressions` feature attribute should
/// be suggested. This function is probably quite expensive, it shouldn't be run in the happy path.
/// Feature attribute should be suggested if `operand` can be promoted and the feature is not
/// enabled.
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ LL | let arr: [Option<String>; 2] = [None::<String>; 2];
<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
= help: add `#![feature(const_in_array_repeat_expressions)]` to the crate attributes to enable

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