Hi All,
Has there been any discussion about stabilizing const_cstr_unchecked
? [link ]
I had been interacting with a C library, and there doesn't appear to be a good way to construct a const &Cstr. It would be nice to be able to do:
const VALUE: &std::ffi::CStr = unsafe {
std::ffi::CStr::from_bytes_with_nul_unchecked(b"Hello World\0")
};
The most recent information I've seen about this suggests a transmute , which doesn't seem to be ideal.
A couple crates exist to handle this sort of scenario:
I recommend you open a new tracking issue and a PR that changes the issue number on the unstable annotation from none to that new issue. Then, that tracking issue would be a good place for discussion.
The current status of all unsafe const fn
is that they are blocked on
This RFC was drafted by me with lots of input from @oli-obk.
Define UB during const evaluation to lead to an unspecified result for the affected CTFE query, but not otherwise infect the compilation process.
Cc @rust-lang/wg-const-eval
[Rendered](https://github.com/RalfJung/rfcs/blob/const-ub/text/0000-const-ub.md)
rust-lang:master
← RalfJung:const-ub
opened 08:50AM - 10 Nov 20 UTC
1 Like
system
Closed
July 13, 2021, 12:40pm
4
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.