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>
This commit is contained in:
parent
c06a7eb2a6
commit
75df62d4a2
6 changed files with 73 additions and 49 deletions
|
@ -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)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue