Skip to content

Commit ca8420c

Browse files
author
Samy Kacimi
committed
Normalize use of backticks in compiler messages for doc
rust-lang#60532
1 parent 3ebca72 commit ca8420c

File tree

10 files changed

+33
-33
lines changed

10 files changed

+33
-33
lines changed

src/doc/rustc/src/lints/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ warning: unused variable: `x`
1919
2 | let x = 5;
2020
| ^
2121
|
22-
= note: #[warn(unused_variables)] on by default
22+
= note: `#[warn(unused_variables)]` on by default
2323
= note: to avoid this warning, consider using `_x` instead
2424
```
2525

src/doc/rustc/src/lints/levels.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ warning: unused variable: `x`
5353
2 | let x = 5;
5454
| ^
5555
|
56-
= note: #[warn(unused_variables)] on by default
56+
= note: `#[warn(unused_variables)]` on by default
5757
= note: to avoid this warning, consider using `_x` instead
5858
```
5959

@@ -76,7 +76,7 @@ error: bitshift exceeds the type's number of bits
7676
2 | 100u8 << 10;
7777
| ^^^^^^^^^^^
7878
|
79-
= note: #[deny(exceeding_bitshifts)] on by default
79+
= note: `#[deny(exceeding_bitshifts)]` on by default
8080
```
8181
8282
What's the difference between an error from a lint and a regular old error?
@@ -236,7 +236,7 @@ warning: bitshift exceeds the type's number of bits
236236
2 | 100u8 << 10;
237237
| ^^^^^^^^^^^
238238
|
239-
= note: #[warn(exceeding_bitshifts)] on by default
239+
= note: `#[warn(exceeding_bitshifts)]` on by default
240240
241241
warning: this expression will panic at run-time
242242
--> lib.rs:2:5

src/doc/rustc/src/lints/listing/allowed-by-default.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ pub struct Foo;
165165
When set to 'deny', this will produce:
166166

167167
```text
168-
error: type does not implement `fmt::Debug`; consider adding #[derive(Debug)] or a manual implementation
168+
error: type does not implement `fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation
169169
--> src/main.rs:3:1
170170
|
171171
3 | pub struct Foo;

src/doc/rustc/src/lints/listing/deny-by-default.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ error: defaults for type parameters are only allowed in `struct`, `enum`, `type`
4040
4 | fn foo<T=i32>(t: T) {}
4141
| ^
4242
|
43-
= note: #[deny(invalid_type_param_default)] on by default
43+
= note: `#[deny(invalid_type_param_default)]` on by default
4444
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
4545
= note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
4646
```
@@ -74,7 +74,7 @@ error: private struct constructors are not usable through re-exports in outer mo
7474
5 | ::S;
7575
| ^^^
7676
|
77-
= note: #[deny(legacy_constructor_visibility)] on by default
77+
= note: `#[deny(legacy_constructor_visibility)]` on by default
7878
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
7979
= note: for more information, see issue #39207 <https://github.com/rust-lang/rust/issues/39207>
8080
```
@@ -84,9 +84,9 @@ error: private struct constructors are not usable through re-exports in outer mo
8484

8585
The legacy_directory_ownership warning is issued when
8686

87-
* There is a non-inline module with a #[path] attribute (e.g. #[path = "foo.rs"] mod bar;),
87+
* There is a non-inline module with a `#[path]` attribute (e.g. `#[path = "foo.rs"] mod bar;`),
8888
* The module's file ("foo.rs" in the above example) is not named "mod.rs", and
89-
* The module's file contains a non-inline child module without a #[path] attribute.
89+
* The module's file contains a non-inline child module without a `#[path]` attribute.
9090

9191
The warning can be fixed by renaming the parent module to "mod.rs" and moving
9292
it into its own directory if appropriate.
@@ -139,7 +139,7 @@ const FOO: i32 = 5;
139139
This will produce:
140140

141141
```text
142-
error: const items should never be #[no_mangle]
142+
error: const items should never be `#[no_mangle]`
143143
--> src/main.rs:3:1
144144
|
145145
3 | const FOO: i32 = 5;
@@ -187,7 +187,7 @@ error: parenthesized parameters may only be used with a trait
187187
2 | let x = 5 as usize();
188188
| ^^
189189
|
190-
= note: #[deny(parenthesized_params_in_types_and_modules)] on by default
190+
= note: `#[deny(parenthesized_params_in_types_and_modules)]` on by default
191191
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
192192
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
193193
```

src/doc/rustc/src/lints/listing/warn-by-default.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ warning: floating-point literals cannot be used in patterns
9090
4 | 5.0 => {},
9191
| ^^^
9292
|
93-
= note: #[warn(illegal_floating_point_literal_pattern)] on by default
93+
= note: `#[warn(illegal_floating_point_literal_pattern)]` on by default
9494
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
9595
= note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
9696
```
@@ -109,7 +109,7 @@ extern "C" {
109109
This will produce:
110110

111111
```text
112-
warning: found struct without foreign-function-safe representation annotation in foreign module, consider adding a #[repr(C)] attribute to the type
112+
warning: found struct without foreign-function-safe representation annotation in foreign module, consider adding a `#[repr(C)]` attribute to the type
113113
--> src/main.rs:2:20
114114
|
115115
2 | static STATIC: String;
@@ -146,7 +146,7 @@ warning: cannot specify lifetime arguments explicitly if late bound lifetime par
146146
8 | S.late::<'static>(&0, &0);
147147
| ^^^^^^^
148148
|
149-
= note: #[warn(late_bound_lifetime_arguments)] on by default
149+
= note: `#[warn(late_bound_lifetime_arguments)]` on by default
150150
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
151151
= note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
152152
```
@@ -327,7 +327,7 @@ warning: patterns aren't allowed in methods without bodies
327327
2 | fn foo(mut arg: u8);
328328
| ^^^^^^^
329329
|
330-
= note: #[warn(patterns_in_fns_without_body)] on by default
330+
= note: `#[warn(patterns_in_fns_without_body)]` on by default
331331
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
332332
= note: for more information, see issue #35203 <https://github.com/rust-lang/rust/issues/35203>
333333
```
@@ -406,7 +406,7 @@ fn foo() {}
406406
This will produce:
407407

408408
```text
409-
warning: function is marked #[no_mangle], but not exported
409+
warning: function is marked `#[no_mangle]`, but not exported
410410
--> src/main.rs:2:1
411411
|
412412
2 | fn foo() {}
@@ -433,7 +433,7 @@ static X: i32 = 4;
433433
This will produce:
434434

435435
```text
436-
warning: static is marked #[no_mangle], but not exported
436+
warning: static is marked `#[no_mangle]`, but not exported
437437
--> src/main.rs:2:1
438438
|
439439
2 | static X: i32 = 4;
@@ -496,7 +496,7 @@ warning: borrow of packed field requires unsafe function or block (error E0133)
496496
11 | let y = &x.data.0;
497497
| ^^^^^^^^^
498498
|
499-
= note: #[warn(safe_packed_borrows)] on by default
499+
= note: `#[warn(safe_packed_borrows)]` on by default
500500
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
501501
= note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043>
502502
```
@@ -542,7 +542,7 @@ warning: bounds on generic parameters are not enforced in type aliases
542542
2 | type SendVec<T: Send> = Vec<T>;
543543
| ^^^^
544544
|
545-
= note: #[warn(type_alias_bounds)] on by default
545+
= note: `#[warn(type_alias_bounds)]` on by default
546546
= help: the bound will not be checked when the type alias is used, and should be removed
547547
```
548548

@@ -567,7 +567,7 @@ warning: type annotations needed
567567
4 | if data.is_null() {}
568568
| ^^^^^^^
569569
|
570-
= note: #[warn(tyvar_behind_raw_pointer)] on by default
570+
= note: `#[warn(tyvar_behind_raw_pointer)]` on by default
571571
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
572572
= note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906>
573573
```
@@ -787,7 +787,7 @@ warning: doc comment not used by rustdoc
787787

788788
## unused-features
789789

790-
This lint detects unused or unknown features found in crate-level #[feature] directives.
790+
This lint detects unused or unknown features found in crate-level `#[feature]` directives.
791791
To fix this, simply remove the feature flag.
792792

793793
## unused-imports
@@ -839,7 +839,7 @@ warning: unused macro definition
839839

840840
## unused-must-use
841841

842-
This lint detects unused result of a type flagged as #[must_use]. Some
842+
This lint detects unused result of a type flagged as `#[must_use]`. Some
843843
example code that triggers this lint:
844844

845845
```rust

src/librustdoc/clean/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ impl Clean<Option<Lifetime>> for ty::RegionKind {
13191319
ty::ReEmpty |
13201320
ty::ReClosureBound(_) |
13211321
ty::ReErased => {
1322-
debug!("Cannot clean region {:?}", self);
1322+
debug!("cannot clean region {:?}", self);
13231323
None
13241324
}
13251325
}
@@ -4082,7 +4082,7 @@ impl ToSource for syntax_pos::Span {
40824082

40834083
fn name_from_pat(p: &hir::Pat) -> String {
40844084
use rustc::hir::*;
4085-
debug!("Trying to get a name from pattern: {:?}", p);
4085+
debug!("trying to get a name from pattern: {:?}", p);
40864086

40874087
match p.node {
40884088
PatKind::Wild => "_".to_string(),

src/librustdoc/config.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl Options {
250250
None => ColorConfig::Auto,
251251
Some(arg) => {
252252
early_error(ErrorOutputType::default(),
253-
&format!("argument for --color must be `auto`, `always` or `never` \
253+
&format!("argument for `--color` must be `auto`, `always` or `never` \
254254
(instead was `{}`)", arg));
255255
}
256256
};
@@ -269,7 +269,7 @@ impl Options {
269269
Some("short") => ErrorOutputType::HumanReadable(HumanReadableErrorType::Short(color)),
270270
Some(arg) => {
271271
early_error(ErrorOutputType::default(),
272-
&format!("argument for --error-format must be `human`, `json` or \
272+
&format!("argument for `--error-format` must be `human`, `json` or \
273273
`short` (instead was `{}`)", arg));
274274
}
275275
};

src/librustdoc/core.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
432432
},
433433
sym::plugins => {
434434
report_deprecated_attr("plugins = \"...\"", diag);
435-
eprintln!("WARNING: #![doc(plugins = \"...\")] no longer functions; \
435+
eprintln!("WARNING: `#![doc(plugins = \"...\")]` no longer functions; \
436436
see CVE-2018-1000622");
437437
continue
438438
},

src/librustdoc/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ impl Tester for Collector {
730730
let edition = config.edition.unwrap_or(self.edition);
731731
let persist_doctests = self.persist_doctests.clone();
732732

733-
debug!("Creating test {}: {}", name, test);
733+
debug!("creating test {}: {}", name, test);
734734
self.tests.push(testing::TestDescAndFn {
735735
desc: testing::TestDesc {
736736
name: testing::DynTestName(name),

src/librustdoc/visit_ast.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
9696
pub fn visit_variant_data(&mut self, item: &'tcx hir::Item,
9797
name: ast::Name, sd: &'tcx hir::VariantData,
9898
generics: &'tcx hir::Generics) -> Struct<'tcx> {
99-
debug!("Visiting struct");
99+
debug!("visiting struct");
100100
let struct_type = struct_type_from_def(&*sd);
101101
Struct {
102102
id: item.hir_id,
@@ -115,7 +115,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
115115
pub fn visit_union_data(&mut self, item: &'tcx hir::Item,
116116
name: ast::Name, sd: &'tcx hir::VariantData,
117117
generics: &'tcx hir::Generics) -> Union<'tcx> {
118-
debug!("Visiting union");
118+
debug!("visiting union");
119119
let struct_type = struct_type_from_def(&*sd);
120120
Union {
121121
id: item.hir_id,
@@ -134,7 +134,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
134134
pub fn visit_enum_def(&mut self, it: &'tcx hir::Item,
135135
name: ast::Name, def: &'tcx hir::EnumDef,
136136
generics: &'tcx hir::Generics) -> Enum<'tcx> {
137-
debug!("Visiting enum");
137+
debug!("visiting enum");
138138
Enum {
139139
name,
140140
variants: def.variants.iter().map(|v| Variant {
@@ -161,7 +161,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
161161
header: hir::FnHeader,
162162
generics: &'tcx hir::Generics,
163163
body: hir::BodyId) {
164-
debug!("Visiting fn");
164+
debug!("visiting fn");
165165
let macro_kind = item.attrs.iter().filter_map(|a| {
166166
if a.check_name(sym::proc_macro) {
167167
Some(MacroKind::Bang)
@@ -371,7 +371,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
371371

372372
pub fn visit_item(&mut self, item: &'tcx hir::Item,
373373
renamed: Option<ast::Ident>, om: &mut Module<'tcx>) {
374-
debug!("Visiting item {:?}", item);
374+
debug!("visiting item {:?}", item);
375375
let ident = renamed.unwrap_or(item.ident);
376376

377377
if item.vis.node.is_pub() {

0 commit comments

Comments
 (0)