Skip to content

Comments

Parse impl restrictions#152943

Open
CoCo-Japan-pan wants to merge 10 commits intorust-lang:mainfrom
CoCo-Japan-pan:impl-restriction-parse
Open

Parse impl restrictions#152943
CoCo-Japan-pan wants to merge 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants