-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-patternsRelating to patterns and pattern matchingRelating to patterns and pattern matchingC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-debug-assertionsThis issue requires a build of rustc or tooling with debug-assertions in some wayThis issue requires a build of rustc or tooling with debug-assertions in some way
Description
auto-reduced (treereduce-rust):
fn main() {
if let &Some(Some(x)) = &Some(&mut Some(0)) {}
}
original:
fn main(e: &mut &&mut Foo) {
if let &Some(Some(x)) = &Some(&mut Some(0)) {
let _: &u32 = x;
}
if let Some(&x) = Some(&mut 0) {
let _: u32 = x;
}
}
Version information
rustc 1.86.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.86.0-dev
LLVM version: 19.1.7
Possibly related line of code:
rust/compiler/rustc_hir_typeck/src/pat.rs
Lines 423 to 435 in fdd1a3b
def_br: ByRef, | |
adjust_mode: AdjustMode, | |
max_ref_mutbl: MutblCap, | |
) -> (Ty<'tcx>, ByRef, MutblCap) { | |
#[cfg(debug_assertions)] | |
if def_br == ByRef::Yes(Mutability::Mut) && max_ref_mutbl != MutblCap::Mut { | |
span_bug!(pat.span, "Pattern mutability cap violated!"); | |
} | |
match adjust_mode { | |
AdjustMode::Pass => (expected, def_br, max_ref_mutbl), | |
AdjustMode::Reset => (expected, ByRef::No, MutblCap::Mut), | |
AdjustMode::Peel => self.peel_off_references(pat, expected, def_br, max_ref_mutbl), | |
} |
Metadata
Metadata
Assignees
Labels
A-patternsRelating to patterns and pattern matchingRelating to patterns and pattern matchingC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-debug-assertionsThis issue requires a build of rustc or tooling with debug-assertions in some wayThis issue requires a build of rustc or tooling with debug-assertions in some way