]> git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/auxiliary/deprecation-lint.rs
New upstream version 1.23.0+dfsg1
[rustc.git] / src / test / compile-fail / auxiliary / deprecation-lint.rs
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
11 #![feature(deprecated)]
12
13 #[deprecated(since = "1.0.0", note = "text")]
14 pub fn deprecated() {}
15 #[deprecated(since = "1.0.0", note = "text")]
16 pub fn deprecated_text() {}
17
18 pub struct MethodTester;
19
20 impl MethodTester {
21 #[deprecated(since = "1.0.0", note = "text")]
22 pub fn method_deprecated(&self) {}
23 #[deprecated(since = "1.0.0", note = "text")]
24 pub fn method_deprecated_text(&self) {}
25 }
26
27 pub trait Trait {
28 #[deprecated(since = "1.0.0", note = "text")]
29 fn trait_deprecated(&self) {}
30 #[deprecated(since = "1.0.0", note = "text")]
31 fn trait_deprecated_text(&self) {}
32 }
33
34 #[deprecated(since = "1.0.0", note = "text")]
35 pub trait DeprecatedTrait { fn dummy(&self) { } }
36
37 impl Trait for MethodTester {}
38
39 #[deprecated(since = "1.0.0", note = "text")]
40 pub struct DeprecatedStruct {
41 pub i: isize
42 }
43
44 #[deprecated(since = "1.0.0", note = "text")]
45 pub struct DeprecatedUnitStruct;
46
47 pub enum Enum {
48 #[deprecated(since = "1.0.0", note = "text")]
49 DeprecatedVariant,
50 }
51
52 #[deprecated(since = "1.0.0", note = "text")]
53 pub struct DeprecatedTupleStruct(pub isize);
54
55 pub mod nested {
56 #[deprecated(since = "1.0.0", note = "text")]
57 pub struct DeprecatedStruct {
58 pub i: isize
59 }
60
61 #[deprecated(since = "1.0.0", note = "text")]
62 pub struct DeprecatedUnitStruct;
63
64 pub enum Enum {
65 #[deprecated(since = "1.0.0", note = "text")]
66 DeprecatedVariant,
67 }
68
69 #[deprecated(since = "1.0.0", note = "text")]
70 pub struct DeprecatedTupleStruct(pub isize);
71 }
72
73 pub struct Stable {
74 #[deprecated(since = "1.0.0", note = "text")]
75 pub override2: u8,
76 }
77
78 pub struct Stable2(pub u8, pub u8, #[deprecated(since = "1.0.0", note = "text")] pub u8);
79
80 #[deprecated(since = "1.0.0", note = "text")]
81 pub struct Deprecated {
82 pub inherit: u8,
83 }
84
85 #[deprecated(since = "1.0.0", note = "text")]
86 pub struct Deprecated2(pub u8,
87 pub u8,
88 pub u8);
89
90 #[deprecated(since = "1.0.0", note = "text")]
91 pub mod deprecated_mod {
92 pub fn deprecated() {}
93 }
94
95 #[macro_export]
96 macro_rules! macro_test {
97 () => (deprecated());
98 }
99
100 #[macro_export]
101 macro_rules! macro_test_arg {
102 ($func:expr) => ($func);
103 }
104
105 #[macro_export]
106 macro_rules! macro_test_arg_nested {
107 ($func:ident) => (macro_test_arg!($func()));
108 }