Don't print leading zeros on hex dumps constants

This commit is contained in:
Oliver Scherer 2020-02-05 12:17:41 +01:00
parent 4ddb4bdaad
commit e22ddfd80d
5 changed files with 17 additions and 21 deletions

View file

@ -31,7 +31,7 @@ fn main() {
// START rustc.main.ConstProp.after.mir
// bb0: {
// ...
// _3 = const {0x01: std::option::Option<bool>};
// _3 = const {transmute(0x1): std::option::Option<bool>};
// _4 = const 1isize;
// switchInt(const 1isize) -> [1isize: bb2, otherwise: bb1];
// }

View file

@ -1,18 +1,18 @@
// compile-flags: -C overflow-checks=no
fn use_zst(_: ((), ())) { }
fn use_zst(_: ((), ())) {}
struct Temp {
x: u8
x: u8,
}
fn use_u8(_: u8) { }
fn use_u8(_: u8) {}
fn main() {
let ((), ()) = ((), ());
use_zst(((), ()));
use_u8((Temp { x : 40 }).x + 2);
use_u8((Temp { x: 40 }).x + 2);
}
// END RUST SOURCE
@ -56,7 +56,7 @@ fn main() {
// StorageLive(_8);
// StorageLive(_10);
// StorageLive(_11);
// _11 = const {0x28 : Temp};
// _11 = const {transmute(0x28) : Temp};
// _10 = const 40u8;
// StorageDead(_10);
// _8 = const use_u8(const 42u8) -> bb2;

View file

@ -1,12 +1,9 @@
// normalize-stderr-64bit "0x00000000" -> "0x[PREFIX]"
// normalize-stderr-32bit "0x" -> "0x[PREFIX]"
#![feature(const_generics, const_compare_raw_pointers)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
struct Const<const P: *const u32>;
fn main() {
let _: Const<{15 as *const _}> = Const::<{10 as *const _}>; //~ mismatched types
let _: Const<{10 as *const _}> = Const::<{10 as *const _}>;
let _: Const<{ 15 as *const _ }> = Const::<{ 10 as *const _ }>; //~ mismatched types
let _: Const<{ 10 as *const _ }> = Const::<{ 10 as *const _ }>;
}

View file

@ -1,5 +1,5 @@
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/raw-ptr-const-param.rs:4:12
--> $DIR/raw-ptr-const-param.rs:1:12
|
LL | #![feature(const_generics, const_compare_raw_pointers)]
| ^^^^^^^^^^^^^^
@ -7,15 +7,15 @@ LL | #![feature(const_generics, const_compare_raw_pointers)]
= note: `#[warn(incomplete_features)]` on by default
error[E0308]: mismatched types
--> $DIR/raw-ptr-const-param.rs:10:38
--> $DIR/raw-ptr-const-param.rs:7:40
|
LL | let _: Const<{15 as *const _}> = Const::<{10 as *const _}>;
| ----------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `0x[PREFIX]0000000f`, found `0x[PREFIX]0000000a`
LL | let _: Const<{ 15 as *const _ }> = Const::<{ 10 as *const _ }>;
| ------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `0xf`, found `0xa`
| |
| expected due to this
|
= note: expected struct `Const<0x[PREFIX]0000000f>`
found struct `Const<0x[PREFIX]0000000a>`
= note: expected struct `Const<0xf>`
found struct `Const<0xa>`
error: aborting due to previous error