Add a test for the feature gate, as well as some test to ensure the raw
keyword stays weak. Also add some tests to check whether the raw_ref_op
syntax is parsed correctly.
gcc/testsuite/ChangeLog:
* rust/compile/not_raw_ref_op.rs: New test.
* rust/compile/raw_ref_op.rs: New test.
* rust/compile/raw_ref_op_feature_gate.rs: New test.
* rust/compile/raw_ref_op_invalid.rs: New test.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
--- /dev/null
+// { dg-options "-frust-compile-until=lowering" }
+pub struct Toto {
+ u: usize,
+}
+
+pub fn test(raw: Toto) {
+ // Not raw ref op syntax, raw keyword is weak.
+ let _c = &raw;
+}
--- /dev/null
+// { dg-options "-fsyntax-only" }
+#![feature(raw_ref_op)]
+
+pub struct Toto {
+ u: usize,
+}
+
+pub fn test(mut toto: Toto) {
+ let _a = &raw mut toto.u;
+ let _b = &raw const toto.u;
+}
--- /dev/null
+// { dg-options "-frust-compile-until=lowering" }
+pub struct Toto {
+ u: usize,
+}
+
+pub fn test(mut toto: Toto) {
+ let _a = &raw mut toto.u; //{ dg-error "raw address of syntax is experimental." "" { target *-*-* } }
+}
--- /dev/null
+// { dg-options "-fsyntax-only" }
+#![feature(raw_ref_op)]
+
+pub struct Toto {
+ u: usize,
+}
+
+pub fn test(mut toto: Toto) {
+ let _c = &raw toto.u; //{ dg-error "expecting .;. but .identifier. found" "" { target *-*-* } }
+ //{ dg-excess-errors "Additional errors for parent items" { target *-*-* } }
+
+}