@@ -2525,15 +2525,30 @@ extern "rust-intrinsic" {
25252525 /// or `false`, and the caller has to ensure sound behavior for both cases.
25262526 /// In other words, the following code has *Undefined Behavior*:
25272527 ///
2528- /// ```rust
2529- /// if !is_val_statically_known(0) { unreachable_unchecked(); }
2528+ /// ```
2529+ /// #![feature(is_val_statically_known)]
2530+ /// #![feature(core_intrinsics)]
2531+ /// # #![allow(internal_features)]
2532+ /// use std::hint::unreachable_unchecked;
2533+ /// use std::intrinsics::is_val_statically_known;
2534+ ///
2535+ /// unsafe {
2536+ /// if !is_val_statically_known(0) { unreachable_unchecked(); }
2537+ /// }
25302538 /// ```
25312539 ///
25322540 /// This also means that the following code's behavior is unspecified; it
25332541 /// may panic, or it may not:
25342542 ///
2535- /// ```rust,no_run
2536- /// assert_eq!(is_val_statically_known(0), black_box(is_val_statically_known(0)))
2543+ /// ```no_run
2544+ /// #![feature(is_val_statically_known)]
2545+ /// #![feature(core_intrinsics)]
2546+ /// # #![allow(internal_features)]
2547+ /// use std::intrinsics::is_val_statically_known;
2548+ ///
2549+ /// unsafe {
2550+ /// assert_eq!(is_val_statically_known(0), is_val_statically_known(0));
2551+ /// }
25372552 /// ```
25382553 ///
25392554 /// Unsafe code may not rely on `is_val_statically_known` returning any
@@ -2547,15 +2562,14 @@ extern "rust-intrinsic" {
25472562 #[ rustc_const_unstable( feature = "is_val_statically_known" , issue = "none" ) ]
25482563 #[ rustc_nounwind]
25492564 #[ cfg( not( bootstrap) ) ]
2550- pub fn is_val_statically_known < T > ( arg : T ) -> bool ;
2565+ pub fn is_val_statically_known < T : Copy > ( arg : T ) -> bool ;
25512566}
25522567
25532568// FIXME: Seems using `unstable` here completely ignores `rustc_allow_const_fn_unstable`
25542569// and thus compiling stage0 core doesn't work.
2555- #[ rustc_const_stable( feature = "is_val_statically_known" , since = "never " ) ]
2570+ #[ rustc_const_stable( feature = "is_val_statically_known" , since = "0.0.0 " ) ]
25562571#[ cfg( bootstrap) ]
2557- pub const unsafe fn is_val_statically_known < T > ( t : T ) -> bool {
2558- mem:: forget ( t) ;
2572+ pub const unsafe fn is_val_statically_known < T : Copy > ( _arg : T ) -> bool {
25592573 false
25602574}
25612575
0 commit comments