Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitecadf37

Browse files
committed
Auto merge of#17284 - Veykril:doc-links, r=Veykril
fix: Use correct toolchain channel when generating builtin type doc links
2 parents6e8646d +616fdd0 commitecadf37

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

‎src/tools/rust-analyzer/crates/ide/src/doc_links.rs‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff 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
ifletDefinition::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-
letSome(krate) =def.krate(db)else{returnDefault::default()};
504+
letSome(krate) = krateelse{returnDefault::default()};
500505
letSome(display_name) = krate.display_name(db)else{returnDefault::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.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp