Skip to content

Panic when formatting #4479

Closed
Closed
@ndmitchell

Description

@ndmitchell

Describe the bug

Given:

fn get_hashes() { x. 0. 0 }

I get:

thread 'main' panicked at 'bad span: `.`: ` 0`', src/tools/rustfmt/src/source_map.rs:52:13

To Reproduce

$ rustfmt test.rs
thread 'main' panicked at 'bad span: `.`: ` 0`', src/tools/rustfmt/src/source_map.rs:52:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected behavior

Not panic.

Meta

  • rustfmt version: rustfmt 1.4.22-nightly (97d03010 2020-10-04)
  • From where did you install rustfmt?: rustup
  • How do you run rustfmt: rustfmt

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPanic, non-idempotency, invalid code, etc.duplicate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions