Rollup merge of #66435 - JohnTitor:fix-spelling, r=Centril

Correct `const_in_array_repeat_expressions` feature name

Fixes #66433

r? @estebank
This commit is contained in:
Tyler Mandry 2019-11-15 14:44:50 +01:00 committed by GitHub
commit d99026e891
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 7 deletions

View file

@ -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");
}
}

View file

@ -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),

View file

@ -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(

View file

@ -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.

View file

@ -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