diff options
Diffstat (limited to 'crates/hir_def/src')
-rw-r--r-- | crates/hir_def/src/body/tests.rs | 33 | ||||
-rw-r--r-- | crates/hir_def/src/nameres/tests/diagnostics.rs | 42 |
2 files changed, 0 insertions, 75 deletions
diff --git a/crates/hir_def/src/body/tests.rs b/crates/hir_def/src/body/tests.rs index d4fae05a6..075dcc6d2 100644 --- a/crates/hir_def/src/body/tests.rs +++ b/crates/hir_def/src/body/tests.rs | |||
@@ -89,39 +89,6 @@ mod m { | |||
89 | } | 89 | } |
90 | 90 | ||
91 | #[test] | 91 | #[test] |
92 | fn cfg_diagnostics() { | ||
93 | check_diagnostics( | ||
94 | r" | ||
95 | fn f() { | ||
96 | // The three g̶e̶n̶d̶e̶r̶s̶ statements: | ||
97 | |||
98 | #[cfg(a)] fn f() {} // Item statement | ||
99 | //^^^^^^^^^^^^^^^^^^^ InactiveCode | ||
100 | #[cfg(a)] {} // Expression statement | ||
101 | //^^^^^^^^^^^^ InactiveCode | ||
102 | #[cfg(a)] let x = 0; // let statement | ||
103 | //^^^^^^^^^^^^^^^^^^^^ InactiveCode | ||
104 | |||
105 | abc(#[cfg(a)] 0); | ||
106 | //^^^^^^^^^^^ InactiveCode | ||
107 | let x = Struct { | ||
108 | #[cfg(a)] f: 0, | ||
109 | //^^^^^^^^^^^^^^ InactiveCode | ||
110 | }; | ||
111 | match () { | ||
112 | () => (), | ||
113 | #[cfg(a)] () => (), | ||
114 | //^^^^^^^^^^^^^^^^^^ InactiveCode | ||
115 | } | ||
116 | |||
117 | #[cfg(a)] 0 // Trailing expression of block | ||
118 | //^^^^^^^^^^^ InactiveCode | ||
119 | } | ||
120 | ", | ||
121 | ); | ||
122 | } | ||
123 | |||
124 | #[test] | ||
125 | fn macro_diag_builtin() { | 92 | fn macro_diag_builtin() { |
126 | check_diagnostics( | 93 | check_diagnostics( |
127 | r#" | 94 | r#" |
diff --git a/crates/hir_def/src/nameres/tests/diagnostics.rs b/crates/hir_def/src/nameres/tests/diagnostics.rs index 5a088b6e5..f1ee03d4d 100644 --- a/crates/hir_def/src/nameres/tests/diagnostics.rs +++ b/crates/hir_def/src/nameres/tests/diagnostics.rs | |||
@@ -13,48 +13,6 @@ fn check_no_diagnostics(ra_fixture: &str) { | |||
13 | } | 13 | } |
14 | 14 | ||
15 | #[test] | 15 | #[test] |
16 | fn inactive_item() { | ||
17 | // Additional tests in `cfg` crate. This only tests disabled cfgs. | ||
18 | |||
19 | check_diagnostics( | ||
20 | r#" | ||
21 | //- /lib.rs | ||
22 | #[cfg(no)] pub fn f() {} | ||
23 | //^^^^^^^^^^^^^^^^^^^^^^^^ UnconfiguredCode | ||
24 | |||
25 | #[cfg(no)] #[cfg(no2)] mod m; | ||
26 | //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UnconfiguredCode | ||
27 | |||
28 | #[cfg(all(not(a), b))] enum E {} | ||
29 | //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UnconfiguredCode | ||
30 | |||
31 | #[cfg(feature = "std")] use std; | ||
32 | //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UnconfiguredCode | ||
33 | "#, | ||
34 | ); | ||
35 | } | ||
36 | |||
37 | /// Tests that `cfg` attributes behind `cfg_attr` is handled properly. | ||
38 | #[test] | ||
39 | fn inactive_via_cfg_attr() { | ||
40 | cov_mark::check!(cfg_attr_active); | ||
41 | check_diagnostics( | ||
42 | r#" | ||
43 | //- /lib.rs | ||
44 | #[cfg_attr(not(never), cfg(no))] fn f() {} | ||
45 | //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UnconfiguredCode | ||
46 | |||
47 | #[cfg_attr(not(never), cfg(not(no)))] fn f() {} | ||
48 | |||
49 | #[cfg_attr(never, cfg(no))] fn g() {} | ||
50 | |||
51 | #[cfg_attr(not(never), inline, cfg(no))] fn h() {} | ||
52 | //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UnconfiguredCode | ||
53 | "#, | ||
54 | ); | ||
55 | } | ||
56 | |||
57 | #[test] | ||
58 | fn builtin_macro_fails_expansion() { | 16 | fn builtin_macro_fails_expansion() { |
59 | check_diagnostics( | 17 | check_diagnostics( |
60 | r#" | 18 | r#" |