-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Syntax Error: expected comma
when RA + HRTB + const trait
#19478
Comments
I believe the const trait syntax is being reworked, so there is no point in supporting it now. |
But parser #[cfg(not(feature = "RA"))]
pub const fn const_incr42<T>(mut x: T)
where
T: ~const ConstFrom<u8>
+ for<'a> ~const ConstAddAssign<&'a T>
+ ~const core::marker::Destruct,
{
let delta = T::const_from(42u8);
x.const_add_assign(&delta)
} Quote @ChayimFriedman2
What do you think? Thank you. |
I don't completely disagree with this statement since the const_trait_impl feature is considered quite experimental as its implementation has completely changed several times over the last years and still doesn't have an approved RFC backing it, so I think I can safely say as an outsider that it likely represents a certain 'risk' for the rust-analyzer team to support it (in whatever capacity) ('risk' as in potentially wasted people hours). Moreover, const_trait_impl isn't even that convenient to use right now since most And lastly, yeah, the syntax is being reworked (see the RFC) to the point that it's absolutely not clear yet how it'll end up looking. However, I do have to note that rust-analyzer does seem to be able to parse |
BUG
Syntax Error: expected comma
when RA + HRTB + const traitDetail
rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)
rustc version: (eg. output of
rustc -V
)rustc 1.87.0-nightly (3f5502370 2025-03-27)
editor or extension: (eg. VSCode, Vim, Emacs, etc. For VSCode users, specify your extension version; for users of other editors, provide the distribution if applicable)
vscode
relevant settings: (eg. client settings, or environment variables like
CARGO
,RUSTC
,RUSTUP_HOME
orCARGO_HOME
)repository link (if public, optional): (eg. rust-analyzer)
code snippet to reproduce:
Related
Prev
rust-lang/rust#139134 (comment)
The text was updated successfully, but these errors were encountered: