mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-10-31 03:54:42 +00:00 
			
		
		
		
	Preserve impl assoc names in ImplData
This commit is contained in:
		
							parent
							
								
									76c1a376c3
								
							
						
					
					
						commit
						0480ebef75
					
				
					 10 changed files with 78 additions and 89 deletions
				
			
		|  | @ -244,7 +244,7 @@ bitflags::bitflags! { | |||
| #[derive(Debug, Clone, PartialEq, Eq)] | ||||
| pub struct TraitData { | ||||
|     pub name: Name, | ||||
|     pub items: Vec<(Name, AssocItemId)>, | ||||
|     pub items: Box<[(Name, AssocItemId)]>, | ||||
|     pub flags: TraitFlags, | ||||
|     pub visibility: RawVisibility, | ||||
|     // box it as the vec is usually empty anyways
 | ||||
|  | @ -360,7 +360,7 @@ impl TraitAliasData { | |||
| pub struct ImplData { | ||||
|     pub target_trait: Option<TraitRef>, | ||||
|     pub self_ty: TypeRefId, | ||||
|     pub items: Box<[AssocItemId]>, | ||||
|     pub items: Box<[(Name, AssocItemId)]>, | ||||
|     pub is_negative: bool, | ||||
|     pub is_unsafe: bool, | ||||
|     // box it as the vec is usually empty anyways
 | ||||
|  | @ -393,7 +393,6 @@ impl ImplData { | |||
|         collector.collect(&item_tree, tree_id.tree_id(), &impl_def.items); | ||||
| 
 | ||||
|         let (items, macro_calls, diagnostics) = collector.finish(); | ||||
|         let items = items.into_iter().map(|(_, item)| item).collect(); | ||||
| 
 | ||||
|         ( | ||||
|             Arc::new(ImplData { | ||||
|  | @ -648,12 +647,12 @@ impl<'a> AssocItemCollector<'a> { | |||
|     fn finish( | ||||
|         self, | ||||
|     ) -> ( | ||||
|         Vec<(Name, AssocItemId)>, | ||||
|         Box<[(Name, AssocItemId)]>, | ||||
|         Option<Box<Vec<(AstId<ast::Item>, MacroCallId)>>>, | ||||
|         Vec<DefDiagnostic>, | ||||
|     ) { | ||||
|         ( | ||||
|             self.items, | ||||
|             self.items.into_boxed_slice(), | ||||
|             if self.macro_calls.is_empty() { None } else { Some(Box::new(self.macro_calls)) }, | ||||
|             self.diagnostics, | ||||
|         ) | ||||
|  |  | |||
|  | @ -107,7 +107,7 @@ impl LangItems { | |||
|         for (_, module_data) in crate_def_map.modules() { | ||||
|             for impl_def in module_data.scope.impls() { | ||||
|                 lang_items.collect_lang_item(db, impl_def, LangItemTarget::ImplDef); | ||||
|                 for assoc in db.impl_data(impl_def).items.iter().copied() { | ||||
|                 for &(_, assoc) in db.impl_data(impl_def).items.iter() { | ||||
|                     match assoc { | ||||
|                         AssocItemId::FunctionId(f) => { | ||||
|                             lang_items.collect_lang_item(db, f, LangItemTarget::Function) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lukas Wirth
						Lukas Wirth