Skip to content

Commit

Permalink
use backticks instead of single quotes when reporting "use of unstabl…
Browse files Browse the repository at this point in the history
…e library feature"

This is consistent with all other diagnostics I could find containing
features and enables the use of `DiagSymbolList` for generalizing
diagnostics for unstable library features to multiple features.
  • Loading branch information
dianne committed Nov 3, 2024
1 parent b3f75cc commit f3c53ac
Show file tree
Hide file tree
Showing 113 changed files with 425 additions and 425 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_hir_analysis/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ hir_analysis_missing_trait_item_suggestion = implement the missing item: `{$snip
hir_analysis_missing_trait_item_unstable = not all trait items implemented, missing: `{$missing_item_name}`
.note = default implementation of `{$missing_item_name}` is unstable
.some_note = use of unstable library feature '{$feature}': {$reason}
.none_note = use of unstable library feature '{$feature}'
.some_note = use of unstable library feature `{$feature}`: {$reason}
.none_note = use of unstable library feature `{$feature}`
hir_analysis_missing_type_params =
the type {$parameterCount ->
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_middle/src/middle/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ pub fn report_unstable(
soft_handler: impl FnOnce(&'static Lint, Span, String),
) {
let msg = match reason {
Some(r) => format!("use of unstable library feature '{feature}': {r}"),
None => format!("use of unstable library feature '{feature}'"),
Some(r) => format!("use of unstable library feature `{feature}`: {r}"),
None => format!("use of unstable library feature `{feature}`"),
};

if is_soft {
Expand Down
10 changes: 5 additions & 5 deletions tests/ui-fulldeps/hash-stable-is-unstable.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
//@ compile-flags: -Zdeduplicate-diagnostics=yes
extern crate rustc_data_structures;
//~^ use of unstable library feature 'rustc_private'
//~^ use of unstable library feature `rustc_private`
//~| NOTE: issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
extern crate rustc_macros;
//~^ use of unstable library feature 'rustc_private'
//~^ use of unstable library feature `rustc_private`
//~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
extern crate rustc_query_system;
//~^ use of unstable library feature 'rustc_private'
//~^ use of unstable library feature `rustc_private`
//~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

use rustc_macros::HashStable;
//~^ use of unstable library feature 'rustc_private'
//~^ use of unstable library feature `rustc_private`
//~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

#[derive(HashStable)]
//~^ use of unstable library feature 'rustc_private'
//~^ use of unstable library feature `rustc_private`
//~| NOTE: in this expansion of #[derive(HashStable)]
//~| NOTE: in this expansion of #[derive(HashStable)]
//~| NOTE: in this expansion of #[derive(HashStable)]
Expand Down
10 changes: 5 additions & 5 deletions tests/ui-fulldeps/hash-stable-is-unstable.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
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?
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:2:1
|
LL | extern crate rustc_data_structures;
Expand All @@ -8,7 +8,7 @@ LL | extern crate rustc_data_structures;
= help: add `#![feature(rustc_private)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

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?
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:6:1
|
LL | extern crate rustc_macros;
Expand All @@ -18,7 +18,7 @@ LL | extern crate rustc_macros;
= help: add `#![feature(rustc_private)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

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?
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:1
|
LL | extern crate rustc_query_system;
Expand All @@ -28,7 +28,7 @@ LL | extern crate rustc_query_system;
= help: add `#![feature(rustc_private)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

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?
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:15:5
|
LL | use rustc_macros::HashStable;
Expand All @@ -38,7 +38,7 @@ LL | use rustc_macros::HashStable;
= help: add `#![feature(rustc_private)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

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?
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:20:10
|
LL | #[derive(HashStable)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui-fulldeps/pathless-extern-unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
// Test that `--extern rustc_middle` fails with `rustc_private`.

pub use rustc_middle;
//~^ ERROR use of unstable library feature 'rustc_private'
//~^ ERROR use of unstable library feature `rustc_private`

fn main() {}
2 changes: 1 addition & 1 deletion tests/ui-fulldeps/pathless-extern-unstable.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
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?
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/pathless-extern-unstable.rs:6:9
|
LL | pub use rustc_middle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
#![feature(inherent_associated_types)]
#![allow(incomplete_features)]

type Data = aux::Owner::Data; //~ ERROR use of unstable library feature 'data'
type Data = aux::Owner::Data; //~ ERROR use of unstable library feature `data`

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0658]: use of unstable library feature 'data'
error[E0658]: use of unstable library feature `data`
--> $DIR/assoc-inherent-unstable.rs:7:13
|
LL | type Data = aux::Owner::Data;
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/async-await/async-fn/edition-2015.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ fn foo(x: impl async Fn()) -> impl async Fn() { x }
//~| ERROR `async` trait bounds are only allowed in Rust 2018 or later
//~| ERROR async closures are unstable
//~| ERROR async closures are unstable
//~| ERROR use of unstable library feature 'async_closure'
//~| ERROR use of unstable library feature 'async_closure'
//~| ERROR use of unstable library feature `async_closure`
//~| ERROR use of unstable library feature `async_closure`

fn main() {}
4 changes: 2 additions & 2 deletions tests/ui/async-await/async-fn/edition-2015.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= help: to use an async block, remove the `||`: `async {`

error[E0658]: use of unstable library feature 'async_closure'
error[E0658]: use of unstable library feature `async_closure`
--> $DIR/edition-2015.rs:1:42
|
LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
Expand All @@ -48,7 +48,7 @@ LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
= help: add `#![feature(async_closure)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'async_closure'
error[E0658]: use of unstable library feature `async_closure`
--> $DIR/edition-2015.rs:1:22
|
LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/box/alloc-unstable-fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ use std::boxed::Box;

fn main() {
let _boxed: Box<u32, _> = Box::new(10);
//~^ ERROR use of unstable library feature 'allocator_api'
//~^ ERROR use of unstable library feature `allocator_api`
}
2 changes: 1 addition & 1 deletion tests/ui/box/alloc-unstable-fail.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0658]: use of unstable library feature 'allocator_api'
error[E0658]: use of unstable library feature `allocator_api`
--> $DIR/alloc-unstable-fail.rs:4:26
|
LL | let _boxed: Box<u32, _> = Box::new(10);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#[cfg_accessible(std)] //~ ERROR use of unstable library feature 'cfg_accessible'
#[cfg_accessible(std)] //~ ERROR use of unstable library feature `cfg_accessible`
fn main() {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0658]: use of unstable library feature 'cfg_accessible': `cfg_accessible` is not fully implemented
error[E0658]: use of unstable library feature `cfg_accessible`: `cfg_accessible` is not fully implemented
--> $DIR/cfg_accessible-unstable.rs:1:3
|
LL | #[cfg_accessible(std)]
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/consts/const-unstable-intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ const fn const_main() {
let x = 42;
unsafe {
unstable_intrinsic::old_way::size_of_val(&x);
//~^ERROR: unstable library feature 'unstable'
//~^ERROR: unstable library feature `unstable`
//~|ERROR: cannot call non-const intrinsic
unstable_intrinsic::old_way::min_align_of_val(&x);
//~^ERROR: unstable library feature 'unstable'
//~^ERROR: unstable library feature `unstable`
//~|ERROR: not yet stable as a const intrinsic
unstable_intrinsic::new_way::size_of_val(&x);
//~^ERROR: unstable library feature 'unstable'
//~^ERROR: unstable library feature `unstable`
//~|ERROR: cannot be (indirectly) exposed to stable
unstable_intrinsic::new_way::min_align_of_val(&x);
//~^ERROR: unstable library feature 'unstable'
//~^ERROR: unstable library feature `unstable`
//~|ERROR: not yet stable as a const intrinsic

old_way::size_of_val(&x);
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/consts/const-unstable-intrinsic.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0658]: use of unstable library feature 'unstable'
error[E0658]: use of unstable library feature `unstable`
--> $DIR/const-unstable-intrinsic.rs:17:9
|
LL | unstable_intrinsic::old_way::size_of_val(&x);
Expand All @@ -8,7 +8,7 @@ LL | unstable_intrinsic::old_way::size_of_val(&x);
= help: add `#![feature(unstable)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'unstable'
error[E0658]: use of unstable library feature `unstable`
--> $DIR/const-unstable-intrinsic.rs:20:9
|
LL | unstable_intrinsic::old_way::min_align_of_val(&x);
Expand All @@ -18,7 +18,7 @@ LL | unstable_intrinsic::old_way::min_align_of_val(&x);
= help: add `#![feature(unstable)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'unstable'
error[E0658]: use of unstable library feature `unstable`
--> $DIR/const-unstable-intrinsic.rs:23:9
|
LL | unstable_intrinsic::new_way::size_of_val(&x);
Expand All @@ -28,7 +28,7 @@ LL | unstable_intrinsic::new_way::size_of_val(&x);
= help: add `#![feature(unstable)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'unstable'
error[E0658]: use of unstable library feature `unstable`
--> $DIR/const-unstable-intrinsic.rs:26:9
|
LL | unstable_intrinsic::new_way::min_align_of_val(&x);
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/derives/rustc-decodable-issue-123156.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Future incompatibility report: Future breakage diagnostic:
warning: use of unstable library feature 'rustc_encodable_decodable': derive macro for `rustc-serialize`; should not be used in new code
warning: use of unstable library feature `rustc_encodable_decodable`: derive macro for `rustc-serialize`; should not be used in new code
--> $DIR/rustc-decodable-issue-123156.rs:10:10
|
LL | #[derive(RustcDecodable)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/explore-issue-38412.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn main() {

let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } =
Record::new();
//~^^ ERROR use of unstable library feature 'unstable_undeclared'
//~^^ ERROR use of unstable library feature `unstable_undeclared`

let r = Record::new();
let t = Tuple::new();
Expand Down
14 changes: 7 additions & 7 deletions tests/ui/explore-issue-38412.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0658]: use of unstable library feature 'unstable_undeclared'
error[E0658]: use of unstable library feature `unstable_undeclared`
--> $DIR/explore-issue-38412.rs:19:63
|
LL | let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } =
Expand All @@ -8,7 +8,7 @@ LL | let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_un
= help: add `#![feature(unstable_undeclared)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'unstable_undeclared'
error[E0658]: use of unstable library feature `unstable_undeclared`
--> $DIR/explore-issue-38412.rs:28:5
|
LL | r.a_unstable_undeclared_pub;
Expand Down Expand Up @@ -36,7 +36,7 @@ error[E0616]: field `d_priv` of struct `Record` is private
LL | r.d_priv;
| ^^^^^^ private field

error[E0658]: use of unstable library feature 'unstable_undeclared'
error[E0658]: use of unstable library feature `unstable_undeclared`
--> $DIR/explore-issue-38412.rs:35:5
|
LL | t.2;
Expand Down Expand Up @@ -64,7 +64,7 @@ error[E0616]: field `5` of struct `pub_and_stability::Tuple` is private
LL | t.5;
| ^ private field

error[E0658]: use of unstable library feature 'unstable_undeclared'
error[E0658]: use of unstable library feature `unstable_undeclared`
--> $DIR/explore-issue-38412.rs:42:7
|
LL | r.unstable_undeclared_trait_method();
Expand All @@ -74,7 +74,7 @@ LL | r.unstable_undeclared_trait_method();
= help: add `#![feature(unstable_undeclared)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'unstable_undeclared'
error[E0658]: use of unstable library feature `unstable_undeclared`
--> $DIR/explore-issue-38412.rs:46:7
|
LL | r.unstable_undeclared();
Expand Down Expand Up @@ -117,7 +117,7 @@ LL | r.private();
LL | fn private(&self) -> i32 { self.d_priv }
| ------------------------ private method defined here

error[E0658]: use of unstable library feature 'unstable_undeclared'
error[E0658]: use of unstable library feature `unstable_undeclared`
--> $DIR/explore-issue-38412.rs:55:7
|
LL | t.unstable_undeclared_trait_method();
Expand All @@ -127,7 +127,7 @@ LL | t.unstable_undeclared_trait_method();
= help: add `#![feature(unstable_undeclared)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'unstable_undeclared'
error[E0658]: use of unstable library feature `unstable_undeclared`
--> $DIR/explore-issue-38412.rs:59:7
|
LL | t.unstable_undeclared();
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/feature-gates/bench.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//@ edition:2018

#[bench] //~ ERROR use of unstable library feature 'test'
#[bench] //~ ERROR use of unstable library feature `test`
//~| WARN this was previously accepted
fn bench() {}

use bench as _; //~ ERROR use of unstable library feature 'test'
use bench as _; //~ ERROR use of unstable library feature `test`
//~| WARN this was previously accepted
fn main() {}
8 changes: 4 additions & 4 deletions tests/ui/feature-gates/bench.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable
error: use of unstable library feature `test`: `bench` is a part of custom test frameworks which are unstable
--> $DIR/bench.rs:3:3
|
LL | #[bench]
Expand All @@ -8,7 +8,7 @@ LL | #[bench]
= note: for more information, see issue #64266 <https://github.com/rust-lang/rust/issues/64266>
= note: `#[deny(soft_unstable)]` on by default

error: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable
error: use of unstable library feature `test`: `bench` is a part of custom test frameworks which are unstable
--> $DIR/bench.rs:7:5
|
LL | use bench as _;
Expand All @@ -20,7 +20,7 @@ LL | use bench as _;
error: aborting due to 2 previous errors

Future incompatibility report: Future breakage diagnostic:
error: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable
error: use of unstable library feature `test`: `bench` is a part of custom test frameworks which are unstable
--> $DIR/bench.rs:3:3
|
LL | #[bench]
Expand All @@ -31,7 +31,7 @@ LL | #[bench]
= note: `#[deny(soft_unstable)]` on by default

Future breakage diagnostic:
error: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable
error: use of unstable library feature `test`: `bench` is a part of custom test frameworks which are unstable
--> $DIR/bench.rs:7:5
|
LL | use bench as _;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/feature-gates/feature-gate-alloc-error-handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use core::alloc::Layout;

#[alloc_error_handler] //~ ERROR use of unstable library feature 'alloc_error_handler'
#[alloc_error_handler] //~ ERROR use of unstable library feature `alloc_error_handler`
fn oom(info: Layout) -> ! {
loop {}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0658]: use of unstable library feature 'alloc_error_handler'
error[E0658]: use of unstable library feature `alloc_error_handler`
--> $DIR/feature-gate-alloc-error-handler.rs:8:3
|
LL | #[alloc_error_handler]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0658]: use of unstable library feature 'autodiff'
error[E0658]: use of unstable library feature `autodiff`
--> $DIR/feature-gate-autodiff-use.rs:13:3
|
LL | #[autodiff(dfoo, Reverse)]
Expand All @@ -8,7 +8,7 @@ LL | #[autodiff(dfoo, Reverse)]
= help: add `#![feature(autodiff)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'autodiff'
error[E0658]: use of unstable library feature `autodiff`
--> $DIR/feature-gate-autodiff-use.rs:9:5
|
LL | use std::autodiff::autodiff;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0658]: use of unstable library feature 'autodiff'
error[E0658]: use of unstable library feature `autodiff`
--> $DIR/feature-gate-autodiff-use.rs:13:3
|
LL | #[autodiff(dfoo, Reverse)]
Expand All @@ -14,7 +14,7 @@ error: this rustc version does not support autodiff
LL | #[autodiff(dfoo, Reverse)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'autodiff'
error[E0658]: use of unstable library feature `autodiff`
--> $DIR/feature-gate-autodiff-use.rs:9:5
|
LL | use std::autodiff::autodiff;
Expand Down
Loading

0 comments on commit f3c53ac

Please sign in to comment.