Skip to content

Commit a1d7d38

Browse files
committed
Implement IntoDiagArg for hir Namespace
1 parent d83d20c commit a1d7d38

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Diff for: compiler/rustc_errors/src/diagnostic.rs

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::{
66
use rustc_data_structures::fx::FxIndexMap;
77
use rustc_error_messages::fluent_value_from_str_list_sep_by_and;
88
use rustc_error_messages::FluentValue;
9+
use rustc_hir::def::Namespace;
910
use rustc_lint_defs::{Applicability, LintExpectationId};
1011
use rustc_span::source_map::Spanned;
1112
use rustc_span::symbol::Symbol;
@@ -158,6 +159,12 @@ impl IntoDiagArg for DiagArgValue {
158159
}
159160
}
160161

162+
impl IntoDiagArg for Namespace {
163+
fn into_diag_arg(self) -> DiagArgValue {
164+
DiagArgValue::Str(Cow::Borrowed(self.descr()))
165+
}
166+
}
167+
161168
impl Into<FluentValue<'static>> for DiagArgValue {
162169
fn into(self) -> FluentValue<'static> {
163170
match self {

Diff for: compiler/rustc_lint/src/lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_errors::{
88
codes::*, Applicability, Diag, DiagArgValue, DiagMessage, DiagStyledString, EmissionGuarantee,
99
LintDiagnostic, SubdiagMessageOp, Subdiagnostic, SuggestionStyle,
1010
};
11-
use rustc_hir::def_id::DefId;
11+
use rustc_hir::{def::Namespace, def_id::DefId};
1212
use rustc_macros::{LintDiagnostic, Subdiagnostic};
1313
use rustc_middle::ty::{
1414
inhabitedness::InhabitedPredicate, Clause, PolyExistentialTraitRef, Ty, TyCtxt,

0 commit comments

Comments
 (0)