Skip to content

Commit 99c18c4

Browse files
author
Agustin Fernandez
committed
Add more context to async fn trait error. Suggest async-trait.
1 parent eb5ef81 commit 99c18c4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/librustc_passes/ast_validation.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,12 @@ impl<'a> AstValidator<'a> {
244244
fn check_trait_fn_not_async(&self, span: Span, asyncness: IsAsync) {
245245
if asyncness.is_async() {
246246
struct_span_err!(self.session, span, E0706,
247-
"trait fns cannot be declared `async`").emit()
247+
"trait fns cannot be declared `async`")
248+
.note("Due to technical restrictions rust does not currently support `async` \
249+
trait fns.")
250+
.note("Consider using the `async-trait` crate in the meantime until further \
251+
notice.")
252+
.emit();
248253
}
249254
}
250255

0 commit comments

Comments
 (0)