Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
.collect();
generic_args.push((kw::SelfUpper, this.clone()));

let args = FormatArgs {
this,
// Unused
this_sugared: String::new(),
// Unused
item_context: "",
generic_args,
};
let args = FormatArgs { this, generic_args, .. };
let CustomDiagnostic { message, label, notes, parent_label: _ } =
directive.eval(None, &args);

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_expand/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// tidy-alphabetical-start
#![allow(internal_features)]
#![feature(associated_type_defaults)]
#![feature(default_field_values)]
#![feature(macro_metavar_expr)]
#![feature(proc_macro_diagnostic)]
#![feature(proc_macro_internals)]
Expand Down
13 changes: 1 addition & 12 deletions compiler/rustc_expand/src/mbe/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,8 @@ pub(super) fn failed_to_match_macro(
let CustomDiagnostic {
message: custom_message, label: custom_label, notes: custom_notes, ..
} = {
let macro_name = name.to_string();
on_unmatch_args
.map(|directive| {
directive.eval(
None,
&FormatArgs {
this: macro_name.clone(),
this_sugared: macro_name,
Comment thread
JonathanBrouwer marked this conversation as resolved.
item_context: "macro invocation",
generic_args: Vec::new(),
},
)
})
.map(|directive| directive.eval(None, &FormatArgs { this: name.to_string(), .. }))
.unwrap_or_default()
};

Expand Down
7 changes: 4 additions & 3 deletions compiler/rustc_hir/src/attrs/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,11 @@ impl FormatString {
/// ```
#[derive(Debug)]
pub struct FormatArgs {
/// The name of the item the attribute is on.
pub this: String,
pub this_sugared: String,
pub item_context: &'static str,
pub generic_args: Vec<(Symbol, String)>,
pub this_sugared: String = String::new(),
pub item_context: &'static str = "",
pub generic_args: Vec<(Symbol, String)> = Vec::new(),
}

#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_hir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#![feature(closure_track_caller)]
#![feature(const_default)]
#![feature(const_trait_impl)]
#![feature(default_field_values)]
#![feature(derive_const)]
#![feature(exhaustive_patterns)]
#![feature(never_type)]
Expand Down
7 changes: 1 addition & 6 deletions compiler/rustc_resolve/src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -886,12 +886,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {

let args = FormatArgs {
this,
// Unused
this_sugared: String::new(),
// Unused
item_context: "",
// Unused
generic_args: Vec::new(),
..
};
let CustomDiagnostic { message, label, notes, .. } = directive.eval(None, &args);

Expand Down
Loading