Skip to content

Commit e378c93

Browse files
committed
Apply review from RalfJung
1 parent fc7a659 commit e378c93

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/const-eval.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,12 @@ Constant evaluation returns a [`ConstEvalResult`] with either the error, or the
3131
representation of the constant. "simplest" meaning if it is representable as an
3232
integer or fat pointer, it will directly yield the value (via [`ConstValue::Scalar`]
3333
or [`ConstValue::Slice`]), instead of referring to the [`miri`](./miri.html) virtual
34-
memory allocation (via [`ConstValue::ByRef`]). This means that the `const_eval_*`
35-
functions cannot be used to create miri-pointers to the evaluated constant or
36-
static. If you need that, you need to directly work with the functions in
37-
[`src/librustc_mir/const_eval.rs`].
34+
memory allocation (via [`ConstValue::ByRef`]). If you need the value of a constant inside Miri,
35+
you need to directly work with [`eval_const_to_op`].
3836

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

0 commit comments

Comments
 (0)