about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/back
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-04-02 10:28:12 +0000
committerbors <bors@rust-lang.org>2021-04-02 10:28:12 +0000
commit0978a9eb99eca9f99889014b232f67ece898aadb (patch)
tree36c08d4b400121e3df05cf15a222b5f5771dcdfb /compiler/rustc_codegen_llvm/src/back
parent5662d9343f0696efcc38a1264656737c9f22d427 (diff)
parentc6676db7aecc217d86dc1a478ca28b61acac87f4 (diff)
downloadrust-0978a9eb99eca9f99889014b232f67ece898aadb.tar.gz
rust-0978a9eb99eca9f99889014b232f67ece898aadb.zip
Auto merge of #83207 - oli-obk:valtree2, r=lcnr
normalize mir::Constant differently from ty::Const in preparation for valtrees

Valtrees are unable to represent many kind of constant values (this is on purpose). For constants that are used at runtime, we do not need a valtree representation and can thus use a different form of evaluation. In order to make this explicit and less fragile, I added a `fold_constant` method to `TypeFolder` and implemented it for normalization. Normalization can now, when it wants to eagerly evaluate a constant, normalize `mir::Constant` directly into a `mir::ConstantKind::Val` instead of relying on the `ty::Const` evaluation.

In the future we can get rid of the `ty::Const` in there entirely and add our own `Unevaluated` variant to `mir::ConstantKind`. This would allow us to remove the `promoted` field from `ty::ConstKind::Unevaluated`, as promoteds can never occur in the type system.

cc `@rust-lang/wg-const-eval`

r? `@lcnr`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/back')
0 files changed, 0 insertions, 0 deletions