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 in compiler messages for libsyntax/feature_gate.rs #62526

Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1465,7 +1465,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
cfg_fn!(dropck_eyepatch))),
(sym::unwind, Whitelisted, template!(List: "allowed|aborts"), Gated(Stability::Unstable,
sym::unwind_attributes,
"#[unwind] is experimental",
"`#[unwind]` is experimental",
cfg_fn!(unwind_attributes))),
(sym::used, Whitelisted, template!(Word), Ungated),

Expand Down Expand Up @@ -1551,13 +1551,13 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[

(sym::alloc_error_handler, Normal, template!(Word), Gated(Stability::Unstable,
sym::alloc_error_handler,
"#[alloc_error_handler] is an unstable feature",
"`#[alloc_error_handler]` is an unstable feature",
cfg_fn!(alloc_error_handler))),

// RFC 2412
(sym::optimize, Whitelisted, template!(List: "size|speed"), Gated(Stability::Unstable,
sym::optimize_attribute,
"#[optimize] attribute is an unstable feature",
"`#[optimize]` attribute is an unstable feature",
cfg_fn!(optimize_attribute))),

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

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

// If we're on stable and only emitting a "soft" warning, add a note to
Expand Down Expand Up @@ -1985,23 +1985,23 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
if let Some(content) = attr.meta_item_list() {
if content.len() == 1 && content[0].check_name(sym::cfg) {
gate_feature_post!(&self, doc_cfg, attr.span,
"#[doc(cfg(...))] is experimental"
"`#[doc(cfg(...))]` is experimental"
);
} else if content.iter().any(|c| c.check_name(sym::masked)) {
gate_feature_post!(&self, doc_masked, attr.span,
"#[doc(masked)] is experimental"
"`#[doc(masked)]` is experimental"
);
} else if content.iter().any(|c| c.check_name(sym::spotlight)) {
gate_feature_post!(&self, doc_spotlight, attr.span,
"#[doc(spotlight)] is experimental"
"`#[doc(spotlight)]` is experimental"
);
} else if content.iter().any(|c| c.check_name(sym::alias)) {
gate_feature_post!(&self, doc_alias, attr.span,
"#[doc(alias = \"...\")] is experimental"
"`#[doc(alias = \"...\")]` is experimental"
);
} else if content.iter().any(|c| c.check_name(sym::keyword)) {
gate_feature_post!(&self, doc_keyword, attr.span,
"#[doc(keyword = \"...\")] is experimental"
"`#[doc(keyword = \"...\")]` is experimental"
);
}
}
Expand Down Expand Up @@ -2044,13 +2044,13 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
}
if attr::contains_name(&i.attrs[..], sym::start) {
gate_feature_post!(&self, start, i.span,
"a #[start] function is an experimental \
"a `#[start]` function is an experimental \
feature whose signature may change \
over time");
}
if attr::contains_name(&i.attrs[..], sym::main) {
gate_feature_post!(&self, main, i.span,
"declaration of a nonstandard #[main] \
"declaration of a non-standard `#[main]` \
function may change over time, for now \
a top-level `fn main()` is required");
}
Expand Down Expand Up @@ -2638,7 +2638,7 @@ fn maybe_stage_features(span_handler: &Handler, krate: &ast::Crate,
if attr.check_name(sym::feature) {
let release_channel = option_env!("CFG_RELEASE_CHANNEL").unwrap_or("(unknown)");
span_err!(span_handler, attr.span, E0554,
"#![feature] may not be used on the {} release channel",
"`#![feature]` may not be used on the {} release channel",
release_channel);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/gated-plugin.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | #![plugin(attr_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/29597
= help: add #![feature(plugin)] to the crate attributes to enable
= help: add `#![feature(plugin)]` to the crate attributes to enable

error: aborting due to previous error

Expand Down
10 changes: 5 additions & 5 deletions src/test/ui-fulldeps/hash-stable-is-unstable.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LL | extern crate rustc_data_structures;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/27812
= help: add #![feature(rustc_private)] to the crate attributes to enable
= help: add `#![feature(rustc_private)]` to the crate attributes to enable

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?
--> $DIR/hash-stable-is-unstable.rs:5:1
Expand All @@ -18,7 +18,7 @@ LL | extern crate rustc;
| ^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/27812
= help: add #![feature(rustc_private)] to the crate attributes to enable
= help: add `#![feature(rustc_private)]` to the crate attributes to enable

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?
--> $DIR/hash-stable-is-unstable.rs:7:1
Expand All @@ -27,7 +27,7 @@ LL | extern crate rustc_macros;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/27812
= help: add #![feature(rustc_private)] to the crate attributes to enable
= help: add `#![feature(rustc_private)]` to the crate attributes to enable

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?
--> $DIR/hash-stable-is-unstable.rs:10:5
Expand All @@ -36,7 +36,7 @@ LL | use rustc_macros::HashStable;
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/27812
= help: add #![feature(rustc_private)] to the crate attributes to enable
= help: add `#![feature(rustc_private)]` to the crate attributes to enable

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?
--> $DIR/hash-stable-is-unstable.rs:13:10
Expand All @@ -45,7 +45,7 @@ LL | #[derive(HashStable)]
| ^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/27812
= help: add #![feature(rustc_private)] to the crate attributes to enable
= help: add `#![feature(rustc_private)]` to the crate attributes to enable

error: aborting due to 6 previous errors

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/async-await/feature-async-closure.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | let _ = async || {};
| ^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/62290
= help: add #![feature(async_closure)] to the crate attributes to enable
= help: add `#![feature(async_closure)]` to the crate attributes to enable

error: aborting due to previous error

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/attributes/obsolete-attr.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | #[fixed_stack_segment] fn f() {}
| ^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
= help: add #![feature(custom_attribute)] to the crate attributes to enable
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable

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

error: aborting due to 2 previous errors

Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/attributes/unknown-attr.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | #![mutable_doc]
| ^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
= help: add #![feature(custom_attribute)] to the crate attributes to enable
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable

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

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

error: aborting due to 3 previous errors

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/cast/cast-ptr-to-int-const.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | main as u32
| ^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/51910
= help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable
= help: add `#![feature(const_raw_ptr_to_usize_cast)]` to the crate attributes to enable

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

error: aborting due to 2 previous errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | #![cfg_attr(broken, no_core)]
| ^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/29639
= help: add #![feature(no_core)] to the crate attributes to enable
= help: add `#![feature(no_core)]` to the crate attributes to enable

error: aborting due to previous error

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

error: aborting due to previous error

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

error: aborting due to previous error

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

error: aborting due to previous error

Expand Down
10 changes: 5 additions & 5 deletions src/test/ui/conditional-compilation/cfg-generic-params.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ LL | fn f_lt_yes<#[cfg_attr(yes, unknown)] 'a>() {}
| ^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
= help: add #![feature(custom_attribute)] to the crate attributes to enable
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable

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

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

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

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

error: aborting due to 8 previous errors

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

error: aborting due to previous error

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

error: aborting due to 2 previous errors

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/const-generics/issue-60263.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | struct B<const I: u8>;
| ^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/44580
= help: add #![feature(const_generics)] to the crate attributes to enable
= help: add `#![feature(const_generics)]` to the crate attributes to enable

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/const-deref-ptr.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | static C: u64 = unsafe {*(0xdeadbeef as *const u64)};
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/51911
= help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable
= help: add `#![feature(const_raw_ptr_deref)]` to the crate attributes to enable

error: aborting due to previous error

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

error: aborting due to previous error

Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/consts/const-eval/feature-gate-const_panic.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | const Z: () = panic!("cheese");
| ^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/51999
= help: add #![feature(const_panic)] to the crate attributes to enable
= help: add `#![feature(const_panic)]` to the crate attributes to enable
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

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

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

error: aborting due to 3 previous errors
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/const-eval/match-test-ptr-null.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | match &1 as *const i32 as usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/51910
= help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable
= help: add `#![feature(const_raw_ptr_to_usize_cast)]` to the crate attributes to enable

error[E0019]: constant contains unimplemented expression type
--> $DIR/match-test-ptr-null.rs:6:15
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | #[rustc_allow_const_fn_ptr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
= help: add #![feature(rustc_attrs)] to the crate attributes to enable
= help: add `#![feature(rustc_attrs)]` to the crate attributes to enable

error: aborting due to previous error

Expand Down
Loading