Skip to content

Commit

Permalink
Add justification to non-static lifetime diagnostic
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Dec 27, 2020
1 parent 464a409 commit d31d96b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion impl/src/valid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ fn check_field_attrs(fields: &[Field]) -> Result<()> {
if contains_non_static_lifetime(source_field) {
return Err(Error::new_spanned(
&source_field.original.ty,
"non-static lifetimes are not allowed in the source of an error",
"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
2 changes: 1 addition & 1 deletion tests/ui/lifetime.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: non-static lifetimes are not allowed in the source of an error
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>);
Expand Down

0 comments on commit d31d96b

Please sign in to comment.