Rollup merge of #90344 - xfix:tracking-issue-const_cstr_unchecked, r=Mark-Simulacrum

Add tracking issue number to const_cstr_unchecked

Also created a tracking issue, see #90343.

I think it makes sense to stabilize this somewhat soon considering abuse of `transmute` to have this feature in constants, see https://crates.io/crates/cstr for an example. Code can be rewritten to use `mem::transmute` to work on stable.
This commit is contained in:
Matthias Krüger 2021-10-27 18:25:47 +02:00 committed by GitHub
commit 623c3e144e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1257,7 +1257,7 @@ impl CStr {
#[inline]
#[must_use]
#[stable(feature = "cstr_from_bytes", since = "1.10.0")]
#[rustc_const_unstable(feature = "const_cstr_unchecked", issue = "none")]
#[rustc_const_unstable(feature = "const_cstr_unchecked", issue = "90343")]
pub const unsafe fn from_bytes_with_nul_unchecked(bytes: &[u8]) -> &CStr {
// SAFETY: Casting to CStr is safe because its internal representation
// is a [u8] too (safe only inside std).