Skip to content

Evaluate free constants and statics in definition order under the parallel front-end#157353

Draft
xmakro wants to merge 1 commit into
rust-lang:mainfrom
xmakro:parallel-frontend-const-eval-order
Draft

Evaluate free constants and statics in definition order under the parallel front-end#157353
xmakro wants to merge 1 commit into
rust-lang:mainfrom
xmakro:parallel-frontend-const-eval-order

Conversation

@xmakro
Copy link
Copy Markdown

@xmakro xmakro commented Jun 3, 2026

Summary

Under the parallel front-end, tests/ui/consts/chained-constants-stackoverflow.rs intermittently fails with "queries overflow the depth limit", even though it is a valid program that compiles fine single-threaded. This is the depth-limit nondeterminism tracked in issue 146616.

Cause

check_crate forces the value of every free static and non-generic const, so that an item whose value fails to evaluate is still reported even when the item is unused. This forcing runs inside par_hir_body_owners, which under the parallel front-end hands the items to worker threads in an arbitrary order.

A constant whose initializer refers to another constant evaluates that other constant as a nested, depth-limited query. When a worker thread starts evaluating a constant before the constants it depends on have been cached, the nested evaluation builds a query stack whose depth tracks the length of the still-uncached dependency chain. For a long chain of constants (this test has 350) that depth depends on thread scheduling and can exceed the recursion limit, so the same crate compiles single-threaded but intermittently fails in parallel.

Fix

When more than one thread is in use, force these values sequentially in definition order before the parallel loop. This matches the single-threaded evaluation order: each constant's dependencies are already cached by the time it is evaluated, so the query depth stays shallow.

The fix changes only the evaluation order, never the recursion limit, so genuine overflow tests are unaffected. Those tests each have a single evaluation entry point whose depth does not depend on scheduling (one body owner recursing linearly, or codegen monomorphizing a generic const), so they still overflow with identical output. The side-effecting maybe_check_static_with_link_section check is kept in the parallel loop so that it still runs exactly once.

The previously ignored test is re-enabled under the parallel front-end.

Testing

  • chained-constants-stackoverflow.rs: 0 overflows across 240 runs at -Zthreads=8/16/32 with the fix, and 80 of 80 overflow without it.
  • The four genuine depth-limit overflow tests (consts/recursive-block, query-system/query_depth, consts/recursive-const-in-impl, generic-const-items/recursive) still overflow deterministically with their existing expected output.
  • ./x test --set rust.parallel-frontend-threads=8 on the affected tests, plus a sweep of tests/ui/consts and tests/ui/statics: all pass.

Trade-off

This serializes evaluation of free constant and static values under the parallel front-end. The heavy per-body work (type checking, borrow checking, MIR) remains fully parallel in the separate loops in rustc_interface. The cost is limited to crates with many independent, expensive top-level constants.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 3, 2026
… front-end

The crate analysis pass forces the value of every free `static` and
non-generic `const`, so that an item whose value fails to evaluate is
reported even when the item is unused. This forcing runs inside
`par_hir_body_owners`, which under the parallel front-end hands the items
to worker threads in an arbitrary order.

A constant whose initializer refers to another constant evaluates that
other constant as a nested, depth-limited query. When a worker thread
starts evaluating a constant before the constants it depends on have been
cached, the nested evaluation builds a query stack whose depth tracks the
length of the still-uncached dependency chain. For a long chain of
constants this depth depends on thread scheduling and can spuriously
exceed the recursion limit, so the same valid crate compiles under the
single-threaded front-end but intermittently fails under the parallel one.

Chains of associated constants reach this same depth-limited path: the
per-body const-checking that runs during analysis evaluates the constants
an item refers to, so an associated constant defined in terms of earlier
ones evaluates the whole chain. Include non-generic associated constants
in the eager forcing so that their chains are evaluated in definition
order as well, with the same parent-aware monomorphization guard used for
free constants. As a result an associated constant whose value fails to
evaluate is now reported at its definition, like a free constant, instead
of at a use site.

Force these values sequentially in definition order before the parallel
loop when more than one thread is in use. This matches the single-threaded
evaluation order: each constant's dependencies are already cached by the
time it is evaluated, so the query depth stays shallow. Genuine unbounded
recursion still overflows, because it has a single evaluation entry point
whose depth does not depend on scheduling.

Re-enable tests/ui/consts/chained-constants-stackoverflow.rs under the
parallel front-end.
@xmakro xmakro force-pushed the parallel-frontend-const-eval-order branch from 001ad70 to 049476e Compare June 3, 2026 04:18
@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
- error: aborting due to 37 previous errors
+ error: constant evaluation is taking a long time
+   --> $DIR/lint-attr-everywhere-early.rs:50:34
+    |
+ LL |     const INHERENT_CONST: i32 = {while true {} 1};
+    |                                  ^^^^^^^^^^^^^
+    |
+    = note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval.
+            If your compilation actually takes a long time, you can safely allow the lint
+ help: the constant being evaluated
+   --> $DIR/lint-attr-everywhere-early.rs:50:5
+    |
+ LL |     const INHERENT_CONST: i32 = {while true {} 1};
+    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+    = note: `#[deny(long_running_const_eval)]` on by default
+ 
+ error: constant evaluation is taking a long time
+   --> $DIR/lint-attr-everywhere-early.rs:81:31
+    |
+ LL |     const ASSOC_CONST: i32 = {while true {} 1};
+    |                               ^^^^^^^^^^^^^
+    |
+    = note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval.
+            If your compilation actually takes a long time, you can safely allow the lint
+ help: the constant being evaluated
+   --> $DIR/lint-attr-everywhere-early.rs:81:5
+    |
+ LL |     const ASSOC_CONST: i32 = {while true {} 1};
+    |     ^^^^^^^^^^^^^^^^^^^^^^
+ 
+ error: aborting due to 39 previous errors
500 
501 

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:50:34
- LL |     const INHERENT_CONST: i32 = {while true {} 1}; //~ ERROR denote infinite loops with
-   --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:50:5
- LL |     const INHERENT_CONST: i32 = {while true {} 1}; //~ ERROR denote infinite loops with
-   --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:81:31
- LL |     const ASSOC_CONST: i32 = {while true {} 1};  //~ ERROR denote infinite loops with
-   --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:81:5
- LL |     const ASSOC_CONST: i32 = {while true {} 1};  //~ ERROR denote infinite loops with
+ error: constant evaluation is taking a long time
+   --> $DIR/lint-attr-everywhere-early.rs:50:34
+    |
+ LL |     const INHERENT_CONST: i32 = {while true {} 1};
+    |                                  ^^^^^^^^^^^^^
+    |
+    = note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval.
+            If your compilation actually takes a long time, you can safely allow the lint
+ help: the constant being evaluated
+   --> $DIR/lint-attr-everywhere-early.rs:50:5
+    |
+ LL |     const INHERENT_CONST: i32 = {while true {} 1};
+    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+    = note: `#[deny(long_running_const_eval)]` on by default
+ 
+ error: constant evaluation is taking a long time
+   --> $DIR/lint-attr-everywhere-early.rs:81:31
+    |
+ LL |     const ASSOC_CONST: i32 = {while true {} 1};
+    |                               ^^^^^^^^^^^^^
+    |
+    = note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval.
+            If your compilation actually takes a long time, you can safely allow the lint
+ help: the constant being evaluated
+   --> $DIR/lint-attr-everywhere-early.rs:81:5
+    |
+ LL |     const ASSOC_CONST: i32 = {while true {} 1};
+    |     ^^^^^^^^^^^^^^^^^^^^^^
+ 
+ error: aborting due to 39 previous errors


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args lint/lint-attr-everywhere-early.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/lint/lint-attr-everywhere-early.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/lint/lint-attr-everywhere-early" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2015"
stdout: none
--- stderr -------------------------------
error: type `type_outer` should have an upper camel case name
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:23:6
   |
LL | type type_outer = i32; //~ ERROR type `type_outer` should have an upper camel case name
   |      ^^^^^^^^^^ help: convert the identifier to upper camel case: `TypeOuter`
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:22:8
   |
LL | #[deny(non_camel_case_types)]
   |        ^^^^^^^^^^^^^^^^^^^^

error: unnecessary parentheses around type
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:25:43
   |
LL | type BareFnPtr = fn(#[deny(unused_parens)](i32)); //~ ERROR unnecessary parentheses around type
   |                                           ^   ^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:25:28
   |
LL | type BareFnPtr = fn(#[deny(unused_parens)](i32)); //~ ERROR unnecessary parentheses around type
   |                            ^^^^^^^^^^^^^
help: remove these parentheses
   |
LL - type BareFnPtr = fn(#[deny(unused_parens)](i32)); //~ ERROR unnecessary parentheses around type
LL + type BareFnPtr = fn(#[deny(unused_parens)]i32); //~ ERROR unnecessary parentheses around type
   |

error: type `ITEM_OUTER` should have an upper camel case name
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:31:8
   |
LL | struct ITEM_OUTER; //~ ERROR type `ITEM_OUTER` should have an upper camel case name
   |        ^^^^^^^^^^ help: convert the identifier to upper camel case: `ItemOuter`
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:30:8
   |
LL | #[deny(non_camel_case_types)]
   |        ^^^^^^^^^^^^^^^^^^^^

error: usage of an `unsafe` block
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:36:9
   |
LL |         unsafe {} //~ ERROR usage of an `unsafe` block
   |         ^^^^^^^^^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:34:13
   |
LL |     #![deny(unsafe_code)]
   |             ^^^^^^^^^^^

error: usage of an `unsafe` block
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:44:39
   |
LL |     fn inherent_denied_from_inner() { unsafe {} } //~ ERROR usage of an `unsafe` block
   |                                       ^^^^^^^^^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:42:13
   |
LL |     #![deny(unsafe_code)]
   |             ^^^^^^^^^^^

error: denote infinite loops with `loop { ... }`
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:47:24
   |
LL |     fn inherent_fn() { while true {} } //~ ERROR denote infinite loops with
   |                        ^^^^^^^^^^ help: use `loop`
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:46:12
   |
LL |     #[deny(while_true)]
   |            ^^^^^^^^^^

error: denote infinite loops with `loop { ... }`
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:50:34
   |
LL |     const INHERENT_CONST: i32 = {while true {} 1}; //~ ERROR denote infinite loops with
   |                                  ^^^^^^^^^^ help: use `loop`
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:49:12
   |
LL |     #[deny(while_true)]
   |            ^^^^^^^^^^

error: trait `trait_inner` should have an upper camel case name
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:53:7
   |
LL | trait trait_inner { //~ ERROR trait `trait_inner` should have an upper camel case name
   |       ^^^^^^^^^^^ help: convert the identifier to upper camel case: `TraitInner`
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:54:13
   |
LL |     #![deny(non_camel_case_types)]
   |             ^^^^^^^^^^^^^^^^^^^^

error: usage of an `unsafe` block
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:60:30
   |
LL |     fn denied_from_inner() { unsafe {} } //~ ERROR usage of an `unsafe` block
   |                              ^^^^^^^^^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:58:13
   |
LL |     #![deny(unsafe_code)]
   |             ^^^^^^^^^^^

error: denote infinite loops with `loop { ... }`
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:63:21
   |
LL |     fn assoc_fn() { while true {} } //~ ERROR denote infinite loops with
   |                     ^^^^^^^^^^ help: use `loop`
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:62:12
   |
LL |     #[deny(while_true)]
   |            ^^^^^^^^^^

error: denote infinite loops with `loop { ... }`
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:66:31
   |
LL |     const ASSOC_CONST: i32 = {while true {} 1}; //~ ERROR denote infinite loops with
   |                               ^^^^^^^^^^ help: use `loop`
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:65:12
   |
LL |     #[deny(while_true)]
   |            ^^^^^^^^^^

error: associated type `assoc_type` should have an upper camel case name
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:69:10
   |
LL |     type assoc_type; //~ ERROR associated type `assoc_type` should have an upper camel case name
   |          ^^^^^^^^^^ help: convert the identifier to upper camel case: `AssocType`
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:68:12
   |
LL |     #[deny(non_camel_case_types)]
   |            ^^^^^^^^^^^^^^^^^^^^

error: usage of an `unsafe` block
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:75:30
   |
LL |     fn denied_from_inner() { unsafe {} } //~ ERROR usage of an `unsafe` block
   |                              ^^^^^^^^^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:73:13
   |
LL |     #![deny(unsafe_code)]
   |             ^^^^^^^^^^^

error: denote infinite loops with `loop { ... }`
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:78:21
   |
LL |     fn assoc_fn() { while true {} } //~ ERROR denote infinite loops with
   |                     ^^^^^^^^^^ help: use `loop`
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:77:12
   |
LL |     #[deny(while_true)]
   |            ^^^^^^^^^^

error: denote infinite loops with `loop { ... }`
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:81:31
   |
LL |     const ASSOC_CONST: i32 = {while true {} 1};  //~ ERROR denote infinite loops with
   |                               ^^^^^^^^^^ help: use `loop`
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:80:12
   |
LL |     #[deny(while_true)]
   |            ^^^^^^^^^^

error: unnecessary parentheses around type
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:84:23
   |
LL |     type assoc_type = (i32); //~ ERROR unnecessary parentheses around type
   |                       ^   ^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:83:12
   |
LL |     #[deny(unused_parens)]
   |            ^^^^^^^^^^^^^
help: remove these parentheses
   |
LL -     type assoc_type = (i32); //~ ERROR unnecessary parentheses around type
LL +     type assoc_type = i32; //~ ERROR unnecessary parentheses around type
   |

error: unnecessary parentheses around type
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:88:31
   |
LL |     #[deny(unused_parens)]f1: (i32), //~ ERROR unnecessary parentheses around type
   |                               ^   ^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:88:12
   |
LL |     #[deny(unused_parens)]f1: (i32), //~ ERROR unnecessary parentheses around type
   |            ^^^^^^^^^^^^^
help: remove these parentheses
   |
LL -     #[deny(unused_parens)]f1: (i32), //~ ERROR unnecessary parentheses around type
LL +     #[deny(unused_parens)]f1: i32, //~ ERROR unnecessary parentheses around type
   |

error: unnecessary parentheses around type
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:90:42
   |
LL | struct StructTuple(#[deny(unused_parens)](i32)); //~ ERROR unnecessary parentheses around type
   |                                          ^   ^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:90:27
   |
LL | struct StructTuple(#[deny(unused_parens)](i32)); //~ ERROR unnecessary parentheses around type
   |                           ^^^^^^^^^^^^^
help: remove these parentheses
   |
LL - struct StructTuple(#[deny(unused_parens)](i32)); //~ ERROR unnecessary parentheses around type
LL + struct StructTuple(#[deny(unused_parens)]i32); //~ ERROR unnecessary parentheses around type
   |

error: variant `VARIANT_CAMEL` should have an upper camel case name
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:94:5
   |
LL |     VARIANT_CAMEL, //~ ERROR variant `VARIANT_CAMEL` should have an upper camel case name
   |     ^^^^^^^^^^^^^ help: convert the identifier to upper camel case: `VariantCamel`
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:93:12
   |
LL |     #[deny(non_camel_case_types)]
   |            ^^^^^^^^^^^^^^^^^^^^

error: unnecessary parentheses around type
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:100:37
   |
LL |     fn foreign_denied_from_inner(x: (i32)); //~ ERROR unnecessary parentheses around type
   |                                     ^   ^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:98:13
   |
LL |     #![deny(unused_parens)]
   |             ^^^^^^^^^^^^^
help: remove these parentheses
   |
LL -     fn foreign_denied_from_inner(x: (i32)); //~ ERROR unnecessary parentheses around type
LL +     fn foreign_denied_from_inner(x: i32); //~ ERROR unnecessary parentheses around type
   |

error: unnecessary parentheses around type
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:105:37
   |
LL |     fn foreign_denied_from_outer(x: (i32)); //~ ERROR unnecessary parentheses around type
   |                                     ^   ^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:104:12
   |
LL |     #[deny(unused_parens)]
   |            ^^^^^^^^^^^^^
help: remove these parentheses
   |
LL -     fn foreign_denied_from_outer(x: (i32)); //~ ERROR unnecessary parentheses around type
LL +     fn foreign_denied_from_outer(x: i32); //~ ERROR unnecessary parentheses around type
   |

error: unnecessary parentheses around type
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:108:43
   |
LL | fn function(#[deny(unused_parens)] param: (i32)) {} //~ ERROR unnecessary parentheses around type
   |                                           ^   ^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:108:20
   |
LL | fn function(#[deny(unused_parens)] param: (i32)) {} //~ ERROR unnecessary parentheses around type
   |                    ^^^^^^^^^^^^^
help: remove these parentheses
   |
LL - fn function(#[deny(unused_parens)] param: (i32)) {} //~ ERROR unnecessary parentheses around type
LL + fn function(#[deny(unused_parens)] param: i32) {} //~ ERROR unnecessary parentheses around type
   |

error: type parameter `foo` should have an upper camel case name
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:110:42
   |
LL | fn generics<#[deny(non_camel_case_types)]foo>() {} //~ ERROR type parameter `foo` should have an upper camel case name
   |                                          ^^^ help: convert the identifier to upper camel case (notice the capitalization): `Foo`
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:110:20
   |
LL | fn generics<#[deny(non_camel_case_types)]foo>() {} //~ ERROR type parameter `foo` should have an upper camel case name
   |                    ^^^^^^^^^^^^^^^^^^^^

error: unnecessary parentheses around assigned value
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:116:13
   |
LL |     let x = (1); //~ ERROR unnecessary parentheses around assigned value
   |             ^ ^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:115:12
   |
LL |     #[deny(unused_parens)]
   |            ^^^^^^^^^^^^^
help: remove these parentheses
   |
LL -     let x = (1); //~ ERROR unnecessary parentheses around assigned value
LL +     let x = 1; //~ ERROR unnecessary parentheses around assigned value
   |

error: unnecessary parentheses around type
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:122:50
   |
LL |     let closure = |#[deny(unused_parens)] param: (i32)| {}; //~ ERROR unnecessary parentheses around type
   |                                                  ^   ^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:122:27
   |
LL |     let closure = |#[deny(unused_parens)] param: (i32)| {}; //~ ERROR unnecessary parentheses around type
   |                           ^^^^^^^^^^^^^
help: remove these parentheses
   |
LL -     let closure = |#[deny(unused_parens)] param: (i32)| {}; //~ ERROR unnecessary parentheses around type
LL +     let closure = |#[deny(unused_parens)] param: i32| {}; //~ ERROR unnecessary parentheses around type
   |

error: unnecessary parentheses around block return value
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:126:46
   |
LL |     let f = Match{#[deny(unused_parens)]f1: {(123)}}; //~ ERROR unnecessary parentheses around block return value
   |                                              ^   ^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:126:26
   |
LL |     let f = Match{#[deny(unused_parens)]f1: {(123)}}; //~ ERROR unnecessary parentheses around block return value
   |                          ^^^^^^^^^^^^^
help: remove these parentheses
   |
LL -     let f = Match{#[deny(unused_parens)]f1: {(123)}}; //~ ERROR unnecessary parentheses around block return value
LL +     let f = Match{#[deny(unused_parens)]f1: {123}}; //~ ERROR unnecessary parentheses around block return value
   |

error: usage of an `unsafe` block
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:133:13
   |
LL |             unsafe {} //~ ERROR usage of an `unsafe` block
   |             ^^^^^^^^^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:129:17
   |
LL |         #![deny(unsafe_code)]
   |                 ^^^^^^^^^^^

error: denote infinite loops with `loop { ... }`
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:134:13
   |
LL |             while true {} //~ ERROR denote infinite loops with
   |             ^^^^^^^^^^ help: use `loop`
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:131:16
   |
LL |         #[deny(while_true)]
   |                ^^^^^^^^^^

error: `...` range patterns are deprecated
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:140:20
   |
LL |         Match{f1: 0...100} => {}
   |                    ^^^ help: use `..=` for an inclusive range
   |
   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html>
note: the lint level is defined here
---

error: usage of an `unsafe` block
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:149:9
   |
LL |         unsafe {} //~ ERROR usage of an `unsafe` block
   |         ^^^^^^^^^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:148:17
   |
LL |         #![deny(unsafe_code)]
   |                 ^^^^^^^^^^^

error: usage of an `unsafe` block
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:153:9
   |
LL |         unsafe {} //~ ERROR usage of an `unsafe` block
   |         ^^^^^^^^^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:152:16
   |
LL |         #[deny(unsafe_code)]
   |                ^^^^^^^^^^^

error: usage of an `unsafe` block
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:158:5
   |
LL |     unsafe {}; //~ ERROR usage of an `unsafe` block
   |     ^^^^^^^^^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:157:12
   |
LL |     #[deny(unsafe_code)]
   |            ^^^^^^^^^^^

error: usage of an `unsafe` block
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:160:27
   |
LL |     [#[deny(unsafe_code)] unsafe {123}]; //~ ERROR usage of an `unsafe` block
   |                           ^^^^^^^^^^^^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:160:13
   |
LL |     [#[deny(unsafe_code)] unsafe {123}]; //~ ERROR usage of an `unsafe` block
   |             ^^^^^^^^^^^

error: usage of an `unsafe` block
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:161:27
   |
LL |     (#[deny(unsafe_code)] unsafe {123},); //~ ERROR usage of an `unsafe` block
   |                           ^^^^^^^^^^^^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:161:13
   |
LL |     (#[deny(unsafe_code)] unsafe {123},); //~ ERROR usage of an `unsafe` block
   |             ^^^^^^^^^^^

error: usage of an `unsafe` block
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:163:31
   |
LL |     call(#[deny(unsafe_code)] unsafe {123}); //~ ERROR usage of an `unsafe` block
   |                               ^^^^^^^^^^^^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:163:17
   |
LL |     call(#[deny(unsafe_code)] unsafe {123}); //~ ERROR usage of an `unsafe` block
   |                 ^^^^^^^^^^^

error: usage of an `unsafe` block
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:165:38
   |
LL |     TupleStruct(#[deny(unsafe_code)] unsafe {123}); //~ ERROR usage of an `unsafe` block
   |                                      ^^^^^^^^^^^^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:165:24
   |
LL |     TupleStruct(#[deny(unsafe_code)] unsafe {123}); //~ ERROR usage of an `unsafe` block
   |                        ^^^^^^^^^^^

error: `...` range patterns are deprecated
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:176:18
   |
---

error: constant evaluation is taking a long time
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:50:34
   |
LL |     const INHERENT_CONST: i32 = {while true {} 1}; //~ ERROR denote infinite loops with
   |                                  ^^^^^^^^^^^^^
   |
   = note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval.
           If your compilation actually takes a long time, you can safely allow the lint
help: the constant being evaluated
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:50:5
   |
LL |     const INHERENT_CONST: i32 = {while true {} 1}; //~ ERROR denote infinite loops with
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: `#[deny(long_running_const_eval)]` on by default

error: constant evaluation is taking a long time
##[error]  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:81:31
   |
LL |     const ASSOC_CONST: i32 = {while true {} 1};  //~ ERROR denote infinite loops with
   |                               ^^^^^^^^^^^^^
   |
   = note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval.
           If your compilation actually takes a long time, you can safely allow the lint
help: the constant being evaluated
  --> /checkout/tests/ui/lint/lint-attr-everywhere-early.rs:81:5
   |
LL |     const ASSOC_CONST: i32 = {while true {} 1};  //~ ERROR denote infinite loops with
   |     ^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 39 previous errors
------------------------------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants