Skip to content

Commit

Permalink
Apply review from RalfJung
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed May 20, 2020
1 parent fc7a659 commit e378c93
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/const-eval.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ Constant evaluation returns a [`ConstEvalResult`] with either the error, or the
representation of the constant. "simplest" meaning if it is representable as an
integer or fat pointer, it will directly yield the value (via [`ConstValue::Scalar`]
or [`ConstValue::Slice`]), instead of referring to the [`miri`](./miri.html) virtual
memory allocation (via [`ConstValue::ByRef`]). This means that the `const_eval_*`
functions cannot be used to create miri-pointers to the evaluated constant or
static. If you need that, you need to directly work with the functions in
[`src/librustc_mir/const_eval.rs`].
memory allocation (via [`ConstValue::ByRef`]). If you need the value of a constant inside Miri,
you need to directly work with [`eval_const_to_op`].

[`GlobalId`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/interpret/struct.GlobalId.html
[`ConstValue::Scalar`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/interpret/value/enum.ConstValue.html#variant.Scalar
[`ConstValue::Slice`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/interpret/value/enum.ConstValue.html#variant.Slice
[`ConstValue::ByRef`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/interpret/value/enum.ConstValue.html#variant.ByRef
[`ConstEvalResult`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/interpret/error/type.ConstEvalResult.html
[`src/librustc_mir/const_eval.rs`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/const_eval/index.html
[`eval_const_to_op`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/interpret/struct.InterpCx.html#method.eval_const_to_op

0 comments on commit e378c93

Please sign in to comment.