diff options
author | Florian Diebold <[email protected]> | 2021-05-23 11:52:41 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-05-23 11:52:41 +0100 |
commit | a5d85a6356dc761d047f46bf04eae09dc9ab80f9 (patch) | |
tree | c02c9f04b9f1ef694d2a1e0680e137e060a7cda2 /crates/ide_completion | |
parent | bc1ba1549d97e7d5ddceb16b7238ae8aab5794d0 (diff) |
Add test for #8931 and better checking
Diffstat (limited to 'crates/ide_completion')
-rw-r--r-- | crates/ide_completion/src/completions/dot.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/crates/ide_completion/src/completions/dot.rs b/crates/ide_completion/src/completions/dot.rs index 7e4efe589..1bff55936 100644 --- a/crates/ide_completion/src/completions/dot.rs +++ b/crates/ide_completion/src/completions/dot.rs | |||
@@ -454,4 +454,33 @@ mod foo { | |||
454 | "#]], | 454 | "#]], |
455 | ); | 455 | ); |
456 | } | 456 | } |
457 | |||
458 | #[test] | ||
459 | fn issue_8931() { | ||
460 | check( | ||
461 | r#" | ||
462 | #[lang = "fn_once"] | ||
463 | trait FnOnce<Args> { | ||
464 | type Output; | ||
465 | } | ||
466 | struct S; | ||
467 | |||
468 | struct Foo; | ||
469 | impl Foo { | ||
470 | fn foo(&self) -> &[u8] { loop {} } | ||
471 | } | ||
472 | |||
473 | impl S { | ||
474 | fn indented(&mut self, f: impl FnOnce(&mut Self)) { | ||
475 | } | ||
476 | |||
477 | fn f(&mut self, v: Foo) { | ||
478 | self.indented(|this| v.$0) | ||
479 | } | ||
480 | } | ||
481 | "#, | ||
482 | expect![[r#" | ||
483 | "#]], | ||
484 | ); | ||
485 | } | ||
457 | } | 486 | } |