Skip to content

Commit 7876fa6

Browse files
committed
Add backticks in appropriate places
1 parent 84c8849 commit 7876fa6

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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,13 @@ warning: unknown lint: `x5100`
172172
LL | #[deny(x5100)] impl S { }
173173
| ^^^^^
174174

175-
warning: macro_escape is a deprecated synonym for macro_use
175+
warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
176176
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:466:1
177177
|
178178
LL | #[macro_escape]
179179
| ^^^^^^^^^^^^^^^
180180

181-
warning: macro_escape is a deprecated synonym for macro_use
181+
warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
182182
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:469:17
183183
|
184184
LL | mod inner { #![macro_escape] }

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
// check-pass
77

88
#![macro_escape]
9-
//~^ WARN macro_escape is a deprecated synonym for macro_use
9+
//~^ WARN `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
1010

1111
fn main() {}

src/test/ui/feature-gate/issue-43106-gating-of-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/issue-43106-gating-of-macro_escape.rs:8:1
33
|
44
LL | #![macro_escape]

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
// get that warning; see issue-43106-gating-of-builtin-attrs.rs
55

66
#![macro_use(my_macro)]
7-
//~^ ERROR arguments to macro_use are not allowed here
7+
//~^ ERROR arguments to `macro_use` are not allowed here
88

99
#[macro_use(my_macro)]
10-
//~^ ERROR arguments to macro_use are not allowed here
10+
//~^ ERROR arguments to `macro_use` are not allowed here
1111
mod macro_escape {
1212
mod inner { #![macro_use(my_macro)] }
13-
//~^ ERROR arguments to macro_use are not allowed here
13+
//~^ ERROR arguments to `macro_use` are not allowed here
1414

1515
#[macro_use = "2700"] struct S;
1616
//~^ ERROR malformed `macro_use` attribute

src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
error: arguments to macro_use are not allowed here
1+
error: arguments to `macro_use` are not allowed here
22
--> $DIR/issue-43106-gating-of-macro_use.rs:6:1
33
|
44
LL | #![macro_use(my_macro)]
55
| ^^^^^^^^^^^^^^^^^^^^^^^
66

7-
error: arguments to macro_use are not allowed here
7+
error: arguments to `macro_use` are not allowed here
88
--> $DIR/issue-43106-gating-of-macro_use.rs:9:1
99
|
1010
LL | #[macro_use(my_macro)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^
1212

13-
error: arguments to macro_use are not allowed here
13+
error: arguments to `macro_use` are not allowed here
1414
--> $DIR/issue-43106-gating-of-macro_use.rs:12:17
1515
|
1616
LL | mod inner { #![macro_use(my_macro)] }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
extern crate self; //~ ERROR `extern crate self;` requires renaming
22

3-
#[macro_use] //~ ERROR `macro_use` is not supported on `extern crate self`
3+
#[macro_use] //~ ERROR `#[macro_use]` is not supported on `extern crate self`
44
extern crate self as foo;
55

66
fn main() {}

src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: `extern crate self;` requires renaming
44
LL | extern crate self;
55
| ^^^^^^^^^^^^^^^^^^ help: try: `extern crate self as name;`
66

7-
error: `macro_use` is not supported on `extern crate self`
7+
error: `#[macro_use]` is not supported on `extern crate self`
88
--> $DIR/extern-crate-self-fail.rs:3:1
99
|
1010
LL | #[macro_use]

src/test/ui/issues/issue-29124.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ error[E0599]: no method named `x` found for fn item `fn() -> Ret {Obj::func}` in
44
LL | Obj::func.x();
55
| ^ method not found in `fn() -> Ret {Obj::func}`
66
|
7-
= note: Obj::func is a function, perhaps you wish to call it
7+
= note: `Obj::func` is a function, perhaps you wish to call it
88

99
error[E0599]: no method named `x` found for fn item `fn() -> Ret {func}` in the current scope
1010
--> $DIR/issue-29124.rs:17:10
1111
|
1212
LL | func.x();
1313
| ^ method not found in `fn() -> Ret {func}`
1414
|
15-
= note: func is a function, perhaps you wish to call it
15+
= note: `func` is a function, perhaps you wish to call it
1616

1717
error: aborting due to 2 previous errors
1818

src/test/ui/issues/issue-57362-1.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0599]: no method named `f` found for fn pointer `fn(&u8)` in the current
44
LL | a.f();
55
| ^ method not found in `fn(&u8)`
66
|
7-
= note: a is a function, perhaps you wish to call it
7+
= note: `a` is a function, perhaps you wish to call it
88
= help: items from traits can only be used if the trait is implemented and in scope
99
= note: the following trait defines an item `f`, perhaps you need to implement it:
1010
candidate #1: `Trait`

src/test/ui/lint/uninitialized-zeroed.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ LL | let _val: Void = mem::zeroed();
108108
| this code causes undefined behavior when executed
109109
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
110110
|
111-
= note: 0-variant enums have no valid value
111+
= note: enums with no variants have no valid value
112112

113113
error: the type `Void` does not permit being left uninitialized
114114
--> $DIR/uninitialized-zeroed.rs:47:26
@@ -119,7 +119,7 @@ LL | let _val: Void = mem::uninitialized();
119119
| this code causes undefined behavior when executed
120120
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
121121
|
122-
= note: 0-variant enums have no valid value
122+
= note: enums with no variants have no valid value
123123

124124
error: the type `&'static i32` does not permit zero-initialization
125125
--> $DIR/uninitialized-zeroed.rs:49:34
@@ -294,7 +294,7 @@ LL | let _val: NonNull<i32> = mem::zeroed();
294294
| this code causes undefined behavior when executed
295295
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
296296
|
297-
= note: std::ptr::NonNull<i32> must be non-null
297+
= note: `std::ptr::NonNull<i32>` must be non-null
298298

299299
error: the type `std::ptr::NonNull<i32>` does not permit being left uninitialized
300300
--> $DIR/uninitialized-zeroed.rs:68:34
@@ -305,7 +305,7 @@ LL | let _val: NonNull<i32> = mem::uninitialized();
305305
| this code causes undefined behavior when executed
306306
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
307307
|
308-
= note: std::ptr::NonNull<i32> must be non-null
308+
= note: `std::ptr::NonNull<i32>` must be non-null
309309

310310
error: the type `*const dyn std::marker::Send` does not permit zero-initialization
311311
--> $DIR/uninitialized-zeroed.rs:70:37
@@ -364,7 +364,7 @@ LL | let _val: NonBig = mem::uninitialized();
364364
| this code causes undefined behavior when executed
365365
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
366366
|
367-
= note: NonBig must be initialized inside its custom valid range
367+
= note: `NonBig` must be initialized inside its custom valid range
368368

369369
error: the type `&'static i32` does not permit zero-initialization
370370
--> $DIR/uninitialized-zeroed.rs:84:34
@@ -397,7 +397,7 @@ LL | let _val: NonZeroU32 = mem::transmute(0);
397397
| this code causes undefined behavior when executed
398398
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
399399
|
400-
= note: std::num::NonZeroU32 must be non-null
400+
= note: `std::num::NonZeroU32` must be non-null
401401

402402
error: the type `std::ptr::NonNull<i32>` does not permit zero-initialization
403403
--> $DIR/uninitialized-zeroed.rs:89:34
@@ -408,7 +408,7 @@ LL | let _val: NonNull<i32> = MaybeUninit::zeroed().assume_init();
408408
| this code causes undefined behavior when executed
409409
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
410410
|
411-
= note: std::ptr::NonNull<i32> must be non-null
411+
= note: `std::ptr::NonNull<i32>` must be non-null
412412

413413
error: the type `std::ptr::NonNull<i32>` does not permit being left uninitialized
414414
--> $DIR/uninitialized-zeroed.rs:90:34
@@ -419,7 +419,7 @@ LL | let _val: NonNull<i32> = MaybeUninit::uninit().assume_init();
419419
| this code causes undefined behavior when executed
420420
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
421421
|
422-
= note: std::ptr::NonNull<i32> must be non-null
422+
= note: `std::ptr::NonNull<i32>` must be non-null
423423

424424
error: the type `bool` does not permit being left uninitialized
425425
--> $DIR/uninitialized-zeroed.rs:91:26

src/test/ui/malformed/malformed-interpolated.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: suffixed literals are not allowed in attributes
44
LL | check!(0u8);
55
| ^^^
66
|
7-
= help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
7+
= help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
88

99
error: unexpected token: `-0`
1010
--> $DIR/malformed-interpolated.rs:5:25

src/test/ui/module-macro_use-arguments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[macro_use(foo, bar)] //~ ERROR arguments to macro_use are not allowed here
1+
#[macro_use(foo, bar)] //~ ERROR arguments to `macro_use` are not allowed here
22
mod foo {
33
}
44

src/test/ui/module-macro_use-arguments.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: arguments to macro_use are not allowed here
1+
error: arguments to `macro_use` are not allowed here
22
--> $DIR/module-macro_use-arguments.rs:1:1
33
|
44
LL | #[macro_use(foo, bar)]

0 commit comments

Comments
 (0)