diff options
| author | bors <bors@rust-lang.org> | 2019-12-14 10:21:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-12-14 10:21:32 +0000 |
| commit | c8ea4ace9213ae045123fdfeb59d1ac887656d31 (patch) | |
| tree | 2a7d207294b6f2c99d1ddbe193b1d5af8ee46a09 /src/libstd/ffi/c_str.rs | |
| parent | 12307b3b08edee543a78fb9d4a837fbd6d6ac0fa (diff) | |
| parent | 0b47ba7019adf06f6687a8c94040e63ae1ea4fba (diff) | |
| download | rust-c8ea4ace9213ae045123fdfeb59d1ac887656d31.tar.gz rust-c8ea4ace9213ae045123fdfeb59d1ac887656d31.zip | |
Auto merge of #67136 - oli-obk:const_stability, r=Centril
Require stable/unstable annotations for the constness of all stable fns with a const modifier r? @RalfJung @Centril Every `#[stable]` const fn now needs either a `#[rustc_const_unstable]` attribute or a `#[rustc_const_stable]` attribute. You can't silently stabilize the constness of a function anymore.
Diffstat (limited to 'src/libstd/ffi/c_str.rs')
| -rw-r--r-- | src/libstd/ffi/c_str.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 6dcda986310..14ca0423d8b 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -1065,7 +1065,8 @@ impl CStr { /// ``` #[inline] #[stable(feature = "cstr_from_bytes", since = "1.10.0")] - #[rustc_const_unstable(feature = "const_cstr_unchecked")] + #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_cstr_unchecked"))] + #[cfg_attr(not(bootstrap), rustc_const_unstable(feature = "const_cstr_unchecked", issue = "0"))] pub const unsafe fn from_bytes_with_nul_unchecked(bytes: &[u8]) -> &CStr { &*(bytes as *const [u8] as *const CStr) } @@ -1119,6 +1120,7 @@ impl CStr { /// [`CString`]: struct.CString.html #[inline] #[stable(feature = "rust1", since = "1.0.0")] + #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_str_as_ptr", since = "1.32.0"))] pub const fn as_ptr(&self) -> *const c_char { self.inner.as_ptr() } |
