mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Add test for #8931 and better checking
This commit is contained in:
parent
bc1ba1549d
commit
a5d85a6356
3 changed files with 114 additions and 13 deletions
|
@ -454,4 +454,33 @@ mod foo {
|
|||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_8931() {
|
||||
check(
|
||||
r#"
|
||||
#[lang = "fn_once"]
|
||||
trait FnOnce<Args> {
|
||||
type Output;
|
||||
}
|
||||
struct S;
|
||||
|
||||
struct Foo;
|
||||
impl Foo {
|
||||
fn foo(&self) -> &[u8] { loop {} }
|
||||
}
|
||||
|
||||
impl S {
|
||||
fn indented(&mut self, f: impl FnOnce(&mut Self)) {
|
||||
}
|
||||
|
||||
fn f(&mut self, v: Foo) {
|
||||
self.indented(|this| v.$0)
|
||||
}
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue