Closed zjijz closed 3 years ago
Apparently, this is only an issue for #![feature(min_const_generics)]
and not #![feature(const_generics)]
(https://github.com/rust-lang/rust/pull/74953).
However, #![feature(const_generics)]
breaks with this message:
error[E0747]: type provided when a constant was expected
--> src/lib.rs:5:1
|
5 | #[async_trait]
| ^^^^^^^^^^^^^^
|
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: if this generic argument was intended as a const parameter, try surrounding it with braces:
|
5 | { #[async_trait] }
Both issues will be fixed by #136.
Another option is to sort the params after inserting, which would also fix an incorrect ordering provided by the user.
I think adjusting the wrong input silently is a bad idea.
expands to
Example: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=8958651135342165990e5cf7d6735145
The compiler gives these error messages:
This issue seems to specifically be the param ordering on the inner async function:
async fn __run<const DUMMY : bool, AsyncTrait: ?Sized + Test ...
.I think expand.rs:420 is the offending line as it simply appends the
_self
type to the param list. I imagine this isn't an issue when only using lifetimes and types because this upholds the required order. This also means prepending doesn't solve the issue as well (since it would break using lifetime generics).My idea would be to assume the user orders the manual generics properly and find insert the
_self
type right before const generics start. Another option is to sort the params after inserting, which would also fix an incorrect ordering provided by the user.EDIT: This is while using
#![feature(min_const_generics)]
.