diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs
index d05f62ea29e4..6dfbdace8e2a 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs
@@ -231,9 +231,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
}
});
- if let Ok(Some(command)) =
- OnUnimplementedDirective::of_item(self.tcx, trait_ref.def_id, def_id)
- {
+ if let Ok(Some(command)) = OnUnimplementedDirective::of_item(self.tcx, def_id) {
command.evaluate(self.tcx, trait_ref, &flags)
} else {
OnUnimplementedNote::default()
diff --git a/compiler/rustc_trait_selection/src/traits/on_unimplemented.rs b/compiler/rustc_trait_selection/src/traits/on_unimplemented.rs
index 9752ff453235..2f697c1fa27b 100644
--- a/compiler/rustc_trait_selection/src/traits/on_unimplemented.rs
+++ b/compiler/rustc_trait_selection/src/traits/on_unimplemented.rs
@@ -54,7 +54,7 @@ fn parse_error(
impl<'tcx> OnUnimplementedDirective {
fn parse(
tcx: TyCtxt<'tcx>,
- trait_def_id: DefId,
+ item_def_id: DefId,
items: &[NestedMetaItem],
span: Span,
is_root: bool,
@@ -63,7 +63,7 @@ impl<'tcx> OnUnimplementedDirective {
let mut item_iter = items.iter();
let parse_value = |value_str| {
- OnUnimplementedFormatString::try_parse(tcx, trait_def_id, value_str, span).map(Some)
+ OnUnimplementedFormatString::try_parse(tcx, item_def_id, value_str, span).map(Some)
};
let condition = if is_root {
@@ -135,7 +135,7 @@ impl<'tcx> OnUnimplementedDirective {
{
if let Some(items) = item.meta_item_list() {
if let Ok(subcommand) =
- Self::parse(tcx, trait_def_id, &items, item.span(), false)
+ Self::parse(tcx, item_def_id, &items, item.span(), false)
{
subcommands.push(subcommand);
} else {
@@ -178,19 +178,15 @@ impl<'tcx> OnUnimplementedDirective {
}
}
- pub fn of_item(
- tcx: TyCtxt<'tcx>,
- trait_def_id: DefId,
- impl_def_id: DefId,
- ) -> Result