Manishearth · GitHub

stability.rs:

#![crate_type="lib"]
#![feature(staged_api)]
#![staged_api]
#![stable(feature = "stability", since = "1.0.0")]
mod foo {
   #[derive(Copy)]
   pub struct Bar;
}
#[unstable(feature="foobar")]
pub mod foobar {
    pub use super::foo::*;
}

test.rs:

extern crate stability;
use stability::foobar::Bar;
fn main(){
   let x = Bar; //~ ERROR use of unmarked library feature
}

#[unstable] is inherited through mods (only #[stable] isn't inherited). However, in this particular case, the inheritance doesn't cross the reexport.

A more concrete example is the hash_state module. Chris fixed the stability of its items in this PR, however the module itself was private and reexported as an #[unstable] module before the PR. Yet, usage of items within the hash_state module were broken before the PR.

This seems wrong, #[unstable] (and the others, except #[stable]) should be inherited down pub uses.

cc @brson

Read the original on github.com ↗