mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Lookup super traits in is_dyn_method
This commit is contained in:
parent
eb143383c3
commit
ed8e1fd472
2 changed files with 42 additions and 7 deletions
|
@ -1941,6 +1941,33 @@ fn dyn_trait() {
|
|||
"#,
|
||||
900,
|
||||
);
|
||||
check_number(
|
||||
r#"
|
||||
//- minicore: coerce_unsized, index, slice
|
||||
trait A {
|
||||
fn x(&self) -> i32;
|
||||
}
|
||||
|
||||
trait B: A {}
|
||||
|
||||
impl A for i32 {
|
||||
fn x(&self) -> i32 {
|
||||
5
|
||||
}
|
||||
}
|
||||
|
||||
impl B for i32 {
|
||||
|
||||
}
|
||||
|
||||
const fn f(x: &dyn B) -> i32 {
|
||||
x.x()
|
||||
}
|
||||
|
||||
const GOAL: i32 = f(&2i32);
|
||||
"#,
|
||||
5,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue