Skip to content

Conversation

Nadrieril
Copy link
Member

This adds an error on or-patterns under match guard that may cause the guard to be run more than once, such as true | true if f(). This is for crater purposes.

r? ghost

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 6, 2025
@rust-log-analyzer

This comment has been minimized.

@Nadrieril
Copy link
Member Author

@bors try

bors added a commit that referenced this pull request Jul 7, 2025
…, r=<try>

[WIP] Lint self-overlapping or-patterns under guard

This adds an error on or-patterns under match guard that may cause the guard to be run more than once, such as `true | true if f()`. This is for crater purposes.

r? ghost
@bors
Copy link
Collaborator

bors commented Jul 7, 2025

⌛ Trying commit c0fda28 with merge 3ce2ac6...

@bors
Copy link
Collaborator

bors commented Jul 7, 2025

💔 Test failed - checks-actions

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 7, 2025
@rust-log-analyzer

This comment has been minimized.

@Nadrieril
Copy link
Member Author

does the try job have to succeed for crater?

@craterbot check

@craterbot
Copy link
Collaborator

🚨 Error: missing start toolchain

🆘 If you have any trouble with Crater please ask in t-infra on Zulip
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@bors
Copy link
Collaborator

bors commented Jul 9, 2025

☔ The latest upstream changes (presumably #143472) made this pull request unmergeable. Please resolve the merge conflicts.

@Nadrieril Nadrieril force-pushed the lint-overlapping-or-pat-under-guard branch from c0fda28 to cfd618d Compare October 8, 2025 08:31
@Nadrieril
Copy link
Member Author

I might revisit this later but I don't have time to continue that rn.

@Nadrieril Nadrieril closed this Oct 8, 2025
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 8, 2025
@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling rustc_transmute v0.0.0 (/checkout/compiler/rustc_transmute)
error: pattern overlaps with or-alternative under a guard
   --> compiler/rustc_transmute/src/layout/tree.rs:216:13
    |
216 |             (Self::Seq(elts), other) | (other, Self::Seq(elts)) if elts.len() == 0 => other,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^   ------------------------ overlaps with

error: pattern overlaps with or-alternative under a guard
   --> compiler/rustc_transmute/src/layout/tree.rs:236:13
    |
236 |             (Self::Alt(alts), other) | (other, Self::Alt(alts)) if alts.len() == 0 => other,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^   ------------------------ overlaps with

[RUSTC-TIMING] rustc_transmute test:false 0.736
error: could not compile `rustc_transmute` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: pattern overlaps with or-alternative under a guard
   --> compiler/rustc_infer/src/infer/relate/lattice.rs:154:13
    |
154 |             (&ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }), _)
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
155 |             | (_, &ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }))
    |               ------------------------------------------------------- overlaps with

error: pattern overlaps with or-alternative under a guard
   --> compiler/rustc_infer/src/infer/relate/type_relating.rs:191:13
    |
191 |             (&ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }), _)
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
192 |             | (_, &ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }))
    |               ------------------------------------------------------- overlaps with

[RUSTC-TIMING] rustc_infer test:false 3.930
error: could not compile `rustc_infer` (lib) due to 2 previous errors
[RUSTC-TIMING] rustc_parse test:false 51.890
[RUSTC-TIMING] rustc_middle test:false 69.924

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-compiler Relevant 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.

5 participants