about summary refs log tree commit diff
path: root/tests/ui/contracts/associated-item.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/contracts/associated-item.rs')
-rw-r--r--tests/ui/contracts/associated-item.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/contracts/associated-item.rs b/tests/ui/contracts/associated-item.rs
new file mode 100644
index 00000000000..4a2d05abbc5
--- /dev/null
+++ b/tests/ui/contracts/associated-item.rs
@@ -0,0 +1,18 @@
+// Ensure we don't ICE when lowering contracts on an associated item.
+
+//@ compile-flags: --crate-type=lib
+//@ check-pass
+
+#![feature(contracts)]
+//~^ WARN the feature `contracts` is incomplete and may not be safe to use
+
+extern crate core;
+
+use core::contracts::requires;
+
+struct Foo;
+
+impl Foo {
+    #[requires(align > 0 && (align & (align - 1)) == 0)]
+    pub fn foo(align: i32) {}
+}