Commit Graph

107 Commits

Author SHA1 Message Date
Camille GILLOT 30a95b7c0a FileCheck while_let_loops. 2023-12-02 21:10:04 +00:00
Camille GILLOT c00068e49f FileCheck tuple_literal_propagation. 2023-12-02 21:08:55 +00:00
Camille GILLOT 87522d0007 FileCheck return_place. 2023-12-02 21:08:12 +00:00
Camille GILLOT a12027e128 FileCheck switch_int. 2023-12-02 21:06:48 +00:00
Camille GILLOT 19767eb7a6 FileCheck slice_len. 2023-12-02 21:06:38 +00:00
Camille GILLOT 3e90c1b434 FileCheck scalar_literal_propagation. 2023-12-02 21:02:42 +00:00
Camille GILLOT f3743aec51 FileCheck repeat. 2023-12-02 21:01:48 +00:00
Camille GILLOT 343ef6a9cb FileCheck reify_fn_ptr. 2023-12-02 21:00:59 +00:00
Camille GILLOT 6baec3ccc2 FileCheck ref_deref. 2023-12-02 20:58:45 +00:00
Camille GILLOT c8c9207e4c FileCheck read_immutable_static. 2023-12-02 20:56:26 +00:00
Camille GILLOT 45dd5d6bf3 FileCheck mutable_variable_unprop_assign. 2023-12-02 20:54:56 +00:00
Camille GILLOT 6a8eea8f5b FileCheck mutable_variable_aggregate_partial_read. 2023-12-02 20:51:23 +00:00
Camille GILLOT d91bb5074e FileCheck mutable_variable_no_prop. 2023-12-02 20:50:00 +00:00
Camille GILLOT 3e169abc1b FileCheck mutable_variable_aggregate_mut_ref. 2023-12-02 20:49:50 +00:00
Camille GILLOT 03c5ad1549 FileCheck mutable_variable_aggregate. 2023-12-02 20:49:38 +00:00
Camille GILLOT ea9f968333 FileCheck mutable_variable. 2023-12-02 20:49:28 +00:00
Camille GILLOT 902a3e2e75 FileCheck mult_by_zero. 2023-12-02 20:39:26 +00:00
Camille GILLOT 8e9b912c4c FileCheck issue_67019. 2023-12-02 20:38:07 +00:00
Camille GILLOT ce9b1e23a5 FileCheck issue_66971. 2023-12-02 20:37:05 +00:00
Camille GILLOT 218d8ccf43 FileCheck inherit_overflow. 2023-12-02 20:31:27 +00:00
Camille GILLOT 6086dd6766 FileCheck indirect. 2023-12-02 20:29:47 +00:00
Camille GILLOT bf5d114da8 FileCheck discriminant. 2023-12-02 20:28:33 +00:00
Camille GILLOT 043d29b58a FileCheck and rename const_prop_fails_gracefully. 2023-12-02 20:23:16 +00:00
Camille GILLOT 7f328d2a44 FileCheck checked_add. 2023-12-02 20:18:58 +00:00
Camille GILLOT e6a1b77cd1 FileCheck cast. 2023-12-02 20:18:47 +00:00
Camille GILLOT b8f2f63931 FileCheck boxes. 2023-12-02 20:18:21 +00:00
Camille GILLOT 3fc03948a8 FileCheck boolean_identities. 2023-12-02 20:18:14 +00:00
Camille GILLOT e8e35c8127 FileCheck bad_op_unsafe_oob_for_slices. 2023-12-02 20:18:02 +00:00
Camille GILLOT 97f03cb898 FileCheck bad_op_mod_by_zero. 2023-12-02 20:17:49 +00:00
Camille GILLOT 0d5bc872a9 FileCheck bad_op_div_by_zero. 2023-12-02 20:17:37 +00:00
Camille GILLOT 9f01d9d1b6 FileCheck array_index. 2023-12-02 20:17:20 +00:00
Camille GILLOT 6564bac532 FileCheck aggregate. 2023-12-02 20:17:04 +00:00
Camille GILLOT 378abbc604 FileCheck address_of_pair. 2023-12-02 20:16:49 +00:00
Matthias Krüger 434232f7b2 Rollup merge of #118426 - aDotInTheVoid:const-wat, r=compiler-errors,cjgillot
ConstProp: Correctly remove const if unknown value assigned to it.

Closes #118328

The problematic sequence of MIR is:

```rust
          _1 = const 0_usize;
          _1 = const _; // This is an associated constant we can't know before monomorphization.
          _0 = _1;
```

1. When `ConstProp::visit_assign` happens on `_1 = const 0_usize;`, it records that `0x0usize` is the value for `_1`.
2. Next `visit_assign` happens on `_1 = const _;`. Because the rvalue `.has_param()`, it can't be const evaled.
3. Finaly, `visit_assign` happens on `_0 = _1;`. Here it would think the value of `_1` was `0x0usize` from step 1.

The solution is to remove consts when checking the RValue fails, as they may have contained values that should now be invalidated, as that local was overwritten.

This should probably be back-ported to beta. Stable is more iffy, as it's gone unidentified since 1.70, so I only think it's worthwhile if there's another reason for a 1.74.1 release anyway.
2023-11-29 12:34:50 +01:00
Alona Enraght-Moony 6e956c0a38 Rename and add another test 2023-11-28 23:17:28 +00:00
Alona Enraght-Moony 9121a41450 ConstProp: Remove const when rvalue check fails. 2023-11-28 22:15:11 +00:00
Alona Enraght-Moony b1a6cf4a0e Precommit test for https://github.com/rust-lang/rust/issues/118328. 2023-11-28 15:12:46 +00:00
bohan fc87d6e23d add track_caller for arith ops 2023-11-24 00:54:06 +08:00
bors 992943dbae Auto merge of #117537 - GKFX:offset-of-enum-feature, r=cjgillot
Feature gate enums in offset_of

As requested at https://github.com/rust-lang/rust/issues/106655#issuecomment-1790815262, put enums in offset_of behind their own feature gate.

`@rustbot` label F-offset_of
2023-11-05 13:44:59 +00:00
bors 8acf40bd54 Auto merge of #117469 - cjgillot:filecheck-mir, r=Mark-Simulacrum
Add FileCheck annotations to a few MIR opt tests

const_debuginfo did not specify which passes were running.
const_prop_miscompile is renamed and moved to const_prop directory.
while_storage was broken.
2023-11-05 07:54:12 +00:00
George Bateman 7c09b99ebb Feature gate enums in offset_of 2023-11-03 13:16:47 +00:00
George Bateman 9d6ce61376 Update MIR tests for offset_of 2023-10-31 23:26:02 +00:00
George Bateman e936416a8d Support enum variants in offset_of! 2023-10-31 23:25:54 +00:00
Camille GILLOT ac4d0965bb FileCheck const_prop_miscompile. 2023-10-31 22:56:02 +00:00
Camille GILLOT ec28dc7aa7 Use PlaceMention for match scrutinees. 2023-10-24 15:30:17 +00:00
Camille GILLOT 328192bff4 FileCheck transmute. 2023-10-19 15:51:54 +00:00
Camille GILLOT 4ff03cd1a4 Allow to run filecheck in mir-opt tests. 2023-10-19 15:51:52 +00:00
Camille GILLOT 02424e4bc5 Normalize alloc-id in tests. 2023-10-16 16:29:35 +00:00
Camille GILLOT e63d19c4dd Remove mir::LocalDecl::internal. 2023-10-04 17:55:15 +00:00
Ralf Jung b18c0a8c4e fix clippy (and MIR printing) handling of ConstValue::Indirect slices 2023-09-14 11:56:55 +02:00