-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Type inference breaks for types with generic lifetimes and generic type parameters with default values #17515
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
Labels
C-bug
Category: bug
Comments
Hm, this works in older RA versions, so I guess it might have been broken with the lifetime inference work. @dfireBird |
This is #17075, I'm already looking into it |
lnicola
pushed a commit
to lnicola/rust
that referenced
this issue
Jul 11, 2024
fix: Fix lifetime parameters moving parameter defaults Fixes rust-lang/rust-analyzer#17075, rust-lang/rust-analyzer#17515 We were incorrectly filling the default params due to our odd order of lifetime parameters vs type/const params. So this needs some special handling so that we don't shift the defaults around.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rust-analyzer version:
0.3.2011-standalone
rustc version:
rustc 1.78.0 (9b00956e5 2024-04-29)
extension: VSCode extension
v0.3.2011
Reproduction
Paste the following code into
main.rs
Expected
I expected rust-analyzer to resolve the
.method()
invocation correctly and highlight it as yellow according to my semantic tokens highlighting config.Actual
You may see that
method()
method symbol is unresolved. Here is how it looks in my VSCode. I configured unresolved symbols semantic token type to be displayed in pale-red. You may see that the lifetime parameter of the struct is inferred to be{unknown}
. I suppose this is the reason why.method()
is unresolved.Well-formed variation
If you remove the
T = bool
default value of the generic parameter on the struct definition and passbool
explicitly then all is fine.The text was updated successfully, but these errors were encountered: