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

https://gitlab.com/alx741/rust · Rust · 179 lines · 146 code · 24 blank · 9 comment · 1 complexity · a1044b975399ea4ddb88309b6ea0a688 MD5 · raw file

  1. // Copyright 2013 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="lint_stability"]
  11. #![crate_type = "lib"]
  12. #![feature(staged_api)]
  13. #![stable(feature = "lint_stability", since = "1.0.0")]
  14. #[stable(feature = "test_feature", since = "1.0.0")]
  15. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  16. pub fn deprecated() {}
  17. #[stable(feature = "test_feature", since = "1.0.0")]
  18. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  19. pub fn deprecated_text() {}
  20. #[unstable(feature = "test_feature", issue = "0")]
  21. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  22. pub fn deprecated_unstable() {}
  23. #[unstable(feature = "test_feature", issue = "0")]
  24. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  25. pub fn deprecated_unstable_text() {}
  26. #[unstable(feature = "test_feature", issue = "0")]
  27. pub fn unstable() {}
  28. #[unstable(feature = "test_feature", reason = "text", issue = "0")]
  29. pub fn unstable_text() {}
  30. #[stable(feature = "rust1", since = "1.0.0")]
  31. pub fn stable() {}
  32. #[stable(feature = "rust1", since = "1.0.0")]
  33. pub fn stable_text() {}
  34. #[stable(feature = "rust1", since = "1.0.0")]
  35. pub struct MethodTester;
  36. impl MethodTester {
  37. #[stable(feature = "test_feature", since = "1.0.0")]
  38. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  39. pub fn method_deprecated(&self) {}
  40. #[stable(feature = "test_feature", since = "1.0.0")]
  41. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  42. pub fn method_deprecated_text(&self) {}
  43. #[unstable(feature = "test_feature", issue = "0")]
  44. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  45. pub fn method_deprecated_unstable(&self) {}
  46. #[unstable(feature = "test_feature", issue = "0")]
  47. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  48. pub fn method_deprecated_unstable_text(&self) {}
  49. #[unstable(feature = "test_feature", issue = "0")]
  50. pub fn method_unstable(&self) {}
  51. #[unstable(feature = "test_feature", reason = "text", issue = "0")]
  52. pub fn method_unstable_text(&self) {}
  53. #[stable(feature = "rust1", since = "1.0.0")]
  54. pub fn method_stable(&self) {}
  55. #[stable(feature = "rust1", since = "1.0.0")]
  56. pub fn method_stable_text(&self) {}
  57. }
  58. #[stable(feature = "test_feature", since = "1.0.0")]
  59. pub trait Trait {
  60. #[stable(feature = "test_feature", since = "1.0.0")]
  61. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  62. fn trait_deprecated(&self) {}
  63. #[stable(feature = "test_feature", since = "1.0.0")]
  64. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  65. fn trait_deprecated_text(&self) {}
  66. #[unstable(feature = "test_feature", issue = "0")]
  67. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  68. fn trait_deprecated_unstable(&self) {}
  69. #[unstable(feature = "test_feature", issue = "0")]
  70. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  71. fn trait_deprecated_unstable_text(&self) {}
  72. #[unstable(feature = "test_feature", issue = "0")]
  73. fn trait_unstable(&self) {}
  74. #[unstable(feature = "test_feature", reason = "text", issue = "0")]
  75. fn trait_unstable_text(&self) {}
  76. #[stable(feature = "rust1", since = "1.0.0")]
  77. fn trait_stable(&self) {}
  78. #[stable(feature = "rust1", since = "1.0.0")]
  79. fn trait_stable_text(&self) {}
  80. }
  81. #[stable(feature = "test_feature", since = "1.0.0")]
  82. impl Trait for MethodTester {}
  83. #[unstable(feature = "test_feature", issue = "0")]
  84. pub trait UnstableTrait { fn dummy(&self) { } }
  85. #[stable(feature = "test_feature", since = "1.0.0")]
  86. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  87. pub trait DeprecatedTrait {
  88. #[stable(feature = "test_feature", since = "1.0.0")] fn dummy(&self) { }
  89. }
  90. #[stable(feature = "test_feature", since = "1.0.0")]
  91. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  92. pub struct DeprecatedStruct {
  93. #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
  94. }
  95. #[unstable(feature = "test_feature", issue = "0")]
  96. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  97. pub struct DeprecatedUnstableStruct {
  98. #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
  99. }
  100. #[unstable(feature = "test_feature", issue = "0")]
  101. pub struct UnstableStruct {
  102. #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
  103. }
  104. #[stable(feature = "rust1", since = "1.0.0")]
  105. pub struct StableStruct {
  106. #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
  107. }
  108. #[stable(feature = "test_feature", since = "1.0.0")]
  109. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  110. pub struct DeprecatedUnitStruct;
  111. #[unstable(feature = "test_feature", issue = "0")]
  112. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  113. pub struct DeprecatedUnstableUnitStruct;
  114. #[unstable(feature = "test_feature", issue = "0")]
  115. pub struct UnstableUnitStruct;
  116. #[stable(feature = "rust1", since = "1.0.0")]
  117. pub struct StableUnitStruct;
  118. #[stable(feature = "test_feature", since = "1.0.0")]
  119. pub enum Enum {
  120. #[stable(feature = "test_feature", since = "1.0.0")]
  121. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  122. DeprecatedVariant,
  123. #[unstable(feature = "test_feature", issue = "0")]
  124. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  125. DeprecatedUnstableVariant,
  126. #[unstable(feature = "test_feature", issue = "0")]
  127. UnstableVariant,
  128. #[stable(feature = "rust1", since = "1.0.0")]
  129. StableVariant,
  130. }
  131. #[stable(feature = "test_feature", since = "1.0.0")]
  132. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  133. pub struct DeprecatedTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
  134. #[unstable(feature = "test_feature", issue = "0")]
  135. #[rustc_deprecated(since = "1.0.0", reason = "text")]
  136. pub struct DeprecatedUnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
  137. #[unstable(feature = "test_feature", issue = "0")]
  138. pub struct UnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
  139. #[stable(feature = "rust1", since = "1.0.0")]
  140. pub struct StableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
  141. #[stable(feature = "test_feature", since = "1.0.0")]
  142. #[macro_export]
  143. macro_rules! macro_test {
  144. () => (deprecated());
  145. }
  146. #[stable(feature = "test_feature", since = "1.0.0")]
  147. #[macro_export]
  148. macro_rules! macro_test_arg {
  149. ($func:expr) => ($func);
  150. }
  151. #[stable(feature = "test_feature", since = "1.0.0")]
  152. #[macro_export]
  153. macro_rules! macro_test_arg_nested {
  154. ($func:ident) => (macro_test_arg!($func()));
  155. }