Skip to content
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

error in format string : unreachable!("foo {bar,baz}"); no longer compiles #93761

Closed
matthiaskrgr opened this issue Feb 8, 2022 · 2 comments
Closed
Labels
C-bug Category: This is a bug.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Feb 8, 2022

I tried this code:

unreachable!("passing both, --remove-if-{older,younger}-than was temporarily disabled!");

I expected to see this happen:
This used to compile with edition 2018 and 2021 until rustc 1.60.0-nightly (734368a20 2022-02-07)

Instead, this happened: (edition 2021)
https://github.com/matthiaskrgr/cargo-cache/blob/a9b9f30fe6726390288c2337663409adc666a8a3/src/date.rs#L179

 error: invalid format string: expected `'}'`, found `','`
   --> src/date.rs:179:59
    |
179 |             unreachable!("passing both, --remove-if-{older,younger}-than was temporarily disabled!")
    |                                                     -     ^ expected `}` in format string
    |                                                     |
    |                                                     because of this opening brace
    |
    = note: if you intended to print `{`, you can escape it using `{{`

I'm not sure why this didn't pop up in the crater run for #93394 so made a ticket just in case, cc @m-ou-se

Feel free to close if this is a a true positive. :)

Meta

rustc --version --verbose:

rustc 1.60.0-nightly (734368a20 2022-02-07)
binary: rustc
commit-hash: 734368a200904ef9c21db86c595dc04263c87be0
commit-date: 2022-02-07
host: x86_64-unknown-linux-gnu
release: 1.60.0-nightly
LLVM version: 13.0.0
@matthiaskrgr matthiaskrgr added the C-bug Category: This is a bug. label Feb 8, 2022
@matthiaskrgr matthiaskrgr changed the title error in format string error in format string : unreachable!("foo {bar, baz}"); no longer compiles Feb 8, 2022
@matthiaskrgr matthiaskrgr changed the title error in format string : unreachable!("foo {bar, baz}"); no longer compiles error in format string : unreachable!("foo {bar,baz}"); no longer compiles Feb 8, 2022
@RalfJung
Copy link
Member

RalfJung commented Feb 8, 2022

Looks related to #92137

@matthiaskrgr
Copy link
Member Author

Ah so I guess this is expected breaking change then 😅
closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants