Skip to content

feat: invisible character help string - #150790

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
GenericNerd:lexer/help-invisible-character
Jan 12, 2026
Merged

feat: invisible character help string#150790
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
GenericNerd:lexer/help-invisible-character

Conversation

@GenericNerd

Copy link
Copy Markdown
Contributor

I was playing around with zero width spaces in different programming languages and thought that this error message could be more helpful. Hopefully it's a good first contribution! :)

@rustbotrustbot 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 Jan 8, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

r? @WaffleLapkin

rustbot has assigned @WaffleLapkin.
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

@rust-log-analyzer

This comment has been minimized.

// way.
let (token, sugg) =
unicode_chars::check_for_substitution(self, start, c, repeats + 1);
const INVISIBLE_CHARACTERS: [char; 8] = ['\u{200B}', '\u{200C}', '\u{2060}', '\u{2061}', '\u{2062}', '\u{00AD}', '\u{034F}', '\u{061C}'];

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.

Is there any place this list could be sourced from so we don't need to maintain it in this specific place? There are definitely more as well. Maybe one of the unicode- crates provides it, @Manishearth would know.

Also having a const in the middle of a block is rather unidiomatic, if kept it should be moved to the top of the file.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I found a list of invisible characters here: https://www.editpad.org/tool/invisible-character. I only took ones that didn't actually take up a space.

I can move the const to the top of the file as well if that's more idiomatic.

@lukaslueg

Copy link
Copy Markdown
Contributor

@Bryntet

Copy link
Copy Markdown
Contributor

clippy lint that does the same thing

this clippy lint only does this on string literals though from what I can tell

@GenericNerd
GenericNerdforce-pushed the lexer/help-invisible-character branch from 11d0da1 to a6212c5CompareJanuary 8, 2026 21:26
@Kivooeo

Copy link
Copy Markdown
Member

Could you please squash the commits?

@tgross35

Copy link
Copy Markdown
Member

^ and drop the emojis pls, we know what a feature is even without the ✨ :)

@WaffleLapkinWaffleLapkin 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-review Status: Awaiting review from the assignee but also interested parties. labels Jan 9, 2026
@GenericNerd

Copy link
Copy Markdown
ContributorAuthor

^ and drop the emojis pls, we know what a feature is even without the ✨ :)

Is there any specific guidelines for commit messages? I was made semi-aware of squashing commits but was not made aware of how commits are meant to be formatted. I used the conventional commits extension in VSC so I'm just trying to make sure I only have to do this once!

@tgross35

Copy link
Copy Markdown
Member

Nothing too specific :) "conventional" prefixes like feat: are fine, as are area descriptors like lint:. A rule of thumb is just that if somebody reads the summary they should be able to loosely guess what changed.

Gitmoji is just pretty superfluous and doesn't match anything in the log, so we ask to avoid emojis in summaries.

@GenericNerd
GenericNerdforce-pushed the lexer/help-invisible-character branch from a6212c5 to 2b597f5CompareJanuary 10, 2026 14:31
@GenericNerdGenericNerd changed the title feat: ✨ invisible character help stringfeat: invisible character help stringJan 10, 2026
@GenericNerd

Copy link
Copy Markdown
ContributorAuthor

@rustbot ready

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 10, 2026
@tgross35

Copy link
Copy Markdown
Member

I assume you were taking a look at this / ready to approve based on the squash request, so

r? @Kivooeo

@rustbotrustbot assigned Kivooeo and unassigned WaffleLapkinJan 11, 2026
@GenericNerd

Copy link
Copy Markdown
ContributorAuthor

I assume you were taking a look at this / ready to approve based on the squash request, so

r? @Kivooeo

My bad, I thought I just needed to put the status label back to waiting for review! I did squash the commits, removed the emoji and changed the title like you mentioned though :)

@Kivooeo

Copy link
Copy Markdown
Member

I asked for the commits to be squashed as there were quite a few small ones

I'll take a final look at the implementation later today - it's 6 am here and it's been a long day, I apologise in advance for any potential delays and appreciate your patience

@Kivooeo

Copy link
Copy Markdown
Member

looks good thanks for your contribution!

@bors r=Kivooeo,tgross35 rollup

@rust-borsrust-borsBot 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 Jan 11, 2026
@rust-bors

rust-borsBot commented Jan 11, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 2b597f5 has been approved by Kivooeo,tgross35

It is now in the queue for this repository.

rust-borsBot added a commit that referenced this pull request Jan 12, 2026
Rollup of 9 pull requests
Successful merges:
- #147938 (Add const cloning of slices and tests)
- #149718 (Add freeze file times on Windows)
- #150438 (Remove mentions of debootstrap and chroots from the m68k-unknown-none-elf platform support doc)
- #150790 (feat: invisible character help string)
- #150906 (Simplify `#[eii]` macro using methods on ecx)
- #150938 (Port `#[collapse_debuginfo]` to the new attribute parsing system)
- #150953 (std: sys: fs: uefi: Implement copy)
- #150964 (Completely list all unparsed attributes)
- #150975 (ui: add test for normalizing const projections with assoc const equality)
Failed merges:
- #150972 (Rename EII attributes slightly (being consistent in naming things foreign items, not extern items))
r? @ghost
@rust-bors
rust-borsBot merged commit 66d1844 into rust-lang:mainJan 12, 2026
11 checks passed
@rustbotrustbot added this to the 1.94.0 milestone Jan 12, 2026
rust-timer added a commit that referenced this pull request Jan 12, 2026
Rollup merge of #150790 - lexer/help-invisible-character, r=Kivooeo,tgross35
feat: invisible character help string
I was playing around with zero width spaces in different programming languages and thought that this error message could be more helpful. Hopefully it's a good first contribution! :)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

8 participants

@GenericNerd@rustbot@rust-log-analyzer@lukaslueg@Bryntet@Kivooeo@tgross35@WaffleLapkin