about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2022-08-25 12:25:44 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2022-09-02 07:26:17 +1000
commit053874eecc9806f36195c35a7fad9c8878b0788e (patch)
treed9cf807bb56580071d449dc21decb2da8f31a1ac /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent9af618b62e91b45d61f41548f24ba60b834e362b (diff)
downloadrust-053874eecc9806f36195c35a7fad9c8878b0788e.tar.gz
rust-053874eecc9806f36195c35a7fad9c8878b0788e.zip
Clean up THIR patterns.
`thir::Pat::kind` is a `Box<PatKind>`, which doesn't follow the usual
pattern in AST/HIR/THIR which is that the "kind" enum for a node is
stored inline within the parent struct.

This commit makes the `PatKind` directly inline within the `Pat`. This
requires using `Box<Pat>` in all the types that hold a `Pat.

Ideally, `Pat` would be stored in `Thir` like `Expr` and `Stmt` and
referred to with a `PatId` rather than `Box<Pat>`. But this is hard to
do because lots of `Pat`s get created after the destruction of the `Cx`
that does normal THIR building. But this does get us a step closer to
`PatId`, because all the `Box<Pat>` occurrences would be replaced with
`PatId` if `PatId` ever happened.

At 128 bytes, `Pat` is large. Subsequent commits will shrink it.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions