1
1
use crate :: base:: * ;
2
- use crate :: proc_macro:: { collect_derives, MarkAttrs } ;
2
+ use crate :: proc_macro:: collect_derives;
3
3
use crate :: hygiene:: { ExpnId , SyntaxContext , ExpnData , ExpnKind } ;
4
4
use crate :: mbe:: macro_rules:: annotate_err_with_kind;
5
5
use crate :: placeholders:: { placeholder, PlaceholderExpander } ;
@@ -394,7 +394,9 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
394
394
let fragment = self . expand_invoc ( invoc, & ext. kind ) ;
395
395
self . collect_invocations ( fragment, & [ ] )
396
396
}
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.
398
400
let ( derives, item) = match invoc. kind {
399
401
InvocationKind :: DeriveContainer { derives, item } => ( derives, item) ,
400
402
_ => unreachable ! ( ) ,
@@ -421,20 +423,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
421
423
422
424
let mut item = self . fully_configure ( item) ;
423
425
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
- }
438
426
439
427
let mut derive_placeholders = Vec :: with_capacity ( derives. len ( ) ) ;
440
428
invocations. reserve ( derives. len ( ) ) ;
0 commit comments