Auto merge of #10793 - c410-f3r:bbbbbbbbbbb, r=xFrednet

[`arithmetic_side_effects`] Fix #10792

Fix #10792

```
changelog: [`arithmetic_side_effects`]: Retrieve field values of structures that are in constant environments
```
This commit is contained in:
bors 2023-06-19 19:51:49 +00:00
commit c8c03ea606
9 changed files with 114 additions and 72 deletions

View file

@ -466,4 +466,19 @@ pub fn issue_10767() {
&3.5_f32 + &1.3_f32;
}
pub fn issue_10792() {
struct One {
a: u32,
}
struct Two {
b: u32,
c: u64,
}
const ONE: One = One { a: 1 };
const TWO: Two = Two { b: 2, c: 3 };
let _ = 10 / ONE.a;
let _ = 10 / TWO.b;
let _ = 10 / TWO.c;
}
fn main() {}