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
rust-analyzer version: 0.3.1983-standalone (7852a4c 2024-06-02)
use std::borrow::{Borrow, BorrowMut}; pub trait Item: 'static {} pub trait BorrowPoint { fn set_item1<T: Item>(&mut self, global: T); fn set_item2<T: Item>(&mut self, global: T); fn set_item3<T: Item>(&mut self, global: T); } struct Point; impl Point { pub fn f1(&mut self) { println!("Point.f1"); } pub fn set_item2(&mut self) { println!("Point.set_item2"); } pub fn set_item3<I: Item>(&mut self, _item: I) { println!("Point.set_item3"); } } struct PointWrapper(Point); impl Borrow<Point> for PointWrapper { fn borrow(&self) -> &Point { &self.0 } } impl BorrowMut<Point> for PointWrapper { fn borrow_mut(&mut self) -> &mut Point { &mut self.0 } } impl<C> BorrowPoint for C where C: BorrowMut<Point>, { fn set_item1<I: Item>(&mut self, _item: I) { self.borrow_mut().f1(); } fn set_item2<I: Item>(&mut self, _item: I) { self.borrow_mut().set_item2(); } fn set_item3<I: Item>(&mut self, item: I) { self.borrow_mut().set_item3(item); } } #[cfg(test)] mod tests { use super::*; struct G1; impl Item for G1 {} #[test] fn test_name() { let mut s = PointWrapper(Point); s.set_item1(G1); s.set_item2(G1); } }
issue1:
issue2: go to definition not working:
issue3: go to definition will go to wrong place:
The text was updated successfully, but these errors were encountered:
Dup of #5514 (yet another case).
Sorry, something went wrong.
No branches or pull requests
rust-analyzer version: 0.3.1983-standalone (7852a4c 2024-06-02)
issue1:
issue2: go to definition not working:
issue3: go to definition will go to wrong place:
The text was updated successfully, but these errors were encountered: