Skip to content

Commit

Permalink
Add two new tests related to may_dangle attribute
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
P-E-P committed Jun 11, 2024
1 parent 85967c8 commit 14c4c2f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gcc/testsuite/rust/compile/dropck_eyepatch_feature_gate.rs
Original file line number Diff line number Diff line change
@@ -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 *-*-* } }
10 changes: 10 additions & 0 deletions gcc/testsuite/rust/compile/may_dangle.rs
Original file line number Diff line number Diff line change
@@ -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> {}

0 comments on commit 14c4c2f

Please sign in to comment.