about summary refs log tree commit diff
path: root/tests/ui/macros/assert-desugaring-145770.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/macros/assert-desugaring-145770.rs')
-rw-r--r--tests/ui/macros/assert-desugaring-145770.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/macros/assert-desugaring-145770.rs b/tests/ui/macros/assert-desugaring-145770.rs
new file mode 100644
index 00000000000..9eb850f0380
--- /dev/null
+++ b/tests/ui/macros/assert-desugaring-145770.rs
@@ -0,0 +1,22 @@
+//! 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.
+
+#[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);
+  //~^ ERROR mismatched types
+}