Skip to content

Commit 6846164

Browse files
committed
Auto merge of #96302 - Serial-ATA:more-diagnostic-items, r=manishearth
Add more diagnostic items This just adds a handful diagnostic items I noticed were missing. Would it be worth doing this for all of the remaining types? I'm willing to do it if it'd be helpful.
2 parents 83322c5 + be9dd2d commit 6846164

File tree

5 files changed

+18
-40
lines changed

5 files changed

+18
-40
lines changed

library/core/src/fmt/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ mod nofloat;
1919
mod num;
2020

2121
#[stable(feature = "fmt_flags_align", since = "1.28.0")]
22+
#[cfg_attr(not(test), rustc_diagnostic_item = "Alignment")]
2223
/// Possible alignments returned by `Formatter::align`
2324
#[derive(Debug)]
2425
pub enum Alignment {
@@ -462,6 +463,7 @@ impl<'a> Arguments<'a> {
462463
///
463464
/// [`format()`]: ../../std/fmt/fn.format.html
464465
#[stable(feature = "rust1", since = "1.0.0")]
466+
#[cfg_attr(not(test), rustc_diagnostic_item = "Arguments")]
465467
#[derive(Copy, Clone)]
466468
pub struct Arguments<'a> {
467469
// Format string pieces to print.

library/core/src/sync/atomic.rs

+15
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ unsafe impl Sync for AtomicBool {}
162162
/// loads and stores of pointers. Its size depends on the target pointer's size.
163163
#[cfg(target_has_atomic_load_store = "ptr")]
164164
#[stable(feature = "rust1", since = "1.0.0")]
165+
#[cfg_attr(not(test), rustc_diagnostic_item = "AtomicPtr")]
165166
#[cfg_attr(target_pointer_width = "16", repr(C, align(2)))]
166167
#[cfg_attr(target_pointer_width = "32", repr(C, align(4)))]
167168
#[cfg_attr(target_pointer_width = "64", repr(C, align(8)))]
@@ -1458,6 +1459,7 @@ macro_rules! atomic_int {
14581459
$stable_nand:meta,
14591460
$const_stable:meta,
14601461
$stable_init_const:meta,
1462+
$diagnostic_item:meta,
14611463
$s_int_type:literal,
14621464
$extra_feature:expr,
14631465
$min_fn:ident, $max_fn:ident,
@@ -1480,6 +1482,7 @@ macro_rules! atomic_int {
14801482
///
14811483
/// [module-level documentation]: crate::sync::atomic
14821484
#[$stable]
1485+
#[$diagnostic_item]
14831486
#[repr(C, align($align))]
14841487
pub struct $atomic_type {
14851488
v: UnsafeCell<$int_type>,
@@ -2306,6 +2309,7 @@ atomic_int! {
23062309
stable(feature = "integer_atomics_stable", since = "1.34.0"),
23072310
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
23082311
unstable(feature = "integer_atomics", issue = "32976"),
2312+
cfg_attr(not(test), rustc_diagnostic_item = "AtomicI8"),
23092313
"i8",
23102314
"",
23112315
atomic_min, atomic_max,
@@ -2325,6 +2329,7 @@ atomic_int! {
23252329
stable(feature = "integer_atomics_stable", since = "1.34.0"),
23262330
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
23272331
unstable(feature = "integer_atomics", issue = "32976"),
2332+
cfg_attr(not(test), rustc_diagnostic_item = "AtomicU8"),
23282333
"u8",
23292334
"",
23302335
atomic_umin, atomic_umax,
@@ -2344,6 +2349,7 @@ atomic_int! {
23442349
stable(feature = "integer_atomics_stable", since = "1.34.0"),
23452350
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
23462351
unstable(feature = "integer_atomics", issue = "32976"),
2352+
cfg_attr(not(test), rustc_diagnostic_item = "AtomicI16"),
23472353
"i16",
23482354
"",
23492355
atomic_min, atomic_max,
@@ -2363,6 +2369,7 @@ atomic_int! {
23632369
stable(feature = "integer_atomics_stable", since = "1.34.0"),
23642370
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
23652371
unstable(feature = "integer_atomics", issue = "32976"),
2372+
cfg_attr(not(test), rustc_diagnostic_item = "AtomicU16"),
23662373
"u16",
23672374
"",
23682375
atomic_umin, atomic_umax,
@@ -2382,6 +2389,7 @@ atomic_int! {
23822389
stable(feature = "integer_atomics_stable", since = "1.34.0"),
23832390
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
23842391
unstable(feature = "integer_atomics", issue = "32976"),
2392+
cfg_attr(not(test), rustc_diagnostic_item = "AtomicI32"),
23852393
"i32",
23862394
"",
23872395
atomic_min, atomic_max,
@@ -2401,6 +2409,7 @@ atomic_int! {
24012409
stable(feature = "integer_atomics_stable", since = "1.34.0"),
24022410
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
24032411
unstable(feature = "integer_atomics", issue = "32976"),
2412+
cfg_attr(not(test), rustc_diagnostic_item = "AtomicU32"),
24042413
"u32",
24052414
"",
24062415
atomic_umin, atomic_umax,
@@ -2420,6 +2429,7 @@ atomic_int! {
24202429
stable(feature = "integer_atomics_stable", since = "1.34.0"),
24212430
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
24222431
unstable(feature = "integer_atomics", issue = "32976"),
2432+
cfg_attr(not(test), rustc_diagnostic_item = "AtomicI64"),
24232433
"i64",
24242434
"",
24252435
atomic_min, atomic_max,
@@ -2439,6 +2449,7 @@ atomic_int! {
24392449
stable(feature = "integer_atomics_stable", since = "1.34.0"),
24402450
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
24412451
unstable(feature = "integer_atomics", issue = "32976"),
2452+
cfg_attr(not(test), rustc_diagnostic_item = "AtomicU64"),
24422453
"u64",
24432454
"",
24442455
atomic_umin, atomic_umax,
@@ -2458,6 +2469,7 @@ atomic_int! {
24582469
unstable(feature = "integer_atomics", issue = "32976"),
24592470
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
24602471
unstable(feature = "integer_atomics", issue = "32976"),
2472+
cfg_attr(not(test), rustc_diagnostic_item = "AtomicI128"),
24612473
"i128",
24622474
"#![feature(integer_atomics)]\n\n",
24632475
atomic_min, atomic_max,
@@ -2477,6 +2489,7 @@ atomic_int! {
24772489
unstable(feature = "integer_atomics", issue = "32976"),
24782490
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
24792491
unstable(feature = "integer_atomics", issue = "32976"),
2492+
cfg_attr(not(test), rustc_diagnostic_item = "AtomicU128"),
24802493
"u128",
24812494
"#![feature(integer_atomics)]\n\n",
24822495
atomic_umin, atomic_umax,
@@ -2500,6 +2513,7 @@ macro_rules! atomic_int_ptr_sized {
25002513
stable(feature = "atomic_nand", since = "1.27.0"),
25012514
rustc_const_stable(feature = "const_ptr_sized_atomics", since = "1.24.0"),
25022515
stable(feature = "rust1", since = "1.0.0"),
2516+
cfg_attr(not(test), rustc_diagnostic_item = "AtomicIsize"),
25032517
"isize",
25042518
"",
25052519
atomic_min, atomic_max,
@@ -2520,6 +2534,7 @@ macro_rules! atomic_int_ptr_sized {
25202534
stable(feature = "atomic_nand", since = "1.27.0"),
25212535
rustc_const_stable(feature = "const_ptr_sized_atomics", since = "1.24.0"),
25222536
stable(feature = "rust1", since = "1.0.0"),
2537+
cfg_attr(not(test), rustc_diagnostic_item = "AtomicUsize"),
25232538
"usize",
25242539
"",
25252540
atomic_umin, atomic_umax,

library/std/src/error.rs

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ use crate::time;
5353
/// high-level module to provide its own errors while also revealing some of the
5454
/// implementation for debugging via `source` chains.
5555
#[stable(feature = "rust1", since = "1.0.0")]
56+
#[cfg_attr(not(test), rustc_diagnostic_item = "Error")]
5657
pub trait Error: Debug + Display {
5758
/// The lower-level source of this error, if any.
5859
///

src/test/ui/coercion/coerce-issue-49593-box-never-windows.nofallback.stderr

-20
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@ error[E0277]: the trait bound `(): std::error::Error` is not satisfied
44
LL | /* *mut $0 is coerced to Box<dyn Error> here */ Box::<_ /* ! */>::new(x)
55
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()`
66
|
7-
= help: the following other types implement trait `std::error::Error`:
8-
!
9-
&'a T
10-
AccessError
11-
AddrParseError
12-
Arc<T>
13-
BorrowError
14-
BorrowMutError
15-
Box<T>
16-
and 45 others
177
= note: required for the cast to the object type `dyn std::error::Error`
188

199
error[E0277]: the trait bound `(): std::error::Error` is not satisfied
@@ -22,16 +12,6 @@ error[E0277]: the trait bound `(): std::error::Error` is not satisfied
2212
LL | /* *mut $0 is coerced to *mut Error here */ raw_ptr_box::<_ /* ! */>(x)
2313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()`
2414
|
25-
= help: the following other types implement trait `std::error::Error`:
26-
!
27-
&'a T
28-
AccessError
29-
AddrParseError
30-
Arc<T>
31-
BorrowError
32-
BorrowMutError
33-
Box<T>
34-
and 45 others
3515
= note: required for the cast to the object type `(dyn std::error::Error + 'static)`
3616

3717
error: aborting due to 2 previous errors

src/test/ui/coercion/coerce-issue-49593-box-never.nofallback.stderr

-20
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@ error[E0277]: the trait bound `(): std::error::Error` is not satisfied
44
LL | /* *mut $0 is coerced to Box<dyn Error> here */ Box::<_ /* ! */>::new(x)
55
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()`
66
|
7-
= help: the following other types implement trait `std::error::Error`:
8-
!
9-
&'a T
10-
AccessError
11-
AddrParseError
12-
Arc<T>
13-
BorrowError
14-
BorrowMutError
15-
Box<T>
16-
and 43 others
177
= note: required for the cast to the object type `dyn std::error::Error`
188

199
error[E0277]: the trait bound `(): std::error::Error` is not satisfied
@@ -22,16 +12,6 @@ error[E0277]: the trait bound `(): std::error::Error` is not satisfied
2212
LL | /* *mut $0 is coerced to *mut Error here */ raw_ptr_box::<_ /* ! */>(x)
2313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()`
2414
|
25-
= help: the following other types implement trait `std::error::Error`:
26-
!
27-
&'a T
28-
AccessError
29-
AddrParseError
30-
Arc<T>
31-
BorrowError
32-
BorrowMutError
33-
Box<T>
34-
and 43 others
3515
= note: required for the cast to the object type `(dyn std::error::Error + 'static)`
3616

3717
error: aborting due to 2 previous errors

0 commit comments

Comments
 (0)