-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
impl Trait
and explicit const arguments
#61410
Comments
This hits on my primary use for Const Generics; creating arbitrary sized arrays of data fed from a closure.
Simple failing case:
|
We might want to use @SephVelut: thanks for the test case! |
After #61570, the inference issue is fixed, but there's another error:
due to: https://github.com/rust-lang/rust/blob/c5b39195f4a525a0ee29e39a114b6586c79a3c45/src/librustc_typeck/astconv.rs#L216 |
We can change the check to: let explicit = seg.args.iter().map(|args| args.args.iter()).flatten().any(|arg| {
if let GenericArg::Type(_) = arg { true } else { false }
}); which removes the "cannot provide explicit type parameters" error, but I think the problem then is that the explicit const arg gets provided before the Edit: actually, the issue might be that we only infer IT arguments if It might be better to split |
Current output:
|
fn
errorimpl Trait
and explicit const arguments
I'm tempted to say that this issue should be closed (at least after #65614), because the behaviour here is not specified by any RFC, and probably falls out of scope of at least the initial version of const generics. Note that the suggested changes simply give the original inference issue. |
…tthewjasper Improve error message for APIT with explicit generic arguments This is disallowed with type or const generics. cc rust-lang#61410.
I agree with @varkor here, will add a regression test closing this issue with the current error message. nm, the error message is somewhat unfortunate. Will keep this open for now:
|
There's an issue with the span information now; I'll fix that, then I think this issue can be closed. |
results in:
The text was updated successfully, but these errors were encountered: