File tree 3 files changed +46
-5
lines changed
3 files changed +46
-5
lines changed Original file line number Diff line number Diff line change @@ -1501,11 +1501,17 @@ impl<'a> Item<'a> {
1501
1501
true , |component| {
1502
1502
path. push ( component. to_string ( ) ) ;
1503
1503
} ) ;
1504
- Some ( format ! ( "{root}src/{krate}/{path}.html#{href}" ,
1505
- root = self . cx. root_path,
1506
- krate = self . cx. layout. krate,
1507
- path = path. join( "/" ) ,
1508
- href = href) )
1504
+ // If the span points into an external macro the
1505
+ // source-file will be bogus, i.e `<foo macros>`
1506
+ if Path :: new ( & self . item . source . filename ) . is_file ( ) {
1507
+ Some ( format ! ( "{root}src/{krate}/{path}.html#{href}" ,
1508
+ root = self . cx. root_path,
1509
+ krate = self . cx. layout. krate,
1510
+ path = path. join( "/" ) ,
1511
+ href = href) )
1512
+ } else {
1513
+ None
1514
+ }
1509
1515
1510
1516
// If this item is not part of the local crate, then things get a little
1511
1517
// trickier. We don't actually know the span of the external item, but
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ #[ macro_export]
12
+ macro_rules! make_item (
13
+ ( $name: ident) => ( pub const $name: usize = 42 ; )
14
+ ) ;
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // aux-build:issue-26606-macro.rs
12
+ // ignore-cross-compile
13
+ // build-aux-docs
14
+
15
+ // @has issue_26606_macro/macro.make_item!.html
16
+ #[ macro_use]
17
+ extern crate issue_26606_macro;
18
+
19
+ // @has issue_26606/constant.FOO.html
20
+ // @!has - '//a/@href' '../src/'
21
+ make_item ! ( FOO ) ;
You can’t perform that action at this time.
0 commit comments