Skip to content

Commit d31d96b

Browse files
committed
Add justification to non-static lifetime diagnostic
1 parent 464a409 commit d31d96b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

impl/src/valid.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ fn check_field_attrs(fields: &[Field]) -> Result<()> {
191191
if contains_non_static_lifetime(source_field) {
192192
return Err(Error::new_spanned(
193193
&source_field.original.ty,
194-
"non-static lifetimes are not allowed in the source of an error",
194+
"non-static lifetimes are not allowed in the source of an error, because std::error::Error requires the source is dyn Error + 'static",
195195
));
196196
}
197197
}

tests/ui/lifetime.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: non-static lifetimes are not allowed in the source of an error
1+
error: non-static lifetimes are not allowed in the source of an error, because std::error::Error requires the source is dyn Error + 'static
22
--> $DIR/lifetime.rs:5:26
33
|
44
5 | struct Error<'a>(#[from] Inner<'a>);

0 commit comments

Comments
 (0)