Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize use of backticks compiler messages #61901

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion src/doc/rustc-guide
2 changes: 1 addition & 1 deletion src/doc/rustc/src/lints/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ warning: unused variable: `x`
2 | let x = 5;
| ^
|
= note: #[warn(unused_variables)] on by default
= note: `#[warn(unused_variables)]` on by default
= note: to avoid this warning, consider using `_x` instead
```

Expand Down
6 changes: 3 additions & 3 deletions src/doc/rustc/src/lints/levels.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ warning: unused variable: `x`
2 | let x = 5;
| ^
|
= note: #[warn(unused_variables)] on by default
= note: `#[warn(unused_variables)]` on by default
= note: to avoid this warning, consider using `_x` instead
```

Expand All @@ -76,7 +76,7 @@ error: bitshift exceeds the type's number of bits
2 | 100u8 << 10;
| ^^^^^^^^^^^
|
= note: #[deny(exceeding_bitshifts)] on by default
= note: `#[deny(exceeding_bitshifts)]` on by default
```

What's the difference between an error from a lint and a regular old error?
Expand Down Expand Up @@ -236,7 +236,7 @@ warning: bitshift exceeds the type's number of bits
2 | 100u8 << 10;
| ^^^^^^^^^^^
|
= note: #[warn(exceeding_bitshifts)] on by default
= note: `#[warn(exceeding_bitshifts)]` on by default

warning: this expression will panic at run-time
--> lib.rs:2:5
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustc/src/lints/listing/allowed-by-default.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ pub struct Foo;
When set to 'deny', this will produce:

```text
error: type does not implement `fmt::Debug`; consider adding #[derive(Debug)] or a manual implementation
error: type does not implement `fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation
--> src/main.rs:3:1
|
3 | pub struct Foo;
Expand Down
12 changes: 6 additions & 6 deletions src/doc/rustc/src/lints/listing/deny-by-default.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ error: defaults for type parameters are only allowed in `struct`, `enum`, `type`
4 | fn foo<T=i32>(t: T) {}
| ^
|
= note: #[deny(invalid_type_param_default)] on by default
= note: `#[deny(invalid_type_param_default)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
```
Expand Down Expand Up @@ -74,7 +74,7 @@ error: private struct constructors are not usable through re-exports in outer mo
5 | ::S;
| ^^^
|
= note: #[deny(legacy_constructor_visibility)] on by default
= note: `#[deny(legacy_constructor_visibility)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #39207 <https://github.com/rust-lang/rust/issues/39207>
```
Expand All @@ -84,9 +84,9 @@ error: private struct constructors are not usable through re-exports in outer mo

The legacy_directory_ownership warning is issued when

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

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

```text
error: const items should never be #[no_mangle]
error: const items should never be `#[no_mangle]`
--> src/main.rs:3:1
|
3 | const FOO: i32 = 5;
Expand Down Expand Up @@ -187,7 +187,7 @@ error: parenthesized parameters may only be used with a trait
2 | let x = 5 as usize();
| ^^
|
= note: #[deny(parenthesized_params_in_types_and_modules)] on by default
= note: `#[deny(parenthesized_params_in_types_and_modules)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
```
Expand Down
22 changes: 11 additions & 11 deletions src/doc/rustc/src/lints/listing/warn-by-default.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ warning: floating-point literals cannot be used in patterns
4 | 5.0 => {},
| ^^^
|
= note: #[warn(illegal_floating_point_literal_pattern)] on by default
= note: `#[warn(illegal_floating_point_literal_pattern)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
```
Expand All @@ -109,7 +109,7 @@ extern "C" {
This will produce:

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

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

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

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

## unused-features

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

## unused-imports
Expand Down Expand Up @@ -839,7 +839,7 @@ warning: unused macro definition

## unused-must-use

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

```rust
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/ptr/unique.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ use crate::ptr::NonNull;
/// Unlike `*mut T`, `Unique<T>` is covariant over `T`. This should always be correct
/// for any type which upholds Unique's aliasing requirements.
#[unstable(feature = "ptr_internals", issue = "0",
reason = "use NonNull instead and consider PhantomData<T> \
(if you also use #[may_dangle]), Send, and/or Sync")]
reason = "use `NonNull` instead and consider `PhantomData<T>` \
(if you also use `#[may_dangle]`), `Send`, and/or `Sync`")]
#[doc(hidden)]
#[repr(transparent)]
#[rustc_layout_scalar_valid_range_start(1)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ Erroneous code example:
fn foo() {}

#[main]
fn f() {} // error: multiple functions with a #[main] attribute
fn f() {} // error: multiple functions with a `#[main]` attribute
```

This error indicates that the compiler found multiple functions with the
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/hir/def_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ impl CrateNum {
pub fn as_usize(self) -> usize {
match self {
CrateNum::Index(id) => id.as_usize(),
_ => bug!("tried to get index of nonstandard crate {:?}", self),
_ => bug!("tried to get index of non-standard crate {:?}", self),
}
}

pub fn as_u32(self) -> u32 {
match self {
CrateNum::Index(id) => id.as_u32(),
_ => bug!("tried to get index of nonstandard crate {:?}", self),
_ => bug!("tried to get index of non-standard crate {:?}", self),
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1693,8 +1693,8 @@ impl<'a> LoweringContext<'a> {
if pos == ImplTraitPosition::Binding &&
nightly_options::is_nightly_build() {
help!(err,
"add #![feature(impl_trait_in_bindings)] to the crate attributes \
to enable");
"add `#![feature(impl_trait_in_bindings)]` to the crate \
attributes to enable");
}
err.emit();
hir::TyKind::Err
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/lexical_region_resolve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
constraints.retain(|constraint| {
let (edge_changed, retain) = body(constraint);
if edge_changed {
debug!("Updated due to constraint {:?}", constraint);
debug!("updated due to constraint {:?}", constraint);
changed = true;
}
retain
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/infer/region_constraints/leak_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
}

return Err(if overly_polymorphic {
debug!("Overly polymorphic!");
debug!("overly polymorphic!");
TypeError::RegionsOverlyPolymorphic(placeholder.name, tainted_region)
} else {
debug!("Not as polymorphic!");
debug!("not as polymorphic!");
TypeError::RegionsInsufficientlyPolymorphic(placeholder.name, tainted_region)
});
}
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,19 @@ declare_lint! {
declare_lint! {
pub UNUSED_FEATURES,
Warn,
"unused features found in crate-level #[feature] directives"
"unused features found in crate-level `#[feature]` directives"
}

declare_lint! {
pub STABLE_FEATURES,
Warn,
"stable features found in #[feature] directive"
"stable features found in `#[feature]` directive"
}

declare_lint! {
pub UNKNOWN_CRATE_TYPES,
Deny,
"unknown crate type found in #[crate_type] directive"
"unknown crate type found in `#[crate_type]` directive"
}

declare_lint! {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/lint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
sess.diag_note_once(
&mut err,
DiagnosticMessageId::from(lint),
&format!("#[{}({})] on by default", level.as_str(), name));
&format!("`#[{}({})]` on by default", level.as_str(), name));
}
LintSource::CommandLine(lint_flag_val) => {
let flag = match level {
Expand Down Expand Up @@ -705,7 +705,7 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
if lint_attr_name.as_str() != name {
let level_str = level.as_str();
sess.diag_note_once(&mut err, DiagnosticMessageId::from(lint),
&format!("#[{}({})] implied by #[{}({})]",
&format!("`#[{}({})]` implied by `#[{}({})]`",
level_str, name, level_str, lint_attr_name));
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ fn find_item(item: &Item, ctxt: &mut EntryContext<'_, '_>, at_root: bool) {
ctxt.attr_main_fn = Some((item.hir_id, item.span));
} else {
struct_span_err!(ctxt.session, item.span, E0137,
"multiple functions with a #[main] attribute")
.span_label(item.span, "additional #[main] function")
.span_label(ctxt.attr_main_fn.unwrap().1, "first #[main] function")
"multiple functions with a `#[main]` attribute")
.span_label(item.span, "additional `#[main]` function")
.span_label(ctxt.attr_main_fn.unwrap().1, "first `#[main]` function")
.emit();
}
},
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/mem_categorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
let deref_ty = match base_cmt_ty.builtin_deref(true) {
Some(mt) => mt.ty,
None => {
debug!("Explicit deref of non-derefable type: {:?}", base_cmt_ty);
debug!("explicit deref of non-derefable type: {:?}", base_cmt_ty);
return Err(());
}
};
Expand Down Expand Up @@ -1392,7 +1392,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
let element_ty = match cmt.ty.builtin_index() {
Some(ty) => ty,
None => {
debug!("Explicit index of non-indexable type {:?}", cmt);
debug!("explicit index of non-indexable type {:?}", cmt);
return Err(());
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/resolve_lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1615,7 +1615,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
}
}
Some(LifetimeUseSet::Many) => {
debug!("Not one use lifetime");
debug!("not one use lifetime");
alexreg marked this conversation as resolved.
Show resolved Hide resolved
}
None => {
let hir_id = self.tcx.hir().as_local_hir_id(def_id).unwrap();
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -641,19 +641,19 @@ rustc_queries! {
}
query is_sanitizer_runtime(_: CrateNum) -> bool {
fatal_cycle
desc { "query a crate is #![sanitizer_runtime]" }
desc { "query a crate is `#![sanitizer_runtime]`" }
}
query is_profiler_runtime(_: CrateNum) -> bool {
fatal_cycle
desc { "query a crate is #![profiler_runtime]" }
desc { "query a crate is `#![profiler_runtime]`" }
}
query panic_strategy(_: CrateNum) -> PanicStrategy {
fatal_cycle
desc { "query a crate's configured panic strategy" }
}
query is_no_builtins(_: CrateNum) -> bool {
fatal_cycle
desc { "test whether a crate has #![no_builtins]" }
desc { "test whether a crate has `#![no_builtins]`" }
}
query symbol_mangling_version(_: CrateNum) -> SymbolManglingVersion {
fatal_cycle
Expand Down
Loading