summaryrefslogtreecommitdiffstats
path: root/vendor/thiserror/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /vendor/thiserror/src
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/thiserror/src')
-rw-r--r--vendor/thiserror/src/display.rs36
-rw-r--r--vendor/thiserror/src/lib.rs9
2 files changed, 27 insertions, 18 deletions
diff --git a/vendor/thiserror/src/display.rs b/vendor/thiserror/src/display.rs
index da4905115..27098f167 100644
--- a/vendor/thiserror/src/display.rs
+++ b/vendor/thiserror/src/display.rs
@@ -2,29 +2,39 @@ use std::fmt::Display;
use std::path::{self, Path, PathBuf};
#[doc(hidden)]
-pub trait DisplayAsDisplay {
- fn as_display(&self) -> Self;
+pub trait AsDisplay<'a> {
+ // TODO: convert to generic associated type.
+ // https://github.com/dtolnay/thiserror/pull/253
+ type Target: Display;
+
+ fn as_display(&'a self) -> Self::Target;
}
-impl<T: Display> DisplayAsDisplay for &T {
- fn as_display(&self) -> Self {
- self
+impl<'a, T> AsDisplay<'a> for &T
+where
+ T: Display + 'a,
+{
+ type Target = &'a T;
+
+ fn as_display(&'a self) -> Self::Target {
+ *self
}
}
-#[doc(hidden)]
-pub trait PathAsDisplay {
- fn as_display(&self) -> path::Display<'_>;
-}
+impl<'a> AsDisplay<'a> for Path {
+ type Target = path::Display<'a>;
-impl PathAsDisplay for Path {
- fn as_display(&self) -> path::Display<'_> {
+ #[inline]
+ fn as_display(&'a self) -> Self::Target {
self.display()
}
}
-impl PathAsDisplay for PathBuf {
- fn as_display(&self) -> path::Display<'_> {
+impl<'a> AsDisplay<'a> for PathBuf {
+ type Target = path::Display<'a>;
+
+ #[inline]
+ fn as_display(&'a self) -> Self::Target {
self.display()
}
}
diff --git a/vendor/thiserror/src/lib.rs b/vendor/thiserror/src/lib.rs
index e5d295062..974063639 100644
--- a/vendor/thiserror/src/lib.rs
+++ b/vendor/thiserror/src/lib.rs
@@ -228,13 +228,12 @@
//!
//! [`anyhow`]: https://github.com/dtolnay/anyhow
-#![doc(html_root_url = "https://docs.rs/thiserror/1.0.47")]
+#![doc(html_root_url = "https://docs.rs/thiserror/1.0.50")]
#![allow(
- // Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7421
- clippy::doc_markdown,
clippy::module_name_repetitions,
+ clippy::needless_lifetimes,
clippy::return_self_not_must_use,
- clippy::wildcard_imports,
+ clippy::wildcard_imports
)]
#![cfg_attr(error_generic_member_access, feature(error_generic_member_access))]
@@ -251,7 +250,7 @@ pub mod __private {
#[doc(hidden)]
pub use crate::aserror::AsDynError;
#[doc(hidden)]
- pub use crate::display::{DisplayAsDisplay, PathAsDisplay};
+ pub use crate::display::AsDisplay;
#[cfg(error_generic_member_access)]
#[doc(hidden)]
pub use crate::provide::ThiserrorProvide;