-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Cannot use generic const argument without {}
, despite no conflict
#68257
Comments
impl<const B: usize> Foo<1, { B }> works |
Thank you very much for your help! Apologies for troubling you, I'll maybe try stackoverflow first next time.
…________________________________
From: Marcel Hellwig <notifications@github.com>
Sent: Wednesday, January 15, 2020 6:21:10 PM
To: rust-lang/rust <rust@noreply.github.com>
Cc: DrGabble <jub777@hotmail.co.uk>; Author <author@noreply.github.com>
Subject: Re: [rust-lang/rust] Const Generics Not Compiling (#68257)
impl<const B: usize> Foo<1, {B}>
works
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#68257?email_source=notifications&email_token=ADTUJ2MD2EVFVGVKLIX6MHTQ55HZNA5CNFSM4KHHTA4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJBJAGQ#issuecomment-574787610>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADTUJ2JSYVJEYCPI6QCJJM3Q55HZNANCNFSM4KHHTA4A>.
|
{}
, despite no conflict
I'm surprised this doesn't work, actually, as |
Yeah it confused be how it could figure it out the other way, but not this way round... |
Hmm, I'll try taking a poke at this this weekend. |
Looks like the check for if consts are before types in argument lists happens before we do our fancy lowering magic that turns consts args that had been parsed as type args into their true selves. Why wasn't this caught earlier? We just didn't test it. As for how to fix it? We could just remove parameter ordering or at least slightly relax it. Otherwise, we might have to just move this check later on after things have been lowered to HIR. |
I don't think there's a strong reason for parameter ordering to be enforced and was mainly intended to be conservative. However, it is a small language change, so it might be easier to move this check later on for now. |
I would expect this code to compile, but it does not:
(Playground)
Errors:
The text was updated successfully, but these errors were encountered: