Explicitly ban async in trait impls
This wouldn't compile before because the return type wouldn't match, but now it's properly an error.
This commit is contained in:
parent
d64e577fa3
commit
b97ef26de1
3 changed files with 5 additions and 4 deletions
|
|
@ -265,6 +265,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
|||
self.invalid_visibility(&impl_item.vis, None);
|
||||
if let ImplItemKind::Method(ref sig, _) = impl_item.node {
|
||||
self.check_trait_fn_not_const(sig.header.constness);
|
||||
self.check_trait_fn_not_async(impl_item.span, sig.header.asyncness);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,11 +38,11 @@ LL | L = M; //~ ERROR missing
|
|||
LL | | Z = { 2 + 3 }; //~ ERROR expected one of
|
||||
| |____^ missing `fn`, `type`, or `const`
|
||||
|
||||
error: expected one of `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `;`
|
||||
error: expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `;`
|
||||
--> $DIR/issue-40006.rs:23:18
|
||||
|
|
||||
LL | Z = { 2 + 3 }; //~ ERROR expected one of
|
||||
| ^ expected one of `const`, `extern`, `fn`, `type`, `unsafe`, or `}` here
|
||||
| ^ expected one of 7 possible tokens here
|
||||
|
||||
error: expected one of `!` or `::`, found `(`
|
||||
--> $DIR/issue-40006.rs:24:9
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: expected one of `(`, `const`, `default`, `extern`, `fn`, `type`, or `unsafe`, found `}`
|
||||
error: expected one of `(`, `async`, `const`, `default`, `extern`, `fn`, `type`, or `unsafe`, found `}`
|
||||
--> $DIR/issue-41155.rs:13:1
|
||||
|
|
||||
LL | pub
|
||||
| - expected one of 7 possible tokens here
|
||||
| - expected one of 8 possible tokens here
|
||||
LL | } //~ ERROR expected one of
|
||||
| ^ unexpected token
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue