diff options
| author | David Tolnay <dtolnay@gmail.com> | 2024-11-28 12:47:18 -0800 | 
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2024-11-30 17:53:40 -0800 | 
| commit | 7ced18f329470e5dbdbee54d273193d19e3b43f4 (patch) | |
| tree | 454ace883d6b36f55e04f815c3e305c3420783e7 /compiler/rustc_errors/src/diagnostic_impls.rs | |
| parent | 539c863eaf36d8f8b414cf03b422c6e959505f52 (diff) | |
| download | rust-7ced18f329470e5dbdbee54d273193d19e3b43f4.tar.gz rust-7ced18f329470e5dbdbee54d273193d19e3b43f4.zip | |
Eliminate magic numbers from expression precedence
Diffstat (limited to 'compiler/rustc_errors/src/diagnostic_impls.rs')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic_impls.rs | 7 | 
1 files changed, 7 insertions, 0 deletions
| diff --git a/compiler/rustc_errors/src/diagnostic_impls.rs b/compiler/rustc_errors/src/diagnostic_impls.rs index 798668b8bc1..b4510371323 100644 --- a/compiler/rustc_errors/src/diagnostic_impls.rs +++ b/compiler/rustc_errors/src/diagnostic_impls.rs @@ -6,6 +6,7 @@ use std::path::{Path, PathBuf}; use std::process::ExitStatus; use rustc_abi::TargetDataLayoutErrors; +use rustc_ast::util::parser::ExprPrecedence; use rustc_ast_pretty::pprust; use rustc_macros::Subdiagnostic; use rustc_span::Span; @@ -298,6 +299,12 @@ impl IntoDiagArg for hir::def::Namespace { } } +impl IntoDiagArg for ExprPrecedence { + fn into_diag_arg(self) -> DiagArgValue { + DiagArgValue::Number(self as i32) + } +} + #[derive(Clone)] pub struct DiagSymbolList<S = Symbol>(Vec<S>); | 
