-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Account for new assert!
desugaring in !condition
suggestion
#145273
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
Merged
Merged
+144
−56
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`rustc` is going to change the desugaring of `assert!` to be ```rust match condition { true => {} _ => panic!(), } ``` which will make the edge-case of `condition` being `impl Not<Output = bool>` while not being `bool` itself no longer a straightforward suggestion, but `!!condition` will coerce the expression to be `bool`, so it can be machine applicable.
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
@bors r+ rollup=always |
fmease
added a commit
to fmease/rust
that referenced
this pull request
Aug 12, 2025
Account for new `assert!` desugaring in `!condition` suggestion `rustc` in rust-lang#122661 is going to change the desugaring of `assert!` to be ```rust match condition { true => {} _ => panic!(), } ``` which will make the edge-case of `condition` being `impl Not<Output = bool>` while not being `bool` itself no longer a straightforward suggestion, but `!!condition` will coerce the expression to be `bool`, so it can be machine applicable. Transposing rust-lang/rust-clippy#15453 to the rustc repo. r? ``@samueltardieu``
bors
added a commit
that referenced
this pull request
Aug 12, 2025
Rollup of 15 pull requests Successful merges: - #131477 (Apple: Always pass SDK root when linking with `cc`, and pass it via `SDKROOT` env var) - #139806 (std: sys: pal: uefi: Overhaul Time) - #144386 (Extract TraitImplHeader in AST/HIR) - #144542 (Stabilize `sse4a` and `tbm` target features) - #144921 (Don't emit `rustdoc::broken_intra_doc_links` for GitHub-flavored Markdown admonitions like `[!NOTE]`) - #145155 (Port `#[allow_internal_unsafe]` to the new attribute system (attempt 2)) - #145214 (fix: re-enable self-assignment) - #145216 (rustdoc: correct negative-to-implicit discriminant display) - #145238 (Tweak invalid builtin attribute output) - #145249 (Rename entered trace span variables from `_span` to `_trace`) - #145251 (Support using #[unstable_feature_bound] on trait) - #145253 (Document compiler and stdlib in stage1 in `pr-check-2` CI job) - #145260 (Make explicit guarantees about `Vec`’s allocator) - #145263 (Update books) - #145273 (Account for new `assert!` desugaring in `!condition` suggestion) r? `@ghost` `@rustbot` modify labels: rollup
fmease
added a commit
to fmease/rust
that referenced
this pull request
Aug 12, 2025
Account for new `assert!` desugaring in `!condition` suggestion `rustc` in rust-lang#122661 is going to change the desugaring of `assert!` to be ```rust match condition { true => {} _ => panic!(), } ``` which will make the edge-case of `condition` being `impl Not<Output = bool>` while not being `bool` itself no longer a straightforward suggestion, but `!!condition` will coerce the expression to be `bool`, so it can be machine applicable. Transposing rust-lang/rust-clippy#15453 to the rustc repo. r? ```@samueltardieu```
bors
added a commit
that referenced
this pull request
Aug 12, 2025
Rollup of 14 pull requests Successful merges: - #131477 (Apple: Always pass SDK root when linking with `cc`, and pass it via `SDKROOT` env var) - #139806 (std: sys: pal: uefi: Overhaul Time) - #144210 (std: thread: Return error if setting thread stack size fails) - #144386 (Extract TraitImplHeader in AST/HIR) - #144921 (Don't emit `rustdoc::broken_intra_doc_links` for GitHub-flavored Markdown admonitions like `[!NOTE]`) - #145155 (Port `#[allow_internal_unsafe]` to the new attribute system (attempt 2)) - #145214 (fix: re-enable self-assignment) - #145216 (rustdoc: correct negative-to-implicit discriminant display) - #145238 (Tweak invalid builtin attribute output) - #145249 (Rename entered trace span variables from `_span` to `_trace`) - #145251 (Support using #[unstable_feature_bound] on trait) - #145253 (Document compiler and stdlib in stage1 in `pr-check-2` CI job) - #145263 (Update books) - #145273 (Account for new `assert!` desugaring in `!condition` suggestion) r? `@ghost` `@rustbot` modify labels: rollup
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Aug 12, 2025
Account for new `assert!` desugaring in `!condition` suggestion `rustc` in rust-lang#122661 is going to change the desugaring of `assert!` to be ```rust match condition { true => {} _ => panic!(), } ``` which will make the edge-case of `condition` being `impl Not<Output = bool>` while not being `bool` itself no longer a straightforward suggestion, but `!!condition` will coerce the expression to be `bool`, so it can be machine applicable. Transposing rust-lang/rust-clippy#15453 to the rustc repo. r? ````@samueltardieu````
bors
added a commit
that referenced
this pull request
Aug 12, 2025
Rollup of 17 pull requests Successful merges: - #131477 (Apple: Always pass SDK root when linking with `cc`, and pass it via `SDKROOT` env var) - #139806 (std: sys: pal: uefi: Overhaul Time) - #144210 (std: thread: Return error if setting thread stack size fails) - #144386 (Extract TraitImplHeader in AST/HIR) - #144921 (Don't emit `rustdoc::broken_intra_doc_links` for GitHub-flavored Markdown admonitions like `[!NOTE]`) - #145155 (Port `#[allow_internal_unsafe]` to the new attribute system (attempt 2)) - #145214 (fix: re-enable self-assignment) - #145216 (rustdoc: correct negative-to-implicit discriminant display) - #145238 (Tweak invalid builtin attribute output) - #145249 (Rename entered trace span variables from `_span` to `_trace`) - #145251 (Support using #[unstable_feature_bound] on trait) - #145253 (Document compiler and stdlib in stage1 in `pr-check-2` CI job) - #145260 (Make explicit guarantees about `Vec`’s allocator) - #145263 (Update books) - #145273 (Account for new `assert!` desugaring in `!condition` suggestion) - #145283 (Make I-miscompile imply I-prioritize) - #145291 (bootstrap: Only warn about `rust.debug-assertions` if downloading rustc) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
that referenced
this pull request
Aug 12, 2025
Rollup of 17 pull requests Successful merges: - #131477 (Apple: Always pass SDK root when linking with `cc`, and pass it via `SDKROOT` env var) - #139806 (std: sys: pal: uefi: Overhaul Time) - #144386 (Extract TraitImplHeader in AST/HIR) - #144921 (Don't emit `rustdoc::broken_intra_doc_links` for GitHub-flavored Markdown admonitions like `[!NOTE]`) - #145155 (Port `#[allow_internal_unsafe]` to the new attribute system (attempt 2)) - #145214 (fix: re-enable self-assignment) - #145216 (rustdoc: correct negative-to-implicit discriminant display) - #145238 (Tweak invalid builtin attribute output) - #145249 (Rename entered trace span variables from `_span` to `_trace`) - #145251 (Support using #[unstable_feature_bound] on trait) - #145253 (Document compiler and stdlib in stage1 in `pr-check-2` CI job) - #145260 (Make explicit guarantees about `Vec`’s allocator) - #145263 (Update books) - #145273 (Account for new `assert!` desugaring in `!condition` suggestion) - #145283 (Make I-miscompile imply I-prioritize) - #145291 (bootstrap: Only warn about `rust.debug-assertions` if downloading rustc) - #145292 (Fix a typo in range docs) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Aug 12, 2025
Rollup merge of #145273 - estebank:not-not, r=samueltardieu Account for new `assert!` desugaring in `!condition` suggestion `rustc` in #122661 is going to change the desugaring of `assert!` to be ```rust match condition { true => {} _ => panic!(), } ``` which will make the edge-case of `condition` being `impl Not<Output = bool>` while not being `bool` itself no longer a straightforward suggestion, but `!!condition` will coerce the expression to be `bool`, so it can be machine applicable. Transposing rust-lang/rust-clippy#15453 to the rustc repo. r? `````@samueltardieu`````
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-clippy
Relevant to the Clippy team.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
rustc
in #122661 is going to change the desugaring ofassert!
to bewhich will make the edge-case of
condition
beingimpl Not<Output = bool>
while not beingbool
itself no longer a straightforward suggestion, but!!condition
will coerce the expression to bebool
, so it can be machine applicable.Transposing rust-lang/rust-clippy#15453 to the rustc repo.
r? @samueltardieu