aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/auto_traits2.rs
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/rust/compile/auto_traits2.rs')
-rw-r--r--gcc/testsuite/rust/compile/auto_traits2.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/auto_traits2.rs b/gcc/testsuite/rust/compile/auto_traits2.rs
new file mode 100644
index 0000000..382d446
--- /dev/null
+++ b/gcc/testsuite/rust/compile/auto_traits2.rs
@@ -0,0 +1,25 @@
+#![feature(optin_builtin_traits)]
+
+pub unsafe auto trait Send {}
+#[lang = "sync"]
+pub unsafe auto trait Sync {}
+
+trait A {
+ fn a_method(&self) {}
+}
+
+fn foo(a: &(dyn A + Send + Sync)) {
+ a.a_method();
+}
+
+struct S;
+
+impl A for S {
+ fn a_method(&self) {} // { dg-warning "unused name" }
+}
+
+fn main() {
+ let s = S;
+
+ foo(&s);
+}