diff options
Diffstat (limited to 'crates/ra_hir_ty/src/tests.rs')
-rw-r--r-- | crates/ra_hir_ty/src/tests.rs | 29 |
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] | ||
323 | fn 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 | } | ||