mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Check for dyn impls in method resolution
This commit is contained in:
parent
4cc333c889
commit
965d31ce5b
2 changed files with 38 additions and 11 deletions
|
@ -1106,3 +1106,25 @@ fn main() {
|
|||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn method_on_dyn_impl() {
|
||||
check_types(
|
||||
r#"
|
||||
trait Foo {}
|
||||
|
||||
impl Foo for u32 {}
|
||||
impl dyn Foo {
|
||||
pub fn dyn_foo(&self) -> u32 {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let f = &42u32 as &dyn Foo<u32>;
|
||||
f.dyn_foo();
|
||||
// ^u32
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue