Only skip impls of foreign unstable traits
Previously unstable impls were skipped, which meant that any impl with an unstable method would get skipped.
This commit is contained in:
parent
d7f9451634
commit
e24a0172b0
3 changed files with 42 additions and 3 deletions
|
@ -346,12 +346,14 @@ pub fn build_impl(
|
|||
// such. This helps prevent dependencies of the standard library, for
|
||||
// example, from getting documented as "traits `u32` implements" which
|
||||
// isn't really too helpful.
|
||||
if let Some(stab) = cx.tcx.lookup_stability(did) {
|
||||
if let Some(trait_did) = associated_trait {
|
||||
if let Some(stab) = cx.tcx.lookup_stability(trait_did.def_id) {
|
||||
if stab.level.is_unstable() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let for_ = if let Some(did) = did.as_local() {
|
||||
let hir_id = tcx.hir().as_local_hir_id(did);
|
||||
|
|
26
src/test/rustdoc/auxiliary/unstable-trait.rs
Normal file
26
src/test/rustdoc/auxiliary/unstable-trait.rs
Normal file
|
@ -0,0 +1,26 @@
|
|||
#![feature(staged_api)]
|
||||
#![stable(feature = "private_general", since = "1.0.0")]
|
||||
|
||||
#[unstable(feature = "private_trait", issue = "none")]
|
||||
pub trait Bar {}
|
||||
|
||||
#[stable(feature = "private_general", since = "1.0.0")]
|
||||
pub struct Foo {
|
||||
// nothing
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
#[stable(feature = "private_general", since = "1.0.0")]
|
||||
pub fn stable_impl() {}
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
#[unstable(feature = "private_trait", issue = "none")]
|
||||
pub fn bar() {}
|
||||
|
||||
#[stable(feature = "private_general", since = "1.0.0")]
|
||||
pub fn bar2() {}
|
||||
}
|
||||
|
||||
#[stable(feature = "private_general", since = "1.0.0")]
|
||||
impl Bar for Foo {}
|
11
src/test/rustdoc/hide-unstable-trait.rs
Normal file
11
src/test/rustdoc/hide-unstable-trait.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
// aux-build:unstable-trait.rs
|
||||
|
||||
#![crate_name = "foo"]
|
||||
#![feature(private_trait)]
|
||||
|
||||
extern crate unstable_trait;
|
||||
|
||||
// @has foo/struct.Foo.html 'bar'
|
||||
// @has foo/struct.Foo.html 'bar2'
|
||||
#[doc(inline)]
|
||||
pub use unstable_trait::Foo;
|
Loading…
Add table
Add a link
Reference in a new issue