From 759c7e43971132f7708c1de8b090392e0aef659f Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Fri, 15 Nov 2019 15:50:52 +0900 Subject: [PATCH] Correct `const_in_array_repeat_expressions` feature name --- src/librustc/traits/error_reporting.rs | 6 +++--- src/librustc/traits/mod.rs | 2 +- src/librustc_mir/borrow_check/nll/type_check/mod.rs | 2 +- src/librustc_mir/transform/promote_consts.rs | 2 +- .../feature-gate-const_in_array_repeat_expressions.stderr | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 82631ce743596..c7e51ff321771 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -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"); } } diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index a29d8c66d811d..e052ba4478145 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -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), diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index 6e9e8abbeffe1..9f20a24a183c9 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -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( diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index a7f48162f9b18..b4da437279db1 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -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. diff --git a/src/test/ui/feature-gates/feature-gate-const_in_array_repeat_expressions.stderr b/src/test/ui/feature-gates/feature-gate-const_in_array_repeat_expressions.stderr index cd9242de88f25..08d9ada884a53 100644 --- a/src/test/ui/feature-gates/feature-gate-const_in_array_repeat_expressions.stderr +++ b/src/test/ui/feature-gates/feature-gate-const_in_array_repeat_expressions.stderr @@ -8,7 +8,7 @@ LL | let arr: [Option; 2] = [None::; 2]; 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::marker::Copy` is not satisfied --> $DIR/feature-gate-const_in_array_repeat_expressions.rs:14:36