aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/tests.rs
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-04-07 16:58:05 +0100
committerBenjamin Coenen <[email protected]>2020-04-07 16:58:05 +0100
commitab864ed259c10ff51f7c9c3421d098eeea7b0245 (patch)
treea6451a9ddd7774d02974cc1dca6fbf76c8d4bb1c /crates/ra_hir_ty/src/tests.rs
parentf6d688d13070a54b288486900a30680d013c66ca (diff)
feat: add attributes support on struct fields #3870
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/tests.rs')
-rw-r--r--crates/ra_hir_ty/src/tests.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/ra_hir_ty/src/tests.rs
index 027e5a8f8..c3d793cc2 100644
--- a/crates/ra_hir_ty/src/tests.rs
+++ b/crates/ra_hir_ty/src/tests.rs
@@ -318,3 +318,32 @@ fn no_such_field_diagnostics() {
318 "### 318 "###
319 ); 319 );
320} 320}
321
322#[test]
323fn no_such_field_with_feature_flag_diagnostics() {
324 let diagnostics = TestDB::with_files(
325 r#"
326 //- /lib.rs
327 struct MyStruct {
328 my_val: usize,
329 #[cfg(feature = "foo")]
330 bar: bool,
331 }
332
333 impl MyStruct {
334 #[cfg(feature = "foo")]
335 pub(crate) fn new(my_val: usize, bar: bool) -> Self {
336 Self { my_val, bar }
337 }
338
339 #[cfg(not(feature = "foo"))]
340 pub(crate) fn new(my_val: usize, _bar: bool) -> Self {
341 Self { my_val }
342 }
343 }
344 "#,
345 )
346 .diagnostics();
347
348 assert_snapshot!(diagnostics, "");
349}