Skip to content

Commit 41e71b0

Browse files
author
Samy Kacimi
committed
normalize use of backticks in compiler messages for libsyntax/feature_gate
rust-lang#60532
1 parent 909f5a0 commit 41e71b0

File tree

221 files changed

+693
-693
lines changed

Some content is hidden

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

221 files changed

+693
-693
lines changed

src/libsyntax/feature_gate.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
14651465
cfg_fn!(dropck_eyepatch))),
14661466
(sym::unwind, Whitelisted, template!(List: "allowed|aborts"), Gated(Stability::Unstable,
14671467
sym::unwind_attributes,
1468-
"#[unwind] is experimental",
1468+
"`#[unwind]` is experimental",
14691469
cfg_fn!(unwind_attributes))),
14701470
(sym::used, Whitelisted, template!(Word), Ungated),
14711471

@@ -1551,13 +1551,13 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
15511551

15521552
(sym::alloc_error_handler, Normal, template!(Word), Gated(Stability::Unstable,
15531553
sym::alloc_error_handler,
1554-
"#[alloc_error_handler] is an unstable feature",
1554+
"`#[alloc_error_handler]` is an unstable feature",
15551555
cfg_fn!(alloc_error_handler))),
15561556

15571557
// RFC 2412
15581558
(sym::optimize, Whitelisted, template!(List: "size|speed"), Gated(Stability::Unstable,
15591559
sym::optimize_attribute,
1560-
"#[optimize] attribute is an unstable feature",
1560+
"`#[optimize]` attribute is an unstable feature",
15611561
cfg_fn!(optimize_attribute))),
15621562

15631563
// Crate level attributes
@@ -1674,7 +1674,7 @@ impl<'a> Context<'a> {
16741674
if let Some(content) = attr.meta_item_list() {
16751675
if content.iter().any(|c| c.check_name(sym::include)) {
16761676
gate_feature!(self, external_doc, attr.span,
1677-
"#[doc(include = \"...\")] is experimental"
1677+
"`#[doc(include = \"...\")]` is experimental"
16781678
);
16791679
}
16801680
}
@@ -1803,7 +1803,7 @@ fn leveled_feature_err<'a, S: Into<MultiSpan>>(
18031803

18041804
// #23973: do not suggest `#![feature(...)]` if we are in beta/stable
18051805
if sess.unstable_features.is_nightly_build() {
1806-
err.help(&format!("add #![feature({})] to the crate attributes to enable", feature));
1806+
err.help(&format!("add `#![feature({})]` to the crate attributes to enable", feature));
18071807
}
18081808

18091809
// If we're on stable and only emitting a "soft" warning, add a note to
@@ -1985,23 +1985,23 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
19851985
if let Some(content) = attr.meta_item_list() {
19861986
if content.len() == 1 && content[0].check_name(sym::cfg) {
19871987
gate_feature_post!(&self, doc_cfg, attr.span,
1988-
"#[doc(cfg(...))] is experimental"
1988+
"`#[doc(cfg(...))]` is experimental"
19891989
);
19901990
} else if content.iter().any(|c| c.check_name(sym::masked)) {
19911991
gate_feature_post!(&self, doc_masked, attr.span,
1992-
"#[doc(masked)] is experimental"
1992+
"`#[doc(masked)]` is experimental"
19931993
);
19941994
} else if content.iter().any(|c| c.check_name(sym::spotlight)) {
19951995
gate_feature_post!(&self, doc_spotlight, attr.span,
1996-
"#[doc(spotlight)] is experimental"
1996+
"`#[doc(spotlight)]` is experimental"
19971997
);
19981998
} else if content.iter().any(|c| c.check_name(sym::alias)) {
19991999
gate_feature_post!(&self, doc_alias, attr.span,
2000-
"#[doc(alias = \"...\")] is experimental"
2000+
"`#[doc(alias = \"...\")]` is experimental"
20012001
);
20022002
} else if content.iter().any(|c| c.check_name(sym::keyword)) {
20032003
gate_feature_post!(&self, doc_keyword, attr.span,
2004-
"#[doc(keyword = \"...\")] is experimental"
2004+
"`#[doc(keyword = \"...\")]` is experimental"
20052005
);
20062006
}
20072007
}
@@ -2044,13 +2044,13 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
20442044
}
20452045
if attr::contains_name(&i.attrs[..], sym::start) {
20462046
gate_feature_post!(&self, start, i.span,
2047-
"a #[start] function is an experimental \
2047+
"a `#[start]` function is an experimental \
20482048
feature whose signature may change \
20492049
over time");
20502050
}
20512051
if attr::contains_name(&i.attrs[..], sym::main) {
20522052
gate_feature_post!(&self, main, i.span,
2053-
"declaration of a nonstandard #[main] \
2053+
"declaration of a non-standard `#[main]` \
20542054
function may change over time, for now \
20552055
a top-level `fn main()` is required");
20562056
}
@@ -2638,7 +2638,7 @@ fn maybe_stage_features(span_handler: &Handler, krate: &ast::Crate,
26382638
if attr.check_name(sym::feature) {
26392639
let release_channel = option_env!("CFG_RELEASE_CHANNEL").unwrap_or("(unknown)");
26402640
span_err!(span_handler, attr.span, E0554,
2641-
"#![feature] may not be used on the {} release channel",
2641+
"`#![feature]` may not be used on the {} release channel",
26422642
release_channel);
26432643
}
26442644
}

src/test/ui-fulldeps/gated-plugin.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | #![plugin(attr_plugin_test)]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: for more information, see https://github.com/rust-lang/rust/issues/29597
8-
= help: add #![feature(plugin)] to the crate attributes to enable
8+
= help: add `#![feature(plugin)]` to the crate attributes to enable
99

1010
error: aborting due to previous error
1111

src/test/ui-fulldeps/hash-stable-is-unstable.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LL | extern crate rustc_data_structures;
99
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1010
|
1111
= note: for more information, see https://github.com/rust-lang/rust/issues/27812
12-
= help: add #![feature(rustc_private)] to the crate attributes to enable
12+
= help: add `#![feature(rustc_private)]` to the crate attributes to enable
1313

1414
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
1515
--> $DIR/hash-stable-is-unstable.rs:5:1
@@ -18,7 +18,7 @@ LL | extern crate rustc;
1818
| ^^^^^^^^^^^^^^^^^^^
1919
|
2020
= note: for more information, see https://github.com/rust-lang/rust/issues/27812
21-
= help: add #![feature(rustc_private)] to the crate attributes to enable
21+
= help: add `#![feature(rustc_private)]` to the crate attributes to enable
2222

2323
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
2424
--> $DIR/hash-stable-is-unstable.rs:7:1
@@ -27,7 +27,7 @@ LL | extern crate rustc_macros;
2727
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
2828
|
2929
= note: for more information, see https://github.com/rust-lang/rust/issues/27812
30-
= help: add #![feature(rustc_private)] to the crate attributes to enable
30+
= help: add `#![feature(rustc_private)]` to the crate attributes to enable
3131

3232
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
3333
--> $DIR/hash-stable-is-unstable.rs:10:5
@@ -36,7 +36,7 @@ LL | use rustc_macros::HashStable;
3636
| ^^^^^^^^^^^^^^^^^^^^^^^^
3737
|
3838
= note: for more information, see https://github.com/rust-lang/rust/issues/27812
39-
= help: add #![feature(rustc_private)] to the crate attributes to enable
39+
= help: add `#![feature(rustc_private)]` to the crate attributes to enable
4040

4141
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
4242
--> $DIR/hash-stable-is-unstable.rs:13:10
@@ -45,7 +45,7 @@ LL | #[derive(HashStable)]
4545
| ^^^^^^^^^^
4646
|
4747
= note: for more information, see https://github.com/rust-lang/rust/issues/27812
48-
= help: add #![feature(rustc_private)] to the crate attributes to enable
48+
= help: add `#![feature(rustc_private)]` to the crate attributes to enable
4949

5050
error: aborting due to 6 previous errors
5151

src/test/ui/async-await/feature-async-closure.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | let _ = async || {};
55
| ^^^^^
66
|
77
= note: for more information, see https://github.com/rust-lang/rust/issues/62290
8-
= help: add #![feature(async_closure)] to the crate attributes to enable
8+
= help: add `#![feature(async_closure)]` to the crate attributes to enable
99

1010
error: aborting due to previous error
1111

src/test/ui/attributes/obsolete-attr.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | #[fixed_stack_segment] fn f() {}
55
| ^^^^^^^^^^^^^^^^^^^
66
|
77
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
8-
= help: add #![feature(custom_attribute)] to the crate attributes to enable
8+
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
99

1010
error[E0658]: The attribute `ab_isize` is currently unknown to the compiler and may have meaning added to it in the future
1111
--> $DIR/obsolete-attr.rs:3:3
@@ -14,7 +14,7 @@ LL | #[ab_isize="stdcall"] extern {}
1414
| ^^^^^^^^
1515
|
1616
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
17-
= help: add #![feature(custom_attribute)] to the crate attributes to enable
17+
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
1818

1919
error: aborting due to 2 previous errors
2020

src/test/ui/attributes/unknown-attr.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | #![mutable_doc]
55
| ^^^^^^^^^^^
66
|
77
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
8-
= help: add #![feature(custom_attribute)] to the crate attributes to enable
8+
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
99

1010
error[E0658]: The attribute `dance` is currently unknown to the compiler and may have meaning added to it in the future
1111
--> $DIR/unknown-attr.rs:7:3
@@ -14,7 +14,7 @@ LL | #[dance] mod a {}
1414
| ^^^^^
1515
|
1616
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
17-
= help: add #![feature(custom_attribute)] to the crate attributes to enable
17+
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
1818

1919
error[E0658]: The attribute `dance` is currently unknown to the compiler and may have meaning added to it in the future
2020
--> $DIR/unknown-attr.rs:9:3
@@ -23,7 +23,7 @@ LL | #[dance] fn main() {}
2323
| ^^^^^
2424
|
2525
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
26-
= help: add #![feature(custom_attribute)] to the crate attributes to enable
26+
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
2727

2828
error: aborting due to 3 previous errors
2929

src/test/ui/cast/cast-ptr-to-int-const.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | main as u32
55
| ^^^^^^^^^^^
66
|
77
= note: for more information, see https://github.com/rust-lang/rust/issues/51910
8-
= help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable
8+
= help: add `#![feature(const_raw_ptr_to_usize_cast)]` to the crate attributes to enable
99

1010
error[E0658]: casting pointers to integers in constants is unstable
1111
--> $DIR/cast-ptr-to-int-const.rs:9:9
@@ -14,7 +14,7 @@ LL | &Y as *const u32 as u32
1414
| ^^^^^^^^^^^^^^^^^^^^^^^
1515
|
1616
= note: for more information, see https://github.com/rust-lang/rust/issues/51910
17-
= help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable
17+
= help: add `#![feature(const_raw_ptr_to_usize_cast)]` to the crate attributes to enable
1818

1919
error: aborting due to 2 previous errors
2020

src/test/ui/conditional-compilation/cfg-attr-crate-2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | #![cfg_attr(broken, no_core)]
55
| ^^^^^^^
66
|
77
= note: for more information, see https://github.com/rust-lang/rust/issues/29639
8-
= help: add #![feature(no_core)] to the crate attributes to enable
8+
= help: add `#![feature(no_core)]` to the crate attributes to enable
99

1010
error: aborting due to previous error
1111

src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | #![cfg_attr(broken, no_core, no_std)]
55
| ^^^^^^^
66
|
77
= note: for more information, see https://github.com/rust-lang/rust/issues/29639
8-
= help: add #![feature(no_core)] to the crate attributes to enable
8+
= help: add `#![feature(no_core)]` to the crate attributes to enable
99

1010
error: aborting due to previous error
1111

src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | #![cfg_attr(broken, no_std, no_core)]
55
| ^^^^^^^
66
|
77
= note: for more information, see https://github.com/rust-lang/rust/issues/29639
8-
= help: add #![feature(no_core)] to the crate attributes to enable
8+
= help: add `#![feature(no_core)]` to the crate attributes to enable
99

1010
error: aborting due to previous error
1111

src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LL | foo!();
88
| ------- in this macro invocation
99
|
1010
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
11-
= help: add #![feature(custom_attribute)] to the crate attributes to enable
11+
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
1212

1313
error: aborting due to previous error
1414

src/test/ui/conditional-compilation/cfg-generic-params.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ LL | fn f_lt_yes<#[cfg_attr(yes, unknown)] 'a>() {}
2323
| ^^^^^^^
2424
|
2525
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
26-
= help: add #![feature(custom_attribute)] to the crate attributes to enable
26+
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
2727

2828
error[E0658]: The attribute `unknown` is currently unknown to the compiler and may have meaning added to it in the future
2929
--> $DIR/cfg-generic-params.rs:21:29
@@ -32,7 +32,7 @@ LL | fn f_ty_yes<#[cfg_attr(yes, unknown)] T>() {}
3232
| ^^^^^^^
3333
|
3434
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
35-
= help: add #![feature(custom_attribute)] to the crate attributes to enable
35+
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
3636

3737
error[E0658]: The attribute `unknown` is currently unknown to the compiler and may have meaning added to it in the future
3838
--> $DIR/cfg-generic-params.rs:24:34
@@ -41,7 +41,7 @@ LL | type FnYes = for<#[cfg_attr(yes, unknown)] 'a> fn();
4141
| ^^^^^^^
4242
|
4343
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
44-
= help: add #![feature(custom_attribute)] to the crate attributes to enable
44+
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
4545

4646
error[E0658]: The attribute `unknown` is currently unknown to the compiler and may have meaning added to it in the future
4747
--> $DIR/cfg-generic-params.rs:28:40
@@ -50,7 +50,7 @@ LL | type PolyYes = dyn for<#[cfg_attr(yes, unknown)] 'a> Copy;
5050
| ^^^^^^^
5151
|
5252
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
53-
= help: add #![feature(custom_attribute)] to the crate attributes to enable
53+
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
5454

5555
error[E0658]: The attribute `unknown` is currently unknown to the compiler and may have meaning added to it in the future
5656
--> $DIR/cfg-generic-params.rs:32:43
@@ -59,7 +59,7 @@ LL | struct WhereYes where for<#[cfg_attr(yes, unknown)] 'a> u8: Copy;
5959
| ^^^^^^^
6060
|
6161
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
62-
= help: add #![feature(custom_attribute)] to the crate attributes to enable
62+
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
6363

6464
error: aborting due to 8 previous errors
6565

src/test/ui/const-generics/const-param-in-trait-ungated.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | trait Trait<const T: ()> {}
55
| ^
66
|
77
= note: for more information, see https://github.com/rust-lang/rust/issues/44580
8-
= help: add #![feature(const_generics)] to the crate attributes to enable
8+
= help: add `#![feature(const_generics)]` to the crate attributes to enable
99

1010
error: aborting due to previous error
1111

src/test/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LL | struct B<T, const N: T>(PhantomData<[T; N]>);
1111
| ^
1212
|
1313
= note: for more information, see https://github.com/rust-lang/rust/issues/44580
14-
= help: add #![feature(const_generics)] to the crate attributes to enable
14+
= help: add `#![feature(const_generics)]` to the crate attributes to enable
1515

1616
error: aborting due to 2 previous errors
1717

src/test/ui/const-generics/issue-60263.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | struct B<const I: u8>;
55
| ^
66
|
77
= note: for more information, see https://github.com/rust-lang/rust/issues/44580
8-
= help: add #![feature(const_generics)] to the crate attributes to enable
8+
= help: add `#![feature(const_generics)]` to the crate attributes to enable
99

1010
error: aborting due to previous error
1111

src/test/ui/consts/const-deref-ptr.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | static C: u64 = unsafe {*(0xdeadbeef as *const u64)};
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: for more information, see https://github.com/rust-lang/rust/issues/51911
8-
= help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable
8+
= help: add `#![feature(const_raw_ptr_deref)]` to the crate attributes to enable
99

1010
error: aborting due to previous error
1111

src/test/ui/consts/const-eval/feature-gate-const_fn_union.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | Foo { u }.i
55
| ^^^^^^^^^^^
66
|
77
= note: for more information, see https://github.com/rust-lang/rust/issues/51909
8-
= help: add #![feature(const_fn_union)] to the crate attributes to enable
8+
= help: add `#![feature(const_fn_union)]` to the crate attributes to enable
99

1010
error: aborting due to previous error
1111

src/test/ui/consts/const-eval/feature-gate-const_panic.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | const Z: () = panic!("cheese");
55
| ^^^^^^^^^^^^^^^^
66
|
77
= note: for more information, see https://github.com/rust-lang/rust/issues/51999
8-
= help: add #![feature(const_panic)] to the crate attributes to enable
8+
= help: add `#![feature(const_panic)]` to the crate attributes to enable
99
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
1010

1111
error[E0658]: panicking in constants is unstable
@@ -15,7 +15,7 @@ LL | const X: () = unimplemented!();
1515
| ^^^^^^^^^^^^^^^^
1616
|
1717
= note: for more information, see https://github.com/rust-lang/rust/issues/51999
18-
= help: add #![feature(const_panic)] to the crate attributes to enable
18+
= help: add `#![feature(const_panic)]` to the crate attributes to enable
1919
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2020

2121
error[E0658]: panicking in constants is unstable
@@ -25,7 +25,7 @@ LL | const Y: () = unreachable!();
2525
| ^^^^^^^^^^^^^^
2626
|
2727
= note: for more information, see https://github.com/rust-lang/rust/issues/51999
28-
= help: add #![feature(const_panic)] to the crate attributes to enable
28+
= help: add `#![feature(const_panic)]` to the crate attributes to enable
2929
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
3030

3131
error: aborting due to 3 previous errors

src/test/ui/consts/const-eval/match-test-ptr-null.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | match &1 as *const i32 as usize {
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: for more information, see https://github.com/rust-lang/rust/issues/51910
8-
= help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable
8+
= help: add `#![feature(const_raw_ptr_to_usize_cast)]` to the crate attributes to enable
99

1010
error[E0019]: constant contains unimplemented expression type
1111
--> $DIR/match-test-ptr-null.rs:6:15

src/test/ui/consts/min_const_fn/allow_const_fn_ptr_feature_gate.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | #[rustc_allow_const_fn_ptr]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
8-
= help: add #![feature(rustc_attrs)] to the crate attributes to enable
8+
= help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
99

1010
error: aborting due to previous error
1111

0 commit comments

Comments
 (0)