make CStr::from_bytes_with_nul_unchecked() a const fn#54745
make CStr::from_bytes_with_nul_unchecked() a const fn#54745bors merged 2 commits intorust-lang:masterfrom
CStr::from_bytes_with_nul_unchecked() a const fn#54745Conversation
|
r? @dtolnay (rust_highfive has picked a reviewer for you, use r? to override) |
|
Not sure if this needs a test to confirm the ability to use this in a |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
@oli-obk little snag with |
src/libstd/ffi/c_str.rs
Outdated
There was a problem hiding this comment.
Oh. I should have checked the original source :D You should be able to just add #![feature(const_raw_ptr_deref)] and keep the original source ;)
A test would be great, yes. |
|
r? @oli-obk |
src/libstd/ffi/c_str.rs
Outdated
There was a problem hiding this comment.
@oli-obk preferred ordering of the attributes? shortest to longest or doesn't really matter?
There was a problem hiding this comment.
I don't think it matters. I ususally put the const unstable attribute below the stable attribute
There was a problem hiding this comment.
Done, and added it to the crate feature flags as well.
src/libstd/ffi/c_str.rs
Outdated
There was a problem hiding this comment.
you need to specify a feature name like in
There was a problem hiding this comment.
Should I just make one up or what?
There was a problem hiding this comment.
jup :D that's how feature names work
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
@bors r+ |
|
📌 Commit e0caaec has been approved by |
make `CStr::from_bytes_with_nul_unchecked()` a const fn closes rust-lang#54678
make `CStr::from_bytes_with_nul_unchecked()` a const fn closes rust-lang#54678
Rollup of 10 pull requests Successful merges: - #54269 (#53840: Consolidate pattern check errors) - #54458 (Allow both explicit and elided lifetimes in the same impl header) - #54603 (Add `crate::` to trait suggestions in Rust 2018.) - #54648 (Update Cargo's submodule) - #54680 (make run-pass tests with empty main just compile-pass tests) - #54687 (Use impl_header_lifetime_elision in libcore) - #54699 (Re-export `getopts` so custom drivers can reference it.) - #54702 (do not promote comparing function pointers) - #54728 (Renumber `proc_macro` tracking issues) - #54745 (make `CStr::from_bytes_with_nul_unchecked()` a const fn) Failed merges: r? @ghost
closes #54678