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 #124934

Merged
merged 10 commits into from
May 9, 2024
Merged

Rollup of 5 pull requests #124934

merged 10 commits into from
May 9, 2024

Commits on May 8, 2024

  1. Make a minimal amount of region APIs public

    Xavier Denis authored and xldenis committed May 8, 2024
    Configuration menu
    Copy the full SHA
    d4c6c77 View commit details
    Browse the repository at this point in the history

Commits on May 9, 2024

  1. Add ErrorGuaranteed to Recovered::Yes and use it more.

    The starting point for this was identical comments on two different
    fields, in `ast::VariantData::Struct` and `hir::VariantData::Struct`:
    ```
        // FIXME: investigate making this a `Option<ErrorGuaranteed>`
        recovered: bool
    ```
    I tried that, and then found that I needed to add an `ErrorGuaranteed`
    to `Recovered::Yes`. Then I ended up using `Recovered` instead of
    `Option<ErrorGuaranteed>` for these two places and elsewhere, which
    required moving `ErrorGuaranteed` from `rustc_parse` to `rustc_ast`.
    
    This makes things more consistent, because `Recovered` is used in more
    places, and there are fewer uses of `bool` and
    `Option<ErrorGuaranteed>`. And safer, because it's difficult/impossible
    to set `recovered` to `Recovered::Yes` without having emitted an error.
    nnethercote committed May 9, 2024
    Configuration menu
    Copy the full SHA
    fd91925 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    41d36a0 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3c52553 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    5120010 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#124893 - xldenis:public-region-apis, r=lcnr

    Make a minimal amount of region APIs public
    
    Tools like Creusot, Prusti or Gillian-Rust need to access information about the loans and regions that exist in MIR programs. While `rustc` provides information about loans, there is currently no public way to reason about the regions present in a MIR program. In particular, we to know which regions are actually equal to each other and which ones outlive each other. Currently, `rustc` provides access to `RegionInferenceContext` but the public api hides that last portion of the information.
    
    This PR proposes to make a few apis public, allowing verifiers to reason about the lifetimes present in Rust programs:
    - [eval_equal](https://doc.rust-lang.org/beta/nightly-rustc/rustc_borrowck/region_infer/struct.RegionInferenceContext.html#method.eval_equal)
    - [eval_outlives](https://doc.rust-lang.org/beta/nightly-rustc/rustc_borrowck/region_infer/struct.RegionInferenceContext.html#method.eval_outlives)
    - (Optional) [constraint_sccs](https://doc.rust-lang.org/beta/nightly-rustc/rustc_borrowck/region_infer/struct.RegionInferenceContext.html#method.constraint_sccs)
    
    The first two functions would allow us to compare regions and from this we can construct the set of `RegionVid` which are actually equal to each other, and then recover the inclusions between those regions, while the second allows for more direct, but _low level_ access to that information.
    matthiaskrgr committed May 9, 2024
    Configuration menu
    Copy the full SHA
    ebeedf0 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#124919 - nnethercote:Recovered-Yes-ErrorGua…

    …ranteed, r=compiler-errors
    
    Add `ErrorGuaranteed` to `Recovered::Yes` and use it more.
    
    The starting point for this was identical comments on two different fields, in `ast::VariantData::Struct` and `hir::VariantData::Struct`:
    ```
        // FIXME: investigate making this a `Option<ErrorGuaranteed>`
        recovered: bool
    ```
    I tried that, and then found that I needed to add an `ErrorGuaranteed` to `Recovered::Yes`. Then I ended up using `Recovered` instead of `Option<ErrorGuaranteed>` for these two places and elsewhere, which required moving `ErrorGuaranteed` from `rustc_parse` to `rustc_ast`.
    
    This makes things more consistent, because `Recovered` is used in more places, and there are fewer uses of `bool` and
    `Option<ErrorGuaranteed>`. And safer, because it's difficult/impossible to set `recovered` to `Recovered::Yes` without having emitted an error.
    
    r? `@oli-obk`
    matthiaskrgr committed May 9, 2024
    Configuration menu
    Copy the full SHA
    0a917f8 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#124923 - RalfJung:offset-from-errors, r=com…

    …piler-errors
    
    interpret/miri: better errors on failing offset_from
    
    Fixes rust-lang/miri#3104
    matthiaskrgr committed May 9, 2024
    Configuration menu
    Copy the full SHA
    024881a View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#124924 - goofylfg:master, r=est31

    chore: remove repetitive words
    matthiaskrgr committed May 9, 2024
    Configuration menu
    Copy the full SHA
    a40fa8f View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#124926 - Alexendoo:feature-maybe-incorrect,…

    … r=est31
    
    Make `#![feature]` suggestion MaybeIncorrect
    
    Fixes rust-lang/rust-clippy#12784
    
    The `unstable_name_collisions` lint uses `disabled_nightly_features` to mention the feature name, but accepting the suggestion would result in an ambiguity error
    
    There are other calls where accepting the feature gate would fix code when ran with `cargo fix --broken-code`, though it's not always desirable to add a feature gate even if the user is currently on nightly so MaybeIncorrect seems appropriate
    matthiaskrgr committed May 9, 2024
    Configuration menu
    Copy the full SHA
    779fe95 View commit details
    Browse the repository at this point in the history