Skip to content

mut restriction lowering#159125

Merged
rust-bors[bot] merged 7 commits into
rust-lang:mainfrom
CoCo-Japan-pan:mut-restriction-lowering
Jul 12, 2026
Merged

mut restriction lowering#159125
rust-bors[bot] merged 7 commits into
rust-lang:mainfrom
CoCo-Japan-pan:mut-restriction-lowering

Conversation

@CoCo-Japan-pan

@CoCo-Japan-pan CoCo-Japan-pan commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

This PR is part of the ongoing work to implement mut restrictions proposed in RFC 3323, and linked to a GSoC proposal.
It implements path resolution for mut restrictions and lowers the resolved information to HIR.
Tracking issue: #105077

r? @Urgau
cc @jhpratt

@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 Jul 11, 2026
@jhpratt jhpratt added the F-mut_restriction `#![feature(mut_restriction)]` label Jul 11, 2026
Comment thread compiler/rustc_hir_pretty/src/lib.rs Outdated
mut(in crate::a::E) e2: i32, //~ ERROR expected module, found enum `crate::a::E` [E0577]
mut(crate) e3: i32,
mut(self) e4: i32,
mut(super) e5: i32, //~ ERROR too many leading `super` keywords within `crate` [E0433]

@jhpratt jhpratt Jul 11, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

cc @estebank I'm not in love with this error message, but it is consistent with pub(super) at the top level. The inline diagnostic is better and would probably be best served at the top level (modulo specific wording). What do you think?

(@CoCo-Japan-pan don't worry about handling this)

View changes since the review

@rust-log-analyzer

This comment has been minimized.

@rustbot

rustbot commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Changes to the size of AST and/or HIR nodes.

cc @nnethercote

@CoCo-Japan-pan CoCo-Japan-pan force-pushed the mut-restriction-lowering branch from a6284a4 to c941bde Compare July 11, 2026 10:07

@Urgau Urgau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks pretty good. I only have some nits.

View changes since this review

Comment thread tests/pretty/hir-mut-restriction.rs Outdated
Comment thread tests/ui/mut-restriction/restriction-resolution-errors.rs Outdated
@CoCo-Japan-pan CoCo-Japan-pan force-pushed the mut-restriction-lowering branch from c941bde to c060b6d Compare July 11, 2026 10:42
@Urgau

Urgau commented Jul 11, 2026

Copy link
Copy Markdown
Member

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 11, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 11, 2026
@rust-bors

rust-bors Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: f5dbb65 (f5dbb65f59ea745d451e455f182b75a36f71abe9)
Base parent: ad49852 (ad49852b6f3dd9c1c73fe909d8843bb7e464b387)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (f5dbb65): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.1% [0.0%, 0.2%] 8
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.0% [-0.1%, -0.0%] 3
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -0.5%, secondary 0.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.8% [2.8%, 2.8%] 1
Regressions ❌
(secondary)
0.7% [0.7%, 0.7%] 1
Improvements ✅
(primary)
-3.8% [-3.8%, -3.8%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.5% [-3.8%, 2.8%] 2

Cycles

Results (primary -1.9%, secondary 0.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.7% [2.5%, 12.4%] 7
Improvements ✅
(primary)
-1.9% [-1.9%, -1.9%] 1
Improvements ✅
(secondary)
-4.3% [-8.7%, -1.3%] 5
All ❌✅ (primary) -1.9% [-1.9%, -1.9%] 1

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 488.317s -> 489.984s (0.34%)
Artifact size: 389.82 MiB -> 389.26 MiB (-0.14%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 11, 2026

@Urgau Urgau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me. Thanks.

I will let @jhpratt do a final review.

View changes since this review

@jhpratt

jhpratt commented Jul 11, 2026

Copy link
Copy Markdown
Member

@bors r=jhpratt,Urgau rollup=iffy perf

@rust-bors

rust-bors Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

📌 Commit c060b6d has been approved by jhpratt,Urgau

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 11, 2026
rust-bors Bot pushed a commit that referenced this pull request Jul 12, 2026
Rollup of 3 pull requests

Successful merges:

 - #159125 (`mut` restriction lowering)
 - #159154 (compiler: redescribe llvmlike_vector_align as rust_vector_align)
 - #159157 (Better comment the struct used by `{read,write}_unaligned`)

Failed merges:

 - #158732 (Apply MCP 1003 and move diagnostics.rs into its own module)
@rust-bors rust-bors Bot merged commit 1d97ab6 into rust-lang:main Jul 12, 2026
14 checks passed
rust-timer added a commit that referenced this pull request Jul 12, 2026
Rollup merge of #159125 - CoCo-Japan-pan:mut-restriction-lowering, r=jhpratt,Urgau

`mut` restriction lowering

This PR is part of the ongoing work to implement `mut` restrictions proposed in [RFC 3323](https://rust-lang.github.io/rfcs/3323-restrictions.html), and linked to a [GSoC proposal](https://rust-lang.zulipchat.com/#narrow/channel/421156-gsoc/topic/Project.3A.20Implementing.20impl.20and.20mut.20restrictions/with/592352432).
It implements path resolution for `mut` restrictions and lowers the resolved information to HIR.
Tracking issue: #105077

r? @Urgau
cc @jhpratt
@rustbot rustbot added this to the 1.99.0 milestone Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

F-mut_restriction `#![feature(mut_restriction)]` perf-regression Performance regression. 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