This reverts commit1eeb8e8b15, reversing changes made to324bf2b9fd. Unfortunately the assert desugaring change is not backwards compatible, see RUST-145770. Code such as ```rust #[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); } ``` would be broken by the assert desugaring change. We may need to land the change over an edition boundary, or limit the editions that the desugaring change impacts.
24 lines
480 B
Rust
24 lines
480 B
Rust
//! 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.
|
|
|
|
//@ check-pass
|
|
|
|
#[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);
|
|
}
|