From ae8d74ab2caed66dc84f64f6859bdf3f131388e1 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 9 Jun 2021 18:02:31 +0200 Subject: Implement dummy expansions for builtin attributes --- .../src/completions/qualified_path.rs | 26 ++++++++++++++++++++++ .../src/completions/unqualified_path.rs | 12 +++++----- 2 files changed, 32 insertions(+), 6 deletions(-) (limited to 'crates/ide_completion') diff --git a/crates/ide_completion/src/completions/qualified_path.rs b/crates/ide_completion/src/completions/qualified_path.rs index 0b0a81410..58d4dd9ee 100644 --- a/crates/ide_completion/src/completions/qualified_path.rs +++ b/crates/ide_completion/src/completions/qualified_path.rs @@ -656,6 +656,32 @@ fn main() { let _ = crate::$0 } ); } + #[test] + fn does_not_complete_non_fn_macros() { + check( + r#" +mod m { + #[rustc_builtin_macro] + pub macro Clone {} +} + +fn f() {m::$0} +"#, + expect![[r#""#]], + ); + check( + r#" +mod m { + #[rustc_builtin_macro] + pub macro bench {} +} + +fn f() {m::$0} +"#, + expect![[r#""#]], + ); + } + #[test] fn completes_in_assoc_item_list() { check( diff --git a/crates/ide_completion/src/completions/unqualified_path.rs b/crates/ide_completion/src/completions/unqualified_path.rs index 1f6c4069f..b1e6b2b77 100644 --- a/crates/ide_completion/src/completions/unqualified_path.rs +++ b/crates/ide_completion/src/completions/unqualified_path.rs @@ -481,14 +481,14 @@ impl S { ); check( r#" -mod m { - #[rustc_builtin_macro] - pub macro Clone {} -} +#[rustc_builtin_macro] +pub macro bench {} -fn f() {m::$0} +fn f() {$0} "#, - expect![[r#""#]], + expect![[r#" + fn f() fn() + "#]], ); } -- cgit v1.2.3