forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconsts.rs
More file actions
88 lines (66 loc) · 1.32 KB
/
consts.rs
File metadata and controls
88 lines (66 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//@ check-pass
//@ edition:2021
//@ rustc-env:CARGO_CRATE_NAME=non_local_def
#![warn(non_local_definitions)]
struct Test;
trait Uto {}
const Z: () = {
trait Uto1 {}
impl Uto1 for Test {} // the trait is local, don't lint
impl Uto for &Test {}
//~^ WARN non-local `impl` definition
};
trait Ano {}
const _: () = {
impl Ano for &Test {} // ignored since the parent is an anon-const
};
trait Uto2 {}
static A: u32 = {
impl Uto2 for Test {}
//~^ WARN non-local `impl` definition
1
};
trait Uto3 {}
const B: u32 = {
impl Uto3 for Test {}
//~^ WARN non-local `impl` definition
trait Uto4 {}
impl Uto4 for Test {}
1
};
trait Uto5 {}
fn main() {
impl Test {
//~^ WARN non-local `impl` definition
fn foo() {}
}
const {
impl Test {
//~^ WARN non-local `impl` definition
fn hoo() {}
}
1
};
const _: u32 = {
impl Test {
//~^ WARN non-local `impl` definition
fn foo2() {}
}
1
};
}
trait Uto9 {}
trait Uto10 {}
const _: u32 = {
let _a = || {
impl Uto9 for Test {}
//~^ WARN non-local `impl` definition
1
};
type A = [u32; {
impl Uto10 for Test {}
//~^ WARN non-local `impl` definition
1
}];
1
};