Skip to content

Incorrect span produced when using encoded } #103826

Closed
@cassaundra

Description

@cassaundra

The following code produces an incorrect span on nightly:

fn main() {
    format!("{\x7D");
}

Expected:

error: 1 positional argument in format string, but no arguments were given
 --> src/main.rs:2:14
  |
2 |     format!("{\x7D");
  |              ^^^^^

error: aborting due to previous error

Actual:

error: 1 positional argument in format string, but no arguments were given
 --> src/main.rs:2:14
  |
2 |     format!("{\x7D");
  |              ^^

error: aborting due to previous error

Meta

rustc --version --verbose:

rustc 1.67.0-nightly (95a3a7277 2022-10-31)
binary: rustc
commit-hash: 95a3a7277b44bbd2dd3485703d9a05f64652b60e
commit-date: 2022-10-31
host: x86_64-unknown-linux-gnu
release: 1.67.0-nightly
LLVM version: 15.0.4

This was knowingly introduced as part of #102214. I have already fixed this, and will open a PR shortly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-fmtArea: `core::fmt`C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions