Skip to content

Commit

Permalink
Merge pull request #115 from dtolnay/lifetime
Browse files Browse the repository at this point in the history
Add justification to non-static lifetime diagnostic
  • Loading branch information
dtolnay committed Dec 27, 2020
2 parents a789be4 + d31d96b commit cb3077c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions impl/src/valid.rs
Expand Up @@ -190,8 +190,8 @@ fn check_field_attrs(fields: &[Field]) -> Result<()> {
if let Some(source_field) = source_field.or(from_field) {
if contains_non_static_lifetime(source_field) {
return Err(Error::new_spanned(
source_field.original,
"non-static lifetimes are not allowed in the source of an error",
&source_field.original.ty,
"non-static lifetimes are not allowed in the source of an error, because std::error::Error requires the source is dyn Error + 'static",
));
}
}
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/lifetime.stderr
@@ -1,5 +1,5 @@
error: non-static lifetimes are not allowed in the source of an error
--> $DIR/lifetime.rs:5:18
error: non-static lifetimes are not allowed in the source of an error, because std::error::Error requires the source is dyn Error + 'static
--> $DIR/lifetime.rs:5:26
|
5 | struct Error<'a>(#[from] Inner<'a>);
| ^^^^^^^^^^^^^^^^^
| ^^^^^^^^^

0 comments on commit cb3077c

Please sign in to comment.