1
Fork 0

Rollup merge of #133746 - oli-obk:push-xwyrylxmrtvq, r=jieyouxu

Change `AttrArgs::Eq` to a struct variant

Cleanups for simplifying https://github.com/rust-lang/rust/pull/131808

Basically changes `AttrArgs::Eq` to a struct variant and then avoids several matches on `AttrArgsEq` in favor of methods on it. This will make future refactorings simpler, as they can either keep methods or switch to field accesses without having to restructure code
This commit is contained in:
Guillaume Gomez 2024-12-02 23:08:58 +01:00 committed by GitHub
commit 6f9f17fc08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 68 additions and 52 deletions

View file

@ -1,7 +1,7 @@
use std::iter;
use std::path::PathBuf;
use rustc_ast::{AttrArgs, AttrArgsEq, AttrKind, Attribute, MetaItemInner};
use rustc_ast::{AttrArgs, AttrKind, Attribute, MetaItemInner};
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::codes::*;
use rustc_errors::{ErrorGuaranteed, struct_span_code_err};
@ -639,8 +639,7 @@ impl<'tcx> OnUnimplementedDirective {
let report_span = match &item.args {
AttrArgs::Empty => item.path.span,
AttrArgs::Delimited(args) => args.dspan.entire(),
AttrArgs::Eq(eq_span, AttrArgsEq::Ast(expr)) => eq_span.to(expr.span),
AttrArgs::Eq(span, AttrArgsEq::Hir(expr)) => span.to(expr.span),
AttrArgs::Eq { eq_span, value } => eq_span.to(value.span()),
};
if let Some(item_def_id) = item_def_id.as_local() {