rust/tests/ui/numeric/uppercase-base-prefix.fixed
2024-02-16 20:02:50 +00:00

78 lines
2.8 KiB
Rust

//@ run-rustfix
// Checks that integers with an uppercase base prefix (0B, 0X, 0O) have a nice error
#![allow(unused_variables)]
fn main() {
let a = 0xABCDEF;
//~^ ERROR invalid base prefix for number literal
//~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
//~| HELP try making the prefix lowercase
//~| SUGGESTION 0xABCDEF
let b = 0o755;
//~^ ERROR invalid base prefix for number literal
//~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
//~| HELP try making the prefix lowercase
//~| SUGGESTION 0o755
let c = 0b10101010;
//~^ ERROR invalid base prefix for number literal
//~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
//~| HELP try making the prefix lowercase
//~| SUGGESTION 0b10101010
let d = 0xABC_DEF;
//~^ ERROR invalid base prefix for number literal
//~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
//~| HELP try making the prefix lowercase
//~| SUGGESTION 0xABC_DEF
let e = 0o7_55;
//~^ ERROR invalid base prefix for number literal
//~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
//~| HELP try making the prefix lowercase
//~| SUGGESTION 0o7_55
let f = 0b1010_1010;
//~^ ERROR invalid base prefix for number literal
//~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
//~| HELP try making the prefix lowercase
//~| SUGGESTION 0b1010_1010
let g = 0xABC_DEF_u64;
//~^ ERROR invalid base prefix for number literal
//~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
//~| HELP try making the prefix lowercase
//~| SUGGESTION 0xABC_DEF_u64
let h = 0o7_55_u32;
//~^ ERROR invalid base prefix for number literal
//~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
//~| HELP try making the prefix lowercase
//~| SUGGESTION 0o7_55_u32
let i = 0b1010_1010_u8;
//~^ ERROR invalid base prefix for number literal
//~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
//~| HELP try making the prefix lowercase
//~| SUGGESTION 0b1010_1010_u8
//
let j = 0xABCDEFu64;
//~^ ERROR invalid base prefix for number literal
//~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
//~| HELP try making the prefix lowercase
//~| SUGGESTION 0xABCDEFu64
let k = 0o755u32;
//~^ ERROR invalid base prefix for number literal
//~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
//~| HELP try making the prefix lowercase
//~| SUGGESTION 0o755u32
let l = 0b10101010u8;
//~^ ERROR invalid base prefix for number literal
//~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
//~| HELP try making the prefix lowercase
//~| SUGGESTION 0b10101010u8
}