-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some test for raw_ref_op to prevent regressions
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 <[email protected]>
- Loading branch information
Showing
4 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// { 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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// { 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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// { 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 *-*-* } } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// { 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 *-*-* } } | ||
|
||
} |