@@ -467,17 +467,24 @@ fn map_links<'e>(
467
467
/// ```
468
468
fn get_doc_base_url ( db : & RootDatabase , krate : & Crate ) -> Option < Url > {
469
469
let display_name = krate. display_name ( db) ?;
470
- krate
471
- . get_html_root_url ( db)
472
- . or_else ( || {
473
- // Fallback to docs.rs. This uses `display_name` and can never be
474
- // correct, but that's what fallbacks are about.
475
- //
476
- // FIXME: clicking on the link should just open the file in the editor,
477
- // instead of falling back to external urls.
478
- Some ( format ! ( "https://docs.rs/{krate}/*/" , krate = display_name) )
479
- } )
480
- . and_then ( |s| Url :: parse ( & s) . ok ( ) ?. join ( & format ! ( "{}/" , display_name) ) . ok ( ) )
470
+ let base = match & * * display_name. crate_name ( ) {
471
+ // std and co do not specify `html_root_url` any longer so we gotta handwrite this ourself.
472
+ // FIXME: Use the toolchains channel instead of nightly
473
+ name @ ( "core" | "std" | "alloc" | "proc_macro" | "test" ) => {
474
+ format ! ( "https://doc.rust-lang.org/nightly/{}" , name)
475
+ }
476
+ _ => {
477
+ krate. get_html_root_url ( db) . or_else ( || {
478
+ // Fallback to docs.rs. This uses `display_name` and can never be
479
+ // correct, but that's what fallbacks are about.
480
+ //
481
+ // FIXME: clicking on the link should just open the file in the editor,
482
+ // instead of falling back to external urls.
483
+ Some ( format ! ( "https://docs.rs/{krate}/*/" , krate = display_name) )
484
+ } ) ?
485
+ }
486
+ } ;
487
+ Url :: parse ( & base) . ok ( ) ?. join ( & format ! ( "{}/" , display_name) ) . ok ( )
481
488
}
482
489
483
490
/// Get the filename and extension generated for a symbol by rustdoc.
0 commit comments