Skip to content

confusing format! compiler error #57512

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

Closed
a-l-f-r-e-d opened this issue Jan 11, 2019 · 0 comments
Closed

confusing format! compiler error #57512

a-l-f-r-e-d opened this issue Jan 11, 2019 · 0 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@a-l-f-r-e-d
Copy link

For something like this :

let foo = "foo";
let bar = "bar";
format!("{foo} {bar}", foo = foo, bar); // missed bar = bar

i would expect:

--> src/main.rs:4:39
  |
4 |     format!("{foo} {bar}", foo = foo, bar);
  |                                       ^^^ expected `=`

instead there was

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: Diagnostic { level: Fatal, message: [("expected `=`, found `<eof>`", NoStyle)], code: None, span: MultiSpan { primary_spans: [Span { lo: BytePos(92), hi: BytePos(95), ctxt: #0 }], span_labels: [(Span { lo: BytePos(92), hi: BytePos(95), ctxt: #0 }, "expected `=`")] }, children: [], suggestions: [] }', src/libcore/result.rs:999:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.33.0-nightly (d22fa2d87 2019-01-08) running on x86_64-apple-darwin

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `format`.

To learn more, run the command again with --verbose.
rustc 1.33.0-nightly (d22fa2d87 2019-01-08)
binary: rustc
commit-hash: d22fa2d87d03d19fdb1359faab9ec5e74eff26b3
commit-date: 2019-01-08
host: x86_64-apple-darwin
release: 1.33.0-nightly
LLVM version: 8.0
@Centril Centril added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jan 11, 2019
euclio added a commit to euclio/rust that referenced this issue Jan 11, 2019
Centril added a commit to Centril/rust that referenced this issue Jan 12, 2019
don't unwrap unexpected tokens in `format!`

Fixes rust-lang#57512.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

2 participants