Skip to content

Commit 7831b2b

Browse files
committed
Test for Builtin Type
1 parent bfafcd4 commit 7831b2b

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

crates/ide/src/doc_links.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ fn get_doc_base_urls(
473473
// https://github.com/rust-lang/rust-analyzer/issues/12250
474474
if let Definition::BuiltinType(..) = def {
475475
let weblink = Url::parse("https://doc.rust-lang.org/nightly/core/").ok();
476-
return (weblink, local_doc_path);
476+
return (weblink, None);
477477
};
478478

479479
let Some(krate) = def.krate(db) else { return Default::default() };

crates/ide/src/doc_links/tests.rs

+13
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,19 @@ fn node_to_def(
119119
})
120120
}
121121

122+
#[test]
123+
fn external_docs_doc_builtin_type() {
124+
check_external_docs(
125+
r#"
126+
//- /main.rs crate:foo
127+
let x: u3$02 = 0;
128+
"#,
129+
Some(&OsStr::new("/home/user/project")),
130+
Some(expect![[r#"https://doc.rust-lang.org/nightly/core/primitive.u32.html"#]]),
131+
None,
132+
);
133+
}
134+
122135
#[test]
123136
fn external_docs_doc_url_crate() {
124137
check_external_docs(

0 commit comments

Comments
 (0)