/src/test/compile-fail/auxiliary/inherited_stability.rs

https://gitlab.com/alx741/rust · Rust · 56 lines · 37 code · 10 blank · 9 comment · 1 complexity · 7266161ab7807bdf7b1624bb56eaeb60 MD5 · raw file

  1. // Copyright 2014 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. #![crate_name="inherited_stability"]
  11. #![crate_type = "lib"]
  12. #![unstable(feature = "test_feature", issue = "0")]
  13. #![feature(staged_api)]
  14. pub fn unstable() {}
  15. #[stable(feature = "rust1", since = "1.0.0")]
  16. pub fn stable() {}
  17. #[stable(feature = "rust1", since = "1.0.0")]
  18. pub mod stable_mod {
  19. #[unstable(feature = "test_feature", issue = "0")]
  20. pub fn unstable() {}
  21. #[stable(feature = "rust1", since = "1.0.0")]
  22. pub fn stable() {}
  23. }
  24. #[unstable(feature = "test_feature", issue = "0")]
  25. pub mod unstable_mod {
  26. #[stable(feature = "test_feature", since = "1.0.0")]
  27. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  28. pub fn deprecated() {}
  29. pub fn unstable() {}
  30. }
  31. #[stable(feature = "rust1", since = "1.0.0")]
  32. pub trait Stable {
  33. #[unstable(feature = "test_feature", issue = "0")]
  34. fn unstable(&self);
  35. #[stable(feature = "rust1", since = "1.0.0")]
  36. fn stable(&self);
  37. }
  38. impl Stable for usize {
  39. fn unstable(&self) {}
  40. fn stable(&self) {}
  41. }
  42. pub enum Unstable {
  43. UnstableVariant,
  44. #[stable(feature = "rust1", since = "1.0.0")]
  45. StableVariant
  46. }