Skip to content

Suggest similar keyword when visibility is not followed by an item#154561

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
FranciscoTGouveia:typo-detection-after-visibility
Apr 6, 2026
Merged

Suggest similar keyword when visibility is not followed by an item#154561
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
FranciscoTGouveia:typo-detection-after-visibility

Conversation

@FranciscoTGouveia
Copy link
Copy Markdown
Contributor

@FranciscoTGouveia FranciscoTGouveia commented Mar 29, 2026

Fixes #153353.

I would appreciate feedback on the following:

  • I inlined find_similar_kw instead of changing its visibility to pub(super). I am happy to switch if it is preferred;
  • I didn't add a comment to the new test. Although the rustc-dev-guide specifies that a comment should be added to every new test, this is not common in tests/ui/parser/misspelled_keywords/ and the test seems self-explanatory. Let me know if you would like me to add a comment;

Thank you in advance for your time and input!

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 29, 2026

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

cc @fmease

@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 Mar 29, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 29, 2026

r? @mati865

rustbot has assigned @mati865.
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 69 candidates
  • Random selection from 12 candidates

@Kivooeo
Copy link
Copy Markdown
Member

Kivooeo commented Mar 29, 2026

  • Although the rustc-dev-guide specifies that a comment should be added to every new test, this is not common in tests/ui/parser/misspelled_keywords/ and the test seems self-explanatory. Let me know if you would like me to add a comment

Doesn't necessary when test is self-explanatory

@mati865
Copy link
Copy Markdown
Member

mati865 commented Mar 31, 2026

@rustbot reroll

@rustbot rustbot assigned TaKO8Ki and unassigned mati865 Mar 31, 2026
@TaKO8Ki
Copy link
Copy Markdown
Member

TaKO8Ki commented Apr 5, 2026

@bors r+ rollup

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 5, 2026

📌 Commit 7f53271 has been approved by TaKO8Ki

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 Apr 5, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 5, 2026
…fter-visibility, r=TaKO8Ki

Suggest similar keyword when visibility is not followed by an item

Fixes rust-lang#153353.

I would appreciate feedback on the following:
- I inlined [`find_similar_kw`](https://github.com/rust-lang/rust/blob/cd14b73b4a41542d921f59e362a5b5005fa4f2ef/compiler/rustc_parse/src/parser/diagnostics.rs#L218-L224) instead of changing its visibility to `pub(super)`. I am happy to switch if it is preferred;
- I didn't add a comment to the new test. Although the rustc-dev-guide specifies that a [comment should be added](https://rustc-dev-guide.rust-lang.org/tests/adding.html#comment-explaining-what-the-test-is-about) to every new test, this is not common in `tests/ui/parser/misspelled_keywords/` and the test seems self-explanatory. Let me know if you would like me to add a comment;

Thank you in advance for your time and input!
rust-bors bot pushed a commit that referenced this pull request Apr 5, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #153440 (Various LTO cleanups)
 - #154561 (Suggest similar keyword when visibility is not followed by an item)
 - #154657 (Fix pattern assignment suggestions for uninitialized bindings)
 - #154717 (Fix ICE in unsafe binder discriminant helpers)
 - #154722 (fix(lints): Improve `ill_formed_attribute_input` with better help message)
 - #154808 (Post-attribute ports cleanup pt. 1)
 - #154849 (Promote `char::is_case_ignorable` from perma-unstable to unstable)
 - #154850 (ast_validation: scalable vectors okay for rustdoc)
rust-bors bot pushed a commit that referenced this pull request Apr 5, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #153440 (Various LTO cleanups)
 - #154561 (Suggest similar keyword when visibility is not followed by an item)
 - #154657 (Fix pattern assignment suggestions for uninitialized bindings)
 - #154717 (Fix ICE in unsafe binder discriminant helpers)
 - #154722 (fix(lints): Improve `ill_formed_attribute_input` with better help message)
 - #154808 (Post-attribute ports cleanup pt. 1)
 - #154849 (Promote `char::is_case_ignorable` from perma-unstable to unstable)
 - #154850 (ast_validation: scalable vectors okay for rustdoc)
rust-bors bot pushed a commit that referenced this pull request Apr 6, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #153440 (Various LTO cleanups)
 - #154561 (Suggest similar keyword when visibility is not followed by an item)
 - #154657 (Fix pattern assignment suggestions for uninitialized bindings)
 - #154717 (Fix ICE in unsafe binder discriminant helpers)
 - #154722 (fix(lints): Improve `ill_formed_attribute_input` with better help message)
 - #154808 (Post-attribute ports cleanup pt. 1)
 - #154849 (Promote `char::is_case_ignorable` from perma-unstable to unstable)
 - #154850 (ast_validation: scalable vectors okay for rustdoc)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 6, 2026
…fter-visibility, r=TaKO8Ki

Suggest similar keyword when visibility is not followed by an item

Fixes rust-lang#153353.

I would appreciate feedback on the following:
- I inlined [`find_similar_kw`](https://github.com/rust-lang/rust/blob/cd14b73b4a41542d921f59e362a5b5005fa4f2ef/compiler/rustc_parse/src/parser/diagnostics.rs#L218-L224) instead of changing its visibility to `pub(super)`. I am happy to switch if it is preferred;
- I didn't add a comment to the new test. Although the rustc-dev-guide specifies that a [comment should be added](https://rustc-dev-guide.rust-lang.org/tests/adding.html#comment-explaining-what-the-test-is-about) to every new test, this is not common in `tests/ui/parser/misspelled_keywords/` and the test seems self-explanatory. Let me know if you would like me to add a comment;

Thank you in advance for your time and input!
rust-bors bot pushed a commit that referenced this pull request Apr 6, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #153440 (Various LTO cleanups)
 - #151899 (Constify fold, reduce and last for iterator)
 - #154561 (Suggest similar keyword when visibility is not followed by an item)
 - #154657 (Fix pattern assignment suggestions for uninitialized bindings)
 - #154717 (Fix ICE in unsafe binder discriminant helpers)
 - #154722 (fix(lints): Improve `ill_formed_attribute_input` with better help message)
 - #154777 (`#[cfg]`: suggest alternative `target_` name when the value does not match)
 - #154849 (Promote `char::is_case_ignorable` from perma-unstable to unstable)
 - #154850 (ast_validation: scalable vectors okay for rustdoc)
@rust-bors rust-bors bot merged commit 77a5cb0 into rust-lang:main Apr 6, 2026
11 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Apr 6, 2026
rust-timer added a commit that referenced this pull request Apr 6, 2026
Rollup merge of #154561 - FranciscoTGouveia:typo-detection-after-visibility, r=TaKO8Ki

Suggest similar keyword when visibility is not followed by an item

Fixes #153353.

I would appreciate feedback on the following:
- I inlined [`find_similar_kw`](https://github.com/rust-lang/rust/blob/cd14b73b4a41542d921f59e362a5b5005fa4f2ef/compiler/rustc_parse/src/parser/diagnostics.rs#L218-L224) instead of changing its visibility to `pub(super)`. I am happy to switch if it is preferred;
- I didn't add a comment to the new test. Although the rustc-dev-guide specifies that a [comment should be added](https://rustc-dev-guide.rust-lang.org/tests/adding.html#comment-explaining-what-the-test-is-about) to every new test, this is not common in `tests/ui/parser/misspelled_keywords/` and the test seems self-explanatory. Let me know if you would like me to add a comment;

Thank you in advance for your time and input!
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Apr 7, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#153440 (Various LTO cleanups)
 - rust-lang/rust#151899 (Constify fold, reduce and last for iterator)
 - rust-lang/rust#154561 (Suggest similar keyword when visibility is not followed by an item)
 - rust-lang/rust#154657 (Fix pattern assignment suggestions for uninitialized bindings)
 - rust-lang/rust#154717 (Fix ICE in unsafe binder discriminant helpers)
 - rust-lang/rust#154722 (fix(lints): Improve `ill_formed_attribute_input` with better help message)
 - rust-lang/rust#154777 (`#[cfg]`: suggest alternative `target_` name when the value does not match)
 - rust-lang/rust#154849 (Promote `char::is_case_ignorable` from perma-unstable to unstable)
 - rust-lang/rust#154850 (ast_validation: scalable vectors okay for rustdoc)
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-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.

Typo detection for "const" works in const fn but not in pub const fn

5 participants