/src/test/compile-fail/missing-stability.rs

https://gitlab.com/pranith/rust · Rust · 33 lines · 14 code · 5 blank · 14 comment · 0 complexity · fc041afcea8c79b72d54c20143a2f2f7 MD5 · raw file

  1. // Copyright 2015 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. // Checks that exported items without stability attributes cause an error
  11. #![crate_type="lib"]
  12. #![feature(staged_api)]
  13. #![staged_api]
  14. pub fn unmarked() {
  15. //~^ ERROR This node does not have a stability attribute
  16. ()
  17. }
  18. #[unstable(feature = "foo")]
  19. pub mod foo {
  20. // #[unstable] is inherited
  21. pub fn unmarked() {}
  22. }
  23. #[stable(feature = "bar", since="1.0.0")]
  24. pub mod bar {
  25. // #[stable] is not inherited
  26. pub fn unmarked() {}
  27. //~^ ERROR This node does not have a stability attribute
  28. }