aboutsummaryrefslogtreecommitdiff
path: root/tests/ui/unstable-features/trivial_bounds-feature-gate.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/unstable-features/trivial_bounds-feature-gate.rs')
-rw-r--r--tests/ui/unstable-features/trivial_bounds-feature-gate.rs54
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/ui/unstable-features/trivial_bounds-feature-gate.rs b/tests/ui/unstable-features/trivial_bounds-feature-gate.rs
new file mode 100644
index 0000000..0453a3f
--- /dev/null
+++ b/tests/ui/unstable-features/trivial_bounds-feature-gate.rs
@@ -0,0 +1,54 @@
+// NB: If you change this test, change 'trivial_bounds.rs' at the same time.
+
+mod phantom_pinned {
+ use std::marker::{PhantomData, PhantomPinned};
+
+ struct A(PhantomPinned);
+
+ impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR E0277
+
+ struct Wrapper<T>(T);
+
+ impl<T> Unpin for Wrapper<T> where T: Unpin {}
+
+ struct B(PhantomPinned);
+
+ impl Unpin for B where Wrapper<PhantomPinned>: Unpin {} //~ ERROR E0277
+
+ struct WrapperWithLifetime<'a, T>(PhantomData<&'a ()>, T);
+
+ impl<T> Unpin for WrapperWithLifetime<'_, T> where T: Unpin {}
+
+ struct C(PhantomPinned);
+
+ impl<'a> Unpin for C where WrapperWithLifetime<'a, PhantomPinned>: Unpin {}
+ // Ok
+}
+
+mod inner {
+ use std::marker::{PhantomData, PhantomPinned};
+
+ struct Inner(PhantomPinned);
+
+ struct A(Inner);
+
+ impl Unpin for A where Inner: Unpin {} //~ ERROR E0277
+
+ struct Wrapper<T>(T);
+
+ impl<T> Unpin for Wrapper<T> where T: Unpin {}
+
+ struct B(Inner);
+
+ impl Unpin for B where Wrapper<Inner>: Unpin {} //~ ERROR E0277
+
+ struct WrapperWithLifetime<'a, T>(PhantomData<&'a ()>, T);
+
+ impl<T> Unpin for WrapperWithLifetime<'_, T> where T: Unpin {}
+
+ struct C(Inner);
+
+ impl<'a> Unpin for C where WrapperWithLifetime<'a, Inner>: Unpin {} // Ok
+}
+
+fn main() {}