Rollup merge of #69838 - Centril:expand-module, r=petrochenkov

Expansion-driven outline module parsing

After this PR, the parser will not do any conditional compilation or loading of external module files when `mod foo;` is encountered. Instead, the parser only leaves `mod foo;` in place in the AST, with no items filled in. Expansion later kicks in and will load the actual files and do the parsing. This entails that the following is now valid:

```rust
#[cfg(FALSE)]
mod foo {
    mod bar {
        mod baz; // `foo/bar/baz.rs` doesn't exist, but no error!
    }
}
```

Fixes https://github.com/rust-lang/rust/issues/64197.

r? @petrochenkov
This commit is contained in:
Mazdak Farrokhzad 2020-03-18 18:03:38 +01:00 committed by GitHub
commit 23b79d83f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 601 additions and 593 deletions

View file

@ -1,8 +1,8 @@
error[E0583]: file not found for module `module_that_doesnt_exist`
--> $DIR/E0583.rs:1:5
--> $DIR/E0583.rs:1:1
|
LL | mod module_that_doesnt_exist;
| ^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: to create the module `module_that_doesnt_exist`, create file "$DIR/module_that_doesnt_exist.rs"