Skip to content

Format error and typeof types #4416

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Sep 9, 2020
Merged

Conversation

topecongiro
Copy link
Contributor

These two cases are simple enough; I might as well support it instead of panicking.

Also, in a bit extreme case the current implementation can panic against valid Rust code when macro is involved:

macro_rules! foo {
    (typeof($e:expr)) => {}
}

fn main() {
    foo!(typeof(3));
}

Close #4357.

Copy link
Member

@calebcartwright calebcartwright left a comment

Choose a reason for hiding this comment

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

SGTM

@topecongiro topecongiro merged commit aa8e601 into rust-lang:master Sep 9, 2020
@topecongiro topecongiro deleted the issue-4357 branch September 9, 2020 03:52
calebcartwright pushed a commit to calebcartwright/rustfmt that referenced this pull request Dec 19, 2020
* Add a test for rust-lang#4357

* Format error and typeof types
calebcartwright pushed a commit that referenced this pull request Dec 20, 2020
* Add a test for #4357

* Format error and typeof types
@karyon
Copy link
Contributor

karyon commented Oct 25, 2021

Backport done in #4605

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

internal error: entered unreachable code
3 participants