File tree 2 files changed +26
-2
lines changed
src/tools/rust-analyzer/crates
ide-diagnostics/src/handlers
2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -2003,7 +2003,7 @@ impl ModCollector<'_, '_> {
2003
2003
Err ( cfg) => {
2004
2004
self . emit_unconfigured_diagnostic (
2005
2005
self . tree_id ,
2006
- AttrOwner :: TopLevel ,
2006
+ AttrOwner :: ModItem ( module_id . into ( ) ) ,
2007
2007
& cfg,
2008
2008
) ;
2009
2009
}
Original file line number Diff line number Diff line change @@ -42,7 +42,10 @@ mod tests {
42
42
use crate :: { tests:: check_diagnostics_with_config, DiagnosticsConfig } ;
43
43
44
44
pub ( crate ) fn check ( ra_fixture : & str ) {
45
- let config = DiagnosticsConfig :: test_sample ( ) ;
45
+ let config = DiagnosticsConfig {
46
+ disabled : std:: iter:: once ( "unlinked-file" . to_owned ( ) ) . collect ( ) ,
47
+ ..DiagnosticsConfig :: test_sample ( )
48
+ } ;
46
49
check_diagnostics_with_config ( config, ra_fixture)
47
50
}
48
51
@@ -168,6 +171,27 @@ union FooBar {
168
171
#[cfg(a)] baz: u32,
169
172
//^^^^^^^^^^^^^^^^^^ weak: code is inactive due to #[cfg] directives: a is disabled
170
173
}
174
+ "# ,
175
+ ) ;
176
+ }
177
+
178
+ #[ test]
179
+ fn modules ( ) {
180
+ check (
181
+ r#"
182
+ //- /main.rs
183
+ #[cfg(outline)] mod outline;
184
+ //^^^^^^^^^^^^^^^^^^^^^^^^^^^^ weak: code is inactive due to #[cfg] directives: outline is disabled
185
+
186
+ mod outline_inner;
187
+ //^^^^^^^^^^^^^^^^^^ weak: code is inactive due to #[cfg] directives: outline_inner is disabled
188
+
189
+ #[cfg(inline)] mod inline {}
190
+ //^^^^^^^^^^^^^^^^^^^^^^^^^^^^ weak: code is inactive due to #[cfg] directives: inline is disabled
191
+
192
+ //- /outline_inner.rs
193
+ #![cfg(outline_inner)]
194
+ //- /outline.rs
171
195
"# ,
172
196
) ;
173
197
}
You can’t perform that action at this time.
0 commit comments