Commit ddcf94c
authored
Fix Miri symbolic alignment check failures (#2798)
* Fix Miri symbolic alignment check failures
This change introduces the `miri_promise_symbolic_alignment` intrinsic and uses it to resolve false positives in Miri's symbolic alignment checking. This prepares the codebase for enabling `-Zmiri-symbolic-alignment-check` in CI.
* Defined `miri_promise_symbolic_alignment` in `src/util/mod.rs` (guarded by `cfg(miri)`).
* Applied the intrinsic in `src/pointer/ptr.rs` (`as_ref` and `as_mut`) to promise alignment when the `Aligned` invariant is held.
* Enabled `feature(layout_for_ptr)` under Miri to allow using `align_of_val_raw` for unsized types.
Note: The CI configuration (`.github/workflows/ci.yml`) must be updated separately to add `-Zmiri-symbolic-alignment-check` to `ZC_NIGHTLY_MIRIFLAGS`, as workflow modifications are restricted in this environment.
Makes progress on #674
* Fix Miri symbolic alignment check failures
This change introduces the `miri_promise_symbolic_alignment` intrinsic and uses it to resolve false positives in Miri's symbolic alignment checking. This prepares the codebase for enabling `-Zmiri-symbolic-alignment-check` in CI.
* Defined `miri_promise_symbolic_alignment` in `src/util/mod.rs` (guarded by `cfg(miri)`).
* Applied the intrinsic in `src/pointer/ptr.rs` (`as_ref` and `as_mut`) to promise alignment when the `Aligned` invariant is held.
* Enabled `feature(layout_for_ptr)` under Miri to allow using `align_of_val_raw` for unsized types.
Note: The CI configuration (`.github/workflows/ci.yml`) must be updated separately to add `-Zmiri-symbolic-alignment-check` to `ZC_NIGHTLY_MIRIFLAGS`, as workflow modifications are restricted in this environment.
Makes progress on #674
---------
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>1 parent a9e527a commit ddcf94c
3 files changed
+34
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
| 317 | + | |
317 | 318 | | |
318 | | - | |
319 | | - | |
| 319 | + | |
| 320 | + | |
320 | 321 | | |
321 | 322 | | |
322 | 323 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
232 | 241 | | |
233 | 242 | | |
234 | 243 | | |
| |||
323 | 332 | | |
324 | 333 | | |
325 | 334 | | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
326 | 344 | | |
327 | 345 | | |
328 | 346 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
55 | 68 | | |
56 | 69 | | |
57 | 70 | | |
| |||
0 commit comments