Skip to content

Commit e842489

Browse files
committed
Add backticks in appropriate places
1 parent 8461fa5 commit e842489

25 files changed

+72
-71
lines changed

src/librustc_lint/builtin.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,21 +1959,24 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidValue {
19591959
// return `Bound::Excluded`. (And we have tests checking that we
19601960
// handle the attribute correctly.)
19611961
(Bound::Included(lo), _) if lo > 0 => {
1962-
return Some((format!("{} must be non-null", ty), None));
1962+
return Some((format!("`{}` must be non-null", ty), None));
19631963
}
19641964
(Bound::Included(_), _) | (_, Bound::Included(_))
19651965
if init == InitKind::Uninit =>
19661966
{
19671967
return Some((
1968-
format!("{} must be initialized inside its custom valid range", ty),
1968+
format!(
1969+
"`{}` must be initialized inside its custom valid range",
1970+
ty,
1971+
),
19691972
None,
19701973
));
19711974
}
19721975
_ => {}
19731976
}
19741977
// Now, recurse.
19751978
match adt_def.variants.len() {
1976-
0 => Some((format!("0-variant enums have no valid value"), None)),
1979+
0 => Some((format!("enums with no variants have no valid value"), None)),
19771980
1 => {
19781981
// Struct, or enum with exactly one variant.
19791982
// Proceed recursively, check all fields.

src/librustc_parse/parser/attr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ impl<'a> Parser<'a> {
236236
self.struct_span_err(lit.span, msg)
237237
.help(
238238
"instead of using a suffixed literal \
239-
(1u8, 1.0f32, etc.), use an unsuffixed version \
240-
(1, 1.0, etc.).",
239+
(`1u8`, `1.0f32`, etc.), use an unsuffixed version \
240+
(`1`, `1.0`, etc.)",
241241
)
242242
.emit()
243243
}

src/librustc_resolve/build_reduced_graph.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
963963
.session
964964
.struct_span_err(
965965
attr.span,
966-
"`macro_use` is not supported on `extern crate self`",
966+
"`#[macro_use]` is not supported on `extern crate self`",
967967
)
968968
.emit();
969969
}
@@ -1054,7 +1054,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
10541054
fn contains_macro_use(&mut self, attrs: &[ast::Attribute]) -> bool {
10551055
for attr in attrs {
10561056
if attr.check_name(sym::macro_escape) {
1057-
let msg = "macro_escape is a deprecated synonym for macro_use";
1057+
let msg = "`#[macro_escape]` is a deprecated synonym for `#[macro_use]`";
10581058
let mut err = self.r.session.struct_span_warn(attr.span, msg);
10591059
if let ast::AttrStyle::Inner = attr.style {
10601060
err.help("consider an outer attribute, `#[macro_use]` mod ...").emit();
@@ -1066,7 +1066,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
10661066
}
10671067

10681068
if !attr.is_word() {
1069-
self.r.session.span_err(attr.span, "arguments to macro_use are not allowed here");
1069+
self.r.session.span_err(attr.span, "arguments to `macro_use` are not allowed here");
10701070
}
10711071
return true;
10721072
}

src/librustc_typeck/check/method/suggest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
479479
macro_rules! report_function {
480480
($span:expr, $name:expr) => {
481481
err.note(&format!(
482-
"{} is a function, perhaps you wish to call it",
482+
"`{}` is a function, perhaps you wish to call it",
483483
$name
484484
));
485485
};

src/test/ui/consts/const-eval/validate_uninhabited_zsts.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ LL | const BAR: [Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
4545
| this code causes undefined behavior when executed
4646
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
4747
|
48-
= note: 0-variant enums have no valid value
48+
= note: enums with no variants have no valid value
4949

5050
error: aborting due to previous error
5151

src/test/ui/deprecation/deprecated-macro_escape-inner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// run-pass
22

33
mod foo {
4-
#![macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use
4+
#![macro_escape] //~ WARN `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
55
}
66

77
fn main() {

src/test/ui/deprecation/deprecated-macro_escape-inner.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
warning: macro_escape is a deprecated synonym for macro_use
1+
warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
22
--> $DIR/deprecated-macro_escape-inner.rs:4:5
33
|
44
LL | #![macro_escape]
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// run-pass
22

3-
#[macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use
4-
mod foo {
5-
}
3+
#[macro_escape] //~ WARNING `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
4+
mod foo {}
65

7-
fn main() {
8-
}
6+
fn main() {}

src/test/ui/deprecation/deprecated-macro_escape.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
warning: macro_escape is a deprecated synonym for macro_use
1+
warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
22
--> $DIR/deprecated-macro_escape.rs:3:1
33
|
44
LL | #[macro_escape]

src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,10 +464,10 @@ mod reexport_test_harness_main {
464464

465465
// Cannot feed "2700" to `#[macro_escape]` without signaling an error.
466466
#[macro_escape]
467-
//~^ WARN macro_escape is a deprecated synonym for macro_use
467+
//~^ WARN `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
468468
mod macro_escape {
469469
mod inner { #![macro_escape] }
470-
//~^ WARN macro_escape is a deprecated synonym for macro_use
470+
//~^ WARN `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
471471

472472
#[macro_escape] fn f() { }
473473
//~^ WARN unused attribute

0 commit comments

Comments
 (0)