Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip lint for assertion evaluated to false #119958

Closed
wants to merge 1 commit into from

Conversation

barabadzhi
Copy link

fixes #119908

@rustbot
Copy link
Collaborator

rustbot commented Jan 14, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @oli-obk (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot
Copy link
Collaborator

rustbot commented Jan 14, 2024

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 14, 2024
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-16 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
GITHUB_ACTION=__run_7
GITHUB_ACTIONS=true
GITHUB_ACTION_REF=
GITHUB_ACTION_REPOSITORY=
GITHUB_ACTOR=barabadzhi
GITHUB_API_URL=https://api.github.com
GITHUB_BASE_REF=master
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_114cf2e6-ea90-486a-9421-ca82d0fca75e
GITHUB_EVENT_NAME=pull_request
GITHUB_EVENT_NAME=pull_request
GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=skip-lint
GITHUB_JOB=pr
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_114cf2e6-ea90-486a-9421-ca82d0fca75e
GITHUB_REF=refs/pull/119958/merge
GITHUB_REF_NAME=119958/merge
GITHUB_REF_PROTECTED=false
---
GITHUB_SERVER_URL=https://github.com
GITHUB_SHA=9889488d6af36eca98f425394e52df6dff30b978
GITHUB_STATE=/home/runner/work/_temp/_runner_file_commands/save_state_114cf2e6-ea90-486a-9421-ca82d0fca75e
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_114cf2e6-ea90-486a-9421-ca82d0fca75e
GITHUB_TRIGGERING_ACTOR=barabadzhi
GITHUB_WORKFLOW_REF=rust-lang/rust/.github/workflows/ci.yml@refs/pull/119958/merge
GITHUB_WORKFLOW_SHA=9889488d6af36eca98f425394e52df6dff30b978
GITHUB_WORKSPACE=/home/runner/work/rust/rust
GOROOT_1_19_X64=/opt/hostedtoolcache/go/1.19.13/x64
---
Built container sha256:9c3c93a371e5aed5c18185b24f130d95d5140dbd72a9b325e7b6b49e521a4faa
Looks like docker image is the same as before, not uploading
https://ci-caches.rust-lang.org/docker/7ebc15c01a233894034d277c8cce4e949f4e7791f66b4727c8fb6e058a0b8171d6152e1441d677cef0653843ceeee469c097b8699b2bb74249e674f6aa1a8813
sha256:9c3c93a371e5aed5c18185b24f130d95d5140dbd72a9b325e7b6b49e521a4faa
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-16]
##[group]Clock drift check
  local time: Sun Jan 14 12:08:30 UTC 2024
  network time: Sun, 14 Jan 2024 12:08:30 GMT
  network time: Sun, 14 Jan 2024 12:08:30 GMT
##[endgroup]
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-16', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'build.optimized-compiler-builtins', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-16/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---
........................................................................................  2640/15973
........................................................................................  2728/15973
........................................................................................  2816/15973
........................................................................................  2904/15973
......................................................................................F.  2992/15973
...F............F.......................................................................  3080/15973
......Fi....FF..................................................................F.......  3168/15973
...................FF.....F.............................................................  3256/15973
........................................................................................  3432/15973
......................................................F.................................  3520/15973
........................................................................................  3608/15973
........................................................................................  3696/15973
---

---- [ui] tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs#opt stdout ----
diff of stderr:

38 LL |     const DIV_REV: i32 = T::DIV + (1/0);
39    |                                   ^^^^^ attempt to divide `1_i32` by zero
- error: this operation will panic at runtime
-   --> $DIR/issue-69020-assoc-const-arith-overflow.rs:42:22
-    |
-    |
- LL |     const OOB: i32 = [1][1] + T::OOB;
-    |                      ^^^^^^ index out of bounds: the length is 1 but the index is 1
- error: this operation will panic at runtime
-   --> $DIR/issue-69020-assoc-const-arith-overflow.rs:44:35
-    |
-    |
- LL |     const OOB_REV: i32 = T::OOB + [1][1];
-    |                                   ^^^^^^ index out of bounds: the length is 1 but the index is 1
- error: aborting due to 8 previous errors
+ error: aborting due to 6 previous errors
54 
55 
55 


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.opt/issue-69020-assoc-const-arith-overflow.opt.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args associated-consts/issue-69020-assoc-const-arith-overflow.rs`

error in revision `opt`: 1 errors occurred comparing output.
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.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" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--cfg" "opt" "--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/x86_64-unknown-linux-gnu/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.opt" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.opt/auxiliary" "-O"
--- stderr -------------------------------
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:27:22
   |
   |
LL |     const NEG: i32 = -i32::MIN + T::NEG;
   |                      ^^^^^^^^^ attempt to negate `i32::MIN`, which would overflow
Build completed unsuccessfully in 0:13:09
Build completed unsuccessfully in 0:13:09
   = note: `#[deny(arithmetic_overflow)]` on by default
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:29:35
   |
   |
LL |     const NEG_REV: i32 = T::NEG + (-i32::MIN);
   |                                   ^^^^^^^^^^^ attempt to negate `i32::MIN`, which would overflow
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:32:22
   |
   |
LL |     const ADD: i32 = (i32::MAX+1) + T::ADD;
   |                      ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:34:36
   |
   |
LL |     const ADD_REV: i32 =  T::ADD + (i32::MAX+1);
   |                                    ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
error: this operation will panic at runtime
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:37:22
   |
   |
LL |     const DIV: i32 = (1/0) + T::DIV;
   |                      ^^^^^ attempt to divide `1_i32` by zero
   = note: `#[deny(unconditional_panic)]` on by default

error: this operation will panic at runtime
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:39:35
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:39:35
   |
LL |     const DIV_REV: i32 = T::DIV + (1/0);
   |                                   ^^^^^ attempt to divide `1_i32` by zero
error: aborting due to 6 previous errors
------------------------------------------



---- [ui] tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs#noopt stdout ----
diff of stderr:

38 LL |     const DIV_REV: i32 = T::DIV + (1/0);
39    |                                   ^^^^^ attempt to divide `1_i32` by zero
- error: this operation will panic at runtime
-   --> $DIR/issue-69020-assoc-const-arith-overflow.rs:42:22
-    |
-    |
- LL |     const OOB: i32 = [1][1] + T::OOB;
-    |                      ^^^^^^ index out of bounds: the length is 1 but the index is 1
- error: this operation will panic at runtime
-   --> $DIR/issue-69020-assoc-const-arith-overflow.rs:44:35
-    |
-    |
- LL |     const OOB_REV: i32 = T::OOB + [1][1];
-    |                                   ^^^^^^ index out of bounds: the length is 1 but the index is 1
- error: aborting due to 8 previous errors
+ error: aborting due to 6 previous errors
54 
55 
55 


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.noopt/issue-69020-assoc-const-arith-overflow.noopt.stderr
To only update this specific test, also pass `--test-args associated-consts/issue-69020-assoc-const-arith-overflow.rs`


error in revision `noopt`: 1 errors occurred comparing output.
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.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" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--cfg" "noopt" "--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/x86_64-unknown-linux-gnu/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.noopt" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.noopt/auxiliary" "-C" "opt-level=0"
--- stderr -------------------------------
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:27:22
   |
   |
LL |     const NEG: i32 = -i32::MIN + T::NEG;
   |                      ^^^^^^^^^ attempt to negate `i32::MIN`, which would overflow
   |
   = note: `#[deny(arithmetic_overflow)]` on by default
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:29:35
   |
   |
LL |     const NEG_REV: i32 = T::NEG + (-i32::MIN);
   |                                   ^^^^^^^^^^^ attempt to negate `i32::MIN`, which would overflow
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:32:22
   |
   |
LL |     const ADD: i32 = (i32::MAX+1) + T::ADD;
   |                      ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:34:36
   |
   |
LL |     const ADD_REV: i32 =  T::ADD + (i32::MAX+1);
   |                                    ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
error: this operation will panic at runtime
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:37:22
   |
   |
LL |     const DIV: i32 = (1/0) + T::DIV;
   |                      ^^^^^ attempt to divide `1_i32` by zero
   = note: `#[deny(unconditional_panic)]` on by default

error: this operation will panic at runtime
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:39:35
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:39:35
   |
LL |     const DIV_REV: i32 = T::DIV + (1/0);
   |                                   ^^^^^ attempt to divide `1_i32` by zero
error: aborting due to 6 previous errors
------------------------------------------



---- [ui] tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs#opt_with_overflow_checks stdout ----
diff of stderr:

38 LL |     const DIV_REV: i32 = T::DIV + (1/0);
39    |                                   ^^^^^ attempt to divide `1_i32` by zero
- error: this operation will panic at runtime
-   --> $DIR/issue-69020-assoc-const-arith-overflow.rs:42:22
-    |
-    |
- LL |     const OOB: i32 = [1][1] + T::OOB;
-    |                      ^^^^^^ index out of bounds: the length is 1 but the index is 1
- error: this operation will panic at runtime
-   --> $DIR/issue-69020-assoc-const-arith-overflow.rs:44:35
-    |
-    |
- LL |     const OOB_REV: i32 = T::OOB + [1][1];
-    |                                   ^^^^^^ index out of bounds: the length is 1 but the index is 1
- error: aborting due to 8 previous errors
+ error: aborting due to 6 previous errors
54 
55 
55 


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.opt_with_overflow_checks/issue-69020-assoc-const-arith-overflow.opt_with_overflow_checks.stderr
To only update this specific test, also pass `--test-args associated-consts/issue-69020-assoc-const-arith-overflow.rs`


error in revision `opt_with_overflow_checks`: 1 errors occurred comparing output.
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.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" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--cfg" "opt_with_overflow_checks" "--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/x86_64-unknown-linux-gnu/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.opt_with_overflow_checks" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.opt_with_overflow_checks/auxiliary" "-C" "overflow-checks=on" "-O"
--- stderr -------------------------------
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:27:22
   |
   |
LL |     const NEG: i32 = -i32::MIN + T::NEG;
   |                      ^^^^^^^^^ attempt to negate `i32::MIN`, which would overflow
   |
   = note: `#[deny(arithmetic_overflow)]` on by default
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:29:35
   |
   |
LL |     const NEG_REV: i32 = T::NEG + (-i32::MIN);
   |                                   ^^^^^^^^^^^ attempt to negate `i32::MIN`, which would overflow
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:32:22
   |
   |
LL |     const ADD: i32 = (i32::MAX+1) + T::ADD;
   |                      ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:34:36
   |
   |
LL |     const ADD_REV: i32 =  T::ADD + (i32::MAX+1);
   |                                    ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
error: this operation will panic at runtime
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:37:22
   |
   |
LL |     const DIV: i32 = (1/0) + T::DIV;
   |                      ^^^^^ attempt to divide `1_i32` by zero
   = note: `#[deny(unconditional_panic)]` on by default

error: this operation will panic at runtime
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:39:35
##[error]  --> /checkout/tests/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs:39:35
   |
LL |     const DIV_REV: i32 = T::DIV + (1/0);
   |                                   ^^^^^ attempt to divide `1_i32` by zero
error: aborting due to 6 previous errors
------------------------------------------


---

- warning: this operation will panic at runtime
-   --> $DIR/array-literal-index-oob.rs:7:8
-    |
- LL |     &{ [1, 2, 3][4] };
-    |        ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4
- note: the lint level is defined here
-   --> $DIR/array-literal-index-oob.rs:4:9
-    |
- LL | #![warn(unconditional_panic)]
---
- 


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/array-literal-index-oob/array-literal-index-oob.stderr
To only update this specific test, also pass `--test-args consts/array-literal-index-oob.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
status: exit status: 0
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/consts/array-literal-index-oob.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" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/array-literal-index-oob" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/array-literal-index-oob/auxiliary"
stderr: none


---- [ui] tests/ui/consts/const-err2.rs#noopt stdout ----
---- [ui] tests/ui/consts/const-err2.rs#noopt stdout ----
diff of stderr:

36 LL |     let d = 42u8 - (42u8 + 1);
38 
- error: this operation will panic at runtime
-   --> $DIR/const-err2.rs:31:14
-    |
-    |
- LL |     let _e = [5u8][1];
-    |              ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
-    = note: `#[deny(unconditional_panic)]` on by default
- 
- error: aborting due to 7 previous errors
+ error: aborting due to 6 previous errors
+ error: aborting due to 6 previous errors
48 
49 


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-err2.noopt/const-err2.noopt.stderr
To only update this specific test, also pass `--test-args consts/const-err2.rs`


error in revision `noopt`: 1 errors occurred comparing output.
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/consts/const-err2.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" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--cfg" "noopt" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-err2.noopt" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-err2.noopt/auxiliary" "-C" "opt-level=0"
--- stderr -------------------------------
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/consts/const-err2.rs:19:13
   |
   |
LL |     let a = -i8::MIN;
   |             ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
   |
   = note: `#[deny(arithmetic_overflow)]` on by default
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/consts/const-err2.rs:21:18
   |
   |
LL |     let a_i128 = -i128::MIN;
   |                  ^^^^^^^^^^ attempt to negate `i128::MIN`, which would overflow
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/consts/const-err2.rs:23:13
   |
   |
LL |     let b = 200u8 + 200u8 + 200u8;
   |             ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/consts/const-err2.rs:25:18
   |
   |
LL |     let b_i128 = i128::MIN - i128::MAX;
   |                  ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX`, which would overflow
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/consts/const-err2.rs:27:13
   |
   |
LL |     let c = 200u8 * 4;
   |             ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/consts/const-err2.rs:29:13
   |
   |
LL |     let d = 42u8 - (42u8 + 1);

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



---- [ui] tests/ui/consts/const-err2.rs#opt_with_overflow_checks stdout ----
diff of stderr:

36 LL |     let d = 42u8 - (42u8 + 1);
38 
- error: this operation will panic at runtime
-   --> $DIR/const-err2.rs:31:14
-    |
-    |
- LL |     let _e = [5u8][1];
-    |              ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
-    = note: `#[deny(unconditional_panic)]` on by default
- 
- error: aborting due to 7 previous errors
+ error: aborting due to 6 previous errors
+ error: aborting due to 6 previous errors
48 
49 


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-err2.opt_with_overflow_checks/const-err2.opt_with_overflow_checks.stderr
To only update this specific test, also pass `--test-args consts/const-err2.rs`


error in revision `opt_with_overflow_checks`: 1 errors occurred comparing output.
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/consts/const-err2.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" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--cfg" "opt_with_overflow_checks" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-err2.opt_with_overflow_checks" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-err2.opt_with_overflow_checks/auxiliary" "-C" "overflow-checks=on" "-O"
--- stderr -------------------------------
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/consts/const-err2.rs:19:13
   |
   |
LL |     let a = -i8::MIN;
   |             ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
   |
   = note: `#[deny(arithmetic_overflow)]` on by default
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/consts/const-err2.rs:21:18
   |
   |
LL |     let a_i128 = -i128::MIN;
   |                  ^^^^^^^^^^ attempt to negate `i128::MIN`, which would overflow
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/consts/const-err2.rs:23:13
   |
   |
LL |     let b = 200u8 + 200u8 + 200u8;
   |             ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/consts/const-err2.rs:25:18
   |
   |
LL |     let b_i128 = i128::MIN - i128::MAX;
   |                  ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX`, which would overflow
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/consts/const-err2.rs:27:13
   |
   |
LL |     let c = 200u8 * 4;
   |             ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/consts/const-err2.rs:29:13
   |
   |
LL |     let d = 42u8 - (42u8 + 1);

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



---- [ui] tests/ui/consts/const-err2.rs#opt stdout ----
diff of stderr:

36 LL |     let d = 42u8 - (42u8 + 1);
38 
- error: this operation will panic at runtime
-   --> $DIR/const-err2.rs:31:14
-    |
-    |
- LL |     let _e = [5u8][1];
-    |              ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
-    = note: `#[deny(unconditional_panic)]` on by default
- 
- error: aborting due to 7 previous errors
+ error: aborting due to 6 previous errors
---
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-err2.opt/const-err2.opt.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args consts/const-err2.rs`

error in revision `opt`: 1 errors occurred comparing output.
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/consts/const-err2.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" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--cfg" "opt" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-err2.opt" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-err2.opt/auxiliary" "-O"
--- stderr -------------------------------
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/consts/const-err2.rs:19:13
   |
   |
LL |     let a = -i8::MIN;
   |             ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
   |
   = note: `#[deny(arithmetic_overflow)]` on by default
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/consts/const-err2.rs:21:18
   |
   |
LL |     let a_i128 = -i128::MIN;
   |                  ^^^^^^^^^^ attempt to negate `i128::MIN`, which would overflow
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/consts/const-err2.rs:23:13
   |
   |
LL |     let b = 200u8 + 200u8 + 200u8;
   |             ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/consts/const-err2.rs:25:18
   |
   |
LL |     let b_i128 = i128::MIN - i128::MAX;
   |                  ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX`, which would overflow
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/consts/const-err2.rs:27:13
   |
   |
LL |     let c = 200u8 * 4;
   |             ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow
error: this arithmetic operation will overflow
##[error]  --> /checkout/tests/ui/consts/const-err2.rs:29:13
   |
   |
LL |     let d = 42u8 - (42u8 + 1);

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

---

---- [ui] tests/ui/consts/const-eval/promoted_errors.rs#noopt stdout ----
diff of stderr:

34 LL |     1 / (false as i32)
35    |     ^^^^^^^^^^^^^^^^^^ attempt to divide `1_i32` by zero
- warning: this operation will panic at runtime
-   --> $DIR/promoted_errors.rs:31:5
-    |
- LL |     [1, 2, 3][4]
---
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-eval/promoted_errors.noopt/promoted_errors.noopt.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args consts/const-eval/promoted_errors.rs`

error in revision `noopt`: 1 errors occurred comparing output.
status: exit status: 0
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/consts/const-eval/promoted_errors.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" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--cfg" "noopt" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-eval/promoted_errors.noopt" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-eval/promoted_errors.noopt/auxiliary" "-C" "opt-level=0"
--- stderr -------------------------------
warning: this arithmetic operation will overflow
##[warning]  --> /checkout/tests/ui/consts/const-eval/promoted_errors.rs:15:5
   |
   |
LL |     0 - 1
   |     ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
   |
note: the lint level is defined here
  --> /checkout/tests/ui/consts/const-eval/promoted_errors.rs:11:9
   |
LL | #![warn(arithmetic_overflow, unconditional_panic)]

warning: this operation will panic at runtime
##[warning]  --> /checkout/tests/ui/consts/const-eval/promoted_errors.rs:19:5
   |
   |
LL |     1 / 0
   |     ^^^^^ attempt to divide `1_i32` by zero
note: the lint level is defined here
  --> /checkout/tests/ui/consts/const-eval/promoted_errors.rs:11:30
   |
   |
LL | #![warn(arithmetic_overflow, unconditional_panic)]

warning: this operation will panic at runtime
##[warning]  --> /checkout/tests/ui/consts/const-eval/promoted_errors.rs:23:5
   |
   |
LL |     1 / (1 - 1)
   |     ^^^^^^^^^^^ attempt to divide `1_i32` by zero
warning: this operation will panic at runtime
##[warning]  --> /checkout/tests/ui/consts/const-eval/promoted_errors.rs:27:5
   |
LL |     1 / (false as i32)
LL |     1 / (false as i32)
   |     ^^^^^^^^^^^^^^^^^^ attempt to divide `1_i32` by zero
warning: 4 warnings emitted
------------------------------------------



---- [ui] tests/ui/consts/const-eval/promoted_errors.rs#opt stdout ----
diff of stderr:

34 LL |     1 / (false as i32)
35    |     ^^^^^^^^^^^^^^^^^^ attempt to divide `1_i32` by zero
- warning: this operation will panic at runtime
-   --> $DIR/promoted_errors.rs:31:5
-    |
- LL |     [1, 2, 3][4]
---
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-eval/promoted_errors.opt/promoted_errors.opt.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args consts/const-eval/promoted_errors.rs`

error in revision `opt`: 1 errors occurred comparing output.
status: exit status: 0
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/consts/const-eval/promoted_errors.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" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--cfg" "opt" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-eval/promoted_errors.opt" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-eval/promoted_errors.opt/auxiliary" "-O"
--- stderr -------------------------------
warning: this arithmetic operation will overflow
##[warning]  --> /checkout/tests/ui/consts/const-eval/promoted_errors.rs:15:5
   |
   |
LL |     0 - 1
   |     ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
   |
note: the lint level is defined here
  --> /checkout/tests/ui/consts/const-eval/promoted_errors.rs:11:9
   |
LL | #![warn(arithmetic_overflow, unconditional_panic)]

warning: this operation will panic at runtime
##[warning]  --> /checkout/tests/ui/consts/const-eval/promoted_errors.rs:19:5
   |
   |
LL |     1 / 0
   |     ^^^^^ attempt to divide `1_i32` by zero
note: the lint level is defined here
  --> /checkout/tests/ui/consts/const-eval/promoted_errors.rs:11:30
   |
   |
LL | #![warn(arithmetic_overflow, unconditional_panic)]

warning: this operation will panic at runtime
##[warning]  --> /checkout/tests/ui/consts/const-eval/promoted_errors.rs:23:5
   |
   |
LL |     1 / (1 - 1)
   |     ^^^^^^^^^^^ attempt to divide `1_i32` by zero
warning: this operation will panic at runtime
##[warning]  --> /checkout/tests/ui/consts/const-eval/promoted_errors.rs:27:5
   |
LL |     1 / (false as i32)
LL |     1 / (false as i32)
   |     ^^^^^^^^^^^^^^^^^^ attempt to divide `1_i32` by zero
warning: 4 warnings emitted
------------------------------------------



---- [ui] tests/ui/consts/const-eval/promoted_errors.rs#opt_with_overflow_checks stdout ----
diff of stderr:

34 LL |     1 / (false as i32)
35    |     ^^^^^^^^^^^^^^^^^^ attempt to divide `1_i32` by zero
- warning: this operation will panic at runtime
-   --> $DIR/promoted_errors.rs:31:5
-    |
- LL |     [1, 2, 3][4]
---
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks/promoted_errors.opt_with_overflow_checks.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args consts/const-eval/promoted_errors.rs`

error in revision `opt_with_overflow_checks`: 1 errors occurred comparing output.
status: exit status: 0
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/consts/const-eval/promoted_errors.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" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--cfg" "opt_with_overflow_checks" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks/auxiliary" "-C" "overflow-checks=on" "-O"
--- stderr -------------------------------
warning: this arithmetic operation will overflow
##[warning]  --> /checkout/tests/ui/consts/const-eval/promoted_errors.rs:15:5
   |
   |
LL |     0 - 1
   |     ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
   |
note: the lint level is defined here
  --> /checkout/tests/ui/consts/const-eval/promoted_errors.rs:11:9
   |
LL | #![warn(arithmetic_overflow, unconditional_panic)]

warning: this operation will panic at runtime
##[warning]  --> /checkout/tests/ui/consts/const-eval/promoted_errors.rs:19:5
   |
   |
LL |     1 / 0
   |     ^^^^^ attempt to divide `1_i32` by zero
note: the lint level is defined here
  --> /checkout/tests/ui/consts/const-eval/promoted_errors.rs:11:30
   |
   |
LL | #![warn(arithmetic_overflow, unconditional_panic)]

warning: this operation will panic at runtime
##[warning]  --> /checkout/tests/ui/consts/const-eval/promoted_errors.rs:23:5
   |
   |
LL |     1 / (1 - 1)
   |     ^^^^^^^^^^^ attempt to divide `1_i32` by zero
warning: this operation will panic at runtime
##[warning]  --> /checkout/tests/ui/consts/const-eval/promoted_errors.rs:27:5
   |
LL |     1 / (false as i32)
LL |     1 / (false as i32)
   |     ^^^^^^^^^^^^^^^^^^ attempt to divide `1_i32` by zero
warning: 4 warnings emitted
------------------------------------------



---- [ui] tests/ui/consts/issue-54348.rs stdout ----

error: ui test compiled successfully!
status: exit status: 0
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/consts/issue-54348.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" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/issue-54348" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/issue-54348/auxiliary"
stderr: none


---- [ui] tests/ui/lint/unconditional_panic_98444.rs stdout ----
---- [ui] tests/ui/lint/unconditional_panic_98444.rs stdout ----

error: ui test compiled successfully!
status: exit status: 0
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/lint/unconditional_panic_98444.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" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/lint/unconditional_panic_98444" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/lint/unconditional_panic_98444/auxiliary"
stderr: none



fn main() {
let x: [i32; 0] = [];
if x.len() > 0 {
x[0];
Copy link
Member

@matthiaskrgr matthiaskrgr Jan 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this trigger an unreachable/dead code warning?

Copy link
Author

@barabadzhi barabadzhi Jan 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, lint is omitted for the whole block, as it will never run anyway.

@oli-obk
Copy link
Contributor

oli-obk commented Jan 14, 2024

Your change disables all lints on slice length check assertions. I don't think this issue can easily be fixed, although we can special case [T]::len to be something the const propagator understands

@oli-obk
Copy link
Contributor

oli-obk commented Jan 14, 2024

Note that such a change will be much simpler to do after #119627 lands

@barabadzhi
Copy link
Author

Yep, I see. Thanks @oli-obk.

I've done some more testing & it's the unwanted side effect indeed.
It's my first rustc PR, so I'm nowhere near fluent with the internals.

I'll wait for the #119627 to get merged & will revisit this PR.

@bors
Copy link
Contributor

bors commented Jan 25, 2024

☔ The latest upstream changes (presumably #119627) made this pull request unmergeable. Please resolve the merge conflicts.

@oli-obk
Copy link
Contributor

oli-obk commented Jan 25, 2024

The other PR has landed. Thinking about it a bit more, we may not need a special value at all. You could implemenent an arm for

| TerminatorKind::Call { .. }
and use a diagnostic item on the [T]::len method to detect that it's a call to that. If it is, just check the self type and extract the length in case it is an array. There may be some casts involved, so you may also need to implement some sort of helper for unsizing casts (which could probably be a PR on its own, but not sure we can write a test that will actually be affected).

@oli-obk oli-obk added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 29, 2024
@Dylan-DPC
Copy link
Member

@barabadzhi any updates on this? thanks

@Dylan-DPC
Copy link
Member

Closing this as inactive. Feel free to reöpen this pr or create a new pr if you get the time to work on this. Thanks

@Dylan-DPC Dylan-DPC closed this Apr 24, 2024
@Dylan-DPC Dylan-DPC added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. 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.

rustc is unable to evaluate a singular conditional pathway predicated on the length of an array literal
7 participants