Merge typeck loop with static/const item eval loop
diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs
index 91dde13..d010f1f 100644
--- a/compiler/rustc_hir_analysis/src/lib.rs
+++ b/compiler/rustc_hir_analysis/src/lib.rs
@@ -223,10 +223,6 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
             }
             _ => (),
         }
-    });
-
-    tcx.par_hir_body_owners(|item_def_id| {
-        let def_kind = tcx.def_kind(item_def_id);
         // Skip `AnonConst`s because we feed their `type_of`.
         if !matches!(def_kind, DefKind::AnonConst) {
             tcx.ensure_ok().typeck(item_def_id);
diff --git a/tests/ui/closures/closure-return-type-mismatch.stderr b/tests/ui/closures/closure-return-type-mismatch.stderr
index 052bbbb..f9587d8 100644
--- a/tests/ui/closures/closure-return-type-mismatch.stderr
+++ b/tests/ui/closures/closure-return-type-mismatch.stderr
@@ -1,12 +1,4 @@
 error[E0308]: mismatched types
-  --> $DIR/closure-return-type-mismatch.rs:20:41
-   |
-LL | static FOO: fn() -> bool = || -> bool { 1 };
-   |                                  ----   ^ expected `bool`, found integer
-   |                                  |
-   |                                  expected `bool` because of return type
-
-error[E0308]: mismatched types
   --> $DIR/closure-return-type-mismatch.rs:7:9
    |
 LL |         a
@@ -27,6 +19,14 @@
 LL |             return "hello"
    |                    ^^^^^^^ expected `bool`, found `&str`
 
+error[E0308]: mismatched types
+  --> $DIR/closure-return-type-mismatch.rs:20:41
+   |
+LL | static FOO: fn() -> bool = || -> bool { 1 };
+   |                                  ----   ^ expected `bool`, found integer
+   |                                  |
+   |                                  expected `bool` because of return type
+
 error: aborting due to 3 previous errors
 
 For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/coercion/coerce-loop-issue-122561.stderr b/tests/ui/coercion/coerce-loop-issue-122561.stderr
index 3af7e7c..6415fd5 100644
--- a/tests/ui/coercion/coerce-loop-issue-122561.stderr
+++ b/tests/ui/coercion/coerce-loop-issue-122561.stderr
@@ -25,21 +25,6 @@
    |                                         +++++++++++++++++++
 
 error[E0308]: mismatched types
-  --> $DIR/coerce-loop-issue-122561.rs:85:5
-   |
-LL | /     for i in 0.. {
-LL | |
-LL | |     }
-   | |_____^ expected `i32`, found `()`
-   |
-   = note: `for` loops evaluate to unit type `()`
-help: consider returning a value here
-   |
-LL ~     }
-LL +     /* `i32` value */
-   |
-
-error[E0308]: mismatched types
   --> $DIR/coerce-loop-issue-122561.rs:4:5
    |
 LL |   fn for_infinite() -> bool {
@@ -203,6 +188,21 @@
    |
 
 error[E0308]: mismatched types
+  --> $DIR/coerce-loop-issue-122561.rs:85:5
+   |
+LL | /     for i in 0.. {
+LL | |
+LL | |     }
+   | |_____^ expected `i32`, found `()`
+   |
+   = note: `for` loops evaluate to unit type `()`
+help: consider returning a value here
+   |
+LL ~     }
+LL +     /* `i32` value */
+   |
+
+error[E0308]: mismatched types
   --> $DIR/coerce-loop-issue-122561.rs:92:9
    |
 LL | /         for i in 0..5 {
diff --git a/tests/ui/consts/effect_param.stderr b/tests/ui/consts/effect_param.stderr
index c63be80..a20092d 100644
--- a/tests/ui/consts/effect_param.stderr
+++ b/tests/ui/consts/effect_param.stderr
@@ -1,20 +1,4 @@
 error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
-  --> $DIR/effect_param.rs:11:9
-   |
-LL |     i8::checked_sub::<false>(42, 43);
-   |         ^^^^^^^^^^^--------- help: remove the unnecessary generics
-   |         |
-   |         expected 0 generic arguments
-
-error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
-  --> $DIR/effect_param.rs:13:9
-   |
-LL |     i8::checked_sub::<true>(42, 43);
-   |         ^^^^^^^^^^^-------- help: remove the unnecessary generics
-   |         |
-   |         expected 0 generic arguments
-
-error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
   --> $DIR/effect_param.rs:4:9
    |
 LL |     i8::checked_sub::<true>(42, 43);
@@ -30,6 +14,22 @@
    |         |
    |         expected 0 generic arguments
 
+error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
+  --> $DIR/effect_param.rs:11:9
+   |
+LL |     i8::checked_sub::<false>(42, 43);
+   |         ^^^^^^^^^^^--------- help: remove the unnecessary generics
+   |         |
+   |         expected 0 generic arguments
+
+error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
+  --> $DIR/effect_param.rs:13:9
+   |
+LL |     i8::checked_sub::<true>(42, 43);
+   |         ^^^^^^^^^^^-------- help: remove the unnecessary generics
+   |         |
+   |         expected 0 generic arguments
+
 error: aborting due to 4 previous errors
 
 For more information about this error, try `rustc --explain E0107`.
diff --git a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr
index 411eec8..0816635 100644
--- a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr
+++ b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr
@@ -1,18 +1,3 @@
-error[E0560]: struct `Crate` has no field named `fiel`
-  --> $DIR/dont-suggest-hygienic-fields.rs:44:34
-   |
-LL | environment!();
-   | -------------- in this macro invocation
-...
-LL |     const CRATE: Crate = Crate { fiel: () };
-   |                                  ^^^^ unknown field
-   |
-   = note: this error originates in the macro `environment` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: a field with a similar name exists
-   |
-LL |     const CRATE: Crate = Crate { field: () };
-   |                                      +
-
 error[E0609]: no field `field` on type `Compound`
   --> $DIR/dont-suggest-hygienic-fields.rs:24:16
    |
@@ -48,6 +33,21 @@
 LL |     let _ = ty.0;
    |                ^ unknown field
 
+error[E0560]: struct `Crate` has no field named `fiel`
+  --> $DIR/dont-suggest-hygienic-fields.rs:44:34
+   |
+LL | environment!();
+   | -------------- in this macro invocation
+...
+LL |     const CRATE: Crate = Crate { fiel: () };
+   |                                  ^^^^ unknown field
+   |
+   = note: this error originates in the macro `environment` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: a field with a similar name exists
+   |
+LL |     const CRATE: Crate = Crate { field: () };
+   |                                      +
+
 error: aborting due to 6 previous errors
 
 Some errors have detailed explanations: E0026, E0560, E0609.
diff --git a/tests/ui/impl-trait/normalize-tait-in-const.stderr b/tests/ui/impl-trait/normalize-tait-in-const.stderr
index d4ba9a3..2b6825b 100644
--- a/tests/ui/impl-trait/normalize-tait-in-const.stderr
+++ b/tests/ui/impl-trait/normalize-tait-in-const.stderr
@@ -25,14 +25,6 @@
    |
    = note: `Alias` must be used in combination with a concrete type within the same crate
 
-error[E0015]: cannot call non-const closure in constant functions
-  --> $DIR/normalize-tait-in-const.rs:28:5
-   |
-LL |     fun(filter_positive());
-   |     ^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-
 error[E0308]: mismatched types
   --> $DIR/normalize-tait-in-const.rs:22:9
    |
@@ -52,6 +44,14 @@
 LL |     pub const fn filter_positive<'a>() -> &'a Alias<'a> {
    |                  ^^^^^^^^^^^^^^^
 
+error[E0015]: cannot call non-const closure in constant functions
+  --> $DIR/normalize-tait-in-const.rs:28:5
+   |
+LL |     fun(filter_positive());
+   |     ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+
 error: aborting due to 5 previous errors
 
 Some errors have detailed explanations: E0015, E0308.
diff --git a/tests/ui/parser/pat-lt-bracket-6.stderr b/tests/ui/parser/pat-lt-bracket-6.stderr
index 0274809..83c88d1 100644
--- a/tests/ui/parser/pat-lt-bracket-6.stderr
+++ b/tests/ui/parser/pat-lt-bracket-6.stderr
@@ -6,12 +6,6 @@
    |
    = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html>
 
-error[E0308]: mismatched types
-  --> $DIR/pat-lt-bracket-6.rs:10:30
-   |
-LL | const RECOVERY_WITNESS: () = 0;
-   |                              ^ expected `()`, found integer
-
 error[E0023]: this pattern has 1 field, but the corresponding tuple struct has 2 fields
   --> $DIR/pat-lt-bracket-6.rs:5:14
    |
@@ -26,6 +20,12 @@
 LL |     let Test(&desc[..], _) = x;
    |                       +++
 
+error[E0308]: mismatched types
+  --> $DIR/pat-lt-bracket-6.rs:10:30
+   |
+LL | const RECOVERY_WITNESS: () = 0;
+   |                              ^ expected `()`, found integer
+
 error: aborting due to 3 previous errors
 
 Some errors have detailed explanations: E0023, E0308.
diff --git a/tests/ui/proc-macro/bad-projection.stderr b/tests/ui/proc-macro/bad-projection.stderr
index aa6b3da..f298149 100644
--- a/tests/ui/proc-macro/bad-projection.stderr
+++ b/tests/ui/proc-macro/bad-projection.stderr
@@ -10,6 +10,19 @@
 LL | trait Project {
    | ^^^^^^^^^^^^^
 
+error[E0277]: the trait bound `(): Project` is not satisfied
+  --> $DIR/bad-projection.rs:14:17
+   |
+LL | pub fn uwu() -> <() as Project>::Assoc {}
+   |                 ^^^^^^^^^^^^^^^^^^^^^^ the trait `Project` is not implemented for `()`
+   |
+help: this trait has no implementations, consider adding one
+  --> $DIR/bad-projection.rs:9:1
+   |
+LL | trait Project {
+   | ^^^^^^^^^^^^^
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
 error[E0593]: function is expected to take 1 argument, but it takes 0 arguments
   --> $DIR/bad-projection.rs:14:1
    |
@@ -47,19 +60,6 @@
 LL | trait Project {
    | ^^^^^^^^^^^^^
 
-error[E0277]: the trait bound `(): Project` is not satisfied
-  --> $DIR/bad-projection.rs:14:17
-   |
-LL | pub fn uwu() -> <() as Project>::Assoc {}
-   |                 ^^^^^^^^^^^^^^^^^^^^^^ the trait `Project` is not implemented for `()`
-   |
-help: this trait has no implementations, consider adding one
-  --> $DIR/bad-projection.rs:9:1
-   |
-LL | trait Project {
-   | ^^^^^^^^^^^^^
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-
 error: aborting due to 5 previous errors
 
 Some errors have detailed explanations: E0277, E0593.
diff --git a/tests/ui/return/dont-suggest-through-inner-const.stderr b/tests/ui/return/dont-suggest-through-inner-const.stderr
index 6aeee74..fc98b73 100644
--- a/tests/ui/return/dont-suggest-through-inner-const.stderr
+++ b/tests/ui/return/dont-suggest-through-inner-const.stderr
@@ -1,10 +1,4 @@
 error[E0308]: mismatched types
-  --> $DIR/dont-suggest-through-inner-const.rs:4:9
-   |
-LL |         0
-   |         ^ expected `()`, found integer
-
-error[E0308]: mismatched types
   --> $DIR/dont-suggest-through-inner-const.rs:1:17
    |
 LL | const fn f() -> usize {
@@ -12,6 +6,12 @@
    |          |
    |          implicitly returns `()` as its body has no tail or `return` expression
 
+error[E0308]: mismatched types
+  --> $DIR/dont-suggest-through-inner-const.rs:4:9
+   |
+LL |         0
+   |         ^ expected `()`, found integer
+
 error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/traits/const-traits/no-explicit-const-params.stderr b/tests/ui/traits/const-traits/no-explicit-const-params.stderr
index 9bd2c2c..6955e9a 100644
--- a/tests/ui/traits/const-traits/no-explicit-const-params.stderr
+++ b/tests/ui/traits/const-traits/no-explicit-const-params.stderr
@@ -1,4 +1,32 @@
 error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
+  --> $DIR/no-explicit-const-params.rs:15:5
+   |
+LL |     foo::<true>();
+   |     ^^^-------- help: remove the unnecessary generics
+   |     |
+   |     expected 0 generic arguments
+   |
+note: function defined here, with 0 generic parameters
+  --> $DIR/no-explicit-const-params.rs:3:10
+   |
+LL | const fn foo() {}
+   |          ^^^
+
+error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
+  --> $DIR/no-explicit-const-params.rs:17:12
+   |
+LL |     <() as Bar<true>>::bar();
+   |            ^^^------ help: remove the unnecessary generics
+   |            |
+   |            expected 0 generic arguments
+   |
+note: trait defined here, with 0 generic parameters
+  --> $DIR/no-explicit-const-params.rs:6:7
+   |
+LL | trait Bar {
+   |       ^^^
+
+error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
   --> $DIR/no-explicit-const-params.rs:22:5
    |
 LL |     foo::<false>();
@@ -32,34 +60,6 @@
 LL |     <() as Bar<false>>::bar();
    |      ^^
 
-error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
-  --> $DIR/no-explicit-const-params.rs:15:5
-   |
-LL |     foo::<true>();
-   |     ^^^-------- help: remove the unnecessary generics
-   |     |
-   |     expected 0 generic arguments
-   |
-note: function defined here, with 0 generic parameters
-  --> $DIR/no-explicit-const-params.rs:3:10
-   |
-LL | const fn foo() {}
-   |          ^^^
-
-error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
-  --> $DIR/no-explicit-const-params.rs:17:12
-   |
-LL |     <() as Bar<true>>::bar();
-   |            ^^^------ help: remove the unnecessary generics
-   |            |
-   |            expected 0 generic arguments
-   |
-note: trait defined here, with 0 generic parameters
-  --> $DIR/no-explicit-const-params.rs:6:7
-   |
-LL | trait Bar {
-   |       ^^^
-
 error: aborting due to 5 previous errors
 
 Some errors have detailed explanations: E0107, E0277.
diff --git a/tests/ui/transmutability/uninhabited.stderr b/tests/ui/transmutability/uninhabited.stderr
index 4c5c410..3044b50 100644
--- a/tests/ui/transmutability/uninhabited.stderr
+++ b/tests/ui/transmutability/uninhabited.stderr
@@ -1,21 +1,3 @@
-error[E0080]: evaluation of constant value failed
-  --> $DIR/uninhabited.rs:41:9
-   |
-LL |         assert!(false);
-   |         ^^^^^^^^^^^^^^ evaluation panicked: assertion failed: false
-
-error[E0080]: evaluation of constant value failed
-  --> $DIR/uninhabited.rs:63:9
-   |
-LL |         assert!(false);
-   |         ^^^^^^^^^^^^^^ evaluation panicked: assertion failed: false
-
-error[E0080]: evaluation of constant value failed
-  --> $DIR/uninhabited.rs:87:9
-   |
-LL |         assert!(false);
-   |         ^^^^^^^^^^^^^^ evaluation panicked: assertion failed: false
-
 error[E0277]: `()` cannot be safely transmuted into `void::Void`
   --> $DIR/uninhabited.rs:29:41
    |
@@ -58,6 +40,12 @@
 LL | |         }>
    | |__________^ required by this bound in `is_maybe_transmutable`
 
+error[E0080]: evaluation of constant value failed
+  --> $DIR/uninhabited.rs:41:9
+   |
+LL |         assert!(false);
+   |         ^^^^^^^^^^^^^^ evaluation panicked: assertion failed: false
+
 error[E0277]: `()` cannot be safely transmuted into `yawning_void_enum::Void`
   --> $DIR/uninhabited.rs:71:41
    |
@@ -79,6 +67,12 @@
 LL | |         }>
    | |__________^ required by this bound in `is_maybe_transmutable`
 
+error[E0080]: evaluation of constant value failed
+  --> $DIR/uninhabited.rs:63:9
+   |
+LL |         assert!(false);
+   |         ^^^^^^^^^^^^^^ evaluation panicked: assertion failed: false
+
 error[E0277]: `u128` cannot be safely transmuted into `DistantVoid`
   --> $DIR/uninhabited.rs:92:43
    |
@@ -100,6 +94,12 @@
 LL | |         }>
    | |__________^ required by this bound in `is_maybe_transmutable`
 
+error[E0080]: evaluation of constant value failed
+  --> $DIR/uninhabited.rs:87:9
+   |
+LL |         assert!(false);
+   |         ^^^^^^^^^^^^^^ evaluation panicked: assertion failed: false
+
 error[E0277]: `Src` cannot be safely transmuted into `issue_126267::Error`
   --> $DIR/uninhabited.rs:108:42
    |