Skip to content

Commit 0505d62

Browse files
committed
Permit const assertions in stdlib
1 parent a3fc02d commit 0505d62

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

core/src/panicking.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ use crate::panic::{Location, PanicInfo};
3636
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))]
3737
#[cfg_attr(feature = "panic_immediate_abort", inline)]
3838
#[track_caller]
39+
#[rustc_const_unstable(feature = "core_panic", issue = "none")]
3940
#[lang = "panic"] // needed by codegen for panic on overflow and other `Assert` MIR terminators
4041
pub const fn panic(expr: &'static str) -> ! {
4142
// Use Arguments::new_v1 instead of format_args!("{}", expr) to potentially

core/src/time.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ impl Duration {
727727
pub const fn from_secs_f64(secs: f64) -> Duration {
728728
match Duration::try_from_secs_f64(secs) {
729729
Ok(v) => v,
730-
Err(e) => crate::panicking::panic(e.description()),
730+
Err(e) => panic!("{}", e.description()),
731731
}
732732
}
733733

@@ -788,7 +788,7 @@ impl Duration {
788788
pub const fn from_secs_f32(secs: f32) -> Duration {
789789
match Duration::try_from_secs_f32(secs) {
790790
Ok(v) => v,
791-
Err(e) => crate::panicking::panic(e.description()),
791+
Err(e) => panic!("{}", e.description()),
792792
}
793793
}
794794

0 commit comments

Comments
 (0)