about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/required_consts.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2022-02-02 14:24:45 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2022-02-15 16:19:59 +1100
commita95fb8b150a256856aedeca7ebf30b662d2e5141 (patch)
tree86f2588dc898e21e12de8e6ec307926eefd88331 /compiler/rustc_mir_transform/src/required_consts.rs
parent7eb15509ce758849108e80d8807cde1d6806d74b (diff)
downloadrust-a95fb8b150a256856aedeca7ebf30b662d2e5141.tar.gz
rust-a95fb8b150a256856aedeca7ebf30b662d2e5141.zip
Overhaul `Const`.
Specifically, rename the `Const` struct as `ConstS` and re-introduce `Const` as
this:
```
pub struct Const<'tcx>(&'tcx Interned<ConstS>);
```
This now matches `Ty` and `Predicate` more closely, including using
pointer-based `eq` and `hash`.

Notable changes:
- `mk_const` now takes a `ConstS`.
- `Const` was copy, despite being 48 bytes. Now `ConstS` is not, so need a
  we need separate arena for it, because we can't use the `Dropless` one any
  more.
- Many `&'tcx Const<'tcx>`/`&Const<'tcx>` to `Const<'tcx>` changes
- Many `ct.ty` to `ct.ty()` and `ct.val` to `ct.val()` changes.
- Lots of tedious sigil fiddling.
Diffstat (limited to 'compiler/rustc_mir_transform/src/required_consts.rs')
-rw-r--r--compiler/rustc_mir_transform/src/required_consts.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_mir_transform/src/required_consts.rs b/compiler/rustc_mir_transform/src/required_consts.rs
index 80c87cafea1..1c48efd8b42 100644
--- a/compiler/rustc_mir_transform/src/required_consts.rs
+++ b/compiler/rustc_mir_transform/src/required_consts.rs
@@ -15,7 +15,7 @@ impl<'a, 'tcx> RequiredConstsVisitor<'a, 'tcx> {
 impl<'tcx> Visitor<'tcx> for RequiredConstsVisitor<'_, 'tcx> {
     fn visit_constant(&mut self, constant: &Constant<'tcx>, _: Location) {
         if let Some(ct) = constant.literal.const_for_ty() {
-            if let ConstKind::Unevaluated(_) = ct.val {
+            if let ConstKind::Unevaluated(_) = ct.val() {
                 self.required_consts.push(*constant);
             }
         }