-
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
textDocument/semanticTokens/etc. GAT failure on latest pre-release #11989
Labels
A-ty
type system / type inference / traits / method resolution
C-bug
Category: bug
S-actionable
Someone could pick this issue up and work on it right now
Comments
A combination of const generics and GAT might be the cause of this issue. My fix only bypasses the case for GAT without const generics 🤣 |
pub trait Select {
type Output<'a, T>
where
T: 'a,
Self: 'a;
fn select<'a, T>(self, slice: &'a [T]) -> Self::Output<'a, T>
where
Self: 'a;
}
impl<const N: usize> Select for [usize; N] {
type Output<'a, T> = impl Iterator<Item=&'a T> + 'a where T:'a;
fn select<'a, T>(self, slice: &'a [T]) -> Self::Output<'a, T>
where
Self: 'a,
{
self.into_iter().map(move |i| &slice[i])
}
} rust-analyzer 0.0.0 (766c5f0 2022-07-16) |
N3xed
added a commit
to N3xed/rust-analyzer
that referenced
this issue
Aug 14, 2022
This workaround avoids constant crashing of rust analyzer when using GATs with const generics, even when the const generics are only on the `impl` block. The workaround treats GATs as non-existing if either itself or the parent has const generics. Additionally, I've added the `is_gat` field to `utils::Generics` that determines whether missing generics params crashes rust analyzer. Another solution would have been to remove all panics from the relevant code path regardless of whether the generics is on a GAT, but this could change behavior outside of GATs. Fixes rust-lang#11989, fixes rust-lang#12193
bors
added a commit
that referenced
this issue
Aug 21, 2022
fix: Fix panics on GATs involving const generics This workaround avoids constant crashing of rust analyzer when using GATs with const generics, even when the const generics are only on the `impl` block. The workaround treats GATs as non-existing if either itself or the parent has const generics and removes relevant panicking code-paths. ~~Additionally, I've added the `is_gat` field to `utils::Generics` that determines whether missing generics params crashes rust analyzer. Another solution would have been to remove all panics from the relevant code path regardless of whether the generics are on a GAT, but this could change behavior outside of GATs.~~ Fixes #11989, fixes #12193
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-ty
type system / type inference / traits / method resolution
C-bug
Category: bug
S-actionable
Someone could pick this issue up and work on it right now
I'm getting errors like
textDocument/semanticTokens/full
,textDocument/semanticTokens/full/delta
,textDocument/inlayHints
andtextDocument/definition
failed every time I start typing.I know several GAT issues have already been solved, but I'm working with a pre-release version from 2 days ago. Assuming this fix already made it in 3 days ago I'm still running into issues and thought this warranted an issue report. :)
rust-analyzer version: rust-analyzer version: faaec86 2022-04-12 nightly
rustc version: rustc 1.61.0-nightly (c84f39e6c 2022-03-20)
The text was updated successfully, but these errors were encountered: