@@ -118,11 +118,9 @@ impl<'a> base::Resolver for Resolver<'a> {
118118 & mut self , expansion : ExpnId , fragment : & AstFragment , derives : & [ ExpnId ]
119119 ) {
120120 // Fill in some data for derives if the fragment is from a derive container.
121- let parent_scope = self . invocation_parent_scopes [ & expansion] . clone ( ) ;
121+ let parent_scope = self . invocation_parent_scopes [ & expansion] ;
122122 let parent_def = self . definitions . invocation_parent ( expansion) ;
123- self . invocation_parent_scopes . extend (
124- derives. iter ( ) . map ( |& derive| ( derive, parent_scope. clone ( ) ) )
125- ) ;
123+ self . invocation_parent_scopes . extend ( derives. iter ( ) . map ( |& derive| ( derive, parent_scope) ) ) ;
126124 for & derive_invoc_id in derives {
127125 self . definitions . set_invocation_parent ( derive_invoc_id, parent_def) ;
128126 }
@@ -152,14 +150,14 @@ impl<'a> base::Resolver for Resolver<'a> {
152150
153151 fn resolve_macro_invocation ( & mut self , invoc : & Invocation , invoc_id : ExpnId , force : bool )
154152 -> Result < Option < Lrc < SyntaxExtension > > , Indeterminate > {
155- let parent_scope = & self . invocation_parent_scopes [ & invoc_id] . clone ( ) ;
153+ let parent_scope = self . invocation_parent_scopes [ & invoc_id] ;
156154 let ( path, kind, derives, after_derive) = match invoc. kind {
157155 InvocationKind :: Attr { ref attr, ref derives, after_derive, .. } =>
158- ( & attr. path , MacroKind :: Attr , derives . clone ( ) , after_derive) ,
156+ ( & attr. path , MacroKind :: Attr , self . arenas . alloc_ast_paths ( derives ) , after_derive) ,
159157 InvocationKind :: Bang { ref mac, .. } =>
160- ( & mac. path , MacroKind :: Bang , Vec :: new ( ) , false ) ,
158+ ( & mac. path , MacroKind :: Bang , & [ ] [ .. ] , false ) ,
161159 InvocationKind :: Derive { ref path, .. } =>
162- ( path, MacroKind :: Derive , Vec :: new ( ) , false ) ,
160+ ( path, MacroKind :: Derive , & [ ] [ .. ] , false ) ,
163161 InvocationKind :: DeriveContainer { ref derives, .. } => {
164162 // Block expansion of derives in the container until we know whether one of them
165163 // is a built-in `Copy`. Skip the resolution if there's only one derive - either
@@ -169,7 +167,7 @@ impl<'a> base::Resolver for Resolver<'a> {
169167 if derives. len ( ) > 1 {
170168 for path in derives {
171169 match self . resolve_macro_path ( path, Some ( MacroKind :: Derive ) ,
172- parent_scope, true , force) {
170+ & parent_scope, true , force) {
173171 Ok ( ( Some ( ref ext) , _) ) if ext. is_derive_copy => {
174172 self . add_derives ( invoc. expansion_data . id , SpecialDerives :: COPY ) ;
175173 return Ok ( None ) ;
@@ -184,7 +182,7 @@ impl<'a> base::Resolver for Resolver<'a> {
184182 } ;
185183
186184 // Derives are not included when `invocations` are collected, so we have to add them here.
187- let parent_scope = & ParentScope { derives, ..parent_scope. clone ( ) } ;
185+ let parent_scope = & ParentScope { derives, ..parent_scope } ;
188186 let ( ext, res) = self . smart_resolve_macro_path ( path, kind, parent_scope, force) ?;
189187
190188 let span = invoc. span ( ) ;
@@ -324,7 +322,7 @@ impl<'a> Resolver<'a> {
324322 if trace {
325323 let kind = kind. expect ( "macro kind must be specified if tracing is enabled" ) ;
326324 self . multi_segment_macro_resolutions
327- . push ( ( path, path_span, kind, parent_scope. clone ( ) , res. ok ( ) ) ) ;
325+ . push ( ( path, path_span, kind, * parent_scope, res. ok ( ) ) ) ;
328326 }
329327
330328 self . prohibit_imported_non_macro_attrs ( None , res. ok ( ) , path_span) ;
@@ -341,7 +339,7 @@ impl<'a> Resolver<'a> {
341339 if trace {
342340 let kind = kind. expect ( "macro kind must be specified if tracing is enabled" ) ;
343341 self . single_segment_macro_resolutions
344- . push ( ( path[ 0 ] . ident , kind, parent_scope. clone ( ) , binding. ok ( ) ) ) ;
342+ . push ( ( path[ 0 ] . ident , kind, * parent_scope, binding. ok ( ) ) ) ;
345343 }
346344
347345 let res = binding. map ( |binding| binding. res ( ) ) ;
@@ -410,8 +408,8 @@ impl<'a> Resolver<'a> {
410408 let result = match scope {
411409 Scope :: DeriveHelpers => {
412410 let mut result = Err ( Determinacy :: Determined ) ;
413- for derive in & parent_scope. derives {
414- let parent_scope = & ParentScope { derives : Vec :: new ( ) , ..* parent_scope } ;
411+ for derive in parent_scope. derives {
412+ let parent_scope = & ParentScope { derives : & [ ] , ..* parent_scope } ;
415413 match this. resolve_macro_path ( derive, Some ( MacroKind :: Derive ) ,
416414 parent_scope, true , force) {
417415 Ok ( ( Some ( ext) , _) ) => if ext. helper_attrs . contains ( & ident. name ) {
@@ -457,7 +455,7 @@ impl<'a> Resolver<'a> {
457455 }
458456 }
459457 Scope :: Module ( module) => {
460- let adjusted_parent_scope = & ParentScope { module, ..parent_scope. clone ( ) } ;
458+ let adjusted_parent_scope = & ParentScope { module, ..* parent_scope } ;
461459 let binding = this. resolve_ident_in_module_unadjusted_ext (
462460 ModuleOrUniformRoot :: Module ( module) ,
463461 ident,
0 commit comments