Skip to content

Commit

Permalink
Add a new regression test over struct expr field
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
P-E-P committed Jun 12, 2024
1 parent 8de769b commit 53a857a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions gcc/testsuite/rust/compile/struct_expr_field_attributes.rs
Original file line number Diff line number Diff line change
@@ -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,
}
}

0 comments on commit 53a857a

Please sign in to comment.