about summary refs log tree commit diff
path: root/compiler/rustc_errors
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-08-25 02:32:11 +0000
committerbors <bors@rust-lang.org>2022-08-25 02:32:11 +0000
commit9b9bc6359973482891699bbc5eecedaf34a60503 (patch)
tree9e3e576cf00fad6255b93a7ff98f2b296ffaeb0d /compiler/rustc_errors
parent5462da52ba9edc77c2a7e4fc77aaf3b977d41ad1 (diff)
parentf2878a656b944ceed6f4a98d7e255784266a3dc0 (diff)
downloadrust-9b9bc6359973482891699bbc5eecedaf34a60503.tar.gz
rust-9b9bc6359973482891699bbc5eecedaf34a60503.zip
Auto merge of #100977 - JohnTitor:rollup-8hc7rxh, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #99332 (Stabilize `#![feature(label_break_value)]`)
 - #99954 (let-else: break out to one scope higher for let-else)
 - #100188 (Parser will not suggest invalid expression when use public)
 - #100780 (save_analysis: Migrate diagnostic)
 - #100808 (Migrate `rustc_interface` diagnostics )
 - #100921 (Add a warning about `Option/Result::and()` being eagerly evaluated)
 - #100960 (rustdoc: ayu code color selector more specific)
 - #100964 (Sync rustc_codegen_cranelift)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_errors')
-rw-r--r--compiler/rustc_errors/src/diagnostic.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs
index 356f9dfdb3b..506198df4d8 100644
--- a/compiler/rustc_errors/src/diagnostic.rs
+++ b/compiler/rustc_errors/src/diagnostic.rs
@@ -13,6 +13,7 @@ use rustc_span::{edition::Edition, Span, DUMMY_SP};
 use std::borrow::Cow;
 use std::fmt;
 use std::hash::{Hash, Hasher};
+use std::path::{Path, PathBuf};
 
 /// Error type for `Diagnostic`'s `suggestions` field, indicating that
 /// `.disable_suggestions()` was called on the `Diagnostic`.
@@ -83,6 +84,7 @@ into_diagnostic_arg_using_display!(
     u64,
     i128,
     u128,
+    std::io::Error,
     std::num::NonZeroU32,
     hir::Target,
     Edition,
@@ -124,6 +126,18 @@ impl IntoDiagnosticArg for String {
     }
 }
 
+impl<'a> IntoDiagnosticArg for &'a Path {
+    fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
+        DiagnosticArgValue::Str(Cow::Owned(self.display().to_string()))
+    }
+}
+
+impl IntoDiagnosticArg for PathBuf {
+    fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
+        DiagnosticArgValue::Str(Cow::Owned(self.display().to_string()))
+    }
+}
+
 impl IntoDiagnosticArg for usize {
     fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
         DiagnosticArgValue::Number(self)