Rollup merge of #78908 - liketechnik:fix_macro_expand_src_link, r=jyn514
(rustdoc) [src] link for types defined by macros shows invocation, not defintion
Previously the [src] link on types defined by a macro pointed to the macro definition.
This pr makes the Clean-Implementation for Spans aware of macro defined types, so that the link points to the invocation instead.
I'm not totally sure if it's okay to add the 'macro awareness' in the Clean-Implementation, because it erases that knowledge for all following code. Maybe it would be more sensible to add the check only for the link generation at 25f6938da4/src/librustdoc/html/render/mod.rs (L1619)
Closes #39726.
This commit is contained in:
commit
a5f549eeb5
4 changed files with 13 additions and 11 deletions
|
|
@ -1,15 +1,12 @@
|
|||
// 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/index.html '//a[@href="../src/foo/external-macro-src.rs.html#3-12"]' '[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]'
|
||||
// @has - '//a[@href="../src/foo/external-macro-src.rs.html#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_macro/issue-26606-macro.rs.html#3'
|
||||
// @has - '//a[@href="../src/issue_26606/issue-26606.rs.html#11"]' '[src]'
|
||||
make_item!(FOO);
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@
|
|||
|
||||
// @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/'
|
||||
// @has foo/constant.FOO.html '//a[@href="../src/foo/thread-local-src.rs.html#6"]' '[src]'
|
||||
thread_local!(pub static FOO: bool = false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue