Rollup merge of #122784 - jswrenn:tag_for_variant, r=compiler-errors

Add `tag_for_variant` query

This query allows for sharing code between `rustc_const_eval` and `rustc_transmutability`. It's a precursor to a PR I'm working on to entirely replace the bespoke layout computations in `rustc_transmutability`.

r? `@compiler-errors`
This commit is contained in:
Matthias Krüger
2024-03-22 20:31:29 +01:00
committed by GitHub
13 changed files with 347 additions and 292 deletions

View File

@@ -6,6 +6,7 @@
use std::fmt::Debug;
use rustc_const_eval::const_eval::DummyMachine;
use rustc_const_eval::interpret::{
format_interp_error, ImmTy, InterpCx, InterpResult, Projectable, Scalar,
};
@@ -20,7 +21,6 @@ use rustc_middle::ty::{self, ConstInt, ParamEnv, ScalarInt, Ty, TyCtxt, TypeVisi
use rustc_span::Span;
use rustc_target::abi::{Abi, FieldIdx, HasDataLayout, Size, TargetDataLayout, VariantIdx};
use crate::dataflow_const_prop::DummyMachine;
use crate::errors::{AssertLint, AssertLintKind};
use crate::MirLint;