about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-03-16 16:31:23 +0000
committerbors <bors@rust-lang.org>2020-03-16 16:31:23 +0000
commitdd67187965e136bff1ed05e035293441c60f0790 (patch)
treed14a26886de5881e560f4754531975e84957bd29 /src/test
parent59f4ba95045e91a63e921e0d736242d7e1ffabec (diff)
parent6ca65bdd752a32b376a7f5cb1dba4953e91f46bb (diff)
downloadrust-dd67187965e136bff1ed05e035293441c60f0790.tar.gz
rust-dd67187965e136bff1ed05e035293441c60f0790.zip
Auto merge of #67133 - oli-obk:it_must_be_a_sign, r=eddyb
Deduplicate pretty printing of constants

r? @eddyb for the pretty printing logic
cc @RalfJung
Diffstat (limited to 'src/test')
-rw-r--r--src/test/mir-opt/const-promotion-extern-static.rs4
-rw-r--r--src/test/mir-opt/const_prop/discriminant.rs2
-rw-r--r--src/test/mir-opt/const_prop/issue-66971.rs2
-rw-r--r--src/test/mir-opt/const_prop/read_immutable_static.rs4
-rw-r--r--src/test/mir-opt/simplify-locals-removes-unused-consts.rs24
-rw-r--r--src/test/ui/const-generics/cannot-infer-const-args.stderr2
-rw-r--r--src/test/ui/const-generics/const-generic-type_name.rs2
-rw-r--r--src/test/ui/const-generics/fn-const-param-infer.stderr12
-rw-r--r--src/test/ui/const-generics/raw-ptr-const-param.rs4
-rw-r--r--src/test/ui/const-generics/raw-ptr-const-param.stderr10
-rw-r--r--src/test/ui/consts/offset_from_ub.stderr2
11 files changed, 34 insertions, 34 deletions
diff --git a/src/test/mir-opt/const-promotion-extern-static.rs b/src/test/mir-opt/const-promotion-extern-static.rs
index f6f7d091091..0d4a6d1bafd 100644
--- a/src/test/mir-opt/const-promotion-extern-static.rs
+++ b/src/test/mir-opt/const-promotion-extern-static.rs
@@ -14,7 +14,7 @@ fn main() {}
 // START rustc.FOO.PromoteTemps.before.mir
 // bb0: {
 // ...
-//     _5 = const Scalar(alloc1+0) : &i32;
+//     _5 = const {alloc1+0: &i32};
 //     _4 = &(*_5);
 //     _3 = [move _4];
 //     _2 = &_3;
@@ -31,7 +31,7 @@ fn main() {}
 // START rustc.BAR.PromoteTemps.before.mir
 // bb0: {
 // ...
-//     _5 = const Scalar(alloc0+0) : &i32;
+//     _5 = const {alloc0+0: &i32};
 //     _4 = &(*_5);
 //     _3 = [move _4];
 //     _2 = &_3;
diff --git a/src/test/mir-opt/const_prop/discriminant.rs b/src/test/mir-opt/const_prop/discriminant.rs
index 667d21fc14e..636aa1af653 100644
--- a/src/test/mir-opt/const_prop/discriminant.rs
+++ b/src/test/mir-opt/const_prop/discriminant.rs
@@ -31,7 +31,7 @@ fn main() {
 // START rustc.main.ConstProp.after.mir
 //  bb0: {
 //      ...
-//      _3 = const Scalar(0x01) : std::option::Option<bool>;
+//      _3 = const {transmute(0x01): std::option::Option<bool>};
 //      _4 = const 1isize;
 //      switchInt(const 1isize) -> [1isize: bb2, otherwise: bb1];
 //  }
diff --git a/src/test/mir-opt/const_prop/issue-66971.rs b/src/test/mir-opt/const_prop/issue-66971.rs
index 30c75303b3e..f332bb89509 100644
--- a/src/test/mir-opt/const_prop/issue-66971.rs
+++ b/src/test/mir-opt/const_prop/issue-66971.rs
@@ -29,7 +29,7 @@ fn main() {
 // START rustc.main.ConstProp.after.mir
 //  bb0: {
 //      ...
-//      _3 = const Scalar(<ZST>) : ();
+//      _3 = const ();
 //      _2 = (move _3, const 0u8, const 0u8);
 //      ...
 //      _1 = const encode(move _2) -> bb1;
diff --git a/src/test/mir-opt/const_prop/read_immutable_static.rs b/src/test/mir-opt/const_prop/read_immutable_static.rs
index 693ef783985..d307cebd715 100644
--- a/src/test/mir-opt/const_prop/read_immutable_static.rs
+++ b/src/test/mir-opt/const_prop/read_immutable_static.rs
@@ -10,10 +10,10 @@ fn main() {
 // START rustc.main.ConstProp.before.mir
 //  bb0: {
 //      ...
-//      _3 = const Scalar(alloc0+0) : &u8;
+//      _3 = const {alloc0+0: &u8};
 //      _2 = (*_3);
 //      ...
-//      _5 = const Scalar(alloc0+0) : &u8;
+//      _5 = const {alloc0+0: &u8};
 //      _4 = (*_5);
 //      _1 = Add(move _2, move _4);
 //      ...
diff --git a/src/test/mir-opt/simplify-locals-removes-unused-consts.rs b/src/test/mir-opt/simplify-locals-removes-unused-consts.rs
index 6f03438ff72..e427fd55ad6 100644
--- a/src/test/mir-opt/simplify-locals-removes-unused-consts.rs
+++ b/src/test/mir-opt/simplify-locals-removes-unused-consts.rs
@@ -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
@@ -35,28 +35,28 @@ fn main() {
 // bb0: {
 //   StorageLive(_1);
 //   StorageLive(_2);
-//   _2 = const Scalar(<ZST>) : ();
+//   _2 = const ();
 //   StorageLive(_3);
-//   _3 = const Scalar(<ZST>) : ();
-//   _1 = const Scalar(<ZST>) : ((), ());
+//   _3 = const ();
+//   _1 = const {transmute(()): ((), ())};
 //   StorageDead(_3);
 //   StorageDead(_2);
 //   StorageDead(_1);
 //   StorageLive(_4);
 //   StorageLive(_6);
-//   _6 = const Scalar(<ZST>) : ();
+//   _6 = const ();
 //   StorageLive(_7);
-//   _7 = const Scalar(<ZST>) : ();
+//   _7 = const ();
 //   StorageDead(_7);
 //   StorageDead(_6);
-//   _4 = const use_zst(const Scalar(<ZST>) : ((), ())) -> bb1;
+//   _4 = const use_zst(const {transmute(()): ((), ())}) -> bb1;
 // }
 // bb1: {
 //   StorageDead(_4);
 //   StorageLive(_8);
 //   StorageLive(_10);
 //   StorageLive(_11);
-//   _11 = const Scalar(0x28) : Temp;
+//   _11 = const {transmute(0x28) : Temp};
 //   _10 = const 40u8;
 //   StorageDead(_10);
 //   _8 = const use_u8(const 42u8) -> bb2;
@@ -75,7 +75,7 @@ fn main() {
 // }
 // bb0: {
 //   StorageLive(_1);
-//   _1 = const use_zst(const Scalar(<ZST>) : ((), ())) -> bb1;
+//   _1 = const use_zst(const {transmute(()): ((), ())}) -> bb1;
 // }
 // bb1: {
 //   StorageDead(_1);
diff --git a/src/test/ui/const-generics/cannot-infer-const-args.stderr b/src/test/ui/const-generics/cannot-infer-const-args.stderr
index 8379cbd4908..c1d7022d56b 100644
--- a/src/test/ui/const-generics/cannot-infer-const-args.stderr
+++ b/src/test/ui/const-generics/cannot-infer-const-args.stderr
@@ -10,7 +10,7 @@ error[E0282]: type annotations needed
   --> $DIR/cannot-infer-const-args.rs:9:5
    |
 LL |     foo();
-   |     ^^^ cannot infer type for fn item `fn() -> usize {foo::<_: usize>}`
+   |     ^^^ cannot infer type for fn item `fn() -> usize {foo::<{_: usize}>}`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/const-generics/const-generic-type_name.rs b/src/test/ui/const-generics/const-generic-type_name.rs
index 28586426b44..469843d6aae 100644
--- a/src/test/ui/const-generics/const-generic-type_name.rs
+++ b/src/test/ui/const-generics/const-generic-type_name.rs
@@ -7,5 +7,5 @@
 struct S<const N: usize>;
 
 fn main() {
-    assert_eq!(std::any::type_name::<S<3>>(), "const_generic_type_name::S<3usize>");
+    assert_eq!(std::any::type_name::<S<3>>(), "const_generic_type_name::S<3>");
 }
diff --git a/src/test/ui/const-generics/fn-const-param-infer.stderr b/src/test/ui/const-generics/fn-const-param-infer.stderr
index 44eab8baa40..05d2dff8e98 100644
--- a/src/test/ui/const-generics/fn-const-param-infer.stderr
+++ b/src/test/ui/const-generics/fn-const-param-infer.stderr
@@ -10,12 +10,12 @@ error[E0308]: mismatched types
   --> $DIR/fn-const-param-infer.rs:16:31
    |
 LL |     let _: Checked<not_one> = Checked::<not_two>;
-   |            ----------------   ^^^^^^^^^^^^^^^^^^ expected `not_one`, found `not_two`
+   |            ----------------   ^^^^^^^^^^^^^^^^^^ expected `{not_one as fn(usize) -> bool}`, found `{not_two as fn(usize) -> bool}`
    |            |
    |            expected due to this
    |
-   = note: expected struct `Checked<not_one>`
-              found struct `Checked<not_two>`
+   = note: expected struct `Checked<{not_one as fn(usize) -> bool}>`
+              found struct `Checked<{not_two as fn(usize) -> bool}>`
 
 error[E0308]: mismatched types
   --> $DIR/fn-const-param-infer.rs:20:24
@@ -36,12 +36,12 @@ error[E0308]: mismatched types
   --> $DIR/fn-const-param-infer.rs:25:40
    |
 LL |     let _: Checked<{generic::<u32>}> = Checked::<{generic::<u16>}>;
-   |            -------------------------   ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `generic::<u32>`, found `generic::<u16>`
+   |            -------------------------   ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{generic::<u32> as fn(usize) -> bool}`, found `{generic::<u16> as fn(usize) -> bool}`
    |            |
    |            expected due to this
    |
-   = note: expected struct `Checked<generic::<u32>>`
-              found struct `Checked<generic::<u16>>`
+   = note: expected struct `Checked<{generic::<u32> as fn(usize) -> bool}>`
+              found struct `Checked<{generic::<u16> as fn(usize) -> bool}>`
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/const-generics/raw-ptr-const-param.rs b/src/test/ui/const-generics/raw-ptr-const-param.rs
index f69c37fbb8f..f0349f46962 100644
--- a/src/test/ui/const-generics/raw-ptr-const-param.rs
+++ b/src/test/ui/const-generics/raw-ptr-const-param.rs
@@ -4,6 +4,6 @@
 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 _ }>;
 }
diff --git a/src/test/ui/const-generics/raw-ptr-const-param.stderr b/src/test/ui/const-generics/raw-ptr-const-param.stderr
index 9cd39b61dc9..d9794f60a19 100644
--- a/src/test/ui/const-generics/raw-ptr-const-param.stderr
+++ b/src/test/ui/const-generics/raw-ptr-const-param.stderr
@@ -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:7:38
+  --> $DIR/raw-ptr-const-param.rs:7:40
    |
-LL |     let _: Const<{15 as *const _}> = Const::<{10 as *const _}>;
-   |            -----------------------   ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{pointer}`, found `{pointer}`
+LL |     let _: Const<{ 15 as *const _ }> = Const::<{ 10 as *const _ }>;
+   |            -------------------------   ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{0xf as *const u32}`, found `{0xa as *const u32}`
    |            |
    |            expected due to this
    |
-   = note: expected struct `Const<{pointer}>`
-              found struct `Const<{pointer}>`
+   = note: expected struct `Const<{0xf as *const u32}>`
+              found struct `Const<{0xa as *const u32}>`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/consts/offset_from_ub.stderr b/src/test/ui/consts/offset_from_ub.stderr
index 24da983cf08..bbe3344b412 100644
--- a/src/test/ui/consts/offset_from_ub.stderr
+++ b/src/test/ui/consts/offset_from_ub.stderr
@@ -43,7 +43,7 @@ error: any use of this value will cause an error
 LL |           intrinsics::ptr_offset_from(self, origin)
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |           |
-   |           exact_div: 1 cannot be divided by 2 without remainder
+   |           exact_div: 1isize cannot be divided by 2isize without remainder
    |           inside call to `std::ptr::const_ptr::<impl *const u16>::offset_from` at $DIR/offset_from_ub.rs:36:14
    | 
   ::: $DIR/offset_from_ub.rs:31:1