Skip to content

Parse impl restrictions#152943

Merged
rust-bors[bot] merged 10 commits intorust-lang:mainfrom
CoCo-Japan-pan:impl-restriction-parse
Mar 3, 2026
Merged

Parse impl restrictions#152943
rust-bors[bot] merged 10 commits intorust-lang:mainfrom
CoCo-Japan-pan:impl-restriction-parse

Conversation

@CoCo-Japan-pan
Copy link
Contributor

@CoCo-Japan-pan CoCo-Japan-pan commented Feb 21, 2026

This PR implements the parsing logic for impl restrictions (e.g., pub impl(crate) trait Foo {}) as proposed in RFC 3323.
As the first step of the RFC implementation, this PR focuses strictly on the parsing phase. The new syntax is guarded by the #![feature(impl_restriction)] feature gate.
This implementation basically follows the pattern used in #141754.

r? @jhpratt

@rustbot
Copy link
Collaborator

rustbot commented Feb 21, 2026

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@rustbot rustbot added 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-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue. labels Feb 21, 2026
@Kivooeo
Copy link
Member

Kivooeo commented Feb 21, 2026

since this is more a compiler related change, I'll reroll from @jhpratt

r? compiler

@rustbot rustbot assigned petrochenkov and unassigned jhpratt Feb 21, 2026
@Urgau
Copy link
Member

Urgau commented Feb 21, 2026

This PR is linked to a GSOC idea/proposal, where I and @jhpratt are mentors, we will both review it.

r? Urgau

@rustbot rustbot assigned Urgau and unassigned petrochenkov Feb 21, 2026
@rust-log-analyzer

This comment has been minimized.

@CoCo-Japan-pan
Copy link
Contributor Author

CoCo-Japan-pan commented Feb 22, 2026

It turns out the CI is failing because I was printing impl in rustfmt even when no restrictions are present. I’ll push a fix for this shortly.

@rust-log-analyzer

This comment has been minimized.

@CoCo-Japan-pan
Copy link
Contributor Author

@Urgau Thanks for the feedback! I've addressed all the comments. Ready for another look!

Copy link
Member

@Urgau Urgau left a comment

Choose a reason for hiding this comment

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

Look good to me. I will let @jhpratt do the final review.

View changes since this review

@Urgau
Copy link
Member

Urgau commented Feb 22, 2026

Btw, 17 commits is a bit too much, it would be great if you could squash them to max 2/3 commits.

@CoCo-Japan-pan CoCo-Japan-pan changed the title Introduce impl restriction to AST Parse impl restrictions Feb 23, 2026
@rust-bors

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Feb 28, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@jhpratt
Copy link
Member

jhpratt commented Mar 3, 2026

LGTM! @Urgau Any particular preference regarding this?

it would be great if you could squash them to max 2/3 commits.

The current commits (10) all seem reasonable to me; I reviewed commit-by-commit. A couple could reasonably be folded into their preceding commit, but I don't think it's egregious or anything.

r=me (and you, of course) at your preference.

@Urgau
Copy link
Member

Urgau commented Mar 3, 2026

I'm fine with the 10 commits as they currently are. Let's merge it.

@bors r=Urgau,jhpratt

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 3, 2026

📌 Commit 3dcefa3 has been approved by Urgau,jhpratt

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 Mar 3, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 3, 2026
…rse, r=Urgau,jhpratt

Parse `impl` restrictions

This PR implements the parsing logic for `impl` restrictions (e.g., `pub impl(crate) trait Foo {}`) as proposed in [RFC 3323](https://rust-lang.github.io/rfcs/3323-restrictions.html).
As the first step of the RFC implementation, this PR focuses strictly on the parsing phase. The new syntax is guarded by the `#![feature(impl_restriction)]` feature gate.
This implementation basically follows the pattern used in rust-lang#141754.

r? @jhpratt
rust-bors bot pushed a commit that referenced this pull request Mar 3, 2026
…uwer

Rollup of 4 pull requests

Successful merges:

 - #152164 (Lint unused features)
 - #152943 (Parse `impl` restrictions)
 - #153184 (Replace CodegenResults with CompiledModules)
 - #153319 (Comments and docs: add missing periods to "ie.")
rust-bors bot pushed a commit that referenced this pull request Mar 3, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - #153336 (stdarch subtree update)
 - #152943 (Parse `impl` restrictions)
 - #153184 (Replace CodegenResults with CompiledModules)
 - #153285 (Update call-llvm-intrinsics test for Rust 1.94.0 IR)
 - #153319 (Comments and docs: add missing periods to "ie.")
 - #153326 (Make `rustc_with_all_queries!` pass query modifiers as named values)
@rust-bors rust-bors bot merged commit bef489b into rust-lang:main Mar 3, 2026
11 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Mar 3, 2026
rust-timer added a commit that referenced this pull request Mar 3, 2026
Rollup merge of #152943 - CoCo-Japan-pan:impl-restriction-parse, r=Urgau,jhpratt

Parse `impl` restrictions

This PR implements the parsing logic for `impl` restrictions (e.g., `pub impl(crate) trait Foo {}`) as proposed in [RFC 3323](https://rust-lang.github.io/rfcs/3323-restrictions.html).
As the first step of the RFC implementation, this PR focuses strictly on the parsing phase. The new syntax is guarded by the `#![feature(impl_restriction)]` feature gate.
This implementation basically follows the pattern used in #141754.

r? @jhpratt
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Mar 4, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#153336 (stdarch subtree update)
 - rust-lang/rust#152943 (Parse `impl` restrictions)
 - rust-lang/rust#153184 (Replace CodegenResults with CompiledModules)
 - rust-lang/rust#153285 (Update call-llvm-intrinsics test for Rust 1.94.0 IR)
 - rust-lang/rust#153319 (Comments and docs: add missing periods to "ie.")
 - rust-lang/rust#153326 (Make `rustc_with_all_queries!` pass query modifiers as named values)
github-actions bot pushed a commit to rust-lang/rust-analyzer that referenced this pull request Mar 5, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#153336 (stdarch subtree update)
 - rust-lang/rust#152943 (Parse `impl` restrictions)
 - rust-lang/rust#153184 (Replace CodegenResults with CompiledModules)
 - rust-lang/rust#153285 (Update call-llvm-intrinsics test for Rust 1.94.0 IR)
 - rust-lang/rust#153319 (Comments and docs: add missing periods to "ie.")
 - rust-lang/rust#153326 (Make `rustc_with_all_queries!` pass query modifiers as named values)
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-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler 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.

8 participants