Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/expand_macro.rs')
| -rw-r--r-- | crates/ide/src/expand_macro.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/crates/ide/src/expand_macro.rs b/crates/ide/src/expand_macro.rs index f732674725..7bb6b24a23 100644 --- a/crates/ide/src/expand_macro.rs +++ b/crates/ide/src/expand_macro.rs @@ -42,7 +42,7 @@ pub(crate) fn expand_macro(db: &RootDatabase, position: FilePosition) -> Option< let derive = sema.descend_into_macros(tok.clone()).into_iter().find_map(|descended| { let hir_file = sema.hir_file_for(&descended.parent()?); - if !hir_file.is_derive_attr_macro(db) { + if !hir_file.is_derive_attr_pseudo_expansion(db) { return None; } @@ -55,7 +55,7 @@ pub(crate) fn expand_macro(db: &RootDatabase, position: FilePosition) -> Option< .token_tree()? .token_trees_and_tokens() .filter_map(NodeOrToken::into_token) - .take_while(|it| it == &token) + .take_while(|it| it != &token) .filter(|it| it.kind() == T![,]) .count(); Some(ExpandedMacro { @@ -384,5 +384,18 @@ struct Foo {} "#]], ); + check( + r#" +//- minicore: copy, clone, derive + +#[derive(Copy, Cl$0one)] +struct Foo {} +"#, + expect![[r#" + Clone + impl < >core::clone::Clone for Foo< >{} + + "#]], + ); } } |