Skip to content

Commit 2da7064

Browse files
committed
Change the cfg to a dash
1 parent 301ff58 commit 2da7064

File tree

19 files changed

+78
-78
lines changed

19 files changed

+78
-78
lines changed

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,7 @@ symbols! {
11951195
if_let_rescope,
11961196
if_while_or_patterns,
11971197
ignore,
1198-
immediate_abort,
1198+
immediate_abort: "immediate-abort",
11991199
impl_header_lifetime_elision,
12001200
impl_lint_pass,
12011201
impl_trait_in_assoc_type,

library/alloc/src/alloc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,12 @@ pub const fn handle_alloc_error(layout: Layout) -> ! {
408408
}
409409
}
410410

411-
#[cfg(not(panic = "immediate_abort"))]
411+
#[cfg(not(panic = "immediate-abort"))]
412412
{
413413
core::intrinsics::const_eval_select((layout,), ct_error, rt_error)
414414
}
415415

416-
#[cfg(panic = "immediate_abort")]
416+
#[cfg(panic = "immediate-abort")]
417417
ct_error(layout)
418418
}
419419

library/alloc/src/raw_vec/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ mod tests;
2323
// ensure that the code generation related to these panics is minimal as there's
2424
// only one location which panics rather than a bunch throughout the module.
2525
#[cfg(not(no_global_oom_handling))]
26-
#[cfg_attr(not(panic = "immediate_abort"), inline(never))]
26+
#[cfg_attr(not(panic = "immediate-abort"), inline(never))]
2727
#[track_caller]
2828
fn capacity_overflow() -> ! {
2929
panic!("capacity overflow");

library/alloc/src/vec/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,7 +2047,7 @@ impl<T, A: Allocator> Vec<T, A> {
20472047
#[stable(feature = "rust1", since = "1.0.0")]
20482048
pub fn swap_remove(&mut self, index: usize) -> T {
20492049
#[cold]
2050-
#[cfg_attr(not(panic = "immediate_abort"), inline(never))]
2050+
#[cfg_attr(not(panic = "immediate-abort"), inline(never))]
20512051
#[track_caller]
20522052
#[optimize(size)]
20532053
fn assert_failed(index: usize, len: usize) -> ! {
@@ -2129,7 +2129,7 @@ impl<T, A: Allocator> Vec<T, A> {
21292129
#[must_use = "if you don't need a reference to the value, use `Vec::insert` instead"]
21302130
pub fn insert_mut(&mut self, index: usize, element: T) -> &mut T {
21312131
#[cold]
2132-
#[cfg_attr(not(panic = "immediate_abort"), inline(never))]
2132+
#[cfg_attr(not(panic = "immediate-abort"), inline(never))]
21332133
#[track_caller]
21342134
#[optimize(size)]
21352135
fn assert_failed(index: usize, len: usize) -> ! {
@@ -2193,7 +2193,7 @@ impl<T, A: Allocator> Vec<T, A> {
21932193
#[rustc_confusables("delete", "take")]
21942194
pub fn remove(&mut self, index: usize) -> T {
21952195
#[cold]
2196-
#[cfg_attr(not(panic = "immediate_abort"), inline(never))]
2196+
#[cfg_attr(not(panic = "immediate-abort"), inline(never))]
21972197
#[track_caller]
21982198
#[optimize(size)]
21992199
fn assert_failed(index: usize, len: usize) -> ! {
@@ -2955,7 +2955,7 @@ impl<T, A: Allocator> Vec<T, A> {
29552955
A: Clone,
29562956
{
29572957
#[cold]
2958-
#[cfg_attr(not(panic = "immediate_abort"), inline(never))]
2958+
#[cfg_attr(not(panic = "immediate-abort"), inline(never))]
29592959
#[track_caller]
29602960
#[optimize(size)]
29612961
fn assert_failed(at: usize, len: usize) -> ! {

library/core/src/cell.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ impl Display for BorrowMutError {
778778
}
779779

780780
// This ensures the panicking code is outlined from `borrow_mut` for `RefCell`.
781-
#[cfg_attr(not(panic = "immediate_abort"), inline(never))]
781+
#[cfg_attr(not(panic = "immediate-abort"), inline(never))]
782782
#[track_caller]
783783
#[cold]
784784
const fn panic_already_borrowed(err: BorrowMutError) -> ! {
@@ -790,7 +790,7 @@ const fn panic_already_borrowed(err: BorrowMutError) -> ! {
790790
}
791791

792792
// This ensures the panicking code is outlined from `borrow` for `RefCell`.
793-
#[cfg_attr(not(panic = "immediate_abort"), inline(never))]
793+
#[cfg_attr(not(panic = "immediate-abort"), inline(never))]
794794
#[track_caller]
795795
#[cold]
796796
const fn panic_already_mutably_borrowed(err: BorrowError) -> ! {

library/core/src/num/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,8 +1387,8 @@ pub const fn can_not_overflow<T>(radix: u32, is_signed_ty: bool, digits: &[u8])
13871387
radix <= 16 && digits.len() <= size_of::<T>() * 2 - is_signed_ty as usize
13881388
}
13891389

1390-
#[cfg_attr(not(panic = "immediate_abort"), inline(never))]
1391-
#[cfg_attr(panic = "immediate_abort", inline)]
1390+
#[cfg_attr(not(panic = "immediate-abort"), inline(never))]
1391+
#[cfg_attr(panic = "immediate-abort", inline)]
13921392
#[cold]
13931393
#[track_caller]
13941394
const fn from_ascii_radix_panic(radix: u32) -> ! {

library/core/src/option.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2161,17 +2161,17 @@ impl<T, E> Option<Result<T, E>> {
21612161
}
21622162
}
21632163

2164-
#[cfg_attr(not(panic = "immediate_abort"), inline(never))]
2165-
#[cfg_attr(panic = "immediate_abort", inline)]
2164+
#[cfg_attr(not(panic = "immediate-abort"), inline(never))]
2165+
#[cfg_attr(panic = "immediate-abort", inline)]
21662166
#[cold]
21672167
#[track_caller]
21682168
const fn unwrap_failed() -> ! {
21692169
panic("called `Option::unwrap()` on a `None` value")
21702170
}
21712171

21722172
// This is a separate function to reduce the code size of .expect() itself.
2173-
#[cfg_attr(not(panic = "immediate_abort"), inline(never))]
2174-
#[cfg_attr(panic = "immediate_abort", inline)]
2173+
#[cfg_attr(not(panic = "immediate-abort"), inline(never))]
2174+
#[cfg_attr(panic = "immediate-abort", inline)]
21752175
#[cold]
21762176
#[track_caller]
21772177
const fn expect_failed(msg: &str) -> ! {

library/core/src/panicking.rs

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ compile_error!(
4949
/// the actual formatting into this shared place.
5050
// If panic=immediate-abort, inline the abort call,
5151
// otherwise avoid inlining because of it is cold path.
52-
#[cfg_attr(not(panic = "immediate_abort"), inline(never), cold)]
53-
#[cfg_attr(panic = "immediate_abort", inline)]
52+
#[cfg_attr(not(panic = "immediate-abort"), inline(never), cold)]
53+
#[cfg_attr(panic = "immediate-abort", inline)]
5454
#[track_caller]
5555
#[lang = "panic_fmt"] // needed for const-evaluated panics
5656
#[rustc_do_not_const_check] // hooked by const-eval
5757
#[rustc_const_stable_indirect] // must follow stable const rules since it is exposed to stable
5858
pub const fn panic_fmt(fmt: fmt::Arguments<'_>) -> ! {
59-
if cfg!(panic = "immediate_abort") {
59+
if cfg!(panic = "immediate-abort") {
6060
super::intrinsics::abort()
6161
}
6262

@@ -81,8 +81,8 @@ pub const fn panic_fmt(fmt: fmt::Arguments<'_>) -> ! {
8181
/// Like `panic_fmt`, but for non-unwinding panics.
8282
///
8383
/// Has to be a separate function so that it can carry the `rustc_nounwind` attribute.
84-
#[cfg_attr(not(panic = "immediate_abort"), inline(never), cold)]
85-
#[cfg_attr(panic = "immediate_abort", inline)]
84+
#[cfg_attr(not(panic = "immediate-abort"), inline(never), cold)]
85+
#[cfg_attr(panic = "immediate-abort", inline)]
8686
#[track_caller]
8787
// This attribute has the key side-effect that if the panic handler ignores `can_unwind`
8888
// and unwinds anyway, we will hit the "unwinding out of nounwind function" guard,
@@ -97,7 +97,7 @@ pub const fn panic_nounwind_fmt(fmt: fmt::Arguments<'_>, force_no_backtrace: boo
9797
// We don't unwind anyway at compile-time so we can call the regular `panic_fmt`.
9898
panic_fmt(fmt)
9999
} else #[track_caller] {
100-
if cfg!(panic = "immediate_abort") {
100+
if cfg!(panic = "immediate-abort") {
101101
super::intrinsics::abort()
102102
}
103103

@@ -128,8 +128,8 @@ pub const fn panic_nounwind_fmt(fmt: fmt::Arguments<'_>, force_no_backtrace: boo
128128
/// The underlying implementation of core's `panic!` macro when no formatting is used.
129129
// Never inline unless panic=immediate-abort to avoid code
130130
// bloat at the call sites as much as possible.
131-
#[cfg_attr(not(panic = "immediate_abort"), inline(never), cold)]
132-
#[cfg_attr(panic = "immediate_abort", inline)]
131+
#[cfg_attr(not(panic = "immediate-abort"), inline(never), cold)]
132+
#[cfg_attr(panic = "immediate-abort", inline)]
133133
#[track_caller]
134134
#[rustc_const_stable_indirect] // must follow stable const rules since it is exposed to stable
135135
#[lang = "panic"] // used by lints and miri for panics
@@ -163,8 +163,8 @@ macro_rules! panic_const {
163163
//
164164
// never inline unless panic=immediate-abort to avoid code
165165
// bloat at the call sites as much as possible
166-
#[cfg_attr(not(panic = "immediate_abort"), inline(never), cold)]
167-
#[cfg_attr(panic = "immediate_abort", inline)]
166+
#[cfg_attr(not(panic = "immediate-abort"), inline(never), cold)]
167+
#[cfg_attr(panic = "immediate-abort", inline)]
168168
#[track_caller]
169169
#[rustc_const_stable_indirect] // must follow stable const rules since it is exposed to stable
170170
#[lang = stringify!($lang)]
@@ -219,8 +219,8 @@ pub mod panic_const {
219219

220220
/// Like `panic`, but without unwinding and track_caller to reduce the impact on codesize on the caller.
221221
/// If you want `#[track_caller]` for nicer errors, call `panic_nounwind_fmt` directly.
222-
#[cfg_attr(not(panic = "immediate_abort"), inline(never), cold)]
223-
#[cfg_attr(panic = "immediate_abort", inline)]
222+
#[cfg_attr(not(panic = "immediate-abort"), inline(never), cold)]
223+
#[cfg_attr(panic = "immediate-abort", inline)]
224224
#[lang = "panic_nounwind"] // needed by codegen for non-unwinding panics
225225
#[rustc_nounwind]
226226
#[rustc_const_stable_indirect] // must follow stable const rules since it is exposed to stable
@@ -229,8 +229,8 @@ pub const fn panic_nounwind(expr: &'static str) -> ! {
229229
}
230230

231231
/// Like `panic_nounwind`, but also inhibits showing a backtrace.
232-
#[cfg_attr(not(panic = "immediate_abort"), inline(never), cold)]
233-
#[cfg_attr(panic = "immediate_abort", inline)]
232+
#[cfg_attr(not(panic = "immediate-abort"), inline(never), cold)]
233+
#[cfg_attr(panic = "immediate-abort", inline)]
234234
#[rustc_nounwind]
235235
pub fn panic_nounwind_nobacktrace(expr: &'static str) -> ! {
236236
panic_nounwind_fmt(fmt::Arguments::new_const(&[expr]), /* force_no_backtrace */ true);
@@ -262,25 +262,25 @@ pub const fn panic_display<T: fmt::Display>(x: &T) -> ! {
262262
panic_fmt(format_args!("{}", *x));
263263
}
264264

265-
#[cfg_attr(not(panic = "immediate_abort"), inline(never), cold, optimize(size))]
266-
#[cfg_attr(panic = "immediate_abort", inline)]
265+
#[cfg_attr(not(panic = "immediate-abort"), inline(never), cold, optimize(size))]
266+
#[cfg_attr(panic = "immediate-abort", inline)]
267267
#[track_caller]
268268
#[lang = "panic_bounds_check"] // needed by codegen for panic on OOB array/slice access
269269
fn panic_bounds_check(index: usize, len: usize) -> ! {
270-
if cfg!(panic = "immediate_abort") {
270+
if cfg!(panic = "immediate-abort") {
271271
super::intrinsics::abort()
272272
}
273273

274274
panic!("index out of bounds: the len is {len} but the index is {index}")
275275
}
276276

277-
#[cfg_attr(not(panic = "immediate_abort"), inline(never), cold, optimize(size))]
278-
#[cfg_attr(panic = "immediate_abort", inline)]
277+
#[cfg_attr(not(panic = "immediate-abort"), inline(never), cold, optimize(size))]
278+
#[cfg_attr(panic = "immediate-abort", inline)]
279279
#[track_caller]
280280
#[lang = "panic_misaligned_pointer_dereference"] // needed by codegen for panic on misaligned pointer deref
281281
#[rustc_nounwind] // `CheckAlignment` MIR pass requires this function to never unwind
282282
fn panic_misaligned_pointer_dereference(required: usize, found: usize) -> ! {
283-
if cfg!(panic = "immediate_abort") {
283+
if cfg!(panic = "immediate-abort") {
284284
super::intrinsics::abort()
285285
}
286286

@@ -292,13 +292,13 @@ fn panic_misaligned_pointer_dereference(required: usize, found: usize) -> ! {
292292
)
293293
}
294294

295-
#[cfg_attr(not(panic = "immediate_abort"), inline(never), cold, optimize(size))]
296-
#[cfg_attr(panic = "immediate_abort", inline)]
295+
#[cfg_attr(not(panic = "immediate-abort"), inline(never), cold, optimize(size))]
296+
#[cfg_attr(panic = "immediate-abort", inline)]
297297
#[track_caller]
298298
#[lang = "panic_null_pointer_dereference"] // needed by codegen for panic on null pointer deref
299299
#[rustc_nounwind] // `CheckNull` MIR pass requires this function to never unwind
300300
fn panic_null_pointer_dereference() -> ! {
301-
if cfg!(panic = "immediate_abort") {
301+
if cfg!(panic = "immediate-abort") {
302302
super::intrinsics::abort()
303303
}
304304

@@ -308,13 +308,13 @@ fn panic_null_pointer_dereference() -> ! {
308308
)
309309
}
310310

311-
#[cfg_attr(not(panic = "immediate_abort"), inline(never), cold, optimize(size))]
312-
#[cfg_attr(panic = "immediate_abort", inline)]
311+
#[cfg_attr(not(panic = "immediate-abort"), inline(never), cold, optimize(size))]
312+
#[cfg_attr(panic = "immediate-abort", inline)]
313313
#[track_caller]
314314
#[lang = "panic_invalid_enum_construction"] // needed by codegen for panic on invalid enum construction.
315315
#[rustc_nounwind] // `CheckEnums` MIR pass requires this function to never unwind
316316
fn panic_invalid_enum_construction(source: u128) -> ! {
317-
if cfg!(panic = "immediate_abort") {
317+
if cfg!(panic = "immediate-abort") {
318318
super::intrinsics::abort()
319319
}
320320

@@ -331,8 +331,8 @@ fn panic_invalid_enum_construction(source: u128) -> ! {
331331
///
332332
/// This function is called directly by the codegen backend, and must not have
333333
/// any extra arguments (including those synthesized by track_caller).
334-
#[cfg_attr(not(panic = "immediate_abort"), inline(never), cold, optimize(size))]
335-
#[cfg_attr(panic = "immediate_abort", inline)]
334+
#[cfg_attr(not(panic = "immediate-abort"), inline(never), cold, optimize(size))]
335+
#[cfg_attr(panic = "immediate-abort", inline)]
336336
#[lang = "panic_cannot_unwind"] // needed by codegen for panic in nounwind function
337337
#[rustc_nounwind]
338338
fn panic_cannot_unwind() -> ! {
@@ -347,8 +347,8 @@ fn panic_cannot_unwind() -> ! {
347347
///
348348
/// This function is called directly by the codegen backend, and must not have
349349
/// any extra arguments (including those synthesized by track_caller).
350-
#[cfg_attr(not(panic = "immediate_abort"), inline(never), cold, optimize(size))]
351-
#[cfg_attr(panic = "immediate_abort", inline)]
350+
#[cfg_attr(not(panic = "immediate-abort"), inline(never), cold, optimize(size))]
351+
#[cfg_attr(panic = "immediate-abort", inline)]
352352
#[lang = "panic_in_cleanup"] // needed by codegen for panic in nounwind function
353353
#[rustc_nounwind]
354354
fn panic_in_cleanup() -> ! {
@@ -380,8 +380,8 @@ pub enum AssertKind {
380380
}
381381

382382
/// Internal function for `assert_eq!` and `assert_ne!` macros
383-
#[cfg_attr(not(panic = "immediate_abort"), inline(never), cold, optimize(size))]
384-
#[cfg_attr(panic = "immediate_abort", inline)]
383+
#[cfg_attr(not(panic = "immediate-abort"), inline(never), cold, optimize(size))]
384+
#[cfg_attr(panic = "immediate-abort", inline)]
385385
#[track_caller]
386386
#[doc(hidden)]
387387
pub fn assert_failed<T, U>(
@@ -398,8 +398,8 @@ where
398398
}
399399

400400
/// Internal function for `assert_match!`
401-
#[cfg_attr(not(panic = "immediate_abort"), inline(never), cold, optimize(size))]
402-
#[cfg_attr(panic = "immediate_abort", inline)]
401+
#[cfg_attr(not(panic = "immediate-abort"), inline(never), cold, optimize(size))]
402+
#[cfg_attr(panic = "immediate-abort", inline)]
403403
#[track_caller]
404404
#[doc(hidden)]
405405
pub fn assert_matches_failed<T: fmt::Debug + ?Sized>(
@@ -418,8 +418,8 @@ pub fn assert_matches_failed<T: fmt::Debug + ?Sized>(
418418
}
419419

420420
/// Non-generic version of the above functions, to avoid code bloat.
421-
#[cfg_attr(not(panic = "immediate_abort"), inline(never), cold, optimize(size))]
422-
#[cfg_attr(panic = "immediate_abort", inline)]
421+
#[cfg_attr(not(panic = "immediate-abort"), inline(never), cold, optimize(size))]
422+
#[cfg_attr(panic = "immediate-abort", inline)]
423423
#[track_caller]
424424
fn assert_failed_inner(
425425
kind: AssertKind,

library/core/src/result.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,7 +1847,7 @@ impl<T, E> Result<Result<T, E>, E> {
18471847
}
18481848

18491849
// This is a separate function to reduce the code size of the methods
1850-
#[cfg(not(panic = "immediate_abort"))]
1850+
#[cfg(not(panic = "immediate-abort"))]
18511851
#[inline(never)]
18521852
#[cold]
18531853
#[track_caller]
@@ -1859,7 +1859,7 @@ fn unwrap_failed(msg: &str, error: &dyn fmt::Debug) -> ! {
18591859
// that gets immediately thrown away, since vtables don't get cleaned up
18601860
// by dead code elimination if a trait object is constructed even if it goes
18611861
// unused
1862-
#[cfg(panic = "immediate_abort")]
1862+
#[cfg(panic = "immediate-abort")]
18631863
#[inline]
18641864
#[cold]
18651865
#[track_caller]

library/core/src/slice/index.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ where
3131
}
3232
}
3333

34-
#[cfg_attr(not(panic = "immediate_abort"), inline(never), cold)]
35-
#[cfg_attr(panic = "immediate_abort", inline)]
34+
#[cfg_attr(not(panic = "immediate-abort"), inline(never), cold)]
35+
#[cfg_attr(panic = "immediate-abort", inline)]
3636
#[track_caller]
3737
const fn slice_index_fail(start: usize, end: usize, len: usize) -> ! {
3838
if start > len {

0 commit comments

Comments
 (0)