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

Remove rustc_middle::mir::tcx module. #137213

Merged
merged 1 commit into from
Feb 19, 2025

Conversation

nnethercote
Copy link
Contributor

This is a really weird module. For example, what does tcx in rustc_middle::mir::tcx::PlaceTy mean? The answer is "not much".

The top-level module comment says:

Methods for the various MIR types. These are intended for use after
building is complete.

Awfully broad for a module that has a handful of impl blocks for some MIR types, none of which really relates to TyCtxt. git blame indicates the comment is ancient, from 2015, and made sense then.

This module is now vestigial. This commit removes it and moves all the code within into rustc_middle::mir::statement. Some specifics:

  • Place, PlaceRef, Rvalue, Operand, BorrowKind: they all have impl blocks in both the tcx and statement modules. The commit merges the former into the latter.

  • BinOp, UnOp: they only have impl blocks in tcx. The commit moves these into statement.

  • PlaceTy, RvalueInitializationState: they are defined in tcx. This commit moves them into statement and makes them available in mir::*, like many other MIR types.

r? @tmandry

@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 Feb 18, 2025
@rustbot
Copy link
Collaborator

rustbot commented Feb 18, 2025

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My best guess w/o looking is that this is just an artifact from the early history of the module structure of mir::*.

@compiler-errors
Copy link
Member

r? compiler-errors @bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 18, 2025

📌 Commit 527eada 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 Feb 18, 2025
@compiler-errors
Copy link
Member

(AFAICT the CI failure was network related and not due to this PR)

Urgau added a commit to Urgau/rust that referenced this pull request Feb 18, 2025
…x, r=compiler-errors

Remove `rustc_middle::mir::tcx` module.

This is a really weird module. For example, what does `tcx` in `rustc_middle::mir::tcx::PlaceTy` mean? The answer is "not much".

The top-level module comment says:

> Methods for the various MIR types. These are intended for use after
> building is complete.

Awfully broad for a module that has a handful of impl blocks for some MIR types, none of which really relates to `TyCtxt`. `git blame` indicates the comment is ancient, from 2015, and made sense then.

This module is now vestigial. This commit removes it and moves all the code within into `rustc_middle::mir::statement`. Some specifics:

- `Place`, `PlaceRef`, `Rvalue`, `Operand`, `BorrowKind`: they all have `impl` blocks in both the `tcx` and `statement` modules. The commit merges the former into the latter.

- `BinOp`, `UnOp`: they only have `impl` blocks in `tcx`. The commit moves these into `statement`.

- `PlaceTy`, `RvalueInitializationState`: they are defined in `tcx`. This commit moves them into `statement` *and* makes them available in `mir::*`, like many other MIR types.

r? `@tmandry`
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 18, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang#137151 (Install more signal stack trace handlers)
 - rust-lang#137167 (tests: Also gate `f16::erfc()` doctest with `reliable_f16_math` cfg)
 - rust-lang#137195 (cg_clif: use exclusively ABI alignment)
 - rust-lang#137202 (Enforce T: Hash for Interned<...>)
 - rust-lang#137205 (Remove `std::os::wasi::fs::FileExt::tell`)
 - rust-lang#137211 (don't ICE for alias-relate goals with error term)
 - rust-lang#137213 (Remove `rustc_middle::mir::tcx` module.)
 - rust-lang#137214 (add last std diagnostic items for clippy)
 - rust-lang#137221 (Remove scrutinee_hir_id from ExprKind::Match)

r? `@ghost`
`@rustbot` modify labels: rollup
@Urgau
Copy link
Member

Urgau commented Feb 18, 2025

Failed in #137226 (comment)

  error: unresolved link to `super::tcx::PlaceTy`
     --> compiler/rustc_middle/src/mir/syntax.rs:1136:78
      |
 1136 | ///  3. The type of the place and an optional variant index. See [`PlaceTy`][super::tcx::PlaceTy].
      |                                                                              ^^^^^^^^^^^^^^^^^^^ no item named `tcx` in module `mir`
      |
      = note: `-D rustdoc::broken-intra-doc-links` implied by `-D warnings`
      = help: to override `-D warnings` add `#[allow(rustdoc::broken_intra_doc_links)]`

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 18, 2025
This is a really weird module. For example, what does `tcx` in
`rustc_middle::mir::tcx::PlaceTy` mean? The answer is "not much".

The top-level module comment says:

> Methods for the various MIR types. These are intended for use after
> building is complete.

Awfully broad for a module that has a handful of impl blocks for some
MIR types, none of which really relates to `TyCtxt`. `git blame`
indicates the comment is ancient, from 2015, and made sense then.

This module is now vestigial. This commit removes it and moves all the
code within into `rustc_middle::mir::statement`. Some specifics:

- `Place`, `PlaceRef`, `Rvalue`, `Operand`, `BorrowKind`: they all have `impl`
  blocks in both the `tcx` and `statement` modules. The commit merges
  the former into the latter.

- `BinOp`, `UnOp`: they only have `impl` blocks in `tcx`. The commit
  moves these into `statement`.

- `PlaceTy`, `RvalueInitializationState`: they are defined in `tcx`.
  This commit moves them into `statement` *and* makes them available in
  `mir::*`, like many other MIR types.
@nnethercote nnethercote force-pushed the rm-rustc_middle-mir-tcx branch from 527eada to 5d1551b Compare February 18, 2025 23:26
@rustbot
Copy link
Collaborator

rustbot commented Feb 18, 2025

This PR changes MIR

cc @oli-obk, @RalfJung, @JakobDegen, @davidtwco, @vakaras

@nnethercote
Copy link
Contributor Author

This PR changes MIR

cc @oli-obk, @RalfJung, @JakobDegen, @davidtwco, @vakaras

I fixed the rustdoc link error. That triggered this notification because there is now a single doc link change in a comment in mir/syntax.rs, nothing to see here.

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Feb 18, 2025

📌 Commit 5d1551b 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 18, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 19, 2025
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#136936 (Use 'yes' instead of 'while-echo' in tests/ui/process/process-sigpipe.rs except 'nto')
 - rust-lang#137026 (Stabilize (and const-stabilize) `integer_sign_cast`)
 - rust-lang#137059 (fix: Alloc new errorcode E0803 for E0495)
 - rust-lang#137177 (Update `minifier-rs` version to `0.3.5`)
 - rust-lang#137210 (compiler: Stop reexporting stuff in cg_llvm::abi)
 - rust-lang#137213 (Remove `rustc_middle::mir::tcx` module.)
 - rust-lang#137216 (eval_outlives: bail out early if both regions are in the same SCC)
 - rust-lang#137228 (Fix typo in hidden internal docs of `TrustedRandomAccess`)
 - rust-lang#137242 (Add reference annotations for the `do_not_recommend` attribute)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 34535b6 into rust-lang:master Feb 19, 2025
6 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Feb 19, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 19, 2025
Rollup merge of rust-lang#137213 - nnethercote:rm-rustc_middle-mir-tcx, r=compiler-errors

Remove `rustc_middle::mir::tcx` module.

This is a really weird module. For example, what does `tcx` in `rustc_middle::mir::tcx::PlaceTy` mean? The answer is "not much".

The top-level module comment says:

> Methods for the various MIR types. These are intended for use after
> building is complete.

Awfully broad for a module that has a handful of impl blocks for some MIR types, none of which really relates to `TyCtxt`. `git blame` indicates the comment is ancient, from 2015, and made sense then.

This module is now vestigial. This commit removes it and moves all the code within into `rustc_middle::mir::statement`. Some specifics:

- `Place`, `PlaceRef`, `Rvalue`, `Operand`, `BorrowKind`: they all have `impl` blocks in both the `tcx` and `statement` modules. The commit merges the former into the latter.

- `BinOp`, `UnOp`: they only have `impl` blocks in `tcx`. The commit moves these into `statement`.

- `PlaceTy`, `RvalueInitializationState`: they are defined in `tcx`. This commit moves them into `statement` *and* makes them available in `mir::*`, like many other MIR types.

r? `@tmandry`
@nnethercote nnethercote deleted the rm-rustc_middle-mir-tcx branch February 19, 2025 08:43
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants