-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
[cfg_match] Adjust syntax #133720
[cfg_match] Adjust syntax #133720
Conversation
r? @davidtwco rustbot has assigned @davidtwco. Use |
@rustbot modify labels: +T-libs-api -T-compiler |
This comment has been minimized.
This comment has been minimized.
d3bc54d
to
7087e0d
Compare
This comment has been minimized.
This comment has been minimized.
7087e0d
to
bf503ec
Compare
This comment has been minimized.
This comment has been minimized.
bf503ec
to
093de3c
Compare
This comment has been minimized.
This comment has been minimized.
093de3c
to
7dedd32
Compare
This comment has been minimized.
This comment has been minimized.
7dedd32
to
6a107c8
Compare
This comment has been minimized.
This comment has been minimized.
6a107c8
to
5c363b1
Compare
r? libs-api |
5c363b1
to
c635f0d
Compare
r? libs-api |
This looks great. Let's ship it. |
Thank you for the review, @joshtriplett. For what it is worth, my personal preference falls under the current duplicated strategy because of it is already in place 🦥 |
That was what I was suggesting. I don't think it's worth the additional delay to avoid the duplication. |
4ed46e8
to
0c7310d
Compare
This comment has been minimized.
This comment has been minimized.
0c7310d
to
c89f0dc
Compare
@joshtriplett All concerns were addressed and this PR is waiting for a |
@bors r+ rollup |
…joshtriplett [cfg_match] Adjust syntax A year has passed since the creation of rust-lang#115585 and the feature, as expected, is not moving forward. Let's change that. This PR proposes changing the arm's syntax from `cfg(SOME_CONDITION) => { ... }` to `SOME_CODITION => {}`. ```rust match_cfg! { unix => { fn foo() { /* unix specific functionality */ } } target_pointer_width = "32" => { fn foo() { /* non-unix, 32-bit functionality */ } } _ => { fn foo() { /* fallback implementation */ } } } ``` Why? Because after several manual migrations in rust-lang#116342 it became clear, at least for me, that `cfg` prefixes are unnecessary, verbose and redundant. Again, everything is just a proposal to move things forward. If the shown syntax isn't ideal, feel free to close this PR or suggest other alternatives.
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#133720 ([cfg_match] Adjust syntax) - rust-lang#134496 (Update documentation for Arc::from_raw, Arc::increment_strong_count, and Arc::decrement_strong_count to clarify allocator requirement) - rust-lang#134754 (Implement `use` associated items of traits) - rust-lang#135249 (Fix overflows in the implementation of `overflowing_literals` lint's help) - rust-lang#135251 (Only treat plain literal patterns as short) - rust-lang#135556 (Clarify note in `std::sync::LazyLock` example) - rust-lang#135560 (Update `compiler-builtins` to 0.1.144) r? `@ghost` `@rustbot` modify labels: rollup
…joshtriplett [cfg_match] Adjust syntax A year has passed since the creation of rust-lang#115585 and the feature, as expected, is not moving forward. Let's change that. This PR proposes changing the arm's syntax from `cfg(SOME_CONDITION) => { ... }` to `SOME_CODITION => {}`. ```rust match_cfg! { unix => { fn foo() { /* unix specific functionality */ } } target_pointer_width = "32" => { fn foo() { /* non-unix, 32-bit functionality */ } } _ => { fn foo() { /* fallback implementation */ } } } ``` Why? Because after several manual migrations in rust-lang#116342 it became clear, at least for me, that `cfg` prefixes are unnecessary, verbose and redundant. Again, everything is just a proposal to move things forward. If the shown syntax isn't ideal, feel free to close this PR or suggest other alternatives.
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#133720 ([cfg_match] Adjust syntax) - rust-lang#134496 (Update documentation for Arc::from_raw, Arc::increment_strong_count, and Arc::decrement_strong_count to clarify allocator requirement) - rust-lang#135249 (Fix overflows in the implementation of `overflowing_literals` lint's help) - rust-lang#135251 (Only treat plain literal patterns as short) - rust-lang#135556 (Clarify note in `std::sync::LazyLock` example) - rust-lang#135560 (Update `compiler-builtins` to 0.1.144) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#133720 ([cfg_match] Adjust syntax) - rust-lang#134496 (Update documentation for Arc::from_raw, Arc::increment_strong_count, and Arc::decrement_strong_count to clarify allocator requirement) - rust-lang#135249 (Fix overflows in the implementation of `overflowing_literals` lint's help) - rust-lang#135251 (Only treat plain literal patterns as short) - rust-lang#135556 (Clarify note in `std::sync::LazyLock` example) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#133720 - c410-f3r:cfg-match-foo-bar-baz, r=joshtriplett [cfg_match] Adjust syntax A year has passed since the creation of rust-lang#115585 and the feature, as expected, is not moving forward. Let's change that. This PR proposes changing the arm's syntax from `cfg(SOME_CONDITION) => { ... }` to `SOME_CODITION => {}`. ```rust match_cfg! { unix => { fn foo() { /* unix specific functionality */ } } target_pointer_width = "32" => { fn foo() { /* non-unix, 32-bit functionality */ } } _ => { fn foo() { /* fallback implementation */ } } } ``` Why? Because after several manual migrations in rust-lang#116342 it became clear, at least for me, that `cfg` prefixes are unnecessary, verbose and redundant. Again, everything is just a proposal to move things forward. If the shown syntax isn't ideal, feel free to close this PR or suggest other alternatives.
…tgross35,jhpratt [cfg_match] Document the use of expressions. cc rust-lang#115585 Adds documentation to this new feature introduced in rust-lang#133720.
…tgross35,jhpratt [cfg_match] Document the use of expressions. cc rust-lang#115585 Adds documentation to this new feature introduced in rust-lang#133720.
…tgross35,jhpratt [cfg_match] Document the use of expressions. cc rust-lang#115585 Adds documentation to this new feature introduced in rust-lang#133720.
…tgross35,jhpratt [cfg_match] Document the use of expressions. cc rust-lang#115585 Adds documentation to this new feature introduced in rust-lang#133720.
…tgross35,jhpratt [cfg_match] Document the use of expressions. cc rust-lang#115585 Adds documentation to this new feature introduced in rust-lang#133720.
Rollup merge of rust-lang#135625 - c410-f3r:cfg-match-foo-bar-baz, r=tgross35,jhpratt [cfg_match] Document the use of expressions. cc rust-lang#115585 Adds documentation to this new feature introduced in rust-lang#133720.
A year has passed since the creation of #115585 and the feature, as expected, is not moving forward. Let's change that.
This PR proposes changing the arm's syntax from
cfg(SOME_CONDITION) => { ... }
toSOME_CODITION => {}
.Why? Because after several manual migrations in #116342 it became clear, at least for me, that
cfg
prefixes are unnecessary, verbose and redundant.Again, everything is just a proposal to move things forward. If the shown syntax isn't ideal, feel free to close this PR or suggest other alternatives.