diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2024-05-20 17:57:52 +0200 |
---|---|---|
committer | P-E-P <32375388+P-E-P@users.noreply.github.com> | 2024-06-12 09:11:18 +0000 |
commit | 53a857ac945f0acc8c8db93f534656acca4cbd71 (patch) | |
tree | 391caf192123c6621d56af79a9989355c422b5e7 | |
parent | 8de769bfc570c2fe6392f54092aaf17b90e22813 (diff) | |
download | gcc-53a857ac945f0acc8c8db93f534656acca4cbd71.zip gcc-53a857ac945f0acc8c8db93f534656acca4cbd71.tar.gz gcc-53a857ac945f0acc8c8db93f534656acca4cbd71.tar.bz2 |
Add a new regression test over struct expr field
We want to prevent regressions on struct expr field attribute parsing.
gcc/testsuite/ChangeLog:
* rust/compile/struct_expr_field_attributes.rs: New test.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
-rw-r--r-- | gcc/testsuite/rust/compile/struct_expr_field_attributes.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/struct_expr_field_attributes.rs b/gcc/testsuite/rust/compile/struct_expr_field_attributes.rs new file mode 100644 index 0000000..b5d65dc --- /dev/null +++ b/gcc/testsuite/rust/compile/struct_expr_field_attributes.rs @@ -0,0 +1,22 @@ +pub struct Test { + #[cfg(not(any( + target_os = "solaris", + target_os = "illumos", + target_os = "fuchsia", + target_os = "redox", + )))] + value: bool, + // { dg-warning "field is never read" "" { target *-*-* } .-1 } +} + +pub fn test() -> Test { + Test { + #[cfg(not(any( + target_os = "solaris", + target_os = "illumos", + target_os = "fuchsia", + target_os = "redox", + )))] + value: false, + } +} |