-
Notifications
You must be signed in to change notification settings - Fork 13.5k
make cfg_select
a builtin macro
#143461
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
make cfg_select
a builtin macro
#143461
Conversation
This comment has been minimized.
This comment has been minimized.
e3aeb08
to
1dc0034
Compare
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. This PR modifies cc @jieyouxu |
This comment has been minimized.
This comment has been minimized.
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.
The behavior, per the tests and the impl, looks correct to me.
3d68353
to
3abcece
Compare
I moved some things around (analogously to Implementation-wise the one thing I'm not sure about is how to get |
cc @rust-lang/rustfmt @rust-lang/style |
This comment was marked as resolved.
This comment was marked as resolved.
3abcece
to
53b3b88
Compare
This comment was marked as resolved.
This comment was marked as resolved.
53b3b88
to
5d550b1
Compare
4b84ad7
to
01f41cc
Compare
Given that formatting now seems straightforward, I think this can be merged without the precise formatting logic. It's probably better (also for review etc.) to add formatting separately in the So, this PR is complete from my perspective. |
Nice! I agree that a PR to the rustfmt repo would be ideal to add the formatting logic / refactoring for code sharing with |
01f41cc
to
b4afa4a
Compare
…o, r=petrochenkov make `cfg_select` a builtin macro tracking issue: rust-lang#115585 This parses mostly the same as the `macro cfg_select` version, except: 1. wrapping in double brackets is no longer supported (or needed): `cfg_select {{ /* ... */ }}` is now rejected. 2. in an expression context, the rhs is no longer wrapped in a block, so that this now works: ```rust fn main() { println!(cfg_select! { unix => { "foo" } _ => { "bar" } }); } ``` 3. a single wildcard rule is now supported: `cfg_select { _ => 1 }` now works I've also added an error if none of the rules evaluate to true, and warnings for any arms that follow the `_` wildcard rule. cc `@traviscross` if I'm missing any feature that should/should not be included r? `@petrochenkov` for the macro logic details
Rollup of 14 pull requests Successful merges: - #143301 (`tests/ui`: A New Order [26/N]) - #143461 (make `cfg_select` a builtin macro) - #143519 (Check assoc consts and tys later like assoc fns) - #143554 (slice: Mark `rotate_left`, `rotate_right` unstably const) - #143634 (interpret/allocation: expose init + write_wildcards on a range) - #143679 (Preserve the .debug_gdb_scripts section) - #143685 (Resolve: merge `source_bindings` and `target_bindings` into `bindings`) - #143704 (Be a bit more careful around exotic cycles in in the inliner) - #143734 (Refactor resolve resolution bindings) - #143774 (constify `From` and `Into`) - #143785 (Add --compile-time-deps argument for x check) - #143786 (Fix fallback for CI_JOB_NAME) - #143825 (clippy: fix test filtering when TESTNAME is empty) - #143826 (Fix command trace) r? `@ghost` `@rustbot` modify labels: rollup
…o, r=petrochenkov make `cfg_select` a builtin macro tracking issue: rust-lang#115585 This parses mostly the same as the `macro cfg_select` version, except: 1. wrapping in double brackets is no longer supported (or needed): `cfg_select {{ /* ... */ }}` is now rejected. 2. in an expression context, the rhs is no longer wrapped in a block, so that this now works: ```rust fn main() { println!(cfg_select! { unix => { "foo" } _ => { "bar" } }); } ``` 3. a single wildcard rule is now supported: `cfg_select { _ => 1 }` now works I've also added an error if none of the rules evaluate to true, and warnings for any arms that follow the `_` wildcard rule. cc ``@traviscross`` if I'm missing any feature that should/should not be included r? ``@petrochenkov`` for the macro logic details
Rollup of 13 pull requests Successful merges: - #143301 (`tests/ui`: A New Order [26/N]) - #143461 (make `cfg_select` a builtin macro) - #143519 (Check assoc consts and tys later like assoc fns) - #143554 (slice: Mark `rotate_left`, `rotate_right` unstably const) - #143634 (interpret/allocation: expose init + write_wildcards on a range) - #143679 (Preserve the .debug_gdb_scripts section) - #143685 (Resolve: merge `source_bindings` and `target_bindings` into `bindings`) - #143734 (Refactor resolve resolution bindings) - #143774 (constify `From` and `Into`) - #143785 (Add --compile-time-deps argument for x check) - #143786 (Fix fallback for CI_JOB_NAME) - #143825 (clippy: fix test filtering when TESTNAME is empty) - #143826 (Fix command trace) r? `@ghost` `@rustbot` modify labels: rollup
@bors r- rollup=iffy |
could also be related to #143519 ? 🤔 |
No it's definitely this PR, just finicky targets and a feature that is inherently tied to conditional compilation. |
d683da0
to
3689b80
Compare
@bors2 try jobs=x86_64-msvc-2,test-various |
make `cfg_select` a builtin macro tracking issue: #115585 This parses mostly the same as the `macro cfg_select` version, except: 1. wrapping in double brackets is no longer supported (or needed): `cfg_select {{ /* ... */ }}` is now rejected. 2. in an expression context, the rhs is no longer wrapped in a block, so that this now works: ```rust fn main() { println!(cfg_select! { unix => { "foo" } _ => { "bar" } }); } ``` 3. a single wildcard rule is now supported: `cfg_select { _ => 1 }` now works I've also added an error if none of the rules evaluate to true, and warnings for any arms that follow the `_` wildcard rule. cc `@traviscross` if I'm missing any feature that should/should not be included r? `@petrochenkov` for the macro logic details try-job: x86_64-msvc-2 try-job: test-various
@bors r=petrochenkov |
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 56835d7 (parent) -> e9182f1 (this PR) Test differencesShow 80 test diffsStage 1
Stage 2
Additionally, 76 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard e9182f195b8505c87c4bd055b9f6e114ccda0981 --output-dir test-dashboard And then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
@ytmimi now that this has been merged, we can think about the formatting. I have a working implementation locally. However, the |
Finished benchmarking commit (e9182f1): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 2.6%, secondary 4.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -5.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 465.532s -> 464.056s (-0.32%) |
tracking issue: #115585
This parses mostly the same as the
macro cfg_select
version, except:cfg_select {{ /* ... */ }}
is now rejected.cfg_select { _ => 1 }
now worksI've also added an error if none of the rules evaluate to true, and warnings for any arms that follow the
_
wildcard rule.cc @traviscross if I'm missing any feature that should/should not be included
r? @petrochenkov for the macro logic details