We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
consider the following code:
fn a<B>(b: B) where B: std::borrow::Borrow<u64>, { let c = b.borrow(); }
rust-analyzer infers the type of c to be &unknown.
c
&unknown
However, now consider the following code, where we do not use std::borrow::Borrow, however we use an equivalently defined trait:
trait Borrow<Borrowed: ?Sized> { fn borrow(&self) -> &Borrowed; } fn a<B>(b: B) where B: Borrow<u64>, { let c = b.borrow(); }
rust-analyzer infers c as &u64.
&u64
rust-analyzer version: rust-analyzer version: 0.0.0 (3903243 2022-08-15)
rustc version: rustc 1.63.0 (4b91a6ea7 2022-08-08)
relevant settings: n/a
The text was updated successfully, but these errors were encountered:
Probably duplicate of #5514
Sorry, something went wrong.
It really is a duplicate of #5514, following code would infer c as unknown
unknown
trait Borrow<Borrowed: ?Sized> { fn borrow(&self) -> &Borrowed; } impl<T: ?Sized> Borrow<T> for T { fn borrow(&self) -> &T { self } } fn a<B>(b: B) where B: Borrow<u64>, { let c = b.borrow(); }
No branches or pull requests
consider the following code:
rust-analyzer infers the type of
c
to be&unknown
.However, now consider the following code, where we do not use std::borrow::Borrow, however we use an equivalently defined trait:
rust-analyzer infers
c
as&u64
.rust-analyzer version: rust-analyzer version: 0.0.0 (3903243 2022-08-15)
rustc version: rustc 1.63.0 (4b91a6ea7 2022-08-08)
relevant settings: n/a
The text was updated successfully, but these errors were encountered: