@@ -487,19 +487,23 @@ fn get_doc_base_urls(
487487let 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
493498if 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 ( ) ;
495500let system_link = system_doc. and_then ( |it| it. join ( "core/" ) . ok ( ) ) ;
496501return ( web_link, system_link) ;
497502} ;
498503
499- let Some ( krate) =def . krate ( db ) else { return Default :: default ( ) } ;
504+ let Some ( krate) = krateelse { return Default :: default ( ) } ;
500505let Some ( display_name) = krate. display_name ( db) else { return Default :: default ( ) } ;
501506let crate_data =& db. crate_graph ( ) [ krate. into ( ) ] ;
502- let channel = db. toolchain_channel ( krate. into ( ) ) . unwrap_or ( ReleaseChannel :: Nightly ) . as_str ( ) ;
503507
504508let ( 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.