mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-27 02:06:57 +00:00
fix: Apply adjustments to proper expr when invoking CoerceMany
This commit is contained in:
parent
039ac844f1
commit
11ffa88505
4 changed files with 89 additions and 9 deletions
|
|
@ -912,3 +912,36 @@ fn main() {
|
|||
"",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn regression_19021() {
|
||||
check_pass(
|
||||
r#"
|
||||
//- minicore: deref
|
||||
use core::ops::Deref;
|
||||
|
||||
#[lang = "owned_box"]
|
||||
struct Box<T>(T);
|
||||
|
||||
impl<T> Deref for Box<T> {
|
||||
type Target = T;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
struct Foo;
|
||||
|
||||
fn main() {
|
||||
let x = Box(Foo);
|
||||
let y = &Foo;
|
||||
|
||||
|| match x {
|
||||
ref x => x,
|
||||
_ => y,
|
||||
};
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue