diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2024-05-20 13:29:51 +0200 |
---|---|---|
committer | P-E-P <32375388+P-E-P@users.noreply.github.com> | 2024-06-11 15:53:17 +0000 |
commit | 14c4c2f142d1908e8e93aa15d49f61f97f060727 (patch) | |
tree | cc0df2e8f769014867c6fb37d06c54b3e6eb33f5 | |
parent | 85967c878147b3dc77f969f18adddfe2d5c3676d (diff) | |
download | gcc-14c4c2f142d1908e8e93aa15d49f61f97f060727.zip gcc-14c4c2f142d1908e8e93aa15d49f61f97f060727.tar.gz gcc-14c4c2f142d1908e8e93aa15d49f61f97f060727.tar.bz2 |
Add two new tests related to may_dangle attribute
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>
-rw-r--r-- | gcc/testsuite/rust/compile/dropck_eyepatch_feature_gate.rs | 8 | ||||
-rw-r--r-- | gcc/testsuite/rust/compile/may_dangle.rs | 10 |
2 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/dropck_eyepatch_feature_gate.rs b/gcc/testsuite/rust/compile/dropck_eyepatch_feature_gate.rs new file mode 100644 index 0000000..3c3174f --- /dev/null +++ b/gcc/testsuite/rust/compile/dropck_eyepatch_feature_gate.rs @@ -0,0 +1,8 @@ +// { 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 *-*-* } } diff --git a/gcc/testsuite/rust/compile/may_dangle.rs b/gcc/testsuite/rust/compile/may_dangle.rs new file mode 100644 index 0000000..6b81b53 --- /dev/null +++ b/gcc/testsuite/rust/compile/may_dangle.rs @@ -0,0 +1,10 @@ +// { dg-options "-fsyntax-only" } + +#![feature(dropck_eyepatch)] +struct Test<T> { + _inner: T, +} + +trait Action {} + +unsafe impl<#[may_dangle] T> Action for Test<T> {} |