mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-11-03 21:25:25 +00:00 
			
		
		
		
	Fix path resolution for child mods of those expanded by include!
				
					
				
			Child modules wouldn't use the correct candidate paths due to a branch that doesn't seem to be doing what it's intended to do. Removing the branch fixes the problem and all existing test cases pass.
This commit is contained in:
		
							parent
							
								
									b333f85a9d
								
							
						
					
					
						commit
						b9469f52a3
					
				
					 2 changed files with 47 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
//! This module resolves `mod foo;` declaration to file.
 | 
			
		||||
use arrayvec::ArrayVec;
 | 
			
		||||
use base_db::AnchoredPath;
 | 
			
		||||
use hir_expand::{name::Name, HirFileIdExt, MacroFileIdExt};
 | 
			
		||||
use hir_expand::{name::Name, HirFileIdExt};
 | 
			
		||||
use limit::Limit;
 | 
			
		||||
use span::EditionedFileId;
 | 
			
		||||
use syntax::ToSmolStr as _;
 | 
			
		||||
| 
						 | 
				
			
			@ -73,10 +73,6 @@ impl ModDir {
 | 
			
		|||
            Some(attr_path) => {
 | 
			
		||||
                candidate_files.push(self.dir_path.join_attr(attr_path, self.root_non_dir_owner))
 | 
			
		||||
            }
 | 
			
		||||
            None if file_id.macro_file().map_or(false, |it| it.is_include_macro(db.upcast())) => {
 | 
			
		||||
                candidate_files.push(format!("{}.rs", name.display(db.upcast())));
 | 
			
		||||
                candidate_files.push(format!("{}/mod.rs", name.display(db.upcast())));
 | 
			
		||||
            }
 | 
			
		||||
            None => {
 | 
			
		||||
                candidate_files.push(format!(
 | 
			
		||||
                    "{}{}.rs",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue