@@ -55,18 +55,18 @@ Before the evaluation, a virtual memory location (in this case essentially a
5555` vec![u8; 4] ` or ` vec![u8; 8] ` ) is created for storing the evaluation result.
5656
5757At the start of the evaluation, ` _0 ` and ` _1 ` are
58- ` Value::ByVal(PrimVal ::Undef)` . When the initialization of ` _1 ` is invoked, the
58+ ` ConstValue::Scalar(Scalar ::Undef)` . When the initialization of ` _1 ` is invoked, the
5959value of the ` FOO ` constant is required, and triggers another call to
6060` tcx.const_eval ` , which will not be shown here. If the evaluation of FOO is
6161successful, 42 will be subtracted by its value ` 4096 ` and the result stored in
62- ` _1 ` as ` Value::ByValPair(PrimVal ::Bytes(4054), PrimVal ::Bytes(0))` . The first
62+ ` _1 ` as ` ConstValue::ScalarPair(Scalar ::Bytes(4054), Scalar ::Bytes(0))` . The first
6363part of the pair is the computed value, the second part is a bool that's true if
6464an overflow happened.
6565
6666The next statement asserts that said boolean is ` 0 ` . In case the assertion
6767fails, its error message is used for reporting a compile-time error.
6868
69- Since it does not fail, ` Value::ByVal(PrimVal ::Bytes(4054))` is stored in the
69+ Since it does not fail, ` ConstValue::Scalar(Scalar ::Bytes(4054))` is stored in the
7070virtual memory was allocated before the evaluation. ` _0 ` always refers to that
7171location directly.
7272
@@ -75,23 +75,23 @@ After the evaluation is done, the virtual memory allocation is interned into the
7575miri, but just extract the value from the interned allocation.
7676
7777The ` tcx.const_eval ` function has one additional feature: it will not return a
78- ` ByRef(interned_allocation_id) ` , but a ` ByVal (computed_value)` if possible. This
78+ ` ByRef(interned_allocation_id) ` , but a ` Scalar (computed_value)` if possible. This
7979makes using the result much more convenient, as no further queries need to be
8080executed in order to get at something as simple as a ` usize ` .
8181
8282## Datastructures
8383
8484Miri's core datastructures can be found in
8585[ librustc/mir/interpret] ( https://github.com/rust-lang/rust/blob/master/src/librustc/mir/interpret ) .
86- This is mainly the error enum and the ` Value ` and ` PrimVal ` types. A ` Value ` can
87- be either ` ByVal ` (a single ` PrimVal ` ), ` ByValPair ` (two ` PrimVal ` s, usually fat
86+ This is mainly the error enum and the ` ConstValue ` and ` Scalar ` types. A ` ConstValue ` can
87+ be either ` Scalar ` (a single ` Scalar ` ), ` ScalarPair ` (two ` Scalar ` s, usually fat
8888pointers or two element tuples) or ` ByRef ` , which is used for anything else and
8989refers to a virtual allocation. These allocations can be accessed via the
9090methods on ` tcx.interpret_interner ` .
9191
9292If you are expecting a numeric result, you can use ` unwrap_u64 ` (panics on
9393anything that can't be representad as a ` u64 ` ) or ` to_raw_bits ` which results
94- in an ` Option<u128> ` yielding the ` ByVal ` if possible.
94+ in an ` Option<u128> ` yielding the ` Scalar ` if possible.
9595
9696## Allocations
9797
@@ -113,7 +113,7 @@ to a pointer to `b`.
113113Although the main entry point to constant evaluation is the ` tcx.const_eval `
114114query, there are additional functions in
115115[ librustc_mir/const_eval.rs] ( https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/const_eval/index.html )
116- that allow accessing the fields of a ` Value ` (` ByRef ` or otherwise). You should
116+ that allow accessing the fields of a ` ConstValue ` (` ByRef ` or otherwise). You should
117117never have to access an ` Allocation ` directly except for translating it to the
118118compilation target (at the moment just LLVM).
119119
0 commit comments