remove unused field from VariantDef::new and convert debug to instrument

This commit is contained in:
klensy 2025-02-24 12:25:17 +03:00
parent cede9029fd
commit 8467a76581
3 changed files with 1 additions and 9 deletions

View file

@ -1075,7 +1075,6 @@ fn lower_variant<'tcx>(
def.ctor().map(|(kind, _, def_id)| (kind, def_id.to_def_id())),
discr,
fields,
adt_kind,
parent_did.to_def_id(),
recovered,
adt_kind == AdtKind::Struct && tcx.has_attr(parent_did, sym::non_exhaustive)

View file

@ -1118,7 +1118,6 @@ impl<'a> CrateMetadataRef<'a> {
value: self.get_default_field(did.index),
})
.collect(),
adt_kind,
parent_did,
None,
data.is_non_exhaustive,

View file

@ -1183,23 +1183,17 @@ impl VariantDef {
///
/// If someone speeds up attribute loading to not be a performance concern, they can
/// remove this hack and use the constructor `DefId` everywhere.
#[instrument(level = "debug")]
pub fn new(
name: Symbol,
variant_did: Option<DefId>,
ctor: Option<(CtorKind, DefId)>,
discr: VariantDiscr,
fields: IndexVec<FieldIdx, FieldDef>,
adt_kind: AdtKind,
parent_did: DefId,
recover_tainted: Option<ErrorGuaranteed>,
is_field_list_non_exhaustive: bool,
) -> Self {
debug!(
"VariantDef::new(name = {:?}, variant_did = {:?}, ctor = {:?}, discr = {:?},
fields = {:?}, adt_kind = {:?}, parent_did = {:?})",
name, variant_did, ctor, discr, fields, adt_kind, parent_did,
);
let mut flags = VariantFlags::NO_VARIANT_FLAGS;
if is_field_list_non_exhaustive {
flags |= VariantFlags::IS_FIELD_LIST_NON_EXHAUSTIVE;