Skip to content

Commit bba2bac

Browse files
improve const fn RepeatVec diagnostics
1 parent eb476b1 commit bba2bac

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1908,15 +1908,15 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
19081908

19091909
if is_const_fn {
19101910
err.help(
1911-
"consider creating a new `const` item and initializing with the result \
1911+
"consider creating a new `const` item and initializing it with the result \
19121912
of the function call to be used in the repeat position, like \
19131913
`const VAL: Type = const_fn();` and `let x = [VAL; 42];`",
19141914
);
19151915
}
19161916

19171917
if self.tcx.sess.is_nightly_build() && is_const_fn {
19181918
err.help(
1919-
"create an inline `const` block, see PR \
1919+
"create an inline `const` block, see RFC \
19201920
#2920 <https://github.com/rust-lang/rfcs/pull/2920> \
19211921
for more information",
19221922
);

src/test/ui/consts/const-blocks/fn-call-in-non-const.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ LL | let _: [Option<Bar>; 2] = [no_copy(); 2];
77
= help: the following implementations were found:
88
<Option<T> as Copy>
99
= note: the `Copy` trait is required because the repeated element will be copied
10-
= 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];`
11-
= help: create an inline `const` block, see PR #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
10+
= help: consider creating a new `const` item and initializing it 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];`
11+
= help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
1212

1313
error: aborting due to previous error
1414

src/test/ui/consts/const-fn-in-vec.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ LL | let strings: [String; 5] = [String::new(); 5];
55
| ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
66
|
77
= note: the `Copy` trait is required because the repeated element will be copied
8-
= 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];`
9-
= help: create an inline `const` block, see PR #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
8+
= help: consider creating a new `const` item and initializing it 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];`
9+
= help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
1010

1111
error: aborting due to previous error
1212

0 commit comments

Comments
 (0)