File tree 4 files changed +13
-11
lines changed
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 {
1967
1967
return Span :: empty ( ) ;
1968
1968
}
1969
1969
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
+
1970
1975
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 ( ) ) ;
1974
1979
Span {
1975
1980
filename,
1976
1981
cnum : lo. file . cnum ,
1977
1982
loline : lo. line ,
1978
1983
locol : lo. col . to_usize ( ) ,
1979
1984
hiline : hi. line ,
1980
1985
hicol : hi. col . to_usize ( ) ,
1981
- original : * self ,
1986
+ original : span ,
1982
1987
}
1983
1988
}
1984
1989
}
Original file line number Diff line number Diff line change 1
1
// aux-build:external-macro-src.rs
2
- // ignore-tidy-linelength
3
2
4
3
#![ crate_name = "foo" ]
5
4
6
5
#[ macro_use]
7
6
extern crate external_macro_src;
8
7
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]'
10
9
11
10
// @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]'
15
12
make_foo ! ( ) ;
Original file line number Diff line number Diff line change 7
7
extern crate issue_26606_macro;
8
8
9
9
// @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] '
11
11
make_item ! ( FOO ) ;
Original file line number Diff line number Diff line change 2
2
3
3
// @has foo/index.html '//a[@href="../src/foo/thread-local-src.rs.html#1-6"]' '[src]'
4
4
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] '
6
6
thread_local ! ( pub static FOO : bool = false ) ;
You can’t perform that action at this time.
0 commit comments