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:
Oliver Middleton 2020-04-05 22:37:06 +01:00
parent 607b858236
commit 6f96dc221c
8 changed files with 47 additions and 7 deletions

View 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
}
}
}
}

View 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!();

View file

@ -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);

View 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);