diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b56868e..cd685a2 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -24,7 +24,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- rust: [nightly, beta, stable, 1.56.0]
+ rust: [nightly, beta, stable, 1.65.0]
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
diff --git a/Cargo.toml b/Cargo.toml
index 0a8526c..07d6ced 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,7 +9,7 @@ edition = "2021"
keywords = ["error", "error-handling", "derive"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/dtolnay/thiserror"
-rust-version = "1.56"
+rust-version = "1.65"
[dependencies]
thiserror-impl = { version = "=1.0.47", path = "impl" }
diff --git a/README.md b/README.md
index 9de063c..1bae038 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ This library provides a convenient derive macro for the standard library's
thiserror = "1.0"
```
-*Compiler support: requires rustc 1.56+*
+*Compiler support: requires rustc 1.65+*
diff --git a/impl/Cargo.toml b/impl/Cargo.toml
index 091be61..4aaacae 100644
--- a/impl/Cargo.toml
+++ b/impl/Cargo.toml
@@ -6,7 +6,7 @@ description = "Implementation detail of the `thiserror` crate"
edition = "2021"
license = "MIT OR Apache-2.0"
repository = "https://github.com/dtolnay/thiserror"
-rust-version = "1.56"
+rust-version = "1.65"
[lib]
proc-macro = true
diff --git a/src/display.rs b/src/display.rs
index 58d11e4..38ae9e8 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -2,37 +2,41 @@ use std::fmt::Display;
use std::path::{self, Path, PathBuf};
#[doc(hidden)]
-pub trait AsDisplay<'a> {
- type Target: Display;
+pub trait AsDisplay {
+ type Target<'a>: Display
+ where
+ Self: 'a;
- fn as_display(&'a self) -> Self::Target;
+ fn as_display<'a>(&'a self) -> Self::Target<'a>;
}
-impl<'a, T> AsDisplay<'a> for &T
+impl AsDisplay for &T
where
- T: Display + 'a,
+ T: Display,
{
- type Target = &'a T;
+ type Target<'a> = &'a T
+ where
+ Self: 'a;
- fn as_display(&'a self) -> Self::Target {
+ fn as_display<'a>(&'a self) -> Self::Target<'a> {
*self
}
}
-impl<'a> AsDisplay<'a> for Path {
- type Target = path::Display<'a>;
+impl AsDisplay for Path {
+ type Target<'a> = path::Display<'a>;
#[inline]
- fn as_display(&'a self) -> Self::Target {
+ fn as_display<'a>(&'a self) -> Self::Target<'a> {
self.display()
}
}
-impl<'a> AsDisplay<'a> for PathBuf {
- type Target = path::Display<'a>;
+impl AsDisplay for PathBuf {
+ type Target<'a> = path::Display<'a>;
#[inline]
- fn as_display(&'a self) -> Self::Target {
+ fn as_display<'a>(&'a self) -> Self::Target<'a> {
self.display()
}
}
diff --git a/tests/ui/no-display.stderr b/tests/ui/no-display.stderr
index 0f47c24..26dc842 100644
--- a/tests/ui/no-display.stderr
+++ b/tests/ui/no-display.stderr
@@ -9,7 +9,7 @@ error[E0599]: the method `as_display` exists for reference `&NoDisplay`, but its
|
= note: the following trait bounds were not satisfied:
`NoDisplay: std::fmt::Display`
- which is required by `&NoDisplay: AsDisplay<'_>`
+ which is required by `&NoDisplay: AsDisplay`
note: the trait `std::fmt::Display` must be implemented
--> $RUST/core/src/fmt/mod.rs
|