Skip to content

Add an env override to std_detect #804

Closed

Description

@lu-zero

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?

Activity

  1. gnzlbg commented on Sep 2, 2019

    @gnzlbg
    Contributor

    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.

  2. bjorn3 commented on Sep 2, 2019

    @bjorn3
    Member

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

  3. lu-zero commented on Sep 2, 2019

    @lu-zero
    ContributorAuthor

    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)

  4. bjorn3 commented on Sep 2, 2019

    @bjorn3
    Member

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

    allow-runtime-detect-override?

  5. lu-zero commented on Sep 2, 2019

    @lu-zero
    ContributorAuthor

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

  6. lu-zero commented on Sep 2, 2019

    @lu-zero
    ContributorAuthor

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

  7. gnzlbg commented on Sep 6, 2019

    @gnzlbg
    Contributor

    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.

  8. lu-zero commented on Sep 8, 2019

    @lu-zero
    ContributorAuthor

    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.

  9. lu-zero commented on Sep 9, 2019

    @lu-zero
    ContributorAuthor

    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?

  10. added 4 commits that reference this issue on Sep 17, 2019
    0cf14a2
    45fdfe1
    f3da046
    b8aecbf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions