diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-07-25 19:21:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-25 19:21:37 +0200 |
| commit | 8ecaf2ae57a8bb02731b6052d6807542a20aca27 (patch) | |
| tree | 1739814825e812b4d7334bb449b778730e2c8a7a /compiler/rustc_errors/src | |
| parent | 24e34e20144857da3deb25ac55cf656d374cfbcc (diff) | |
| parent | 516a56581e4c72381991a09bf7c2da7ae85f7948 (diff) | |
| download | rust-8ecaf2ae57a8bb02731b6052d6807542a20aca27.tar.gz rust-8ecaf2ae57a8bb02731b6052d6807542a20aca27.zip | |
Rollup merge of #114014 - davidtwco:issue-114010-env-rawstr, r=cjgillot
builtin_macros: expect raw strings too Fixes #114010. `expr_to_string` allows raw strings through so this code should be expected to handle those.
Diffstat (limited to 'compiler/rustc_errors/src')
| -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 9c972342f25..132f2c015b8 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))) |
