expand: Turn ast::Crate into a first class expansion target#91313
Merged
bors merged 1 commit intorust-lang:masterfrom Dec 1, 2021
Merged
expand: Turn ast::Crate into a first class expansion target#91313bors merged 1 commit intorust-lang:masterfrom
ast::Crate into a first class expansion target#91313bors merged 1 commit intorust-lang:masterfrom
Conversation
And stop creating a fake `mod` item for the crate root when expanding a crate.
Aaron1011
reviewed
Nov 30, 2021
| let mut fold_crate = |krate: ast::Crate| { | ||
| let mut krate = match self.configure(krate) { | ||
| Some(krate) => krate, | ||
| None => return empty_crate(), |
Contributor
There was a problem hiding this comment.
Can the entire crate really be removed with something like #![cfg(FALSE)]? Is there a test case for this?
Contributor
Author
There was a problem hiding this comment.
Yes, libcore has #![cfg(not(test))] in its root in particular.
There are some tests for this as well, e.g. src\test\ui\issues\issue-34932.rs and src\test\ui\conditional-compilation\cfg-in-crate-1.rs.
Contributor
|
@bors r+ |
Collaborator
|
📌 Commit 141c6cc has been approved by |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 1, 2021
…askrgr Rollup of 5 pull requests Successful merges: - rust-lang#88502 (Add slice take methods) - rust-lang#91313 (expand: Turn `ast::Crate` into a first class expansion target) - rust-lang#91424 (Update LLVM with patches for better llvm-cov diagnostics) - rust-lang#91425 (Include lint errors in error count for `-Ztreat-err-as-bug`) - rust-lang#91430 (Add tests for `normalize-docs` overflow errors) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Dec 30, 2021
ast: Avoid aborts on fatal errors thrown from mutable AST visitor Set the node to some dummy value and rethrow the error instead. When using the old aborting `visit_clobber` in `InvocationCollector::visit_crate` the next tests abort due to fatal errors: ``` ui\modules\path-invalid-form.rs ui\modules\path-macro.rs ui\modules\path-no-file-name.rs ui\parser\issues\issue-5806.rs ui\parser\mod_file_with_path_attr.rs ``` Follow up to rust-lang#91313.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Jan 5, 2022
ast: Always keep a `NodeId` in `ast::Crate` This makes it more uniform with other expanded nodes. It makes generic code in rust-lang#92573 simpler in particular. This is another follow-up to rust-lang#91313. r? `@Aaron1011`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
And stop creating a fake
moditem for the crate root when expanding a crate, thus addressing FIXMEs left in #82238, and making a step towards a proper support for crate-level macro attributes (cc #54726).I haven't added token collection support for the whole crate in this PR, maybe later.
r? @Aaron1011