Add simpler entry points to const eval for common usages. I found the `tcx.const_eval` API to be complex/awkward to work with, because of the inherent complexity from all of the different situations it is called from. Though it mainly used in one of the following ways: - Evaluates the value of a constant without any substitutions, e.g. evaluating a static, discriminant, etc. - Evaluates the value of a resolved instance of a constant. this happens when evaluating unevaluated constants or normalising trait constants. - Evaluates a promoted constant. This PR adds three new functions `const_eval_mono`, `const_eval_resolve`, and `const_eval_promoted` to `TyCtxt`, which each cater to one of the three ways `tcx.const_eval` is normally used. |
||
|---|---|---|
| .. | ||
| back | ||
| debuginfo | ||
| llvm | ||
| abi.rs | ||
| allocator.rs | ||
| asm.rs | ||
| attributes.rs | ||
| base.rs | ||
| build.rs | ||
| builder.rs | ||
| callee.rs | ||
| Cargo.toml | ||
| common.rs | ||
| consts.rs | ||
| context.rs | ||
| declare.rs | ||
| intrinsic.rs | ||
| lib.rs | ||
| llvm_util.rs | ||
| metadata.rs | ||
| mono_item.rs | ||
| README.md | ||
| type_.rs | ||
| type_of.rs | ||
| va_arg.rs | ||
| value.rs | ||
The codegen crate contains the code to convert from MIR into LLVM IR,
and then from LLVM IR into machine code. In general it contains code
that runs towards the end of the compilation process.
For more information about how codegen works, see the rustc guide.