Skip to content

remove MutTy - #163327

Open
cyrgani wants to merge 2 commits into
rust-lang:mainfrom
cyrgani:mut-ty
Open

cyrgani wants to merge 2 commits into
rust-lang:mainfrom
cyrgani:mut-ty

Conversation

@cyrgani

@cyrgani cyrgani commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

This PR removes ast::MutTy and hir::MutTy and inlines their two fields directly into their corresponding TypeKind variants. These types probably made sense in pre-1.0 versions where it still had a syntax-level representation with things like [mut T]. Nowadays, it is just a type that is used in some, but not all places to group a type and a mutability together (for example, rustc_type_ir does not include such a wrapper). It also has no methods and just makes some match statements more verbose. Removing it makes them more readable.

@rustbot

rustbot commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

The parser was modified, potentially altering the grammar of (stable) Rust
which would be a breaking change.

cc @fmease

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

clippy is developed in its own repository. If possible, consider making this change to rust-lang/rust-clippy instead.

cc @rust-lang/clippy

rustfmt is developed in its own repository. If possible, consider making this change to rust-lang/rustfmt instead.

cc @rust-lang/rustfmt

Some changes occurred in compiler/rustc_builtin_macros/src/autodiff.rs

cc @ZuseZ4

HIR ty lowering was modified

cc @fmease

Some changes occurred in compiler/rustc_ast/src/expand/autodiff_attrs.rs

cc @ZuseZ4

@rustbot rustbot added F-autodiff `#![feature(autodiff)]` 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. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue. labels Sep 25, 2026
@rustbot

rustbot commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

r? @mejrs

rustbot has assigned @mejrs.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 77 candidates
  • Random selection from 21 candidates

@rust-log-analyzer

This comment has been minimized.

@oli-obk

oli-obk commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Huh I thought we had this before and changed at some point to bundle the pointer with its mutability. Or was that only in TyKind?

Either way, we should keep all three in sync, so also do the change for TyKind::Ref and Ptr, or keep all three in the MutTy system.

@cyrgani

cyrgani commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

It was removed from rustc_type_ir with #122852 and rust-lang/types-team#124.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

F-autodiff `#![feature(autodiff)]` 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. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants