]> git.proxmox.com Git - rustc.git/blame - src/test/compile-fail/deprecation-lint-nested.rs
New upstream version 1.24.1+dfsg1
[rustc.git] / src / test / compile-fail / deprecation-lint-nested.rs
CommitLineData
5bcae85e
SL
1// Copyright 2016 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#![deny(deprecated)]
12#![allow(warnings)]
13
14#[deprecated]
15fn issue_35128() {
16 format_args!("foo");
17}
18
19#[deprecated]
20fn issue_35128_minimal() {
21 static FOO: &'static str = "foo";
22 let _ = FOO;
23}
24
25#[deprecated]
26mod silent {
27 type DeprecatedType = u8;
28 struct DeprecatedStruct;
29 fn deprecated_fn() {}
30 trait DeprecatedTrait {}
31 static DEPRECATED_STATIC: u8 = 0;
32 const DEPRECATED_CONST: u8 = 1;
33
34 struct Foo(DeprecatedType);
35
36 impl DeprecatedTrait for Foo {}
37
38 impl Foo {
39 fn bar<T: DeprecatedTrait>() {
40 deprecated_fn();
41 }
42 }
43
44 fn foo() -> u8 {
45 DEPRECATED_STATIC +
46 DEPRECATED_CONST
47 }
48}
49
50#[deprecated]
51mod loud {
52 #[deprecated]
53 type DeprecatedType = u8;
54 #[deprecated]
55 struct DeprecatedStruct;
56 #[deprecated]
57 fn deprecated_fn() {}
58 #[deprecated]
59 trait DeprecatedTrait {}
60 #[deprecated]
61 static DEPRECATED_STATIC: u8 = 0;
62 #[deprecated]
63 const DEPRECATED_CONST: u8 = 1;
64
65 struct Foo(DeprecatedType); //~ ERROR use of deprecated item
66
67 impl DeprecatedTrait for Foo {} //~ ERROR use of deprecated item
68
69 impl Foo {
70 fn bar<T: DeprecatedTrait>() { //~ ERROR use of deprecated item
71 deprecated_fn(); //~ ERROR use of deprecated item
72 }
73 }
74
75 fn foo() -> u8 {
76 DEPRECATED_STATIC + //~ ERROR use of deprecated item
77 DEPRECATED_CONST //~ ERROR use of deprecated item
78 }
79}
80
81fn main() {}