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

Rollup of 5 pull requests #116855

Merged
merged 16 commits into from
Oct 17, 2023
Merged

Rollup of 5 pull requests #116855

merged 16 commits into from
Oct 17, 2023

Commits on Oct 13, 2023

  1. MCP636: Add simpler and more explicit syntax to check-cfg

    This add a new form and deprecated the other ones:
     - cfg(name1, ..., nameN, values("value1", "value2", ... "valueN"))
     - cfg(name1, ..., nameN) or cfg(name1, ..., nameN, values())
     - cfg(any())
    
    It also changes the default exhaustiveness to be enable-by-default in
    the presence of any --check-cfg arguments.
    Urgau committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    e5e95eb View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    fc78d78 View commit details
    Browse the repository at this point in the history

Commits on Oct 14, 2023

  1. Special case iterator chain checks for suggestion

    When encountering method call chains of `Iterator`, check for trailing
    `;` in the body of closures passed into `Iterator::map`, as well as
    calls to `<T as Clone>::clone` when `T` is a type param and `T: !Clone`.
    
    Fix rust-lang#9082.
    estebank committed Oct 14, 2023
    Configuration menu
    Copy the full SHA
    6d23ee8 View commit details
    Browse the repository at this point in the history

Commits on Oct 16, 2023

  1. Add MonoItems and Instance to stable_mir

    Also add a few methods to instantiate instances and get an instance
    definition.
    
    We're still missing support to actually monomorphize the instance body.
    celinval committed Oct 16, 2023
    Configuration menu
    Copy the full SHA
    364f1a3 View commit details
    Browse the repository at this point in the history
  2. address review comment

    estebank committed Oct 16, 2023
    Configuration menu
    Copy the full SHA
    26954f6 View commit details
    Browse the repository at this point in the history

Commits on Oct 17, 2023

  1. Configuration menu
    Copy the full SHA
    b0e1a52 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8769e02 View commit details
    Browse the repository at this point in the history
  3. basic lint v2 implemented

    a-lafrance committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    f77dea8 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    5895102 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    52ad819 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    e89d4d4 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#111072 - Urgau:check-cfg-new-syntax, r=petr…

    …ochenkov
    
    Add new simpler and more explicit syntax for check-cfg
    
    <details>
    <summary>
    Old proposition (before the MCP)
    </summary>
    
    This PR adds a new simpler and more explicit syntax for check-cfg. It consist of two new form:
     - `exhaustive(names, values)`
     - `configure(name, "value1", "value2", ... "valueN")`
    
    The preview forms `names(...)` and `values(...)` have implicit meaning that are not strait-forward. In particular `values(foo)`&`values(bar)` and `names(foo, bar)` are not equivalent which has created [some confusions](rust-lang#98080).
    
    Also the `names()` and `values()` form are not clear either and again created some confusions where peoples believed that `values()`&`values(foo)` could be reduced to just `values(foo)`.
    
    To fix that the two new forms are made to be explicit and simpler. See the table of correspondence:
      - `names()` -> `exhaustive(names)`
      - `values()` -> `exhaustive(values)`
      - `names(foo)` -> `exhaustive(names)`&`configure(foo)`
      - `values(foo)` -> `configure(foo)`
      - `values(feat, "foo", "bar")` -> `configure(feat, "foo", "bar")`
      - `values(foo)`&`values(bar)` -> `configure(foo, bar)`
      - `names()`&`values()`&`values(my_cfg)` -> `exhaustive(names, values)`&`configure(my_cfg)`
    
    Another benefits of the new syntax is that it allow for further options (like conditional checking for --cfg, currently always on) without syntax change.
    
    The two previous forms are deprecated and will be removed once cargo and beta rustc have the necessary support.
    
    </details>
    
    This PR is the first part of the implementation of [MCP636 - Simplify and improve explicitness of the check-cfg syntax](rust-lang/compiler-team#636).
    
    ## New `cfg` form
    
    It introduces the new [`cfg` form](rust-lang/compiler-team#636) and deprecate the other two:
    ```
    rustc --check-cfg 'cfg(name1, ..., nameN, values("value1", "value2", ... "valueN"))'
    ```
    
    ## Default built-in names and values
    
    It also changes the default for the built-in names and values checking.
    
     - Built-in values checking would always be activated as long as a `--check-cfg` argument is present
     - Built-in names checking would always be activated as long as a `--check-cfg` argument is present **unless** if any `cfg(any())` arg is passed
    
    ~~**Note: depends on rust-lang#111068 but is reviewable (last two commits)!**~~
    
    Resolve rust-lang/compiler-team#636
    
    r? `@petrochenkov`
    matthiaskrgr authored Oct 17, 2023
    Configuration menu
    Copy the full SHA
    ce40742 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#116717 - estebank:issue-9082, r=oli-obk

    Special case iterator chain checks for suggestion
    
    When encountering method call chains of `Iterator`, check for trailing `;` in the body of closures passed into `Iterator::map`, as well as calls to `<T as Clone>::clone` when `T` is a type param and `T: !Clone`.
    
    Fix rust-lang#9082.
    matthiaskrgr authored Oct 17, 2023
    Configuration menu
    Copy the full SHA
    a5aa52c View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#116719 - celinval:smir-mono, r=oli-obk

    Add MonoItems and Instance to stable_mir
    
    Also add a few methods to instantiate instances and get an instance definition. We're still missing support to actually monomorphize the instance body.
    
    This is related to rust-lang/project-stable-mir#36
    
    r? ``@oli-obk``
    
    ``@oli-obk`` is that what you were thinking? I incorporated ``@bjorn3`` idea of just adding a Shim instance definition in rust-lang#116465.
    matthiaskrgr authored Oct 17, 2023
    Configuration menu
    Copy the full SHA
    00f529d View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#116787 - a-lafrance:span-internal-lint, r=o…

    …li-obk
    
    Implement an internal lint encouraging use of `Span::eq_ctxt`
    
    Adds a new Rustc internal lint that forbids use of `.ctxt() == .ctxt()` for spans, encouraging use of `.eq_ctxt()` instead (see rust-lang#49509).
    
    Also fixed a few violations of the lint in the Rustc codebase (a fun additional way I could test my code). Edit: MIR opt folks I believe that's why you're CC'ed, just a heads up.
    
    Two things I'm not sure about:
    1. The way I chose to detect calls to `Span::ctxt`. I know adding diagnostic items to methods is generally discouraged, but after some searching and experimenting I couldn't find anything else that worked, so I went with it. That said, I'm happy to implement something different if there's a better way out there. (For what it's worth, if there is a better way, it might be worth documenting in the rustc-dev-guide, which I'm happy to take care of)
    2. The error message for the lint. Ideally it would probably be good to give some context as to why the suggestion is made (e.g. `rustc::default_hash_types` tells the user that it's because of performance), but I don't have that context so I couldn't put it in the error message. Happy to iterate on the error message based on feedback during review.
    
    r? ``@oli-obk``
    matthiaskrgr authored Oct 17, 2023
    Configuration menu
    Copy the full SHA
    3ea438e View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#116827 - nnethercote:pub-handle_options, r=…

    …compiler-errors
    
    Make `handle_options` public again.
    
    r? ``@compiler-errors``
    matthiaskrgr authored Oct 17, 2023
    Configuration menu
    Copy the full SHA
    6e6cd68 View commit details
    Browse the repository at this point in the history