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 6 pull requests #118757

Closed
wants to merge 17 commits into from

Commits on Dec 8, 2023

  1. Add instance evaluation and methods to read alloc

    The instance evaluation is needed to handle intrinsics such as
    `type_id` and `type_name`.
    
    Since we now use Allocation to represent all evaluated constants,
    provide a few methods to help process the data inside an allocation.
    celinval committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    4c9e842 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9cb6463 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0a0e7e6 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9e15c49 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    eb53721 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    5fdb648 View commit details
    Browse the repository at this point in the history
  7. remove redundant imports

    detects redundant imports that can be eliminated.
    
    for rust-lang#117772 :
    
    In order to facilitate review and modification, split the checking code and
    removing redundant imports code into two PR.
    surechen committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    4b64fbf View commit details
    Browse the repository at this point in the history
  8. privacy: visit trait def id of projections

    A refactoring in rust-lang#117076 changed the `DefIdVisitorSkeleton` to avoid
    calling `visit_projection_ty` for `ty::Projection` aliases, and instead
    just iterate over the args - this makes sense, as `visit_projection_ty`
    will indirectly visit all of the same args, but in doing so, will also
    create a `TraitRef` containing the trait's `DefId`, which also gets
    visited. The trait's `DefId` isn't visited when we only visit the
    arguments without separating them into `TraitRef` and own args first.
    
    Signed-off-by: David Wood <[email protected]>
    davidtwco committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    5d97724 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    cb41509 View commit details
    Browse the repository at this point in the history
  10. Feedback

    - Take more things by self, not &self
    - Clone more things
    - Rework namespacing so we can use `ty::` in the canonicalizer
    compiler-errors committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    1f5895b View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    80f240a View commit details
    Browse the repository at this point in the history
  12. Rollup merge of rust-lang#117586 - compiler-errors:the-canonicalizer,…

    … r=lcnr
    
    Uplift the (new solver) canonicalizer into `rustc_next_trait_solver`
    
    Uplifts the new trait solver's canonicalizer into a new crate called `rustc_next_trait_solver`.
    
    The crate name is literally a bikeshed-avoidance name, so let's not block this PR on that -- renames are welcome later.
    
    There are a host of other changes that were required to make this possible:
    * Expose a `ConstTy` trait to get the `Interner::Ty` from a `Interner::Const`.
    * Expose some constructor methods to construct `Bound` variants. These are currently methods defined on the interner themselves, but they could be pulled into traits later.
    * Expose a `IntoKind` trait to turn a `Ty`/`Const`/`Region` into their corresponding `*Kind`s.
    * Some minor tweaks to other APIs in `rustc_type_ir`.
    
    The canonicalizer code itself is best reviewed **with whitespace ignored.**
    
    r? `@lcnr`
    matthiaskrgr committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    f8b8824 View commit details
    Browse the repository at this point in the history
  13. Rollup merge of rust-lang#118692 - surechen:remove_unused_imports, r=…

    …petrochenkov
    
    remove redundant imports
    
    detects redundant imports that can be eliminated.
    
    for rust-lang#117772 :
    
    In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
    
    r? `@petrochenkov`
    matthiaskrgr committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    85b7dcd View commit details
    Browse the repository at this point in the history
  14. Rollup merge of rust-lang#118694 - celinval:smir-alloc-methods, r=ouz-a

    Add instance evaluation and methods to read an allocation in StableMIR
    
    The instance evaluation is needed to handle intrinsics such as `type_id` and `type_name`.
    
    Since we now use Allocation to represent all evaluated constants, provide a few methods to help process the data inside an allocation.
    
    I've also started to add a structured way to get information about the compilation target machine. For now, I've only added information needed to process an allocation.
    
    r? `````@ouz-a`````
    matthiaskrgr committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    fc3803b View commit details
    Browse the repository at this point in the history
  15. Rollup merge of rust-lang#118715 - davidtwco:issue-117997-privacy-vis…

    …it-trait-ref-and-args, r=TaKO8Ki
    
    privacy: visit trait def id of projections
    
    Fixes rust-lang#117997.
    
    A refactoring in rust-lang#117076 changed the `DefIdVisitorSkeleton` to avoid calling `visit_projection_ty` for `ty::Projection` aliases, and instead just iterate over the args - this makes sense, as `visit_projection_ty` will indirectly visit all of the same args, but in doing so, will also create a `TraitRef` containing the trait's `DefId`, which also gets visited. The trait's `DefId` isn't visited when we only visit the arguments without separating them into `TraitRef` and own args first.
    
    Eventually this influences the reachability set and whether a function is encoded into the metadata.
    matthiaskrgr committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    f58883c View commit details
    Browse the repository at this point in the history
  16. Rollup merge of rust-lang#118730 - jyn514:cmp_refs, r=estebank,compil…

    …er-errors
    
    recurse into refs when comparing tys for diagnostics
    
    before:
    ![image](https://github.com/rust-lang/rust/assets/23638587/bf6abd62-c7f3-4c09-a47e-31b6e129de19)
    
    after:
    ![image](https://github.com/rust-lang/rust/assets/23638587/b704d728-ddba-4204-aebe-c07dcbbcb55c)
    
    this diff from the test suite is also quite nice imo:
    ```diff
    `@@` -4,8  4,8 `@@` error[E0308]: mismatched types
     LL |     debug_assert_eq!(iter.next(), Some(value));
        |                                   ^^^^^^^^^^^ expected `Option<<I as Iterator>::Item>`, found `Option<&<I as Iterator>::Item>`
        |
    -   = note: expected enum `Option<<I as Iterator>::Item>`
    -              found enum `Option<&<I as Iterator>::Item>`
        = note: expected enum `Option<_>`
                   found enum `Option<&_>`
    ```
    matthiaskrgr committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    68c5438 View commit details
    Browse the repository at this point in the history
  17. Rollup merge of rust-lang#118736 - aliemjay:revert-ice-on-ambig, r=co…

    …mpiler-errors
    
    temporarily revert "ice on ambguity in mir typeck"
    
    Reverts rust-lang#116530 as a temporary measure to fix rust-lang#117577. That issue should be ultimately fixed by checking WF of type annotations prior to normalization, which is implemented in rust-lang#104098 but this PR is intended to be backported to beta.
    
    r? `@compiler-errors` (the reviewer of the reverted PR)
    matthiaskrgr committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    a720b77 View commit details
    Browse the repository at this point in the history