Detect invalid exprs in parser used by pretty-printer tests#134599
Merged
bors merged 4 commits intorust-lang:masterfrom Dec 22, 2024
Merged
Detect invalid exprs in parser used by pretty-printer tests#134599bors merged 4 commits intorust-lang:masterfrom
bors merged 4 commits intorust-lang:masterfrom
Conversation
Collaborator
|
rustbot has assigned @Mark-Simulacrum. Use |
fmease
reviewed
Dec 22, 2024
Member
There was a problem hiding this comment.
In both pprust-*.rs tests, I think I would rather use //@ aux-crate: parser=parser.rs //@ edition: 2021 (aux-crate puts the crate into the extern prelude contrary to aux-build) instead of fighting against compiletest (#[path = "auxiliary/parser.rs"] mod parser;). The extra overhead is not really relevant.
Member
|
r? fmease @bors rollup r=me with nit addressed in one way or another and a bit of commit squashing |
5ee181d to
1f2028f
Compare
Member
Author
|
@bors r=fmease |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 22, 2024
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#134599 (Detect invalid exprs in parser used by pretty-printer tests) - rust-lang#134602 (Document `PointerLike` implementation restrictions.) - rust-lang#134635 (Don't ICE on illegal `dyn*` casts) - rust-lang#134639 (Make sure we note ambiguity causes on positive/negative impl conflicts) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 22, 2024
Rollup merge of rust-lang#134599 - dtolnay:fulldepsparser, r=fmease Detect invalid exprs in parser used by pretty-printer tests This PR fixes a bug in rust-lang#133730 inherited from rust-lang#43742. Before this fix, the test might silently only operate on a prefix of some of the test cases in this table: https://github.com/rust-lang/rust/blob/13170cd787cb733ed24842ee825bcbd98dc01476/tests/ui-fulldeps/pprust-parenthesis-insertion.rs#L57 For example, adding the test case `1 .. 2 .. 3` (a syntactically invalid expression) into the table would unexpectedly succeed the test instead of crashing at this unwrap: https://github.com/rust-lang/rust/blob/13170cd787cb733ed24842ee825bcbd98dc01476/tests/ui-fulldeps/pprust-parenthesis-insertion.rs#L199-L200 because `parse_expr` would successfully parse just `1 .. 2` and disregard the last `.. 3`. This PR adds a check that `parse_expr` reaches `Eof`, ensuring all the test cases actually test the whole expression they look like they are supposed to.
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.
This PR fixes a bug in #133730 inherited from #43742. Before this fix, the test might silently only operate on a prefix of some of the test cases in this table:
rust/tests/ui-fulldeps/pprust-parenthesis-insertion.rs
Line 57 in 13170cd
For example, adding the test case
1 .. 2 .. 3(a syntactically invalid expression) into the table would unexpectedly succeed the test instead of crashing at this unwrap:rust/tests/ui-fulldeps/pprust-parenthesis-insertion.rs
Lines 199 to 200 in 13170cd
because
parse_exprwould successfully parse just1 .. 2and disregard the last.. 3.This PR adds a check that
parse_exprreachesEof, ensuring all the test cases actually test the whole expression they look like they are supposed to.