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

Add an env override to std_detect #804

Closed
3 tasks done
lu-zero opened this issue Sep 2, 2019 · 9 comments
Closed
3 tasks done

Add an env override to std_detect #804

lu-zero opened this issue Sep 2, 2019 · 9 comments

Comments

@lu-zero
Copy link
Contributor

lu-zero commented Sep 2, 2019

Sometimes it can be useful to disable certain extensions even if the host cpu sports them.

  • Refactor the cached check logic in src/detect/mod.rs
  • Add a RUST_STD_DETECT_DISABLE env::var check
    • Takes a space separate list of strings
    • For each of them mapping to an arch Feature, turn it off.
  • Document its existence

@gnzlbg Do you see any problem in this approach?

@gnzlbg
Copy link
Contributor

gnzlbg commented Sep 2, 2019

Shall this env variable be read at run-time, or at build time ?

Either way, I think enabling this should be put behind a cargo feature that's disabled by default.

@bjorn3
Copy link
Member

bjorn3 commented Sep 2, 2019

I think it should be during runtime, so you dont have to recompile the world.

@lu-zero
Copy link
Contributor Author

lu-zero commented Sep 2, 2019

Shall this env variable be read at run-time, or at build time ?

run-time

Either way, I think enabling this should be put behind a cargo feature that's disabled by default.

Not sure how to name the feature. (and how to advertise it)

@bjorn3
Copy link
Member

bjorn3 commented Sep 2, 2019

Not sure how to name the feature. (and how to advertise it)

allow-runtime-detect-override?

@lu-zero
Copy link
Contributor Author

lu-zero commented Sep 2, 2019

I'm sold on it, now, which crate should expose it?

@lu-zero
Copy link
Contributor Author

lu-zero commented Sep 2, 2019

Also: should we make the cpu feature checks macro behave like log?

@gnzlbg
Copy link
Contributor

gnzlbg commented Sep 6, 2019

I'm sold on it, now, which crate should expose it?

Maybe std_detect ?

Also: should we make the cpu feature checks macro behave like log?

There is an RFC that allows something like that: rust-lang/rfcs#2725 but I'm not sure if that's what you mean.

@lu-zero
Copy link
Contributor Author

lu-zero commented Sep 8, 2019

It is exactly what I meant.
Also this use-case might be mentioned here

I'll start sending the refactoring patches and the initial impl soon.

@lu-zero
Copy link
Contributor Author

lu-zero commented Sep 9, 2019

I started with #806

Where should I put the documentation about the env variable?

Can I use this to implement the mapping name -> feature mapping?

lu-zero added a commit to lu-zero/stdarch that referenced this issue Sep 17, 2019
lu-zero added a commit to lu-zero/stdarch that referenced this issue Sep 17, 2019
lu-zero added a commit to lu-zero/stdarch that referenced this issue Sep 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants