-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide stable fallback for maybe_uninit_write_slice #64
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really cool. Just a minor suggestion to improve readability.
} | ||
|
||
// Checks if some code can be compiled with the current toolchain | ||
fn compile_probe(probe: &str) -> Option<ExitStatus> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool idea!
crates/builder/build.rs
Outdated
fn main() { | ||
match compile_probe(MAYBE_UNINIT_WRITE_SLICE_PROBE) { | ||
Some(status) if status.success() => {} | ||
_ => println!("cargo:rustc-cfg=no_maybe_uninit_write_slice"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe for readability, we can do
fn enable_compat_for_feature(feature_name: &str) {
println!("cargo:rust-cfg=no_{feature_name}");
}
and in the Err
case:
_ => enable_compat_for_feature("maybe_uninit_write_slice")
8efa06c
to
1fd5ce9
Compare
@s1ck thanks, 🏓 |
Co-Authored-By: Martin Junghanns <nerdfaktor42@mailbox.org>
Co-Authored-By: Martin Junghanns <nerdfaktor42@mailbox.org>
1fd5ce9
to
f8a6303
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💋 👌
This acts also as a scaffold for how to maybe get rid of other feature requirements.
The idea is that we can probe if we need to fallback, which is not the case for nightly or when that features has been stabilized.
If we need to fallback, we provide a compat impl using current stable code.