-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add test to check unicode identifier version #134043
Conversation
|
As far as I can tell there's nothing that makes sure those two dependencies are kept in sync, and I think having |
@@ -0,0 +1 @@ | |||
Unicode version is: (16, 0, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could put this in a static assert in the crate itself (const _: () = assert!(rustc_lexer::UNICODE_VERSION == (16, 0, 0))
or so? That would probably avoid a CI cycle when this gets bumped to find the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not clear, what CI cycle would that avoid? My assumption is that when Cargo.lock
is updated, a PR is opened and all the tests run there.
I'm fine with putting it in the crate, though it would need to be a dedicated module just for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about that more, I would slightly prefer to keep it as a test here to keep the link with the reference test/identifier. Otherwise there is nothing that would be verifying the actual version in use that we could link to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with putting it in the crate, though it would need to be a dedicated module just for that.
It can just be a compiler/rustc_lexer/src/tests.rs
test if you want it to be a proper crate test I think? Like this file. Static assert would be even faster feedback as that will fail at build time locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If anything, we should have such a test in compiler/rustc_lexer/src/tests.rs
to make sure we don't unknowingly change the Unicode version we are using.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what CI cycle would that avoid
For me at least I wouldn't expect to re-run tests locally after bumping Unicode or similar, while I probably would "happen to" re-compile with something like x.py check, which a static assert should catch and tell me to update this, vs. here where I need to push a PR and wait for the CI to fail and then push a trivial update.
But not a big deal anyway.
r? compiler |
35ac908
to
c7f5768
Compare
@rustbot author (left some interim feedback) |
c7f5768
to
a97404e
Compare
@rustbot ready |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
You can r=me after PR CI is green. |
@bors r=jieyouxu rollup |
Rollup of 9 pull requests Successful merges: - rust-lang#133996 (Move most tests for `-l` and `#[link(..)]` into `tests/ui/link-native-libs`) - rust-lang#134012 (Grammar fixes) - rust-lang#134032 (docs: better examples for `std::ops::ControlFlow`) - rust-lang#134040 (bootstrap: print{ln}! -> eprint{ln}! (take 2)) - rust-lang#134043 (Add test to check unicode identifier version) - rust-lang#134053 (rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 10)) - rust-lang#134055 (interpret: clean up deduplicating allocation functions) - rust-lang#134073 (dataflow_const_prop: do not eval a ptr address in SwitchInt) - rust-lang#134084 (Fix typo in RFC mention 3598 -> 3593) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#134043 - ehuss:unicode-version, r=jieyouxu Add test to check unicode identifier version This adds a test to verify which version of Unicode is used for identifiers. This is part of the language, documented at https://doc.rust-lang.org/nightly/reference/identifiers.html#r-ident.unicode. The version here often changes implicitly due to dependency updates pulling in new versions, and thus we often don't notice it has changed leaving the documentation out of date. The intent here is to have a canary to give us a notification when it changes so that we can update the documentation.
This adds a test to verify which version of Unicode is used for identifiers. This is part of the language, documented at https://doc.rust-lang.org/nightly/reference/identifiers.html#r-ident.unicode. The version here often changes implicitly due to dependency updates pulling in new versions, and thus we often don't notice it has changed leaving the documentation out of date. The intent here is to have a canary to give us a notification when it changes so that we can update the documentation.