diff --git a/src/librustc_builtin_macros/format.rs b/src/librustc_builtin_macros/format.rs index 019432035fe344e49c709b6b07d8f23b29b0346f..4cc83f8e31c20de2e61fa8cbe288dd1625fd712c 100644 --- a/src/librustc_builtin_macros/format.rs +++ b/src/librustc_builtin_macros/format.rs @@ -537,7 +537,7 @@ fn verify_arg_type(&mut self, arg: Position, ty: ArgumentType) { name )); err.note( - "to avoid ambiguity format_args! cannot capture variables \ + "to avoid ambiguity, `format_args!` cannot capture variables \ when the format string is expanded from a macro", ); } else if self.ecx.parse_sess().unstable_features.is_nightly_build() { diff --git a/src/test/ui/fmt/format-args-capture-macro-hygiene.stderr b/src/test/ui/fmt/format-args-capture-macro-hygiene.stderr index 55bd97bafe8b3c5a1da342592df583cd63827ed7..0c5915149cd6010830f74e3c453e85225ef0a32c 100644 --- a/src/test/ui/fmt/format-args-capture-macro-hygiene.stderr +++ b/src/test/ui/fmt/format-args-capture-macro-hygiene.stderr @@ -5,7 +5,7 @@ LL | format!(concat!("{foo}")); | ^^^^^^^^^^^^^^^^ | = note: did you intend to capture a variable `foo` from the surrounding scope? - = note: to avoid ambiguity format_args! cannot capture variables when the format string is expanded from a macro + = note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: there is no argument named `bar` @@ -15,7 +15,7 @@ LL | format!(concat!("{ba", "r} {}"), 1); | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: did you intend to capture a variable `bar` from the surrounding scope? - = note: to avoid ambiguity format_args! cannot capture variables when the format string is expanded from a macro + = note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors