Repository navigation
Add a regression test for Issue 7198 and hide parse errors in test output - #7199
Merged
Merged
Conversation
ytmimi
commented
Oct 19, 2026
Contributor
Author
There was a problem hiding this comment.
Tests no longer output this parse error:
error: missing parameters for function definition
--> tests/source/cfg-select-valid-then-invalid-item-error-count-leak.rs:6:31
|
6 | cfg_select! { unix => { fn foo {} } }
| ^
|
help: add a parameter list
|
6 | cfg_select! { unix => { fn foo() {} } }
| ++
Member
There was a problem hiding this comment.
Is it expected that rustfmt emits these errors, given that rustc might not emit an error (if the condition is false)?
Contributor
Author
There was a problem hiding this comment.
rustfmt still needs to format all the cfg_select! arms even if they won't all be compiled so it seems reasonable to me that rustfmt would emit the parse error.
ytmimi
commented
Oct 19, 2026
Contributor
Author
There was a problem hiding this comment.
Without show_parse_errors: false the test output gets cluttered with this output:
error: expected identifier, found keyword `unsafe`
--> tests/target/issue_7198.rs:8:17
|
8 | unsafe extern "C" fn(*mut libc::c_void),
| ^^^^^^ expected identifier, found keyword
error: expected one of `:` or `|`, found keyword `extern`
--> tests/target/issue_7198.rs:8:24
|
8 | unsafe extern "C" fn(*mut libc::c_void),
| ^^^^^^ expected one of `:` or `|`
error: expected parameter name, found `*`
--> tests/target/issue_7198.rs:9:17
|
9 | *mut libc::c_void,
| ^ expected parameter name
error: expected parameter name, found `*`
--> tests/target/issue_7198.rs:10:17
|
10 | *mut libc::c_void,
| ^ expected parameter name
| @@ -1,4 +1,7 @@ | |||
| //@ rustfmt-unstable: true | |||
| //@ rustfmt-show_parse_errors: false | |||
Contributor
There was a problem hiding this comment.
thanks for this, I was about to get up a change for the same thing!
matthewhughes934
approved these changes
Oct 19, 2026
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.
Closes #7198
Also hides parse errors for tests added in #7171