diff options
| author | bors <bors@rust-lang.org> | 2024-03-23 15:58:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-03-23 15:58:17 +0000 |
| commit | 020bbe46bdf613c0b8211984eaa8e5fe97d6c92d (patch) | |
| tree | 724536b866816e008cba2b46e10cf1fdee0bde10 /compiler/rustc_const_eval/src/interpret | |
| parent | d6eb0f5a09247ff8443e68b4d17e0350c74bafb1 (diff) | |
| parent | fce80392d2d2f743e873ce2dcca5a0eddccef507 (diff) | |
| download | rust-020bbe46bdf613c0b8211984eaa8e5fe97d6c92d.tar.gz rust-020bbe46bdf613c0b8211984eaa8e5fe97d6c92d.zip | |
Auto merge of #122947 - matthiaskrgr:rollup-10j7orh, r=matthiaskrgr
Rollup of 11 pull requests Successful merges: - #120577 (Stabilize slice_split_at_unchecked) - #122698 (Cancel `cargo update` job if there's no updates) - #122780 (Rename `hir::Local` into `hir::LetStmt`) - #122915 (Delay a bug if no RPITITs were found) - #122916 (docs(sync): normalize dot in fn summaries) - #122921 (Enable more mir-opt tests in debug builds) - #122922 (-Zprint-type-sizes: print the types of awaitees and unnamed coroutine locals.) - #122927 (Change an ICE regression test to use the original reproducer) - #122930 (add panic location to 'panicked while processing panic') - #122931 (Fix some typos in the pin.rs) - #122933 (tag_for_variant follow-ups) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/discriminant.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/discriminant.rs b/compiler/rustc_const_eval/src/interpret/discriminant.rs index 40469c6632c..704f597cfdb 100644 --- a/compiler/rustc_const_eval/src/interpret/discriminant.rs +++ b/compiler/rustc_const_eval/src/interpret/discriminant.rs @@ -38,7 +38,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { } None => { // No need to write the tag here, because an untagged variant is - // implicitly encoded. For `Niche`-optimized enums, it's by + // implicitly encoded. For `Niche`-optimized enums, this works by // simply by having a value that is outside the niche variants. // But what if the data stored here does not actually encode // this variant? That would be bad! So let's double-check... @@ -227,8 +227,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { Ok(ImmTy::from_scalar(discr_value, discr_layout)) } - /// Computes the tag value and its field number (if any) of a given variant - /// of type `ty`. + /// Computes how to write the tag of a given variant of enum `ty`: + /// - `None` means that nothing needs to be done as the variant is encoded implicitly + /// - `Some((val, field_idx))` means that the given integer value needs to be stored at the + /// given field index. pub(crate) fn tag_for_variant( &self, ty: Ty<'tcx>, |
