-
Notifications
You must be signed in to change notification settings - Fork 996
Closed
Labels
A-matchesArea: match arms, patterns, blocks, etcArea: match arms, patterns, blocks, etcC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICE
Description
enum NonAscii {
Abcd,
Éfgh,
}
use NonAscii::*;
fn f(x: NonAscii) -> bool {
match x {
Éfgh => true,
_ => false,
}
}
fn main() {
dbg!(f(Abcd));
}Rustfmt on Playground (1.4.37-nightly (2021-06-12 24bdc6d)) fails to format the above code:
thread 'main' panicked at 'byte index 109 is not a char boundary; it is inside 'É' (bytes 108..110) of `enum NonAscii {
Abcd,
Éfgh,
}
use NonAscii::*;
fn f(x: NonAscii) -> bool {
match x {
Éfgh => true,
_ => false,
}
}
fn main() {
dbg!(f(Abcd));
}
`', src/tools/rustfmt/src/visitor.rs:47:15
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-matchesArea: match arms, patterns, blocks, etcArea: match arms, patterns, blocks, etcC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICE