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

Allow configuring unstable flags via config file #8393

Merged
merged 17 commits into from
Jul 10, 2020
Merged

Allow configuring unstable flags via config file #8393

merged 17 commits into from
Jul 10, 2020

Commits on Jul 8, 2020

  1. Allow populating CliUnstable from a HashMap

    This makes it easier to populate unstable
    options from configuration files. Might also
    help make unstable option tests easier to write.
    bearcage committed Jul 8, 2020
    Configuration menu
    Copy the full SHA
    1cea4cb View commit details
    Browse the repository at this point in the history
  2. Allow setting unstable options in .cargo/config

    Obviously this only works with nightlies and all
    that, but if you're e.g. testing resolver v2, want
    to always have Ztiming on in your workspace, or
    something like that, this makes it easier to do.
    bearcage committed Jul 8, 2020
    Configuration menu
    Copy the full SHA
    4aede8c View commit details
    Browse the repository at this point in the history
  3. Allow both dashes and underscores for Z flags

    This makes it a little easier to match whatever
    the natural formatting is for where you're setting
    unstable options -- CLI or config file.
    bearcage committed Jul 8, 2020
    Configuration menu
    Copy the full SHA
    9cb1ef8 View commit details
    Browse the repository at this point in the history
  4. Update src/doc/src/reference/unstable.md

    Co-authored-by: Eric Huss <eric@huss.org>
    bearcage and ehuss committed Jul 8, 2020
    Configuration menu
    Copy the full SHA
    c60da96 View commit details
    Browse the repository at this point in the history
  5. Clarify CliUnstable::parse/update_with_table

    These masquerade like construction functions, but they're
    in-place mutators since they're meant to be used one after
    another in a precedence chain.
    bearcage committed Jul 8, 2020
    Configuration menu
    Copy the full SHA
    6d7421c View commit details
    Browse the repository at this point in the history
  6. Revert misfeatures

    Per comments on the PR, a couple changes need to be backed out.
    bearcage committed Jul 8, 2020
    Configuration menu
    Copy the full SHA
    48a6f59 View commit details
    Browse the repository at this point in the history
  7. Switch unstable config parsing to serde

    Tests are currently failing, looks like there's something in the
    Deserializer impl that's forcing field-missing errors even when
    the serde `default` annotation is applied.
    bearcage committed Jul 8, 2020
    Configuration menu
    Copy the full SHA
    bd938f0 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    14c32d4 View commit details
    Browse the repository at this point in the history
  9. Treat all CliUnstable values as default-false

    This is a workaround in case y'all would like to land this change
    before I'm able to finish up a Deserializer refactor.
    bearcage committed Jul 8, 2020
    Configuration menu
    Copy the full SHA
    c532c49 View commit details
    Browse the repository at this point in the history
  10. Drop broken test asserting invalid configs error on nightly

    The current behavior, with the default-false workaround in place,
    is not able to identify extra members of the `unstable` table, so
    it can't error on unexpected members.
    
    I'll add this test back in with a Deserializer refactor to clean up
    the extra logic added to CliUnstable.
    bearcage committed Jul 8, 2020
    Configuration menu
    Copy the full SHA
    08f1020 View commit details
    Browse the repository at this point in the history

Commits on Jul 9, 2020

  1. Revert workaround and patch Deserializer

    This patch changes how ConfigMapAccess iterates k/v pairs when
    deserializing structs.
    
    Previously we produced keys for exactly the set of fields needed
    for a struct, and errored out in the deserializer if we can't find
    anything for that field.
    
    This patch makes us produces keys from the union of two sets:
    
    1. All fields that are both needed for the struct and can be found
       in the environment.
    2. All fields in the config table.
    
    This change allows serde's codegen to handle both missing and
    unknown fields via the usual derive annotations (default or
    deny_unknown_fields respectively)
    bearcage committed Jul 9, 2020
    Configuration menu
    Copy the full SHA
    62d6233 View commit details
    Browse the repository at this point in the history
  2. Minor test fix (error text comparison)

    Serde's errors for missing fields are a lil' different than
    the ones from our Deserializer.
    bearcage committed Jul 9, 2020
    Configuration menu
    Copy the full SHA
    724273e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    782b32b View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    90b9c6a View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    b82281a View commit details
    Browse the repository at this point in the history
  6. Add tests verifying overlapping prefixes and defaults

    These tests demonstrate the current failure mode around
    overlapping env keys and inner structs. To some extent this
    is a limitation of mapping on to environment variables with
    an underscore as both the namespace separator and the
    substitute for dashes in flag names in that the mapping is
    not strictly one-to-one.
    bearcage committed Jul 9, 2020
    Configuration menu
    Copy the full SHA
    e49b3ae View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    d035daa View commit details
    Browse the repository at this point in the history