mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Fix Chalk panic
Fixes #3865. Basically I forgot to shift 'back' when we got `dyn Trait`s back from Chalk, so after going through Chalk a few times, the panic happened.
This commit is contained in:
parent
109bb1a793
commit
236ac630f6
3 changed files with 33 additions and 2 deletions
|
@ -2021,3 +2021,28 @@ fn main() {
|
|||
"###
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dyn_trait_through_chalk() {
|
||||
let t = type_at(
|
||||
r#"
|
||||
//- /main.rs
|
||||
struct Box<T> {}
|
||||
#[lang = "deref"]
|
||||
trait Deref {
|
||||
type Target;
|
||||
}
|
||||
impl<T> Deref for Box<T> {
|
||||
type Target = T;
|
||||
}
|
||||
trait Trait {
|
||||
fn foo(&self);
|
||||
}
|
||||
|
||||
fn test(x: Box<dyn Trait>) {
|
||||
x.foo()<|>;
|
||||
}
|
||||
"#,
|
||||
);
|
||||
assert_eq!(t, "()");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue