Skip to content

Fix the span of trait bound modifier [const] #143171

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fmease
Copy link
Member

@fmease fmease commented Jun 29, 2025

r? project-const-traits or anyone

@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 Jun 29, 2025
@compiler-errors
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jun 29, 2025

📌 Commit 7a55709 has been approved by compiler-errors

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 Jun 29, 2025
Comment on lines 1071 to 1072
&& self.look_ahead(1, |t| t.is_keyword(kw::Const))
&& self.look_ahead(2, |t| *t == token::CloseBracket)
Copy link
Member Author

@fmease fmease Jun 29, 2025

Choose a reason for hiding this comment

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

(I'm pretty sure we don't need the careful lookahead logic and could just if eat("[") then expect("const") expect("]"), there shouldn't be ambiguity issues (I'll post another, tangentially related PR later that goes into more detail) but that will likely regress diagnostics (because if we fail to parse a bound, we try to reparse it as a type to give "expected trait, found type") and I didn't want to deal with that rn and maybe that's why oli chose this approach)

@rust-log-analyzer

This comment has been minimized.

@compiler-errors
Copy link
Member

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 29, 2025
@fmease fmease force-pushed the fix-span-of-maybe-const-mod branch from 7a55709 to f77fead Compare June 29, 2025 02:56
@fmease
Copy link
Member Author

fmease commented Jun 29, 2025

@bors r=compiler-errors

@bors
Copy link
Collaborator

bors commented Jun 29, 2025

📌 Commit f77fead has been approved by compiler-errors

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 29, 2025
@fee1-dead fee1-dead added the PG-const-traits Project group: Const traits label Jun 29, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 29, 2025
…, r=compiler-errors

Fix the span of trait bound modifier `[const]`

r? project-const-traits or anyone
bors added a commit that referenced this pull request Jun 29, 2025
Rollup of 11 pull requests

Successful merges:

 - #142021 (Doc: clarify priority of lint level sources)
 - #142367 (Add regression test for #137857 to ensure that we generate intra doc links for extern crate items.)
 - #142641 (Generate symbols.o for proc-macros too)
 - #142889 (Clarify doc comment on unix OpenOptions)
 - #143063 (explain `ImportData::imported_module`)
 - #143088 (Improve documentation of `TagEncoding`)
 - #143135 (fix typos on some doc comments)
 - #143138 (Port `#[link_name]` to the new attribute parsing infrastructure)
 - #143155 (`librustdoc` house-keeping 🧹)
 - #143169 (Remove unused feature gates)
 - #143171 (Fix the span of trait bound modifier `[const]`)

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
PG-const-traits Project group: Const traits 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.

6 participants