Skip to content
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

Minimal miri support #803

Merged
merged 2 commits into from
Sep 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion crates/std_detect/src/detect/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,15 @@ mod bit;
mod cache;

cfg_if! {
if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
if #[cfg(miri)] {
// When running under miri all target-features that are not enabled at
// compile-time are reported as disabled at run-time.
//
// For features for which `cfg(target_feature)` returns true,
// this run-time detection logic is never called.
#[path = "os/other.rs"]
Copy link
Contributor

@gnzlbg gnzlbg Aug 31, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a comment here saying that on miri all features are always disabled features that are not enabled at compile-time (e.g. cfg(target_feature) == true) are always disabled ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment should maybe add that this is correct because for features for which cfg(target_feature) is true, the run-time detection logic is not invoked, so is_x86_feature_detected! will return the same answer as miri for those anyways.

cc @RalfJung

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea what this means. I have never used run-time feature detection so none of this code here means anything to me.

lu-zero marked this conversation as resolved.
Show resolved Hide resolved
mod os;
} else if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
// On x86/x86_64 no OS specific functionality is required.
#[path = "os/x86.rs"]
mod os;
Expand Down