11use crate :: base:: * ;
2- use crate :: proc_macro:: { collect_derives, MarkAttrs } ;
2+ use crate :: proc_macro:: collect_derives;
33use crate :: hygiene:: { ExpnId , SyntaxContext , ExpnData , ExpnKind } ;
44use crate :: mbe:: macro_rules:: annotate_err_with_kind;
55use crate :: placeholders:: { placeholder, PlaceholderExpander } ;
@@ -394,7 +394,9 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
394394 let fragment = self . expand_invoc ( invoc, & ext. kind ) ;
395395 self . collect_invocations ( fragment, & [ ] )
396396 }
397- InvocationRes :: DeriveContainer ( exts) => {
397+ InvocationRes :: DeriveContainer ( _exts) => {
398+ // FIXME: Consider using the derive resolutions (`_exts`) immediately,
399+ // instead of enqueuing the derives to be resolved again later.
398400 let ( derives, item) = match invoc. kind {
399401 InvocationKind :: DeriveContainer { derives, item } => ( derives, item) ,
400402 _ => unreachable ! ( ) ,
@@ -421,20 +423,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
421423
422424 let mut item = self . fully_configure ( item) ;
423425 item. visit_attrs ( |attrs| attrs. retain ( |a| !a. has_name ( sym:: derive) ) ) ;
424- let mut helper_attrs = Vec :: new ( ) ;
425- let mut has_copy = false ;
426- for ext in exts {
427- helper_attrs. extend ( & ext. helper_attrs ) ;
428- has_copy |= ext. is_derive_copy ;
429- }
430- // Mark derive helpers inside this item as known and used.
431- // FIXME: This is a hack, derive helpers should be integrated with regular name
432- // resolution instead. For example, helpers introduced by a derive container
433- // can be in scope for all code produced by that container's expansion.
434- item. visit_with ( & mut MarkAttrs ( & helper_attrs) ) ;
435- if has_copy {
436- self . cx . resolver . add_derive_copy ( invoc. expansion_data . id ) ;
437- }
438426
439427 let mut derive_placeholders = Vec :: with_capacity ( derives. len ( ) ) ;
440428 invocations. reserve ( derives. len ( ) ) ;
0 commit comments