File tree Expand file tree Collapse file tree 4 files changed +13
-11
lines changed Expand file tree Collapse file tree 4 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -1967,18 +1967,23 @@ impl Clean<Span> for rustc_span::Span {
19671967 return Span :: empty ( ) ;
19681968 }
19691969
1970+ // Get the macro invocation instead of the definition,
1971+ // in case the span is result of a macro expansion.
1972+ // (See rust-lang/rust#39726)
1973+ let span = self . source_callsite ( ) ;
1974+
19701975 let sm = cx. sess ( ) . source_map ( ) ;
1971- let filename = sm. span_to_filename ( * self ) ;
1972- let lo = sm. lookup_char_pos ( self . lo ( ) ) ;
1973- let hi = sm. lookup_char_pos ( self . hi ( ) ) ;
1976+ let filename = sm. span_to_filename ( span ) ;
1977+ let lo = sm. lookup_char_pos ( span . lo ( ) ) ;
1978+ let hi = sm. lookup_char_pos ( span . hi ( ) ) ;
19741979 Span {
19751980 filename,
19761981 cnum : lo. file . cnum ,
19771982 loline : lo. line ,
19781983 locol : lo. col . to_usize ( ) ,
19791984 hiline : hi. line ,
19801985 hicol : hi. col . to_usize ( ) ,
1981- original : * self ,
1986+ original : span ,
19821987 }
19831988 }
19841989}
Original file line number Diff line number Diff line change 11// aux-build:external-macro-src.rs
2- // ignore-tidy-linelength
32
43#![ crate_name = "foo" ]
54
65#[ macro_use]
76extern crate external_macro_src;
87
9- // @has foo/index.html '//a[@href="../src/foo/external-macro-src.rs.html#4-15 "]' '[src]'
8+ // @has foo/index.html '//a[@href="../src/foo/external-macro-src.rs.html#3-12 "]' '[src]'
109
1110// @has foo/struct.Foo.html
12- // @has - '//a[@href="https://example.com/src/external_macro_src/external-macro-src.rs.html#8"]' '[src]'
13- // @has - '//a[@href="https://example.com/src/external_macro_src/external-macro-src.rs.html#9-13"]' '[src]'
14- // @has - '//a[@href="https://example.com/src/external_macro_src/external-macro-src.rs.html#10-12"]' '[src]'
11+ // @has - '//a[@href="../src/foo/external-macro-src.rs.html#12"]' '[src]'
1512make_foo ! ( ) ;
Original file line number Diff line number Diff line change 77extern crate issue_26606_macro;
88
99// @has issue_26606/constant.FOO.html
10- // @has - '//a/ @href' ' ../src/issue_26606_macro /issue-26606-macro .rs.html#3 '
10+ // @has - '//a[ @href=" ../src/issue_26606 /issue-26606.rs.html#11"]' '[src] '
1111make_item ! ( FOO ) ;
Original file line number Diff line number Diff line change 22
33// @has foo/index.html '//a[@href="../src/foo/thread-local-src.rs.html#1-6"]' '[src]'
44
5- // @has foo/constant.FOO.html '//a/ @href' 'https://doc.rust-lang.org/nightly/ src/std/ '
5+ // @has foo/constant.FOO.html '//a[ @href="../ src/foo/thread-local-src.rs.html#6"]' '[src] '
66thread_local ! ( pub static FOO : bool = false ) ;
You can’t perform that action at this time.
0 commit comments