Skip to content

confusing format! compiler error #57512

Closed
@a-l-f-r-e-d

Description

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions