diff options
| author | Gary Guo <gary@garyguo.net> | 2020-06-26 13:19:50 +0100 |
|---|---|---|
| committer | Gary Guo <gary@garyguo.net> | 2020-06-26 21:36:14 +0100 |
| commit | fc239e82fe1ef91632dfa858487d89141aaab7a7 (patch) | |
| tree | 70619f809e6f43f5527c7a069e3e3b284d66d34e /src/libcore | |
| parent | 224bc052564117abfb8716772779ade221133395 (diff) | |
| download | rust-fc239e82fe1ef91632dfa858487d89141aaab7a7.tar.gz rust-fc239e82fe1ef91632dfa858487d89141aaab7a7.zip | |
Make `likely` and `unlikely` const
They are gated by internal feature gate const_likely
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/intrinsics.rs | 2 | ||||
| -rw-r--r-- | src/libcore/lib.rs | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 2298958b881..da174299fb9 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -952,6 +952,7 @@ extern "rust-intrinsic" { /// Any use other than with `if` statements will probably not have an effect. /// /// This intrinsic does not have a stable counterpart. + #[rustc_const_unstable(feature = "const_likely", issue = "none")] pub fn likely(b: bool) -> bool; /// Hints to the compiler that branch condition is likely to be false. @@ -960,6 +961,7 @@ extern "rust-intrinsic" { /// Any use other than with `if` statements will probably not have an effect. /// /// This intrinsic does not have a stable counterpart. + #[rustc_const_unstable(feature = "const_likely", issue = "none")] pub fn unlikely(b: bool) -> bool; /// Executes a breakpoint trap, for inspection by a debugger. diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 4eb2fdbd078..412d323b283 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -92,6 +92,7 @@ #![feature(const_slice_from_raw_parts)] #![feature(const_slice_ptr_len)] #![feature(const_type_name)] +#![feature(const_likely)] #![feature(custom_inner_attributes)] #![feature(decl_macro)] #![feature(doc_cfg)] |
