Skip to content

Commit e24a017

Browse files
Only skip impls of foreign unstable traits
Previously unstable impls were skipped, which meant that any impl with an unstable method would get skipped.
1 parent d7f9451 commit e24a017

File tree

3 files changed

+42
-3
lines changed

3 files changed

+42
-3
lines changed

src/librustdoc/clean/inline.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,11 @@ pub fn build_impl(
346346
// such. This helps prevent dependencies of the standard library, for
347347
// example, from getting documented as "traits `u32` implements" which
348348
// isn't really too helpful.
349-
if let Some(stab) = cx.tcx.lookup_stability(did) {
350-
if stab.level.is_unstable() {
351-
return;
349+
if let Some(trait_did) = associated_trait {
350+
if let Some(stab) = cx.tcx.lookup_stability(trait_did.def_id) {
351+
if stab.level.is_unstable() {
352+
return;
353+
}
352354
}
353355
}
354356
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#![feature(staged_api)]
2+
#![stable(feature = "private_general", since = "1.0.0")]
3+
4+
#[unstable(feature = "private_trait", issue = "none")]
5+
pub trait Bar {}
6+
7+
#[stable(feature = "private_general", since = "1.0.0")]
8+
pub struct Foo {
9+
// nothing
10+
}
11+
12+
impl Foo {
13+
#[stable(feature = "private_general", since = "1.0.0")]
14+
pub fn stable_impl() {}
15+
}
16+
17+
impl Foo {
18+
#[unstable(feature = "private_trait", issue = "none")]
19+
pub fn bar() {}
20+
21+
#[stable(feature = "private_general", since = "1.0.0")]
22+
pub fn bar2() {}
23+
}
24+
25+
#[stable(feature = "private_general", since = "1.0.0")]
26+
impl Bar for Foo {}
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// aux-build:unstable-trait.rs
2+
3+
#![crate_name = "foo"]
4+
#![feature(private_trait)]
5+
6+
extern crate unstable_trait;
7+
8+
// @has foo/struct.Foo.html 'bar'
9+
// @has foo/struct.Foo.html 'bar2'
10+
#[doc(inline)]
11+
pub use unstable_trait::Foo;

0 commit comments

Comments
 (0)