diff options
| author | David Wood <david.wood@huawei.com> | 2023-07-25 11:12:52 +0100 | 
|---|---|---|
| committer | David Wood <david.wood@huawei.com> | 2023-07-25 11:12:52 +0100 | 
| commit | 75df62d4a2c45175b8cb1eb4bdc10fa423c11c4c (patch) | |
| tree | 67925908692c640333197f19df25fffd2a76bb9f /compiler/rustc_errors/src/diagnostic_impls.rs | |
| parent | c06a7eb2a6dcbc7649de76472f6845e30f2fb97f (diff) | |
| download | rust-75df62d4a2c45175b8cb1eb4bdc10fa423c11c4c.tar.gz rust-75df62d4a2c45175b8cb1eb4bdc10fa423c11c4c.zip | |
builtin_macros: raw str in diagnostic output
If a raw string was used in the `env!` invocation, then it should also be shown in the diagnostic messages as a raw string. Signed-off-by: David Wood <david@davidtw.co>
Diffstat (limited to 'compiler/rustc_errors/src/diagnostic_impls.rs')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic_impls.rs | 6 | 
1 files changed, 6 insertions, 0 deletions
| diff --git a/compiler/rustc_errors/src/diagnostic_impls.rs b/compiler/rustc_errors/src/diagnostic_impls.rs index 10fe7fc74a8..fb2e84bb7a1 100644 --- a/compiler/rustc_errors/src/diagnostic_impls.rs +++ b/compiler/rustc_errors/src/diagnostic_impls.rs @@ -164,6 +164,12 @@ impl IntoDiagnosticArg for hir::ConstContext { } } +impl IntoDiagnosticArg for ast::Expr { + fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> { + DiagnosticArgValue::Str(Cow::Owned(pprust::expr_to_string(&self))) + } +} + impl IntoDiagnosticArg for ast::Path { fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> { DiagnosticArgValue::Str(Cow::Owned(pprust::path_to_string(&self))) | 
