-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
A-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-bugCategory: bugCategory: bug
Description
rust-analyzer version: 0.4.1482-standalone (9b835f3 2023-04-17)
rustc version: rustc 1.68.2 (9eb3afe9e 2023-03-27)
relevant settings: dont matter, but... vscodium 1.77.2
Steps to reproduce
There is some traits:
trait Foo {type Inner;}
trait Bar {type Inner;}
impl Foo for i32 {type Inner = i32;}
impl Bar for i32 {type Inner = i32;}And when some struct with impl depends of constraint:
struct Baz<T>(T);
impl<T> Baz<T> where T: Foo, T::Inner: Bar,
<T::Inner as Bar>::Inner: Sized
{
pub fn new(obj: T) -> Self {Self(obj)}
pub fn foo(&self) -> String {"foobazz".to_owned()}
}
fn test() {
let baz = Baz::new(1);
let s = baz.foo();
}type hints and autocomplete fails on it (not worked for obj baz):

When remove consrtaint <T::Inner as Bar>::Inner: Sized it worked back:

its important, that tonic code generation creates type constraints like that
jhgg
Metadata
Metadata
Assignees
Labels
A-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-bugCategory: bugCategory: bug