Skip to content

Deduplicate IntTy/UintTy/FloatTy. #144712

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 2 commits into from
Jul 31, 2025
Merged

Conversation

nnethercote
Copy link
Contributor

There are identical definitions in rustc_type_ir and rustc_ast. This commit removes them and places a single definition in rustc_ast_ir. This requires adding rust_span as a dependency of rustc_ast_ir, but means a bunch of silly conversion functions can be removed.

r? @fmease

@rustbot
Copy link
Collaborator

rustbot commented Jul 31, 2025

fmease is currently at their maximum review capacity.
They may take a while to respond.

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jul 31, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 31, 2025

HIR ty lowering was modified

cc @fmease

This PR changes rustc_public

cc @oli-obk, @celinval, @ouz-a

Some changes occurred in compiler/rustc_sanitizers

cc @rcvalle

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

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.

Some changes occurred in exhaustiveness checking

cc @Nadrieril

@rust-log-analyzer

This comment has been minimized.

There are identical definitions in `rustc_type_ir` and `rustc_ast`. This
commit removes them and places a single definition in `rustc_ast_ir`.
This requires adding `rust_span` as a dependency of `rustc_ast_ir`, but
means a bunch of silly conversion functions can be removed.

The one annoying wrinkle is that the old version had differences in
their `Debug` impls, e.g. one printed `u32` while the other printed
`U32`. Some compiler error messages rely on the former (yuk), and some
clippy output depends on the latter. So the commit also changes clippy
to not rely on `Debug` and just implement what it needs itself.
- Add some missing `tidy-alphabetical-*` markers.
- Remove some unnecessary blank lines.

impl fmt::Debug for IntTy {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.name_str())
Copy link
Member

Choose a reason for hiding this comment

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

You could do (here and in the other places)

Suggested change
write!(f, "{}", self.name_str())
f.write_str(self.name_str())

but it doesn't really matter.

Edit: Ah, it's pre-existing.

@fmease
Copy link
Member

fmease commented Jul 31, 2025

Thanks, very nice! @bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jul 31, 2025

📌 Commit 704f2ca has been approved by fmease

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 Jul 31, 2025
bors added a commit that referenced this pull request Jul 31, 2025
Rollup of 6 pull requests

Successful merges:

 - #144688 (Uniform `enter_trace_span!` and add documentation)
 - #144702 (stall `ConstArgHasType` in `compute_goal_fast_path`)
 - #144711 (Consider operator's span when computing binop expr span)
 - #144712 (Deduplicate `IntTy`/`UintTy`/`FloatTy`.)
 - #144726 (merge rustc_attr_data_structures into rustc_hir)
 - #144733 (fix: Match width of ascii and unicode secondary file start)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 5712d50 into rust-lang:master Jul 31, 2025
10 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jul 31, 2025
rust-timer added a commit that referenced this pull request Jul 31, 2025
Rollup merge of #144712 - nnethercote:dedup-num-types, r=fmease

Deduplicate `IntTy`/`UintTy`/`FloatTy`.

There are identical definitions in `rustc_type_ir` and `rustc_ast`. This commit removes them and places a single definition in `rustc_ast_ir`. This requires adding `rust_span` as a dependency of `rustc_ast_ir`, but means a bunch of silly conversion functions can be removed.

r? `@fmease`
@nnethercote nnethercote deleted the dedup-num-types branch July 31, 2025 21:26
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Aug 1, 2025
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#144688 (Uniform `enter_trace_span!` and add documentation)
 - rust-lang/rust#144702 (stall `ConstArgHasType` in `compute_goal_fast_path`)
 - rust-lang/rust#144711 (Consider operator's span when computing binop expr span)
 - rust-lang/rust#144712 (Deduplicate `IntTy`/`UintTy`/`FloatTy`.)
 - rust-lang/rust#144726 (merge rustc_attr_data_structures into rustc_hir)
 - rust-lang/rust#144733 (fix: Match width of ascii and unicode secondary file start)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc 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.

5 participants