File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
ql/integration-tests/macro-expansion Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -167,9 +167,19 @@ impl<'a> Extractor<'a> {
167167 let Some ( id) = path_to_file_id ( file, vfs) else {
168168 return Err ( "not included in files loaded from manifest" . to_string ( ) ) ;
169169 } ;
170- if semantics. file_to_module_def ( id) . is_none ( ) {
171- return Err ( "not included as a module" . to_string ( ) ) ;
172- }
170+ match semantics. file_to_module_def ( id) {
171+ None => return Err ( "not included as a module" . to_string ( ) ) ,
172+ Some ( module)
173+ if module
174+ . as_source_file_id ( semantics. db )
175+ . is_none_or ( |mod_file_id| mod_file_id. file_id ( semantics. db ) != id) =>
176+ {
177+ return Err (
178+ "not loaded as its own module, probably included by `!include`" . to_string ( ) ,
179+ ) ;
180+ }
181+ _ => { }
182+ } ;
173183 self . steps . push ( ExtractionStep :: load_source ( before, file) ) ;
174184 Ok ( ( ) )
175185 }
Original file line number Diff line number Diff line change @@ -38,5 +38,5 @@ unexpanded_macro_calls
3838| calls/src/lib.rs:22:9:22:31 | concat!... |
3939| calls/src/lib.rs:29:9:29:32 | include_str!... |
4040warnings
41- | calls/src/included.rs:2:9:2:39 | macro expansion failed: could not resolve macro 'concat' |
41+ | calls/src/included.rs:1:1:1:1 | semantic analyzer unavailable ( not loaded as its own module, probably included by `!include`) |
4242| calls/src/lib.rs:22:9:22:31 | macro expansion failed: could not resolve macro 'concat' |
You can’t perform that action at this time.
0 commit comments