Skip to content

Commit 27c0c46

Browse files
committed
Implement IntoDiagnosticArg for ast::Visibility
1 parent 58edd7f commit 27c0c46

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

compiler/rustc_errors/src/diagnostic_impls.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,14 @@ impl IntoDiagnosticArg for type_ir::FloatTy {
177177
}
178178
}
179179

180+
impl IntoDiagnosticArg for ast::Visibility {
181+
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
182+
let s = pprust::vis_to_string(&self);
183+
let s = s.trim_end().to_string();
184+
DiagnosticArgValue::Str(Cow::Owned(s))
185+
}
186+
}
187+
180188
impl IntoDiagnosticArg for Level {
181189
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
182190
DiagnosticArgValue::Str(Cow::Borrowed(match self {

0 commit comments

Comments
 (0)