mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-11-04 13:38:31 +00:00 
			
		
		
		
	Merge pull request #20506 from Veykril/veykril/push-xlytslrrylzq
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				rustdoc / rustdoc (push) Has been cancelled
				
			
		
			
				
	
				metrics / build_metrics (push) Has been cancelled
				
			
		
			
				
	
				metrics / other_metrics (diesel-1.4.8) (push) Has been cancelled
				
			
		
			
				
	
				metrics / other_metrics (hyper-0.14.18) (push) Has been cancelled
				
			
		
			
				
	
				metrics / other_metrics (ripgrep-13.0.0) (push) Has been cancelled
				
			
		
			
				
	
				metrics / other_metrics (self) (push) Has been cancelled
				
			
		
			
				
	
				metrics / other_metrics (webrender-2022) (push) Has been cancelled
				
			
		
			
				
	
				metrics / generate_final_metrics (push) Has been cancelled
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	rustdoc / rustdoc (push) Has been cancelled
				
			metrics / build_metrics (push) Has been cancelled
				
			metrics / other_metrics (diesel-1.4.8) (push) Has been cancelled
				
			metrics / other_metrics (hyper-0.14.18) (push) Has been cancelled
				
			metrics / other_metrics (ripgrep-13.0.0) (push) Has been cancelled
				
			metrics / other_metrics (self) (push) Has been cancelled
				
			metrics / other_metrics (webrender-2022) (push) Has been cancelled
				
			metrics / generate_final_metrics (push) Has been cancelled
				
			Fix panic in syntax_highlighting
This commit is contained in:
		
						commit
						e6cd085099
					
				
					 2 changed files with 30 additions and 28 deletions
				
			
		| 
						 | 
					@ -452,10 +452,10 @@ fn traverse(
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                hl
 | 
					                hl
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            NodeOrToken::Token(token) => {
 | 
					            NodeOrToken::Token(token) => salsa::attach(sema.db, || {
 | 
				
			||||||
                highlight::token(sema, token, edition, &is_unsafe_node, tt_level > 0)
 | 
					                highlight::token(sema, token, edition, &is_unsafe_node, tt_level > 0)
 | 
				
			||||||
                    .zip(Some(None))
 | 
					                    .zip(Some(None))
 | 
				
			||||||
            }
 | 
					            }),
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        if let Some((mut highlight, binding_hash)) = element {
 | 
					        if let Some((mut highlight, binding_hash)) = element {
 | 
				
			||||||
            if is_unlinked && highlight.tag == HlTag::UnresolvedReference {
 | 
					            if is_unlinked && highlight.tag == HlTag::UnresolvedReference {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,7 +5,7 @@ use std::mem;
 | 
				
			||||||
use either::Either;
 | 
					use either::Either;
 | 
				
			||||||
use hir::{EditionedFileId, HirFileId, InFile, Semantics, sym};
 | 
					use hir::{EditionedFileId, HirFileId, InFile, Semantics, sym};
 | 
				
			||||||
use ide_db::{
 | 
					use ide_db::{
 | 
				
			||||||
    SymbolKind, active_parameter::ActiveParameter, defs::Definition,
 | 
					    SymbolKind, active_parameter::ActiveParameter, base_db::salsa, defs::Definition,
 | 
				
			||||||
    documentation::docs_with_rangemap, rust_doc::is_rust_fence,
 | 
					    documentation::docs_with_rangemap, rust_doc::is_rust_fence,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
use syntax::{
 | 
					use syntax::{
 | 
				
			||||||
| 
						 | 
					@ -126,32 +126,34 @@ pub(super) fn doc_comment(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Extract intra-doc links and emit highlights for them.
 | 
					    // Extract intra-doc links and emit highlights for them.
 | 
				
			||||||
    if let Some((docs, doc_mapping)) = docs_with_rangemap(sema.db, &attributes) {
 | 
					    if let Some((docs, doc_mapping)) = docs_with_rangemap(sema.db, &attributes) {
 | 
				
			||||||
        extract_definitions_from_docs(&docs)
 | 
					        salsa::attach(sema.db, || {
 | 
				
			||||||
            .into_iter()
 | 
					            extract_definitions_from_docs(&docs)
 | 
				
			||||||
            .filter_map(|(range, link, ns)| {
 | 
					                .into_iter()
 | 
				
			||||||
                doc_mapping
 | 
					                .filter_map(|(range, link, ns)| {
 | 
				
			||||||
                    .map(range)
 | 
					                    doc_mapping
 | 
				
			||||||
                    .filter(|(mapping, _)| mapping.file_id == src_file_id)
 | 
					                        .map(range)
 | 
				
			||||||
                    .and_then(|(InFile { value: mapped_range, .. }, attr_id)| {
 | 
					                        .filter(|(mapping, _)| mapping.file_id == src_file_id)
 | 
				
			||||||
                        Some(mapped_range).zip(resolve_doc_path_for_def(
 | 
					                        .and_then(|(InFile { value: mapped_range, .. }, attr_id)| {
 | 
				
			||||||
                            sema.db,
 | 
					                            Some(mapped_range).zip(resolve_doc_path_for_def(
 | 
				
			||||||
                            def,
 | 
					                                sema.db,
 | 
				
			||||||
                            &link,
 | 
					                                def,
 | 
				
			||||||
                            ns,
 | 
					                                &link,
 | 
				
			||||||
                            attr_id.is_inner_attr(),
 | 
					                                ns,
 | 
				
			||||||
                        ))
 | 
					                                attr_id.is_inner_attr(),
 | 
				
			||||||
                    })
 | 
					                            ))
 | 
				
			||||||
            })
 | 
					                        })
 | 
				
			||||||
            .for_each(|(range, def)| {
 | 
					 | 
				
			||||||
                hl.add(HlRange {
 | 
					 | 
				
			||||||
                    range,
 | 
					 | 
				
			||||||
                    highlight: module_def_to_hl_tag(def)
 | 
					 | 
				
			||||||
                        | HlMod::Documentation
 | 
					 | 
				
			||||||
                        | HlMod::Injected
 | 
					 | 
				
			||||||
                        | HlMod::IntraDocLink,
 | 
					 | 
				
			||||||
                    binding_hash: None,
 | 
					 | 
				
			||||||
                })
 | 
					                })
 | 
				
			||||||
            });
 | 
					                .for_each(|(range, def)| {
 | 
				
			||||||
 | 
					                    hl.add(HlRange {
 | 
				
			||||||
 | 
					                        range,
 | 
				
			||||||
 | 
					                        highlight: module_def_to_hl_tag(def)
 | 
				
			||||||
 | 
					                            | HlMod::Documentation
 | 
				
			||||||
 | 
					                            | HlMod::Injected
 | 
				
			||||||
 | 
					                            | HlMod::IntraDocLink,
 | 
				
			||||||
 | 
					                        binding_hash: None,
 | 
				
			||||||
 | 
					                    })
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Extract doc-test sources from the docs and calculate highlighting for them.
 | 
					    // Extract doc-test sources from the docs and calculate highlighting for them.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue