2025-09-11 09:06:56 +08:00
|
|
|
//! Regression test for #145770.
|
|
|
|
|
//!
|
|
|
|
|
//! Changing the `assert!` desugaring from an `if !cond {}` to `match` expression is
|
|
|
|
|
//! backwards-incompatible, and may need to be done over an edition boundary or limit editions for
|
|
|
|
|
//! which the desguaring change impacts.
|
|
|
|
|
|
2025-09-11 09:00:01 +08:00
|
|
|
//@ check-pass
|
|
|
|
|
|
2025-09-11 09:06:56 +08:00
|
|
|
#[derive(Debug)]
|
|
|
|
|
struct F {
|
|
|
|
|
data: bool
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl std::ops::Not for F {
|
|
|
|
|
type Output = bool;
|
|
|
|
|
fn not(self) -> Self::Output { !self.data }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
let f = F { data: true };
|
|
|
|
|
|
|
|
|
|
assert!(f);
|
|
|
|
|
}
|