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

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