Skip to content

Commit 627b1e8

Browse files
committed
add test for nested deprecated
1 parent 98fe30b commit 627b1e8

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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]
15+
fn issue_35128() {
16+
format_args!("foo");
17+
}
18+
19+
#[deprecated]
20+
fn issue_35128_minimal() {
21+
static FOO: &'static str = "foo";
22+
let _ = FOO;
23+
}
24+
25+
#[deprecated]
26+
mod 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]
51+
mod 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+
81+
fn main() {}

0 commit comments

Comments
 (0)