Skip to content

Commit e73941a

Browse files
committed
rustdoc: Fix missing stability and src links for inlined external macros
1 parent 4a9c58c commit e73941a

File tree

3 files changed

+52
-3
lines changed

3 files changed

+52
-3
lines changed

src/librustdoc/visit_ast.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,10 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> {
244244
def_id,
245245
attrs: def.attrs.clone().into(),
246246
name: def.ident.name,
247-
whence: def.span,
247+
whence: self.cx.tcx.def_span(def_id),
248248
matchers,
249-
stab: self.stability(def.id),
250-
depr: self.deprecation(def.id),
249+
stab: self.cx.tcx.lookup_stability(def_id).cloned(),
250+
depr: self.cx.tcx.lookup_deprecation(def_id),
251251
imported_from: Some(imported_from),
252252
})
253253
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2018 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+
#![feature(staged_api)]
12+
13+
#![stable(feature = "rust1", since = "1.0.0")]
14+
15+
/// docs for my_macro
16+
#[unstable(feature = "macro_test", issue = "0")]
17+
#[rustc_deprecated(since = "1.2.3", reason = "text")]
18+
#[macro_export]
19+
macro_rules! my_macro {
20+
() => ()
21+
}
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2018 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:macros.rs
12+
// build-aux-docs
13+
14+
#![feature(macro_test)]
15+
#![feature(use_extern_macros)]
16+
17+
#![crate_name = "foo"]
18+
19+
extern crate macros;
20+
21+
// @has foo/index.html '//*[@class="docblock-short"]' '[Deprecated] [Experimental]'
22+
23+
// @has foo/macro.my_macro.html
24+
// @has - '//*[@class="docblock"]' 'docs for my_macro'
25+
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.2.3: text'
26+
// @has - '//*[@class="stab unstable"]' 'macro_test'
27+
// @has - '//a/@href' '../src/macros/macros.rs.html#19-21'
28+
pub use macros::my_macro;

0 commit comments

Comments
 (0)