rustdoc: Don't try to load source files from external crates
Local items defined in external macros shouldn't generate rendered source files and should link to the external crate's docs instead.
This commit is contained in:
parent
607b858236
commit
6f96dc221c
8 changed files with 47 additions and 7 deletions
15
src/test/rustdoc/auxiliary/external-macro-src.rs
Normal file
15
src/test/rustdoc/auxiliary/external-macro-src.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// compile-flags:--remap-path-prefix={{src-base}}=/does-not-exist
|
||||
|
||||
#![doc(html_root_url = "https://example.com/")]
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! make_foo {
|
||||
() => {
|
||||
pub struct Foo;
|
||||
impl Foo {
|
||||
pub fn new() -> Foo {
|
||||
Foo
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
src/test/rustdoc/external-macro-src.rs
Normal file
15
src/test/rustdoc/external-macro-src.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// aux-build:external-macro-src.rs
|
||||
// ignore-tidy-linelength
|
||||
|
||||
#![crate_name = "foo"]
|
||||
|
||||
#[macro_use]
|
||||
extern crate external_macro_src;
|
||||
|
||||
// @has foo/index.html '//a[@href="../src/foo/external-macro-src.rs.html#4-15"]' '[src]'
|
||||
|
||||
// @has foo/struct.Foo.html
|
||||
// @has - '//a[@href="https://example.com/src/external_macro_src/external-macro-src.rs.html#8"]' '[src]'
|
||||
// @has - '//a[@href="https://example.com/src/external_macro_src/external-macro-src.rs.html#9-13"]' '[src]'
|
||||
// @has - '//a[@href="https://example.com/src/external_macro_src/external-macro-src.rs.html#10-12"]' '[src]'
|
||||
make_foo!();
|
||||
|
|
@ -7,5 +7,5 @@
|
|||
extern crate issue_26606_macro;
|
||||
|
||||
// @has issue_26606/constant.FOO.html
|
||||
// @has - '//a/@href' '../src/issue_26606/auxiliary/issue-26606-macro.rs.html#3'
|
||||
// @has - '//a/@href' '../src/issue_26606_macro/issue-26606-macro.rs.html#3'
|
||||
make_item!(FOO);
|
||||
|
|
|
|||
6
src/test/rustdoc/thread-local-src.rs
Normal file
6
src/test/rustdoc/thread-local-src.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#![crate_name = "foo"]
|
||||
|
||||
// @has foo/index.html '//a[@href="../src/foo/thread-local-src.rs.html#1-6"]' '[src]'
|
||||
|
||||
// @has foo/constant.FOO.html '//a/@href' 'https://doc.rust-lang.org/nightly/src/std/'
|
||||
thread_local!(pub static FOO: bool = false);
|
||||
Loading…
Add table
Add a link
Reference in a new issue