From a5d85a6356dc761d047f46bf04eae09dc9ab80f9 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 23 May 2021 12:52:41 +0200 Subject: Add test for #8931 and better checking --- crates/ide_completion/src/completions/dot.rs | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'crates/ide_completion/src') 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 { "#]], ); } + + #[test] + fn issue_8931() { + check( + r#" +#[lang = "fn_once"] +trait FnOnce { + 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#" + "#]], + ); + } } -- cgit v1.2.3