Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 12e23c4

Browse files
committed
Fix clippy tests
1 parent 555a033 commit 12e23c4

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

library/core/src/panic.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ pub macro unreachable_2015 {
131131
// cold function. This moves the codegen for setting up the
132132
// arguments to the panic implementation function to the
133133
// presumably cold panic path.
134-
() => ({
135-
$crate::panicking::unreachable_cold_explicit();
136-
}),
134+
() => (
135+
$crate::panicking::unreachable_cold_explicit()
136+
),
137137
($msg:literal $(,)?) => ({
138138
#[cold]
139139
#[track_caller]
@@ -165,9 +165,9 @@ pub macro unreachable_2015 {
165165
)]
166166
#[rustc_macro_transparency = "semitransparent"]
167167
pub macro unreachable_2021 {
168-
() => ({
169-
$crate::panicking::unreachable_cold_explicit();
170-
}),
168+
() => (
169+
$crate::panicking::unreachable_cold_explicit()
170+
),
171171
// Special-case the single-argument case for const_panic.
172172
("{}", $arg:expr $(,)?) => ({
173173
#[cold]

library/core/src/panicking.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,15 @@ pub const fn panic_str_2015(expr: &str) -> ! {
261261
#[cold]
262262
#[track_caller]
263263
#[inline(never)]
264+
#[rustc_const_unstable(feature = "panic_internals", issue = "none")]
264265
pub const fn panic_cold_explicit() -> ! {
265266
panic("explicit panic");
266267
}
267268

268269
#[cold]
269270
#[track_caller]
270271
#[inline(never)]
272+
#[rustc_const_unstable(feature = "panic_internals", issue = "none")]
271273
pub const fn unreachable_cold_explicit() -> ! {
272274
panic("internal error: entered unreachable code");
273275
}

src/tools/clippy/tests/ui/missing_const_for_thread_local.stderr

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,5 @@ error: initializer for `thread_local` value can be made `const`
3737
LL | static PEEL_ME_MANY: i32 = { let x = 1; x * x };
3838
| ^^^^^^^^^^^^^^^^^^^^ help: replace with: `const { { let x = 1; x * x } }`
3939

40-
error: initializer for `thread_local` value can be made `const`
41-
--> tests/ui/missing_const_for_thread_local.rs:64:55
42-
|
43-
LL | static STATE_12637_UNREACHABLE: Cell<usize> = unreachable!();
44-
| ^^^^^^^^^^^^^^
45-
|
46-
= note: this error originates in the macro `$crate::panic::unreachable_2021` which comes from the expansion of the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
47-
48-
error: aborting due to 7 previous errors
40+
error: aborting due to 6 previous errors
4941

0 commit comments

Comments
 (0)