-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect invalid exprs in parser used by pretty-printer tests #134599
Conversation
rustbot has assigned @Mark-Simulacrum. Use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
r? fmease @bors rollup r=me with nit addressed in one way or another and a bit of commit squashing |
5ee181d
to
1f2028f
Compare
@bors r=fmease |
…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
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 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_expr
would successfully parse just1 .. 2
and disregard the last.. 3
.This PR adds a check that
parse_expr
reachesEof
, ensuring all the test cases actually test the whole expression they look like they are supposed to.