File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed 
src/tools/rust-analyzer/crates/ide/src Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -487,19 +487,23 @@ fn get_doc_base_urls(
487487    let  system_doc = sysroot
488488        . map ( |sysroot| format ! ( "file:///{sysroot}/share/doc/rust/html/" ) ) 
489489        . and_then ( |it| Url :: parse ( & it) . ok ( ) ) ; 
490+     let  krate = def. krate ( db) ; 
491+     let  channel = krate
492+         . and_then ( |krate| db. toolchain_channel ( krate. into ( ) ) ) 
493+         . unwrap_or ( ReleaseChannel :: Nightly ) 
494+         . as_str ( ) ; 
490495
491496    // special case base url of `BuiltinType` to core 
492497    // https://github.com/rust-lang/rust-analyzer/issues/12250 
493498    if  let  Definition :: BuiltinType ( ..)  = def { 
494-         let  web_link = Url :: parse ( "https://doc.rust-lang.org/nightly /core/" ) . ok ( ) ; 
499+         let  web_link = Url :: parse ( & format ! ( "https://doc.rust-lang.org/{channel} /core/" ) ) . ok ( ) ; 
495500        let  system_link = system_doc. and_then ( |it| it. join ( "core/" ) . ok ( ) ) ; 
496501        return  ( web_link,  system_link) ; 
497502    } ; 
498503
499-     let  Some ( krate)  = def . krate ( db )  else  {  return  Default :: default ( )  } ; 
504+     let  Some ( krate)  = krate else  {  return  Default :: default ( )  } ; 
500505    let  Some ( display_name)  = krate. display_name ( db)  else  {  return  Default :: default ( )  } ; 
501506    let  crate_data = & db. crate_graph ( ) [ krate. into ( ) ] ; 
502-     let  channel = db. toolchain_channel ( krate. into ( ) ) . unwrap_or ( ReleaseChannel :: Nightly ) . as_str ( ) ; 
503507
504508    let  ( web_base,  local_base)  = match  & crate_data. origin  { 
505509        // std and co do not specify `html_root_url` any longer so we gotta handwrite this ourself. 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments