Skip to content

Removing rustc_type_ir in the rustc_infer codebase #140559

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

Merged
merged 1 commit into from
May 6, 2025

Conversation

rperier
Copy link
Contributor

@rperier rperier commented May 1, 2025

cc #138449

This is a second refactoring of rustc_type_ir to use rustc_middle instead, this time that's for rustc_infer

@rustbot
Copy link
Collaborator

rustbot commented May 1, 2025

r? @oli-obk

rustbot has assigned @oli-obk.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 1, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 1, 2025

changes to the core type system

cc @compiler-errors, @lcnr

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@compiler-errors
Copy link
Member

Could you see if there's a strategy to ban naming the traits Interner and InferCtxtLike and the module inherent from the rustc_middle::ty reexport? Just to avoid situations like people naming API-layer traits via paths like rustc_middle::ty::Interner.

You may be able to do this by privately importing those types by name, or by shadowing them with a dummy ty alias like type Interner = ();

@rperier
Copy link
Contributor Author

rperier commented May 1, 2025

Sure, So it seems that I can do this by using shadowing with private imports. However, it seems that rustc_trait_selection uses ty::Interner (from rustc_middle). Do I change everything in a single commit or do you prefer separated commits ? (a commit for rustc_infer, another one for ban naming + changes in rustc_trait_selection).

@compiler-errors
Copy link
Member

Just do it in one commit is fine

@rperier rperier force-pushed the type-ir-to-type-middle branch from ce280de to 333ca90 Compare May 2, 2025 06:58
@rustbot rustbot added the WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) label May 2, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 2, 2025

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

@rperier
Copy link
Contributor Author

rperier commented May 2, 2025

Fixed, I have also reworded the commit

@rust-log-analyzer

This comment has been minimized.

This commit does the following:
  - Replaces use of rustc_type_ir by rustc_middle in rustc_infer.
  - The DelayedMap type is exposed by rustc_middle so everything can be
    accessed through rustc_middle in a coherent manner.
  - API-layer traits, like InferCtxtLike, Interner or inherent::* must be
    accessed via rustc_type_ir, not rustc_middle::ty. For this reason
    these are not reexported by rustc_middle::ty.
  - Replaces use of ty::Interner by rustc_type_ir::Interner in
    rustc_trait_selection
@rperier rperier force-pushed the type-ir-to-type-middle branch from 333ca90 to 6970813 Compare May 2, 2025 07:37
@rperier rperier requested a review from compiler-errors May 5, 2025 11:27
@compiler-errors
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 5, 2025

📌 Commit 6970813 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 5, 2025
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request May 5, 2025
…compiler-errors

Removing rustc_type_ir in the rustc_infer codebase

cc rust-lang#138449

This is a second refactoring of rustc_type_ir to use rustc_middle instead, this time that's for rustc_infer
bors added a commit to rust-lang-ci/rust that referenced this pull request May 5, 2025
…llaumeGomez

Rollup of 11 pull requests

Successful merges:

 - rust-lang#139764 (Consistent trait bounds for ExtractIf Debug impls)
 - rust-lang#140035 (Implement RFC 3503: frontmatters)
 - rust-lang#140080 (mir-opt: Use one MirPatch in MatchBranchSimplification)
 - rust-lang#140115 (mir-opt: execute MatchBranchSimplification after GVN)
 - rust-lang#140357 (bypass linker configuration and cross target check on `x check`)
 - rust-lang#140374 (Resolve instance for SymFn in global/naked asm)
 - rust-lang#140393 (std: get rid of `sys_common::process`)
 - rust-lang#140532 (Fix RustAnalyzer discovery of rustc's `stable_mir` crate)
 - rust-lang#140559 (Removing rustc_type_ir in the rustc_infer codebase)
 - rust-lang#140636 (implement `PanicTracker` to track `t` panics)
 - rust-lang#140661 (Make `-Zfixed-x18` into a target modifier)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request May 5, 2025
…llaumeGomez

Rollup of 11 pull requests

Successful merges:

 - rust-lang#140080 (mir-opt: Use one MirPatch in MatchBranchSimplification)
 - rust-lang#140115 (mir-opt: execute MatchBranchSimplification after GVN)
 - rust-lang#140357 (bypass linker configuration and cross target check on `x check`)
 - rust-lang#140374 (Resolve instance for SymFn in global/naked asm)
 - rust-lang#140559 (Removing rustc_type_ir in the rustc_infer codebase)
 - rust-lang#140605 (`fn check_opaque_type_parameter_valid` defer error)
 - rust-lang#140636 (implement `PanicTracker` to track `t` panics)
 - rust-lang#140661 (Make `-Zfixed-x18` into a target modifier)
 - rust-lang#140670 (calculate step duration in a panic-safe way)
 - rust-lang#140672 (Deeply normalize in the new solver in WF)
 - rust-lang#140676 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 224e3ca into rust-lang:master May 6, 2025
6 checks passed
@rustbot rustbot added this to the 1.88.0 milestone May 6, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 6, 2025
Rollup merge of rust-lang#140559 - rperier:type-ir-to-type-middle, r=compiler-errors

Removing rustc_type_ir in the rustc_infer codebase

cc rust-lang#138449

This is a second refactoring of rustc_type_ir to use rustc_middle instead, this time that's for rustc_infer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants