First test checks the may_dangle outer atttribute on generic params can
be parsed. The second one tests whether may_dangle attributes are
correctly feature gated.
gcc/testsuite/ChangeLog:
* rust/compile/dropck_eyepatch_feature_gate.rs: New test.
* rust/compile/may_dangle.rs: New test.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
--- /dev/null
+// { dg-options "-frust-compile-until=lowering" }
+struct Test<T> {
+ _inner: T,
+}
+
+trait Action {}
+
+unsafe impl<#[may_dangle] T> Action for Test<T> {} //{ dg-error ".may_dangle. has unstable semantics and may be removed in the future." "" { target *-*-* } }
--- /dev/null
+// { dg-options "-fsyntax-only" }
+
+#![feature(dropck_eyepatch)]
+struct Test<T> {
+ _inner: T,
+}
+
+trait Action {}
+
+unsafe impl<#[may_dangle] T> Action for Test<T> {}