Skip to content

Commit f895ef8

Browse files
Samy KacimiAlexander Regueiro
authored andcommitted
normalize use of backticks in compiler messages
1 parent 5b9a51f commit f895ef8

File tree

41 files changed

+84
-83
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+84
-83
lines changed

src/libcore/ptr/unique.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ use crate::ptr::NonNull;
2626
/// Unlike `*mut T`, `Unique<T>` is covariant over `T`. This should always be correct
2727
/// for any type which upholds Unique's aliasing requirements.
2828
#[unstable(feature = "ptr_internals", issue = "0",
29-
reason = "use NonNull instead and consider PhantomData<T> \
30-
(if you also use #[may_dangle]), Send, and/or Sync")]
29+
reason = "use `NonNull` instead and consider `PhantomData<T>` \
30+
(if you also use `#[may_dangle]`), `Send`, and/or `Sync`")]
3131
#[doc(hidden)]
3232
#[repr(transparent)]
3333
#[rustc_layout_scalar_valid_range_start(1)]

src/librustc/error_codes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ Erroneous code example:
485485
fn foo() {}
486486
487487
#[main]
488-
fn f() {} // error: multiple functions with a #[main] attribute
488+
fn f() {} // error: multiple functions with a `#[main]` attribute
489489
```
490490
491491
This error indicates that the compiler found multiple functions with the

src/librustc/hir/lowering.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,8 +1693,8 @@ impl<'a> LoweringContext<'a> {
16931693
if pos == ImplTraitPosition::Binding &&
16941694
nightly_options::is_nightly_build() {
16951695
help!(err,
1696-
"add #![feature(impl_trait_in_bindings)] to the crate attributes \
1697-
to enable");
1696+
"add `#![feature(impl_trait_in_bindings)]` to the crate \
1697+
attributes to enable");
16981698
}
16991699
err.emit();
17001700
hir::TyKind::Err

src/librustc/lint/builtin.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,19 @@ declare_lint! {
9292
declare_lint! {
9393
pub UNUSED_FEATURES,
9494
Warn,
95-
"unused features found in crate-level #[feature] directives"
95+
"unused features found in crate-level `#[feature]` directives"
9696
}
9797

9898
declare_lint! {
9999
pub STABLE_FEATURES,
100100
Warn,
101-
"stable features found in #[feature] directive"
101+
"stable features found in `#[feature]` directive"
102102
}
103103

104104
declare_lint! {
105105
pub UNKNOWN_CRATE_TYPES,
106106
Deny,
107-
"unknown crate type found in #[crate_type] directive"
107+
"unknown crate type found in `#[crate_type]` directive"
108108
}
109109

110110
declare_lint! {

src/librustc/lint/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
670670
sess.diag_note_once(
671671
&mut err,
672672
DiagnosticMessageId::from(lint),
673-
&format!("#[{}({})] on by default", level.as_str(), name));
673+
&format!("`#[{}({})]` on by default", level.as_str(), name));
674674
}
675675
LintSource::CommandLine(lint_flag_val) => {
676676
let flag = match level {
@@ -705,7 +705,7 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
705705
if lint_attr_name.as_str() != name {
706706
let level_str = level.as_str();
707707
sess.diag_note_once(&mut err, DiagnosticMessageId::from(lint),
708-
&format!("#[{}({})] implied by #[{}({})]",
708+
&format!("`#[{}({})]` implied by `#[{}({})]`",
709709
level_str, name, level_str, lint_attr_name));
710710
}
711711
}

src/librustc/middle/entry.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ fn find_item(item: &Item, ctxt: &mut EntryContext<'_, '_>, at_root: bool) {
120120
ctxt.attr_main_fn = Some((item.hir_id, item.span));
121121
} else {
122122
struct_span_err!(ctxt.session, item.span, E0137,
123-
"multiple functions with a #[main] attribute")
124-
.span_label(item.span, "additional #[main] function")
125-
.span_label(ctxt.attr_main_fn.unwrap().1, "first #[main] function")
123+
"multiple functions with a `#[main]` attribute")
124+
.span_label(item.span, "additional `#[main]` function")
125+
.span_label(ctxt.attr_main_fn.unwrap().1, "first `#[main]` function")
126126
.emit();
127127
}
128128
},

src/librustc/query/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -641,19 +641,19 @@ rustc_queries! {
641641
}
642642
query is_sanitizer_runtime(_: CrateNum) -> bool {
643643
fatal_cycle
644-
desc { "query a crate is #![sanitizer_runtime]" }
644+
desc { "query a crate is `#![sanitizer_runtime]`" }
645645
}
646646
query is_profiler_runtime(_: CrateNum) -> bool {
647647
fatal_cycle
648-
desc { "query a crate is #![profiler_runtime]" }
648+
desc { "query a crate is `#![profiler_runtime]`" }
649649
}
650650
query panic_strategy(_: CrateNum) -> PanicStrategy {
651651
fatal_cycle
652652
desc { "query a crate's configured panic strategy" }
653653
}
654654
query is_no_builtins(_: CrateNum) -> bool {
655655
fatal_cycle
656-
desc { "test whether a crate has #![no_builtins]" }
656+
desc { "test whether a crate has `#![no_builtins]`" }
657657
}
658658
query symbol_mangling_version(_: CrateNum) -> SymbolManglingVersion {
659659
fatal_cycle

src/librustc/session/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1400,7 +1400,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
14001400
thinlto: Option<bool> = (None, parse_opt_bool, [TRACKED],
14011401
"enable ThinLTO when possible"),
14021402
inline_in_all_cgus: Option<bool> = (None, parse_opt_bool, [TRACKED],
1403-
"control whether #[inline] functions are in all cgus"),
1403+
"control whether `#[inline]` functions are in all cgus"),
14041404
tls_model: Option<String> = (None, parse_opt_string, [TRACKED],
14051405
"choose the TLS model to use (rustc --print tls-models for details)"),
14061406
saturating_float_casts: bool = (false, parse_bool, [TRACKED],

src/librustc/traits/error_reporting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1659,7 +1659,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
16591659
ObligationCauseCode::TrivialBound => {
16601660
err.help("see issue #48214");
16611661
if tcx.sess.opts.unstable_features.is_nightly_build() {
1662-
err.help("add #![feature(trivial_bounds)] to the \
1662+
err.help("add `#![feature(trivial_bounds)]` to the \
16631663
crate attributes to enable",
16641664
);
16651665
}

src/librustc_allocator/expand.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl MutVisitor for ExpandAllocatorDirectives<'_> {
7979

8080
if self.found {
8181
self.handler
82-
.span_err(item.span, "cannot define more than one #[global_allocator]");
82+
.span_err(item.span, "cannot define more than one `#[global_allocator]`");
8383
return smallvec![item];
8484
}
8585
self.found = true;
@@ -283,7 +283,7 @@ impl AllocFnFactory<'_> {
283283
AllocatorTy::Unit => (self.cx.ty(self.span, TyKind::Tup(Vec::new())), expr),
284284

285285
AllocatorTy::Layout | AllocatorTy::Usize | AllocatorTy::Ptr => {
286-
panic!("can't convert AllocatorTy to an output")
286+
panic!("can't convert `AllocatorTy` to an output")
287287
}
288288
}
289289
}

0 commit comments

Comments
 (0)