diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-05-23 12:03:18 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-23 12:03:18 +0100 |
commit | 0ec4ce1e9bceb2d7b0833de2ab59e2cd583e01ec (patch) | |
tree | 56ee0561e7f7240a0571e0c1be484c83bf985541 /crates/ide_completion | |
parent | 808ebe4b865176dcc394ea4adcb3a24f60955734 (diff) | |
parent | 34a3bc4196db302ea5b31c51b6d555336965be5f (diff) |
Merge #8938
8938: internal: Fix #8931 r=flodiebold a=flodiebold
- and add some better checking for similar bugs
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ide_completion')
-rw-r--r-- | crates/ide_completion/src/completions/dot.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/crates/ide_completion/src/completions/dot.rs b/crates/ide_completion/src/completions/dot.rs index 7e4efe589..fd9738743 100644 --- a/crates/ide_completion/src/completions/dot.rs +++ b/crates/ide_completion/src/completions/dot.rs | |||
@@ -454,4 +454,34 @@ 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 | me foo() fn(&self) -> &[u8] | ||
484 | "#]], | ||
485 | ); | ||
486 | } | ||
457 | } | 487 | } |