diff --git a/compiler/rustc_builtin_macros/src/concat_bytes.rs b/compiler/rustc_builtin_macros/src/concat_bytes.rs index 87920e51752..eb08170959b 100644 --- a/compiler/rustc_builtin_macros/src/concat_bytes.rs +++ b/compiler/rustc_builtin_macros/src/concat_bytes.rs @@ -154,7 +154,7 @@ pub fn expand_concat_bytes( } } } else { - cx.span_err(count.value.span, "repeat count is not a number"); + cx.span_err(count.value.span, "repeat count is not a positive number"); } } ast::ExprKind::Lit(ref lit) => match lit.kind { diff --git a/src/test/ui/macros/concat-bytes-error.rs b/src/test/ui/macros/concat-bytes-error.rs index 2c7997d5e59..db5d3cab0bd 100644 --- a/src/test/ui/macros/concat-bytes-error.rs +++ b/src/test/ui/macros/concat-bytes-error.rs @@ -39,12 +39,12 @@ fn main() { ]); concat_bytes!(5u16); //~ ERROR cannot concatenate numeric literals concat_bytes!([5u16]); //~ ERROR numeric literal is not a `u8` - concat_bytes!([3; ()]); //~ ERROR repeat count is not a number - concat_bytes!([3; -2]); //~ ERROR repeat count is not a number - concat_bytes!([pie; -2]); //~ ERROR repeat count is not a number + concat_bytes!([3; ()]); //~ ERROR repeat count is not a positive number + concat_bytes!([3; -2]); //~ ERROR repeat count is not a positive number + concat_bytes!([pie; -2]); //~ ERROR repeat count is not a positive number concat_bytes!([pie; 2]); //~ ERROR expected a byte literal concat_bytes!([2.2; 0]); //~ ERROR cannot concatenate float literals - concat_bytes!([5.5; ()]); //~ ERROR repeat count is not a number + concat_bytes!([5.5; ()]); //~ ERROR repeat count is not a positive number concat_bytes!([[1, 2, 3]; 3]); //~ ERROR cannot concatenate doubly nested array concat_bytes!([[42; 2]; 3]); //~ ERROR cannot concatenate doubly nested array } diff --git a/src/test/ui/macros/concat-bytes-error.stderr b/src/test/ui/macros/concat-bytes-error.stderr index f0c53839b3a..d6cd1a3d178 100644 --- a/src/test/ui/macros/concat-bytes-error.stderr +++ b/src/test/ui/macros/concat-bytes-error.stderr @@ -127,19 +127,19 @@ error: numeric literal is not a `u8` LL | concat_bytes!([5u16]); | ^^^^ -error: repeat count is not a number +error: repeat count is not a positive number --> $DIR/concat-bytes-error.rs:42:23 | LL | concat_bytes!([3; ()]); | ^^ -error: repeat count is not a number +error: repeat count is not a positive number --> $DIR/concat-bytes-error.rs:43:23 | LL | concat_bytes!([3; -2]); | ^^ -error: repeat count is not a number +error: repeat count is not a positive number --> $DIR/concat-bytes-error.rs:44:25 | LL | concat_bytes!([pie; -2]); @@ -159,7 +159,7 @@ error: cannot concatenate float literals LL | concat_bytes!([2.2; 0]); | ^^^ -error: repeat count is not a number +error: repeat count is not a positive number --> $DIR/concat-bytes-error.rs:47:25 | LL | concat_bytes!([5.5; ()]);