Skip to content

Fix 3145 #3146

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

Merged
merged 2 commits into from
Sep 7, 2018
Merged

Fix 3145 #3146

merged 2 commits into from
Sep 7, 2018

Conversation

flip1995
Copy link
Member

@flip1995 flip1995 commented Sep 7, 2018

Fixes #3145

This error originates on this assert:
https://github.com/rust-lang-nursery/rust-clippy/blob/63a46b1e1a9a4cc3d78e1cf7a628421051c21167/clippy_lints/src/write.rs#L286-L289

The check_tts function gets the arguments of the macro call as a ThinTokenStream:

writeln!(v, "{}", "foo"); => ThinTokenStream <v, "{}", "foo"> 

The thought behind this assertion is that if no Comma is found after a parsed expr the parser has reached the end of theThinTokenStream, because exprs need to be seperated by a Comma. But with a syntax error like println!("{}" a); this is not the case. Removing the assertion is a simple fix, that shouldn't break anything.

r? @oli-obk

@@ -0,0 +1,3 @@
fn main() {
println!("{}" a); //~ERROR expected token: `,`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just make it a ui test. Rustc is moving away from compile-fail, there's no guarantee these are kept around.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@flip1995 flip1995 merged commit 404dd82 into rust-lang:master Sep 7, 2018
@flip1995 flip1995 deleted the fix-3145 branch September 7, 2018 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

panic when comma missing in println!() arg
2 participants