Skip to content

Using Const<4> instead of Const<{ U4::USIZE }> is better for rust-analyzer #1097

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

Closed
digama0 opened this issue Mar 23, 2022 · 1 comment · Fixed by #1098
Closed

Using Const<4> instead of Const<{ U4::USIZE }> is better for rust-analyzer #1097

digama0 opened this issue Mar 23, 2022 · 1 comment · Fixed by #1098

Comments

@digama0
Copy link

digama0 commented Mar 23, 2022

From rust-lang/rust-analyzer#11803 (comment) :

There is literaly no const eval in const generics yet, so Const<{ four }> is Const<_>. We can handle this special case easily, but the constants in nalgebra are very complex and evaluating them needs trait resolution (#4558) + lowering const generics to body (#7434) + evaluating assoc consts with generic parameters. Short term solution here IMO is replace type u4 = Const<{ typenum::U4::USIZE }> with type U4 = Const<4> in the nalgebra source code, which is an internal and invisible to user change.

Would this be a reasonable change to make? Rust analyzer has a lot of trouble with nalgebra's types, and this is a big impediment to using the crate in beginner settings. Arguably this is a problem that rust analyzer should solve, but if a simple fix like this helps it seems worthwhile.

@sebcrozet
Copy link
Member

Hi! Yes, this can easily be done. I agree we should make the change if it makes it easier for rust-analyzer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants