about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-06-03 09:11:58 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-06-07 08:33:58 +0000
commitcbee17d5025c7824828c793ac776ad6e1addbeac (patch)
tree8fbe94d41a18eeadefbb9434bac9b0d0e0ec9444 /tests
parent92c54db22f3ee0ef13be629b55607c23ed305f3b (diff)
downloadrust-cbee17d5025c7824828c793ac776ad6e1addbeac.tar.gz
rust-cbee17d5025c7824828c793ac776ad6e1addbeac.zip
Revert "Create const block DefIds in typeck instead of ast lowering"
This reverts commit ddc5f9b6c1f21da5d4596bf7980185a00984ac42.
Diffstat (limited to 'tests')
-rw-r--r--tests/mir-opt/building/custom/consts.consts.built.after.mir2
-rw-r--r--tests/pretty/stmt_expr_attributes.rs7
-rw-r--r--tests/ui/lint/non-local-defs/consts.stderr19
-rw-r--r--tests/ui/unpretty/expanded-exhaustive.stdout3
4 files changed, 20 insertions, 11 deletions
diff --git a/tests/mir-opt/building/custom/consts.consts.built.after.mir b/tests/mir-opt/building/custom/consts.consts.built.after.mir
index 7b6964849d4..a011fadcef1 100644
--- a/tests/mir-opt/building/custom/consts.consts.built.after.mir
+++ b/tests/mir-opt/building/custom/consts.consts.built.after.mir
@@ -10,7 +10,7 @@ fn consts() -> () {
 
     bb0: {
         _1 = const 5_u8;
-        _2 = const consts::<C>::{constant#1};
+        _2 = const consts::<C>::{constant#0};
         _3 = const C;
         _4 = const D;
         _5 = consts::<10>;
diff --git a/tests/pretty/stmt_expr_attributes.rs b/tests/pretty/stmt_expr_attributes.rs
index f9041268211..5eb7d2fcae3 100644
--- a/tests/pretty/stmt_expr_attributes.rs
+++ b/tests/pretty/stmt_expr_attributes.rs
@@ -206,7 +206,12 @@ fn _11() {
             let _ = ();
             ()
         };
-    let const {} = #[rustc_dummy] const {};
+    let const {
+                    #![rustc_dummy]
+                } =
+        #[rustc_dummy] const {
+                #![rustc_dummy]
+            };
     let mut x = 0;
     let _ = (#[rustc_dummy] x) = 15;
     let _ = (#[rustc_dummy] x) += 15;
diff --git a/tests/ui/lint/non-local-defs/consts.stderr b/tests/ui/lint/non-local-defs/consts.stderr
index 48bdaa60823..2756ea40138 100644
--- a/tests/ui/lint/non-local-defs/consts.stderr
+++ b/tests/ui/lint/non-local-defs/consts.stderr
@@ -67,13 +67,18 @@ LL |     impl Test {
 warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
   --> $DIR/consts.rs:50:9
    |
-LL | fn main() {
-   | --------- move the `impl` block outside of this function `main`
-...
-LL |         impl Test {
-   |         ^^^^^----
-   |              |
-   |              `Test` is not local
+LL |       const {
+   |  ___________-
+LL | |         impl Test {
+   | |         ^^^^^----
+   | |              |
+   | |              `Test` is not local
+LL | |
+LL | |             fn hoo() {}
+...  |
+LL | |         1
+LL | |     };
+   | |_____- move the `impl` block outside of this inline constant `<unnameable>` and up 2 bodies
    |
    = note: methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item as the `impl`
    = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
diff --git a/tests/ui/unpretty/expanded-exhaustive.stdout b/tests/ui/unpretty/expanded-exhaustive.stdout
index 9e45f57af35..137a8aa5510 100644
--- a/tests/ui/unpretty/expanded-exhaustive.stdout
+++ b/tests/ui/unpretty/expanded-exhaustive.stdout
@@ -83,8 +83,7 @@ mod expressions {
     fn expr_const_block() {
         const {};
         const { 1 };
-        const
-            {
+        const {
                 struct S;
             };
     }