diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-01-04 15:34:00 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-04 15:34:00 +0100 |
| commit | e306cfb115b2e4351757b8282b402b0c736ef529 (patch) | |
| tree | a9ad307c956776e30c3f32d96285688d76d56aa2 /compiler/rustc_codegen_llvm/src | |
| parent | 99a8c339f05648da1a73d24c45754c1b4da747a2 (diff) | |
| parent | f0c0a498b86313468f20f0aa42ffc4fc685cacd2 (diff) | |
| download | rust-e306cfb115b2e4351757b8282b402b0c736ef529.tar.gz rust-e306cfb115b2e4351757b8282b402b0c736ef529.zip | |
Rollup merge of #119532 - GKFX:offset-of-parse-expr, r=est31
Make offset_of field parsing use metavariable which handles any spacing
As discussed at and around comments https://github.com/rust-lang/rust/issues/106655#issuecomment-1793485081 and https://github.com/rust-lang/rust/issues/106655#issuecomment-1793774183, the current arguments to offset_of do not accept all the whitespace combinations: `0. 1.1.1` and `0.1.1. 1` are currently treated specially in `tests/ui/offset-of/offset-of-tuple-nested.rs`.
They also do not allow [forwarding individual fields as in](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=444cdf0ec02b99e8fd5fd8d8ecb312ca)
```rust
macro_rules! off {
($a:expr) => {
offset_of!(m::S, 0. $a)
}
}
```
This PR replaces the macro arguments with `($Container:ty, $($fields:expr)+ $(,)?)` which does allow any arrangement of whitespace that I could come up with and the forwarding of fields example above.
This also allows for array indexing in the future, which I think is the last future extension to the syntax suggested in the offset_of RFC.
Tracking issue for offset_of: #106655
``@rustbot`` label F-offset_of
``@est31``
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions
