rust
rust copied to clipboard
Disallow hidden references to mutable static
Closes #123060
Tracking:
- https://github.com/rust-lang/rust/issues/123758
Sorry, I can only review interpreter and Miri PRs.
r? compiler
r? @davidtwco
The job mingw-check-tidy failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)
Getting action download info
Download action repository 'msys2/[email protected]' (SHA:cc11e9188b693c2b100158c3322424c4cc1dadea)
Download action repository 'actions/checkout@v4' (SHA:0ad4b8fadaa221de15dcec353f45205ec38ea70b)
Download action repository 'actions/upload-artifact@v4' (SHA:65462800fd760344b1a7b4382951275a0abb4808)
Complete job name: PR - mingw-check-tidy
git config --global core.autocrlf false
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
---
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY host-x86_64/mingw-check/reuse-requirements.txt /tmp/
RUN pip3 install --no-deps --no-cache-dir --require-hashes -r /tmp/reuse-requirements.txt \
&& pip3 install virtualenv
COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/
# NOTE: intentionally uses python2 for x.py so we can test it still works.
# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \
--stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---
#12 [5/8] COPY host-x86_64/mingw-check/reuse-requirements.txt /tmp/
#12 DONE 0.0s
#13 [6/8] RUN pip3 install --no-deps --no-cache-dir --require-hashes -r /tmp/reuse-requirements.txt && pip3 install virtualenv
#13 0.485 Downloading binaryornot-0.4.4-py2.py3-none-any.whl (9.0 kB)
#13 0.503 Collecting boolean-py==4.0
#13 0.511 Downloading boolean.py-4.0-py3-none-any.whl (25 kB)
#13 0.528 Collecting chardet==5.1.0
---
#13 3.740 Building wheels for collected packages: reuse
#13 3.741 Building wheel for reuse (pyproject.toml): started
#13 4.073 Building wheel for reuse (pyproject.toml): finished with status 'done'
#13 4.074 Created wheel for reuse: filename=reuse-1.1.0-cp310-cp310-manylinux_2_35_x86_64.whl size=181117 sha256=f5f58750481f69515c2c0d1d503daf565e2565c370d07fc6aeb95fe3498b4269
#13 4.074 Stored in directory: /tmp/pip-ephem-wheel-cache-2_4stttj/wheels/c2/3c/b9/1120c2ab4bd82694f7e6f0537dc5b9a085c13e2c69a8d0c76d
#13 4.077 Installing collected packages: boolean-py, binaryornot, setuptools, reuse, python-debian, markupsafe, license-expression, jinja2, chardet
#13 4.098 Attempting uninstall: setuptools
#13 4.099 Found existing installation: setuptools 59.6.0
#13 4.100 Not uninstalling setuptools at /usr/lib/python3/dist-packages, outside environment /usr
---
#13 5.347 Downloading virtualenv-20.26.1-py3-none-any.whl (3.9 MB)
#13 5.530 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.9/3.9 MB 21.7 MB/s eta 0:00:00
#13 5.585 Collecting filelock<4,>=3.12.2
#13 5.593 Downloading filelock-3.14.0-py3-none-any.whl (12 kB)
#13 5.626 Collecting platformdirs<5,>=3.9.1
#13 5.635 Downloading platformdirs-4.2.1-py3-none-any.whl (17 kB)
#13 5.657 Collecting distlib<1,>=0.3.7
#13 5.664 Downloading distlib-0.3.8-py2.py3-none-any.whl (468 kB)
#13 5.676 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 468.9/468.9 KB 45.6 MB/s eta 0:00:00
#13 5.763 Installing collected packages: distlib, platformdirs, filelock, virtualenv
#13 5.928 Successfully installed distlib-0.3.8 filelock-3.14.0 platformdirs-4.2.1 virtualenv-20.26.1
#13 DONE 6.0s
#14 [7/8] COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
#14 DONE 0.0s
---
DirectMap4k: 188352 kB
DirectMap2M: 7151616 kB
DirectMap1G: 11534336 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint
+ TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint
Finished `dev` profile [unoptimized] target(s) in 0.03s
##[endgroup]
downloading https://ci-artifacts.rust-lang.org/rustc-builds-alt/e3029d220f6843f9b83d35927ff20a86137d7ed0/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz
extracting /checkout/obj/build/cache/llvm-e3029d220f6843f9b83d35927ff20a86137d7ed0-true/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz to /checkout/obj/build/x86_64-unknown-linux-gnu/ci-llvm
---
Finished `release` profile [optimized] target(s) in 25.72s
##[endgroup]
fmt check
tidy check
tidy error: following path contains more than 1676 entries, you should move the test to some relevant subdirectory (current: 1678): /checkout/tests/ui/issues
tidy: Skipping binary file check, read-only filesystem
##[error]tidy error: /checkout/tests/ui/static/reference-to-mut-static.rs:46: trailing whitespace
removing old virtual environment
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10'
Requirement already satisfied: pip in ./build/venv/lib/python3.10/site-packages (24.0)
Collecting black==23.3.0 (from -r /checkout/src/tools/tidy/config/requirements.txt (line 7))
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 15.6 MB/s eta 0:00:00
Collecting click==8.1.3 (from -r /checkout/src/tools/tidy/config/requirements.txt (line 34))
Downloading click-8.1.3-py3-none-any.whl (96 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 96.6/96.6 kB 20.5 MB/s eta 0:00:00
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 96.6/96.6 kB 20.5 MB/s eta 0:00:00
Collecting importlib-metadata==6.7.0 (from -r /checkout/src/tools/tidy/config/requirements.txt (line 38))
Downloading importlib_metadata-6.7.0-py3-none-any.whl (22 kB)
Collecting mypy-extensions==1.0.0 (from -r /checkout/src/tools/tidy/config/requirements.txt (line 42))
Downloading mypy_extensions-1.0.0-py3-none-any.whl (4.7 kB)
Collecting packaging==23.1 (from -r /checkout/src/tools/tidy/config/requirements.txt (line 46))
Downloading packaging-23.1-py3-none-any.whl (48 kB)
Collecting pathspec==0.11.1 (from -r /checkout/src/tools/tidy/config/requirements.txt (line 50))
Downloading pathspec-0.11.1-py3-none-any.whl (29 kB)
Collecting platformdirs==3.6.0 (from -r /checkout/src/tools/tidy/config/requirements.txt (line 54))
Downloading platformdirs-3.6.0-py3-none-any.whl (16 kB)
Downloading platformdirs-3.6.0-py3-none-any.whl (16 kB)
Collecting ruff==0.0.272 (from -r /checkout/src/tools/tidy/config/requirements.txt (line 58))
Downloading ruff-0.0.272-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.9 MB)
Collecting tomli==2.0.1 (from -r /checkout/src/tools/tidy/config/requirements.txt (line 77))
Downloading tomli-2.0.1-py3-none-any.whl (12 kB)
Collecting typed-ast==1.5.4 (from -r /checkout/src/tools/tidy/config/requirements.txt (line 81))
Downloading typed_ast-1.5.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (877 kB)
Downloading typed_ast-1.5.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (877 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 877.7/877.7 kB 66.4 MB/s eta 0:00:00
Collecting typing-extensions==4.6.3 (from -r /checkout/src/tools/tidy/config/requirements.txt (line 107))
Downloading typing_extensions-4.6.3-py3-none-any.whl (31 kB)
Collecting zipp==3.15.0 (from -r /checkout/src/tools/tidy/config/requirements.txt (line 114))
Downloading zipp-3.15.0-py3-none-any.whl (6.8 kB)
Installing collected packages: zipp, typing-extensions, typed-ast, tomli, ruff, platformdirs, pathspec, packaging, mypy-extensions, click, importlib-metadata, black
Successfully installed black-23.3.0 click-8.1.3 importlib-metadata-6.7.0 mypy-extensions-1.0.0 packaging-23.1 pathspec-0.11.1 platformdirs-3.6.0 ruff-0.0.272 tomli-2.0.1 typed-ast-1.5.4 typing-extensions-4.6.3 zipp-3.15.0
some tidy checks failed
Build completed unsuccessfully in 0:00:58
local time: Wed May 8 15:29:10 UTC 2024
network time: Wed, 08 May 2024 15:29:10 GMT
The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)
error: creating a shared reference to mutable static is discouraged
--> compiler/rustc_driver_impl/src/signal_handler.rs:48:10
|
48 | &STACK_TRACE.as_slice()[0..(depth as _)]
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)
Running tests/compile-test.rs (obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/compile_test-8cd08568846ce1e1)
FAILED TEST: tests/ui/redundant_static_lifetimes.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-8c8dc72c21921ba3.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-6d6455405521dc34.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-2de095cd716cbf0c.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-35d37adbfdfa9dbb.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-9152caa60d22e5d6.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-2c8e9f211ec0a5f8.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-2336100e84e1156c.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-5689c7175177147d.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-5a558154da602083.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-c18e5bce8d145559.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-f468dba3e65cc08b.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-e9d338b744af34e7.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/redundant_static_lifetimes.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/redundant_static_lifetimes.stderr` to the actual output
--- tests/ui/redundant_static_lifetimes.stderr
+++ <stderr output>
+++ <stderr output>
error: constants have by default a `'static` lifetime
... 107 lines skipped ...
... 107 lines skipped ...
| -^^^^^^^--- help: consider removing `'static`: `&u8`
-error: aborting due to 18 previous errors
+error: creating a shared reference to mutable static is discouraged
+error: aborting due to 19 previous errors
+error: aborting due to 19 previous errors
+
full stderr:
error: constants have by default a `'static` lifetime
|
|
LL | const VAR_ONE: &'static str = "Test constant #1"; // ERROR: Consider removing 'static.
| -^^^^^^^---- help: consider removing `'static`: `&str`
= note: `-D clippy::redundant-static-lifetimes` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::redundant_static_lifetimes)]`
error: constants have by default a `'static` lifetime
|
|
LL | const VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR: Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: constants have by default a `'static` lifetime
|
|
LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR: Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: constants have by default a `'static` lifetime
|
|
LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR: Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: constants have by default a `'static` lifetime
|
|
LL | const VAR_SIX: &'static u8 = &5;
| -^^^^^^^--- help: consider removing `'static`: `&u8`
error: constants have by default a `'static` lifetime
|
|
LL | const VAR_HEIGHT: &'static Foo = &Foo {};
| -^^^^^^^---- help: consider removing `'static`: `&Foo`
error: constants have by default a `'static` lifetime
|
|
LL | const VAR_SLICE: &'static [u8] = b"Test constant #1"; // ERROR: Consider removing 'static.
| -^^^^^^^----- help: consider removing `'static`: `&[u8]`
error: constants have by default a `'static` lifetime
|
|
LL | const VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR: Consider removing 'static.
| -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)`
error: constants have by default a `'static` lifetime
|
|
LL | const VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR: Consider removing 'static.
| -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]`
error: statics have by default a `'static` lifetime
|
|
LL | static STATIC_VAR_ONE: &'static str = "Test static #1"; // ERROR: Consider removing 'static.
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: statics have by default a `'static` lifetime
|
|
LL | static STATIC_VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR: Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: statics have by default a `'static` lifetime
|
|
LL | static STATIC_VAR_SIX: &'static u8 = &5;
| -^^^^^^^--- help: consider removing `'static`: `&u8`
error: statics have by default a `'static` lifetime
|
|
LL | static STATIC_VAR_HEIGHT: &'static Foo = &Foo {};
| -^^^^^^^---- help: consider removing `'static`: `&Foo`
error: statics have by default a `'static` lifetime
|
|
LL | static STATIC_VAR_SLICE: &'static [u8] = b"Test static #3"; // ERROR: Consider removing 'static.
| -^^^^^^^----- help: consider removing `'static`: `&[u8]`
error: statics have by default a `'static` lifetime
|
|
LL | static STATIC_VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR: Consider removing 'static.
| -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)`
error: statics have by default a `'static` lifetime
|
|
LL | static STATIC_VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR: Consider removing 'static.
| -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]`
error: statics have by default a `'static` lifetime
|
|
LL | static mut STATIC_MUT_SLICE: &'static mut [u32] = &mut [0];
| -^^^^^^^---------- help: consider removing `'static`: `&mut [u32]`
error: statics have by default a `'static` lifetime
|
|
LL | static V: &'static u8 = &17;
| -^^^^^^^--- help: consider removing `'static`: `&u8`
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/ui/redundant_static_lifetimes.rs:46:9
|
LL | STATIC_MUT_SLICE[0] = 0;
---
FAILED TEST: tests/ui/useless_conversion.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-8c8dc72c21921ba3.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-6d6455405521dc34.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-2de095cd716cbf0c.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-35d37adbfdfa9dbb.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-9152caa60d22e5d6.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-2c8e9f211ec0a5f8.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-2336100e84e1156c.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-5689c7175177147d.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-5a558154da602083.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-c18e5bce8d145559.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-f468dba3e65cc08b.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-e9d338b744af34e7.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/useless_conversion.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/useless_conversion.stderr` to the actual output
--- tests/ui/useless_conversion.stderr
+++ <stderr output>
+++ <stderr output>
+error: creating a shared reference to mutable static is discouraged
+ --> tests/ui/useless_conversion.rs:99:20
+ |
+LL | assert_eq!(C.into_iter().next(), Some(1));
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: `-D static-mut-refs` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(static_mut_refs)]`
+
+error: creating a shared reference to mutable static is discouraged
+ --> tests/ui/useless_conversion.rs:100:20
+ |
+LL | assert_eq!(C.into_iter().next(), Some(1));
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> tests/ui/useless_conversion.rs:101:20
+ |
+LL | assert_eq!(C.next(), Some(1));
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> tests/ui/useless_conversion.rs:102:20
+ |
+LL | assert_eq!(C.next(), Some(2));
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
---
full stderr:
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/ui/useless_conversion.rs:99:20
|
LL | assert_eq!(C.into_iter().next(), Some(1));
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: `-D static-mut-refs` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(static_mut_refs)]`
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/ui/useless_conversion.rs:100:20
|
LL | assert_eq!(C.into_iter().next(), Some(1));
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/ui/useless_conversion.rs:101:20
|
LL | assert_eq!(C.next(), Some(1));
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/ui/useless_conversion.rs:102:20
|
LL | assert_eq!(C.next(), Some(2));
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: useless conversion to the same type: `T`
##[error] --> tests/ui/useless_conversion.rs:5:13
|
LL | let _ = T::from(val);
| ^^^^^^^^^^^^ help: consider removing `T::from()`: `val`
note: the lint level is defined here
--> tests/ui/useless_conversion.rs:1:9
|
LL | #![deny(clippy::useless_conversion)]
LL | #![deny(clippy::useless_conversion)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: useless conversion to the same type: `T`
##[error] --> tests/ui/useless_conversion.rs:6:5
|
LL | val.into()
| ^^^^^^^^^^ help: consider removing `.into()`: `val`
error: useless conversion to the same type: `i32`
##[error] --> tests/ui/useless_conversion.rs:18:22
|
|
LL | let _: i32 = 0i32.into();
| ^^^^^^^^^^^ help: consider removing `.into()`: `0i32`
error: useless conversion to the same type: `std::str::Lines<'_>`
##[error] --> tests/ui/useless_conversion.rs:48:22
|
|
LL | if Some("ok") == lines.into_iter().next() {}
| ^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `lines`
error: useless conversion to the same type: `std::str::Lines<'_>`
##[error] --> tests/ui/useless_conversion.rs:53:21
|
LL | let mut lines = text.lines().into_iter();
LL | let mut lines = text.lines().into_iter();
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `text.lines()`
error: useless conversion to the same type: `std::str::Lines<'_>`
##[error] --> tests/ui/useless_conversion.rs:59:22
|
|
LL | if Some("ok") == text.lines().into_iter().next() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `text.lines()`
error: useless conversion to the same type: `std::ops::Range<i32>`
##[error] --> tests/ui/useless_conversion.rs:65:13
|
LL | let _ = NUMBERS.into_iter().next();
LL | let _ = NUMBERS.into_iter().next();
| ^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `NUMBERS`
error: useless conversion to the same type: `std::ops::Range<i32>`
##[error] --> tests/ui/useless_conversion.rs:70:17
|
LL | let mut n = NUMBERS.into_iter();
LL | let mut n = NUMBERS.into_iter();
| ^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `NUMBERS`
error: useless conversion to the same type: `std::string::String`
##[error] --> tests/ui/useless_conversion.rs:132:21
|
|
LL | let _: String = "foo".to_string().into();
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `"foo".to_string()`
error: useless conversion to the same type: `std::string::String`
##[error] --> tests/ui/useless_conversion.rs:133:21
|
|
LL | let _: String = From::from("foo".to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `From::from()`: `"foo".to_string()`
error: useless conversion to the same type: `std::string::String`
##[error] --> tests/ui/useless_conversion.rs:134:13
|
|
LL | let _ = String::from("foo".to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `"foo".to_string()`
error: useless conversion to the same type: `std::string::String`
##[error] --> tests/ui/useless_conversion.rs:135:13
|
|
LL | let _ = String::from(format!("A: {:04}", 123));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `format!("A: {:04}", 123)`
error: useless conversion to the same type: `std::str::Lines<'_>`
##[error] --> tests/ui/useless_conversion.rs:136:13
|
|
LL | let _ = "".lines().into_iter();
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `"".lines()`
error: useless conversion to the same type: `std::vec::IntoIter<i32>`
##[error] --> tests/ui/useless_conversion.rs:137:13
|
|
LL | let _ = vec![1, 2, 3].into_iter().into_iter();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `vec![1, 2, 3].into_iter()`
error: useless conversion to the same type: `std::string::String`
##[error] --> tests/ui/useless_conversion.rs:138:21
|
|
LL | let _: String = format!("Hello {}", "world").into();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `format!("Hello {}", "world")`
error: useless conversion to the same type: `i32`
##[error] --> tests/ui/useless_conversion.rs:143:13
|
|
LL | let _ = i32::from(a + b) * 3;
| ^^^^^^^^^^^^^^^^ help: consider removing `i32::from()`: `(a + b)`
error: useless conversion to the same type: `Foo<'a'>`
|
|
LL | let _: Foo<'a'> = s2.into();
| ^^^^^^^^^ help: consider removing `.into()`: `s2`
error: useless conversion to the same type: `Foo<'a'>`
|
|
LL | let _ = Foo::<'a'>::from(s3);
| ^^^^^^^^^^^^^^^^^^^^ help: consider removing `Foo::<'a'>::from()`: `s3`
error: useless conversion to the same type: `std::vec::IntoIter<Foo<'a'>>`
|
|
LL | let _ = vec![s4, s4, s4].into_iter().into_iter();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `vec![s4, s4, s4].into_iter()`
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
|
LL | b(vec![1, 2].into_iter());
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1, 2]`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
|
LL | fn b<T: IntoIterator<Item = i32>>(_: T) {}
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
|
LL | c(vec![1, 2].into_iter());
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1, 2]`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
|
LL | fn c(_: impl IntoIterator<Item = i32>) {}
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
|
LL | d(vec![1, 2].into_iter());
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1, 2]`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
LL | T: IntoIterator<Item = i32>,
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
|
LL | b(vec![1, 2].into_iter().into_iter());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`s: `vec![1, 2]`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
|
LL | fn b<T: IntoIterator<Item = i32>>(_: T) {}
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
|
LL | b(vec![1, 2].into_iter().into_iter().into_iter());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`s: `vec![1, 2]`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
|
LL | fn b<T: IntoIterator<Item = i32>>(_: T) {}
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
|
LL | foo2::<i32, _>([1, 2, 3].into_iter());
| ^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `[1, 2, 3]`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
|
LL | I: IntoIterator<Item = i32> + Helper<X>,
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
|
LL | foo3([1, 2, 3].into_iter());
| ^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `[1, 2, 3]`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
LL | I: IntoIterator<Item = i32>,
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
|
LL | S1.foo([1, 2].into_iter());
| ^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `[1, 2]`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
|
LL | pub fn foo<I: IntoIterator>(&self, _: I) {}
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
|
LL | v0.into_iter().interleave_shortest(v1.into_iter());
| ^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `v1`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
LL | J: IntoIterator,
| ^^^^^^^^^^^^
---
FAILED TEST: tests/ui/checked_unwrap/simple_conditionals.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-8c8dc72c21921ba3.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-6d6455405521dc34.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-2de095cd716cbf0c.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-35d37adbfdfa9dbb.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-9152caa60d22e5d6.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-2c8e9f211ec0a5f8.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-2336100e84e1156c.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-5689c7175177147d.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-5a558154da602083.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-c18e5bce8d145559.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-f468dba3e65cc08b.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-e9d338b744af34e7.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui/checked_unwrap" "tests/ui/checked_unwrap/simple_conditionals.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/checked_unwrap/simple_conditionals.stderr` to the actual output
--- tests/ui/checked_unwrap/simple_conditionals.stderr
+++ <stderr output>
+++ <stderr output>
+error: creating a shared reference to mutable static is discouraged
+ --> tests/ui/checked_unwrap/simple_conditionals.rs:175:12
+ |
+LL | if X.is_some() {
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
---
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
error: called `unwrap` on `x` after checking its variant with `is_some`
... 234 lines skipped ...
| ^^^^^^^^^^^^^^^^^^^^^^^^
-error: aborting due to 25 previous errors
---
full stderr:
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/ui/checked_unwrap/simple_conditionals.rs:175:12
|
LL | if X.is_some() {
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
---
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: called `unwrap` on `x` after checking its variant with `is_some`
|
|
LL | if x.is_some() {
| -------------- help: try: `if let Some(..) = x`
LL | // unnecessary
LL | x.unwrap();
|
note: the lint level is defined here
--> tests/ui/checked_unwrap/simple_conditionals.rs:3:35
|
|
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: called `expect` on `x` after checking its variant with `is_some`
|
|
LL | if x.is_some() {
| -------------- help: try: `if let Some(..) = x`
...
LL | x.expect("an error message");
error: this call to `unwrap()` will always panic
|
|
LL | if x.is_some() {
| ----------- because of this check
LL | x.unwrap();
| ^^^^^^^^^^
|
note: the lint level is defined here
note: the lint level is defined here
--> tests/ui/checked_unwrap/simple_conditionals.rs:3:9
|
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `expect()` will always panic
|
|
LL | if x.is_some() {
| ----------- because of this check
...
LL | x.expect("an error message");
error: this call to `unwrap()` will always panic
|
|
LL | if x.is_none() {
| ----------- because of this check
LL | // will panic
LL | x.unwrap();
error: called `unwrap` on `x` after checking its variant with `is_none`
|
|
LL | if x.is_none() {
| -------------- help: try: `if let Some(..) = x`
LL | x.unwrap();
| ^^^^^^^^^^
error: called `unwrap` on `x` after checking its variant with `is_some`
|
|
LL | if $a.is_some() {
| --------------- help: try: `if let Some(..) = x`
LL | // unnecessary
LL | $a.unwrap();
...
...
LL | m!(x);
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: called `unwrap` on `x` after checking its variant with `is_ok`
|
|
LL | if x.is_ok() {
| ------------ help: try: `if let Ok(..) = x`
LL | // unnecessary
LL | x.unwrap();
error: called `expect` on `x` after checking its variant with `is_ok`
|
|
LL | if x.is_ok() {
| ------------ help: try: `if let Ok(..) = x`
...
LL | x.expect("an error message");
error: this call to `unwrap_err()` will always panic
|
|
LL | if x.is_ok() {
| --------- because of this check
LL | x.unwrap_err();
| ^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic
|
|
LL | if x.is_ok() {
| --------- because of this check
LL | x.unwrap();
| ^^^^^^^^^^
error: this call to `expect()` will always panic
|
|
LL | if x.is_ok() {
| --------- because of this check
...
LL | x.expect("an error message");
error: called `unwrap_err` on `x` after checking its variant with `is_ok`
|
|
LL | if x.is_ok() {
| ------------ help: try: `if let Err(..) = x`
LL | x.unwrap_err();
| ^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic
|
|
LL | if x.is_err() {
| ---------- because of this check
LL | // will panic
LL | x.unwrap();
error: called `unwrap_err` on `x` after checking its variant with `is_err`
|
|
LL | if x.is_err() {
| ------------- help: try: `if let Err(..) = x`
LL | x.unwrap_err();
| ^^^^^^^^^^^^^^
error: called `unwrap` on `x` after checking its variant with `is_err`
|
|
LL | if x.is_err() {
| ------------- help: try: `if let Ok(..) = x`
LL | x.unwrap();
| ^^^^^^^^^^
error: this call to `unwrap_err()` will always panic
|
|
LL | if x.is_err() {
| ---------- because of this check
LL | x.unwrap_err();
| ^^^^^^^^^^^^^^
error: called `unwrap` on `option` after checking its variant with `is_some`
|
LL | if option.is_some() {
LL | if option.is_some() {
| ------------------- help: try: `if let Some(..) = &option`
LL | option.as_ref().unwrap();
error: this call to `unwrap()` will always panic
|
LL | if option.is_some() {
| ---------------- because of this check
...
...
LL | option.as_ref().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: called `unwrap` on `result` after checking its variant with `is_ok`
|
|
LL | if result.is_ok() {
| ----------------- help: try: `if let Ok(..) = &result`
LL | result.as_ref().unwrap();
error: this call to `unwrap()` will always panic
|
|
LL | if result.is_ok() {
| -------------- because of this check
LL | result.as_ref().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: called `unwrap` on `option` after checking its variant with `is_some`
|
LL | if option.is_some() {
| ------------------- help: try: `if let Some(..) = &mut option`
LL | option.as_mut().unwrap();
LL | option.as_mut().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic
|
LL | if option.is_some() {
| ---------------- because of this check
...
...
LL | option.as_mut().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: called `unwrap` on `result` after checking its variant with `is_ok`
|
|
LL | if result.is_ok() {
| ----------------- help: try: `if let Ok(..) = &mut result`
LL | result.as_mut().unwrap();
error: this call to `unwrap()` will always panic
|
|
LL | if result.is_ok() {
| -------------- because of this check
LL | result.as_mut().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 27 previous errors
Marking as waiting on author since you've made this a draft.
The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)
Running tests/compile-test.rs (obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/compile_test-b61aa4dcf2be3ca8)
FAILED TEST: tests/ui/redundant_static_lifetimes.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-8c8dc72c21921ba3.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-6d6455405521dc34.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-2de095cd716cbf0c.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-35d37adbfdfa9dbb.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-9152caa60d22e5d6.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-2c8e9f211ec0a5f8.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-2336100e84e1156c.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-5689c7175177147d.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-5a558154da602083.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-c18e5bce8d145559.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-f468dba3e65cc08b.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-e9d338b744af34e7.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/redundant_static_lifetimes.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/redundant_static_lifetimes.stderr` to the actual output
--- tests/ui/redundant_static_lifetimes.stderr
+++ <stderr output>
+++ <stderr output>
error: constants have by default a `'static` lifetime
... 107 lines skipped ...
... 107 lines skipped ...
| -^^^^^^^--- help: consider removing `'static`: `&u8`
-error: aborting due to 18 previous errors
+error: creating a shared reference to mutable static is discouraged
+error: aborting due to 19 previous errors
+error: aborting due to 19 previous errors
+
full stderr:
error: constants have by default a `'static` lifetime
|
|
LL | const VAR_ONE: &'static str = "Test constant #1"; // ERROR: Consider removing 'static.
| -^^^^^^^---- help: consider removing `'static`: `&str`
= note: `-D clippy::redundant-static-lifetimes` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::redundant_static_lifetimes)]`
error: constants have by default a `'static` lifetime
|
|
LL | const VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR: Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: constants have by default a `'static` lifetime
|
|
LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR: Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: constants have by default a `'static` lifetime
|
|
LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR: Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: constants have by default a `'static` lifetime
|
|
LL | const VAR_SIX: &'static u8 = &5;
| -^^^^^^^--- help: consider removing `'static`: `&u8`
error: constants have by default a `'static` lifetime
|
|
LL | const VAR_HEIGHT: &'static Foo = &Foo {};
| -^^^^^^^---- help: consider removing `'static`: `&Foo`
error: constants have by default a `'static` lifetime
|
|
LL | const VAR_SLICE: &'static [u8] = b"Test constant #1"; // ERROR: Consider removing 'static.
| -^^^^^^^----- help: consider removing `'static`: `&[u8]`
error: constants have by default a `'static` lifetime
|
|
LL | const VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR: Consider removing 'static.
| -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)`
error: constants have by default a `'static` lifetime
|
|
LL | const VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR: Consider removing 'static.
| -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]`
error: statics have by default a `'static` lifetime
|
|
LL | static STATIC_VAR_ONE: &'static str = "Test static #1"; // ERROR: Consider removing 'static.
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: statics have by default a `'static` lifetime
|
|
LL | static STATIC_VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR: Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: statics have by default a `'static` lifetime
|
|
LL | static STATIC_VAR_SIX: &'static u8 = &5;
| -^^^^^^^--- help: consider removing `'static`: `&u8`
error: statics have by default a `'static` lifetime
|
|
LL | static STATIC_VAR_HEIGHT: &'static Foo = &Foo {};
| -^^^^^^^---- help: consider removing `'static`: `&Foo`
error: statics have by default a `'static` lifetime
|
|
LL | static STATIC_VAR_SLICE: &'static [u8] = b"Test static #3"; // ERROR: Consider removing 'static.
| -^^^^^^^----- help: consider removing `'static`: `&[u8]`
error: statics have by default a `'static` lifetime
|
|
LL | static STATIC_VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR: Consider removing 'static.
| -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)`
error: statics have by default a `'static` lifetime
|
|
LL | static STATIC_VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR: Consider removing 'static.
| -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]`
error: statics have by default a `'static` lifetime
|
|
LL | static mut STATIC_MUT_SLICE: &'static mut [u32] = &mut [0];
| -^^^^^^^---------- help: consider removing `'static`: `&mut [u32]`
error: statics have by default a `'static` lifetime
|
|
LL | static V: &'static u8 = &17;
| -^^^^^^^--- help: consider removing `'static`: `&u8`
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/ui/redundant_static_lifetimes.rs:46:9
|
LL | STATIC_MUT_SLICE[0] = 0;
---
FAILED TEST: tests/ui/useless_conversion.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-8c8dc72c21921ba3.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-6d6455405521dc34.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-2de095cd716cbf0c.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-35d37adbfdfa9dbb.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-9152caa60d22e5d6.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-2c8e9f211ec0a5f8.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-2336100e84e1156c.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-5689c7175177147d.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-5a558154da602083.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-c18e5bce8d145559.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-f468dba3e65cc08b.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-e9d338b744af34e7.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/useless_conversion.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/useless_conversion.stderr` to the actual output
--- tests/ui/useless_conversion.stderr
+++ <stderr output>
+++ <stderr output>
+error: creating a shared reference to mutable static is discouraged
+ --> tests/ui/useless_conversion.rs:99:20
+ |
+LL | assert_eq!(C.into_iter().next(), Some(1));
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: `-D static-mut-refs` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(static_mut_refs)]`
+
+error: creating a shared reference to mutable static is discouraged
+ --> tests/ui/useless_conversion.rs:100:20
+ |
+LL | assert_eq!(C.into_iter().next(), Some(1));
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> tests/ui/useless_conversion.rs:101:20
+ |
+LL | assert_eq!(C.next(), Some(1));
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> tests/ui/useless_conversion.rs:102:20
+ |
+LL | assert_eq!(C.next(), Some(2));
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
---
full stderr:
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/ui/useless_conversion.rs:99:20
|
LL | assert_eq!(C.into_iter().next(), Some(1));
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: `-D static-mut-refs` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(static_mut_refs)]`
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/ui/useless_conversion.rs:100:20
|
LL | assert_eq!(C.into_iter().next(), Some(1));
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/ui/useless_conversion.rs:101:20
|
LL | assert_eq!(C.next(), Some(1));
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/ui/useless_conversion.rs:102:20
|
LL | assert_eq!(C.next(), Some(2));
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: useless conversion to the same type: `T`
##[error] --> tests/ui/useless_conversion.rs:5:13
|
LL | let _ = T::from(val);
| ^^^^^^^^^^^^ help: consider removing `T::from()`: `val`
note: the lint level is defined here
--> tests/ui/useless_conversion.rs:1:9
|
LL | #![deny(clippy::useless_conversion)]
LL | #![deny(clippy::useless_conversion)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: useless conversion to the same type: `T`
##[error] --> tests/ui/useless_conversion.rs:6:5
|
LL | val.into()
| ^^^^^^^^^^ help: consider removing `.into()`: `val`
error: useless conversion to the same type: `i32`
##[error] --> tests/ui/useless_conversion.rs:18:22
|
|
LL | let _: i32 = 0i32.into();
| ^^^^^^^^^^^ help: consider removing `.into()`: `0i32`
error: useless conversion to the same type: `std::str::Lines<'_>`
##[error] --> tests/ui/useless_conversion.rs:48:22
|
|
LL | if Some("ok") == lines.into_iter().next() {}
| ^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `lines`
error: useless conversion to the same type: `std::str::Lines<'_>`
##[error] --> tests/ui/useless_conversion.rs:53:21
|
LL | let mut lines = text.lines().into_iter();
LL | let mut lines = text.lines().into_iter();
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `text.lines()`
error: useless conversion to the same type: `std::str::Lines<'_>`
##[error] --> tests/ui/useless_conversion.rs:59:22
|
|
LL | if Some("ok") == text.lines().into_iter().next() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `text.lines()`
error: useless conversion to the same type: `std::ops::Range<i32>`
##[error] --> tests/ui/useless_conversion.rs:65:13
|
LL | let _ = NUMBERS.into_iter().next();
LL | let _ = NUMBERS.into_iter().next();
| ^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `NUMBERS`
error: useless conversion to the same type: `std::ops::Range<i32>`
##[error] --> tests/ui/useless_conversion.rs:70:17
|
LL | let mut n = NUMBERS.into_iter();
LL | let mut n = NUMBERS.into_iter();
| ^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `NUMBERS`
error: useless conversion to the same type: `std::string::String`
##[error] --> tests/ui/useless_conversion.rs:132:21
|
|
LL | let _: String = "foo".to_string().into();
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `"foo".to_string()`
error: useless conversion to the same type: `std::string::String`
##[error] --> tests/ui/useless_conversion.rs:133:21
|
|
LL | let _: String = From::from("foo".to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `From::from()`: `"foo".to_string()`
error: useless conversion to the same type: `std::string::String`
##[error] --> tests/ui/useless_conversion.rs:134:13
|
|
LL | let _ = String::from("foo".to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `"foo".to_string()`
error: useless conversion to the same type: `std::string::String`
##[error] --> tests/ui/useless_conversion.rs:135:13
|
|
LL | let _ = String::from(format!("A: {:04}", 123));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `format!("A: {:04}", 123)`
error: useless conversion to the same type: `std::str::Lines<'_>`
##[error] --> tests/ui/useless_conversion.rs:136:13
|
|
LL | let _ = "".lines().into_iter();
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `"".lines()`
error: useless conversion to the same type: `std::vec::IntoIter<i32>`
##[error] --> tests/ui/useless_conversion.rs:137:13
|
|
LL | let _ = vec![1, 2, 3].into_iter().into_iter();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `vec![1, 2, 3].into_iter()`
error: useless conversion to the same type: `std::string::String`
##[error] --> tests/ui/useless_conversion.rs:138:21
|
|
LL | let _: String = format!("Hello {}", "world").into();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `format!("Hello {}", "world")`
error: useless conversion to the same type: `i32`
##[error] --> tests/ui/useless_conversion.rs:143:13
|
|
LL | let _ = i32::from(a + b) * 3;
| ^^^^^^^^^^^^^^^^ help: consider removing `i32::from()`: `(a + b)`
error: useless conversion to the same type: `Foo<'a'>`
|
|
LL | let _: Foo<'a'> = s2.into();
| ^^^^^^^^^ help: consider removing `.into()`: `s2`
error: useless conversion to the same type: `Foo<'a'>`
|
|
LL | let _ = Foo::<'a'>::from(s3);
| ^^^^^^^^^^^^^^^^^^^^ help: consider removing `Foo::<'a'>::from()`: `s3`
error: useless conversion to the same type: `std::vec::IntoIter<Foo<'a'>>`
|
|
LL | let _ = vec![s4, s4, s4].into_iter().into_iter();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `vec![s4, s4, s4].into_iter()`
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
|
LL | b(vec![1, 2].into_iter());
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1, 2]`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
|
LL | fn b<T: IntoIterator<Item = i32>>(_: T) {}
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
|
LL | c(vec![1, 2].into_iter());
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1, 2]`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
|
LL | fn c(_: impl IntoIterator<Item = i32>) {}
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
|
LL | d(vec![1, 2].into_iter());
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1, 2]`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
LL | T: IntoIterator<Item = i32>,
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
|
LL | b(vec![1, 2].into_iter().into_iter());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`s: `vec![1, 2]`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
|
LL | fn b<T: IntoIterator<Item = i32>>(_: T) {}
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
|
LL | b(vec![1, 2].into_iter().into_iter().into_iter());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`s: `vec![1, 2]`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
|
LL | fn b<T: IntoIterator<Item = i32>>(_: T) {}
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
|
LL | foo2::<i32, _>([1, 2, 3].into_iter());
| ^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `[1, 2, 3]`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
|
LL | I: IntoIterator<Item = i32> + Helper<X>,
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
|
LL | foo3([1, 2, 3].into_iter());
| ^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `[1, 2, 3]`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
LL | I: IntoIterator<Item = i32>,
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
|
LL | S1.foo([1, 2].into_iter());
| ^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `[1, 2]`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
|
LL | pub fn foo<I: IntoIterator>(&self, _: I) {}
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
|
LL | v0.into_iter().interleave_shortest(v1.into_iter());
| ^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `v1`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
LL | J: IntoIterator,
| ^^^^^^^^^^^^
---
FAILED TEST: tests/ui/checked_unwrap/simple_conditionals.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-8c8dc72c21921ba3.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-6d6455405521dc34.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-2de095cd716cbf0c.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-35d37adbfdfa9dbb.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-9152caa60d22e5d6.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-2c8e9f211ec0a5f8.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-2336100e84e1156c.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-5689c7175177147d.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-5a558154da602083.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-c18e5bce8d145559.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-f468dba3e65cc08b.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-e9d338b744af34e7.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui/checked_unwrap" "tests/ui/checked_unwrap/simple_conditionals.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/checked_unwrap/simple_conditionals.stderr` to the actual output
--- tests/ui/checked_unwrap/simple_conditionals.stderr
+++ <stderr output>
+++ <stderr output>
+error: creating a shared reference to mutable static is discouraged
+ --> tests/ui/checked_unwrap/simple_conditionals.rs:175:12
+ |
+LL | if X.is_some() {
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
---
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
error: called `unwrap` on `x` after checking its variant with `is_some`
... 234 lines skipped ...
| ^^^^^^^^^^^^^^^^^^^^^^^^
-error: aborting due to 25 previous errors
---
full stderr:
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/ui/checked_unwrap/simple_conditionals.rs:175:12
|
LL | if X.is_some() {
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
---
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: called `unwrap` on `x` after checking its variant with `is_some`
|
|
LL | if x.is_some() {
| -------------- help: try: `if let Some(..) = x`
LL | // unnecessary
LL | x.unwrap();
|
note: the lint level is defined here
--> tests/ui/checked_unwrap/simple_conditionals.rs:3:35
|
|
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: called `expect` on `x` after checking its variant with `is_some`
|
|
LL | if x.is_some() {
| -------------- help: try: `if let Some(..) = x`
...
LL | x.expect("an error message");
error: this call to `unwrap()` will always panic
|
|
LL | if x.is_some() {
| ----------- because of this check
LL | x.unwrap();
| ^^^^^^^^^^
|
note: the lint level is defined here
note: the lint level is defined here
--> tests/ui/checked_unwrap/simple_conditionals.rs:3:9
|
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `expect()` will always panic
|
|
LL | if x.is_some() {
| ----------- because of this check
...
LL | x.expect("an error message");
error: this call to `unwrap()` will always panic
|
|
LL | if x.is_none() {
| ----------- because of this check
LL | // will panic
LL | x.unwrap();
error: called `unwrap` on `x` after checking its variant with `is_none`
|
|
LL | if x.is_none() {
| -------------- help: try: `if let Some(..) = x`
LL | x.unwrap();
| ^^^^^^^^^^
error: called `unwrap` on `x` after checking its variant with `is_some`
|
|
LL | if $a.is_some() {
| --------------- help: try: `if let Some(..) = x`
LL | // unnecessary
LL | $a.unwrap();
...
...
LL | m!(x);
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: called `unwrap` on `x` after checking its variant with `is_ok`
|
|
LL | if x.is_ok() {
| ------------ help: try: `if let Ok(..) = x`
LL | // unnecessary
LL | x.unwrap();
error: called `expect` on `x` after checking its variant with `is_ok`
|
|
LL | if x.is_ok() {
| ------------ help: try: `if let Ok(..) = x`
...
LL | x.expect("an error message");
error: this call to `unwrap_err()` will always panic
|
|
LL | if x.is_ok() {
| --------- because of this check
LL | x.unwrap_err();
| ^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic
|
|
LL | if x.is_ok() {
| --------- because of this check
LL | x.unwrap();
| ^^^^^^^^^^
error: this call to `expect()` will always panic
|
|
LL | if x.is_ok() {
| --------- because of this check
...
LL | x.expect("an error message");
error: called `unwrap_err` on `x` after checking its variant with `is_ok`
|
|
LL | if x.is_ok() {
| ------------ help: try: `if let Err(..) = x`
LL | x.unwrap_err();
| ^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic
|
|
LL | if x.is_err() {
| ---------- because of this check
LL | // will panic
LL | x.unwrap();
error: called `unwrap_err` on `x` after checking its variant with `is_err`
|
|
LL | if x.is_err() {
| ------------- help: try: `if let Err(..) = x`
LL | x.unwrap_err();
| ^^^^^^^^^^^^^^
error: called `unwrap` on `x` after checking its variant with `is_err`
|
|
LL | if x.is_err() {
| ------------- help: try: `if let Ok(..) = x`
LL | x.unwrap();
| ^^^^^^^^^^
error: this call to `unwrap_err()` will always panic
|
|
LL | if x.is_err() {
| ---------- because of this check
LL | x.unwrap_err();
| ^^^^^^^^^^^^^^
error: called `unwrap` on `option` after checking its variant with `is_some`
|
LL | if option.is_some() {
LL | if option.is_some() {
| ------------------- help: try: `if let Some(..) = &option`
LL | option.as_ref().unwrap();
error: this call to `unwrap()` will always panic
|
LL | if option.is_some() {
| ---------------- because of this check
...
...
LL | option.as_ref().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: called `unwrap` on `result` after checking its variant with `is_ok`
|
|
LL | if result.is_ok() {
| ----------------- help: try: `if let Ok(..) = &result`
LL | result.as_ref().unwrap();
error: this call to `unwrap()` will always panic
|
|
LL | if result.is_ok() {
| -------------- because of this check
LL | result.as_ref().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: called `unwrap` on `option` after checking its variant with `is_some`
|
LL | if option.is_some() {
| ------------------- help: try: `if let Some(..) = &mut option`
LL | option.as_mut().unwrap();
LL | option.as_mut().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic
|
LL | if option.is_some() {
| ---------------- because of this check
...
...
LL | option.as_mut().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: called `unwrap` on `result` after checking its variant with `is_ok`
|
|
LL | if result.is_ok() {
| ----------------- help: try: `if let Ok(..) = &mut result`
LL | result.as_mut().unwrap();
error: this call to `unwrap()` will always panic
|
|
LL | if result.is_ok() {
| -------------- because of this check
LL | result.as_mut().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 27 previous errors
The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)
Running tests/compile-test.rs (obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/compile_test-b61aa4dcf2be3ca8)
FAILED TEST: tests/ui/redundant_static_lifetimes.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-8c8dc72c21921ba3.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-6d6455405521dc34.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-2de095cd716cbf0c.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-35d37adbfdfa9dbb.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-9152caa60d22e5d6.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-2c8e9f211ec0a5f8.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-2336100e84e1156c.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-5689c7175177147d.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-5a558154da602083.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-c18e5bce8d145559.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-f468dba3e65cc08b.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-e9d338b744af34e7.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/redundant_static_lifetimes.fixed" "--edition" "2021" "--crate-name" "redundant_static_lifetimes"
error: rustfix test got exit status: 1, but expected 0
##[error] --> tests/ui/redundant_static_lifetimes.rs:46:9
|
46 | STATIC_MUT_SLICE[0] = 0;
46 | STATIC_MUT_SLICE[0] = 0;
| ^^^^^^^^^^^^^^^^^^^ after rustfix is applied, all errors should be gone, but weren't
full stderr:
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/ui/redundant_static_lifetimes.fixed:46:9
---
FAILED TEST: tests/ui/useless_conversion.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-8c8dc72c21921ba3.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-6d6455405521dc34.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-2de095cd716cbf0c.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-35d37adbfdfa9dbb.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-9152caa60d22e5d6.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-2c8e9f211ec0a5f8.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-2336100e84e1156c.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-5689c7175177147d.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-5a558154da602083.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-c18e5bce8d145559.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-f468dba3e65cc08b.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-e9d338b744af34e7.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/useless_conversion.fixed" "--edition" "2021" "--crate-name" "useless_conversion"
error: rustfix test got exit status: 1, but expected 0
##[error] --> tests/ui/useless_conversion.rs:99:20
|
|
99 | assert_eq!(C.into_iter().next(), Some(1));
| ^^^^^^^^^^^^^ after rustfix is applied, all errors should be gone, but weren't
full stderr:
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/ui/useless_conversion.fixed:99:20
##[error] --> tests/ui/useless_conversion.fixed:99:20
|
LL | assert_eq!(C.into_iter().next(), Some(1));
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: `-D static-mut-refs` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(static_mut_refs)]`
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/ui/useless_conversion.fixed:101:20
|
LL | assert_eq!(C.into_iter().next(), Some(1));
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/ui/useless_conversion.fixed:103:20
|
LL | assert_eq!(C.next(), Some(1));
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/ui/useless_conversion.fixed:105:20
|
LL | assert_eq!(C.next(), Some(2));
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)
## Running ui tests in tests/pass for x86_64-unknown-linux-gnu
Compiler: "MIRI_ENV_VAR_TEST"="0" "MIRI_TEMP"="/tmp/miri-uitest-xI4XVP" "RUST_BACKTRACE"="1" /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/miri "--error-format=json" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/miri-sysroot" "-Dwarnings" "-Dunused" "-Ainternal_features" "-Zui-testing" "--target" "x86_64-unknown-linux-gnu" "--out-dir" OUT_DIR
FAILED TEST: tests/pass/atomic.rs (revision `stack`)
command: MIRI_ENV_VAR_TEST="0" MIRI_TEMP="/tmp/miri-uitest-xI4XVP" RUST_BACKTRACE="1" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/miri" "--error-format=json" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/miri-sysroot" "-Dwarnings" "-Dunused" "-Ainternal_features" "-Zui-testing" "--target" "x86_64-unknown-linux-gnu" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/tests/pass" "tests/pass/atomic.rs" "--cfg=stack" "-Zmiri-strict-provenance" "--edition" "2021"
error: pass test got exit status: 1, but expected 0
error: actual output differed from expected
Execute `./miri test --bless` to update `tests/pass/atomic.stack.stderr` to the actual output
Execute `./miri test --bless` to update `tests/pass/atomic.stack.stderr` to the actual output
--- tests/pass/atomic.stack.stderr
+++ <stderr output>
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | assert_eq!(*ATOMIC.get_mut(), false);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: `-D static-mut-refs` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(static_mut_refs)]`
+
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | ATOMIC.store(true, SeqCst);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | assert_eq!(*ATOMIC.get_mut(), true);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | ATOMIC.fetch_or(false, SeqCst);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | assert_eq!(*ATOMIC.get_mut(), true);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | ATOMIC.fetch_and(false, SeqCst);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | assert_eq!(*ATOMIC.get_mut(), false);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | ATOMIC.fetch_nand(true, SeqCst);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | assert_eq!(*ATOMIC.get_mut(), true);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | ATOMIC.fetch_xor(true, SeqCst);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | assert_eq!(*ATOMIC.get_mut(), false);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
---
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:22:21
|
22 | assert_eq!(*ATOMIC.get_mut(), false);
| ^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:23:9
|
|
23 | ATOMIC.store(true, SeqCst);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:24:21
|
|
24 | assert_eq!(*ATOMIC.get_mut(), true);
| ^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:25:9
|
|
25 | ATOMIC.fetch_or(false, SeqCst);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:26:21
|
|
26 | assert_eq!(*ATOMIC.get_mut(), true);
| ^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:27:9
|
|
27 | ATOMIC.fetch_and(false, SeqCst);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:28:21
|
|
28 | assert_eq!(*ATOMIC.get_mut(), false);
| ^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:29:9
|
|
29 | ATOMIC.fetch_nand(true, SeqCst);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:30:21
|
|
30 | assert_eq!(*ATOMIC.get_mut(), true);
| ^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:31:9
|
|
31 | ATOMIC.fetch_xor(true, SeqCst);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:32:21
|
|
32 | assert_eq!(*ATOMIC.get_mut(), false);
| ^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
full stderr:
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:22:21
##[error] --> tests/pass/atomic.rs:22:21
|
LL | assert_eq!(*ATOMIC.get_mut(), false);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: `-D static-mut-refs` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(static_mut_refs)]`
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:23:9
|
LL | ATOMIC.store(true, SeqCst);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:24:21
|
LL | assert_eq!(*ATOMIC.get_mut(), true);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:25:9
|
LL | ATOMIC.fetch_or(false, SeqCst);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:26:21
|
LL | assert_eq!(*ATOMIC.get_mut(), true);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:27:9
|
LL | ATOMIC.fetch_and(false, SeqCst);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:28:21
|
LL | assert_eq!(*ATOMIC.get_mut(), false);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:29:9
|
LL | ATOMIC.fetch_nand(true, SeqCst);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:30:21
|
LL | assert_eq!(*ATOMIC.get_mut(), true);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:31:9
|
LL | ATOMIC.fetch_xor(true, SeqCst);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:32:21
|
LL | assert_eq!(*ATOMIC.get_mut(), false);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
---
FAILED TEST: tests/pass/atomic.rs (revision `tree`)
command: MIRI_ENV_VAR_TEST="0" MIRI_TEMP="/tmp/miri-uitest-xI4XVP" RUST_BACKTRACE="1" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/miri" "--error-format=json" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/miri-sysroot" "-Dwarnings" "-Dunused" "-Ainternal_features" "-Zui-testing" "--target" "x86_64-unknown-linux-gnu" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/tests/pass" "tests/pass/atomic.rs" "--cfg=tree" "-Zmiri-strict-provenance" "-Zmiri-tree-borrows" "--edition" "2021"
error: pass test got exit status: 1, but expected 0
error: actual output differed from expected
error: actual output differed from expected
Execute `./miri test --bless` to update `tests/pass/atomic.tree.stderr` to the actual output
--- tests/pass/atomic.tree.stderr
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+ |
+LL | assert_eq!(*ATOMIC.get_mut(), false);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: `-D static-mut-refs` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(static_mut_refs)]`
+
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | ATOMIC.store(true, SeqCst);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | assert_eq!(*ATOMIC.get_mut(), true);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | ATOMIC.fetch_or(false, SeqCst);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | assert_eq!(*ATOMIC.get_mut(), true);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | ATOMIC.fetch_and(false, SeqCst);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | assert_eq!(*ATOMIC.get_mut(), false);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | ATOMIC.fetch_nand(true, SeqCst);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | assert_eq!(*ATOMIC.get_mut(), true);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | ATOMIC.fetch_xor(true, SeqCst);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/atomic.rs:LL:CC
+ |
+LL | assert_eq!(*ATOMIC.get_mut(), false);
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
---
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:22:21
|
22 | assert_eq!(*ATOMIC.get_mut(), false);
| ^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:23:9
|
|
23 | ATOMIC.store(true, SeqCst);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:24:21
|
|
24 | assert_eq!(*ATOMIC.get_mut(), true);
| ^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:25:9
|
|
25 | ATOMIC.fetch_or(false, SeqCst);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:26:21
|
|
26 | assert_eq!(*ATOMIC.get_mut(), true);
| ^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:27:9
|
|
27 | ATOMIC.fetch_and(false, SeqCst);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:28:21
|
|
28 | assert_eq!(*ATOMIC.get_mut(), false);
| ^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:29:9
|
|
29 | ATOMIC.fetch_nand(true, SeqCst);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:30:21
|
|
30 | assert_eq!(*ATOMIC.get_mut(), true);
| ^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:31:9
|
|
31 | ATOMIC.fetch_xor(true, SeqCst);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
error: there were 1 unmatched diagnostics
##[error] --> tests/pass/atomic.rs:32:21
|
|
32 | assert_eq!(*ATOMIC.get_mut(), false);
| ^^^^^^^^^^^^^^^^ Error: creating a shared reference to mutable static is discouraged
full stderr:
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:22:21
##[error] --> tests/pass/atomic.rs:22:21
|
LL | assert_eq!(*ATOMIC.get_mut(), false);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: `-D static-mut-refs` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(static_mut_refs)]`
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:23:9
|
LL | ATOMIC.store(true, SeqCst);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:24:21
|
LL | assert_eq!(*ATOMIC.get_mut(), true);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:25:9
|
LL | ATOMIC.fetch_or(false, SeqCst);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:26:21
|
LL | assert_eq!(*ATOMIC.get_mut(), true);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:27:9
|
LL | ATOMIC.fetch_and(false, SeqCst);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:28:21
|
LL | assert_eq!(*ATOMIC.get_mut(), false);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:29:9
|
LL | ATOMIC.fetch_nand(true, SeqCst);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:30:21
|
LL | assert_eq!(*ATOMIC.get_mut(), true);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:31:9
|
LL | ATOMIC.fetch_xor(true, SeqCst);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass/atomic.rs:32:21
|
LL | assert_eq!(*ATOMIC.get_mut(), false);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
---
Error:
0: ui tests in tests/pass for x86_64-unknown-linux-gnu failed
1: tests failed
Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
error: test failed, to rerun pass `--test ui`
Caused by:
process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/ui-b05abe6a27b66801 --quiet` (exit status: 1)
Build completed unsuccessfully in 0:03:12
local time: Sat May 11 15:20:18 UTC 2024
The Miri subtree was changed
cc @rust-lang/miri
Some changes occurred in src/tools/clippy
cc @rust-lang/clippy
@rustbot ready
@obeis Are you planning on taking care of these FIXMEs? I can't tell what the plan is here. I don't see one written anywhere. If you're not going to handle them in this PR or in another PR shortly after this is merged, do you mind someone else handling them?
@saethlin I plan to address them in another PR. Could you please open an issue for that, and assign it to me?
I honestly don't know how GitHub assignment stuff works. You aren't in the dropdown or search. You can comment @rustbot claim on this issue: https://github.com/rust-lang/rust/issues/125035
(You can @rustbot assign @name someone)
r? compiler
r? @michaelwoerister
I should be able to take a closer look at this early next week.
The job mingw-check-tidy failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)
Getting action download info
Download action repository 'msys2/[email protected]' (SHA:cc11e9188b693c2b100158c3322424c4cc1dadea)
Download action repository 'actions/checkout@v4' (SHA:692973e3d937129bcbf40652eb9f2f61becf3332)
Download action repository 'actions/upload-artifact@v4' (SHA:65462800fd760344b1a7b4382951275a0abb4808)
Complete job name: PR - mingw-check-tidy
git config --global core.autocrlf false
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
---
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY host-x86_64/mingw-check/reuse-requirements.txt /tmp/
RUN pip3 install --no-deps --no-cache-dir --require-hashes -r /tmp/reuse-requirements.txt \
&& pip3 install virtualenv
COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/
# NOTE: intentionally uses python2 for x.py so we can test it still works.
# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \
--stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---
#12 [5/8] COPY host-x86_64/mingw-check/reuse-requirements.txt /tmp/
#12 DONE 0.0s
#13 [6/8] RUN pip3 install --no-deps --no-cache-dir --require-hashes -r /tmp/reuse-requirements.txt && pip3 install virtualenv
#13 0.427 Downloading binaryornot-0.4.4-py2.py3-none-any.whl (9.0 kB)
#13 0.440 Collecting boolean-py==4.0
#13 0.442 Downloading boolean.py-4.0-py3-none-any.whl (25 kB)
#13 0.454 Collecting chardet==5.1.0
---
#13 3.478 Building wheels for collected packages: reuse
#13 3.479 Building wheel for reuse (pyproject.toml): started
#13 3.813 Building wheel for reuse (pyproject.toml): finished with status 'done'
#13 3.814 Created wheel for reuse: filename=reuse-1.1.0-cp310-cp310-manylinux_2_35_x86_64.whl size=181117 sha256=f5f58750481f69515c2c0d1d503daf565e2565c370d07fc6aeb95fe3498b4269
#13 3.814 Stored in directory: /tmp/pip-ephem-wheel-cache-b839v5ij/wheels/c2/3c/b9/1120c2ab4bd82694f7e6f0537dc5b9a085c13e2c69a8d0c76d
#13 3.816 Installing collected packages: boolean-py, binaryornot, setuptools, reuse, python-debian, markupsafe, license-expression, jinja2, chardet
#13 3.840 Attempting uninstall: setuptools
#13 3.840 Found existing installation: setuptools 59.6.0
#13 3.841 Not uninstalling setuptools at /usr/lib/python3/dist-packages, outside environment /usr
#13 3.841 Not uninstalling setuptools at /usr/lib/python3/dist-packages, outside environment /usr
#13 3.842 Can't uninstall 'setuptools'. No files were found to uninstall.
#13 4.521 Successfully installed binaryornot-0.4.4 boolean-py-4.0 chardet-5.1.0 jinja2-3.1.2 license-expression-30.0.0 markupsafe-2.1.1 python-debian-0.1.49 reuse-1.1.0 setuptools-66.0.0
#13 4.521 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#13 5.045 Collecting virtualenv
#13 5.083 Downloading virtualenv-20.26.2-py3-none-any.whl (3.9 MB)
#13 5.141 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.9/3.9 MB 70.5 MB/s eta 0:00:00
#13 5.192 Collecting platformdirs<5,>=3.9.1
#13 5.196 Downloading platformdirs-4.2.2-py3-none-any.whl (18 kB)
#13 5.214 Collecting distlib<1,>=0.3.7
#13 5.217 Downloading distlib-0.3.8-py2.py3-none-any.whl (468 kB)
#13 5.255 Collecting filelock<4,>=3.12.2
#13 5.258 Downloading filelock-3.15.1-py3-none-any.whl (15 kB)
#13 5.258 Downloading filelock-3.15.1-py3-none-any.whl (15 kB)
#13 5.348 Installing collected packages: distlib, platformdirs, filelock, virtualenv
#13 5.516 Successfully installed distlib-0.3.8 filelock-3.15.1 platformdirs-4.2.2 virtualenv-20.26.2
#13 DONE 5.6s
#14 [7/8] COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
#14 DONE 0.0s
---
DirectMap4k: 206784 kB
DirectMap2M: 6084608 kB
DirectMap1G: 12582912 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint
+ TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint
Finished `dev` profile [unoptimized] target(s) in 0.03s
##[endgroup]
downloading https://ci-artifacts.rust-lang.org/rustc-builds-alt/7ac6c2fc685681824fbfc156b38035df743881dd/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz
extracting /checkout/obj/build/cache/llvm-7ac6c2fc685681824fbfc156b38035df743881dd-true/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz to /checkout/obj/build/x86_64-unknown-linux-gnu/ci-llvm
---
##[endgroup]
fmt check
fmt: checked 5082 files
tidy check
tidy error: following path contains more than 1671 entries, you should move the test to some relevant subdirectory (current: 1674): /checkout/tests/ui/issues
removing old virtual environment
removing old virtual environment
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10'
Requirement already satisfied: pip in ./build/venv/lib/python3.10/site-packages (24.0)
some tidy checks failed
Build completed unsuccessfully in 0:01:08
local time: Fri Jun 14 17:07:36 UTC 2024
network time: Fri, 14 Jun 2024 17:07:36 GMT
The job x86_64-gnu-llvm-17 failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)
#16 exporting to docker image format
#16 sending tarball 25.8s done
#16 DONE 31.0s
##[endgroup]
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-17]
---
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-17', '--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', '--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-17/bin/llvm-config
configure: llvm.link-shared := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id := 99999999
---
Downloaded boml v0.3.1
Compiling boml v0.3.1
Compiling y v0.1.0 (/checkout/compiler/rustc_codegen_gcc/build_system)
Finished `release` profile [optimized] target(s) in 3.55s
Running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-codegen/x86_64-unknown-linux-gnu/release/y test --use-system-gcc --use-backend gcc --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/cg_gcc --release --mini-tests --std-tests`
Using system GCC
[BUILD] example
[AOT] mini_core_hello_world
/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/cg_gcc/mini_core_hello_world
abc
---
Compiling alloc v0.0.0 (/checkout/library/alloc)
error: creating a shared reference to mutable static is discouraged
--> library/std/src/thread/local/tests.rs:119:32
|
119 | assert_eq!(HITS, 3);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: `-D static-mut-refs` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(static_mut_refs)]`
help: use `addr_of!` instead to create a raw pointer
|
119 | assert_eq!(addr_of!(HITS), 3);
error: creating a shared reference to mutable static is discouraged
--> library/std/src/thread/local/tests.rs:124:36
|
|
124 | assert_eq!(HITS, 3);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
help: use `addr_of!` instead to create a raw pointer
|
124 | assert_eq!(addr_of!(HITS), 3);
error: creating a shared reference to mutable static is discouraged
--> library/std/src/thread/local/tests.rs:135:28
|
|
135 | assert_eq!(HITS, 2);
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
help: use `addr_of!` instead to create a raw pointer
|
135 | assert_eq!(addr_of!(HITS), 2);
error: could not compile `std` (lib test) due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
Build completed unsuccessfully in 0:21:57
Thank you @michaelwoerister for the review. I’ve made all the requested changes.
The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)
## Running ui tests in tests/pass-dep for x86_64-unknown-linux-gnu
Compiler: "MIRI_ENV_VAR_TEST"="0" "MIRI_TEMP"="/tmp/miri-uitest-as44F8" "RUST_BACKTRACE"="1" /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/miri "--error-format=json" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/miri-sysroot" "-Dwarnings" "-Dunused" "-Ainternal_features" "-Zui-testing" "--target" "x86_64-unknown-linux-gnu" "--out-dir" OUT_DIR
FAILED TEST: tests/pass-dep/libc/libc-socketpair.rs
command: MIRI_ENV_VAR_TEST="0" MIRI_TEMP="/tmp/miri-uitest-as44F8" RUST_BACKTRACE="1" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/miri" "--error-format=json" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/miri-sysroot" "-Dwarnings" "-Dunused" "-Ainternal_features" "-Zui-testing" "--target" "x86_64-unknown-linux-gnu" "--extern" "getrandom_01=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libgetrandom-1a84680087822575.rlib" "--extern" "getrandom_01=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libgetrandom-1a84680087822575.rmeta" "--extern" "getrandom_02=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libgetrandom-6a48ada216ae6498.rlib" "--extern" "getrandom_02=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libgetrandom-6a48ada216ae6498.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/liblibc-93e019ca4d5b5d07.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/liblibc-93e019ca4d5b5d07.rmeta" "--extern" "num_cpus=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libnum_cpus-ec1fdd6a89ab23f5.rlib" "--extern" "num_cpus=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libnum_cpus-ec1fdd6a89ab23f5.rmeta" "--extern" "page_size=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libpage_size-1fea7517e9bb7912.rlib" "--extern" "page_size=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libpage_size-1fea7517e9bb7912.rmeta" "--extern" "tempfile=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libtempfile-6fa1a5c89d4e8576.rlib" "--extern" "tempfile=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libtempfile-6fa1a5c89d4e8576.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libtokio-0452b82ad34b265f.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libtokio-0452b82ad34b265f.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/debug/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/tests/pass-dep/libc" "tests/pass-dep/libc/libc-socketpair.rs" "-Zmiri-preemption-rate=0" "--edition" "2021"
error: pass test got exit status: 1, but expected 0
error: actual output differed from expected
Execute `./miri test --bless` to update `tests/pass-dep/libc/libc-socketpair.stderr` to the actual output
Execute `./miri test --bless` to update `tests/pass-dep/libc/libc-socketpair.stderr` to the actual output
--- tests/pass-dep/libc/libc-socketpair.stderr
+++ <stderr output>
+error: creating a shared reference to mutable static is discouraged
+ --> $DIR/libc-socketpair.rs:LL:CC
+ |
+LL | unsafe { assert_eq!(VAL, 1) };
+ |
+ = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+ = note: this will be a hard error in the 2024 edition
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+ = note: `-D static-mut-refs` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(static_mut_refs)]`
+help: use `addr_of!` instead to create a raw pointer
+ |
+LL | unsafe { assert_eq!(addr_of!(VAL), 1) };
+
+error: miri cannot be run on programs that fail compilation
+
+error: aborting due to 2 previous errors
---
error: there were 1 unmatched diagnostics
##[error] --> tests/pass-dep/libc/libc-socketpair.rs:116:29
|
116 | unsafe { assert_eq!(VAL, 1) };
| ^^^ Error: creating a shared reference to mutable static is discouraged
full stderr:
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/pass-dep/libc/libc-socketpair.rs:116:29
##[error] --> tests/pass-dep/libc/libc-socketpair.rs:116:29
|
LL | unsafe { assert_eq!(VAL, 1) };
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: `-D static-mut-refs` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(static_mut_refs)]`
help: use `addr_of!` instead to create a raw pointer
|
LL | unsafe { assert_eq!(addr_of!(VAL), 1) };
error: miri cannot be run on programs that fail compilation
error: aborting due to 2 previous errors
---
Error:
0: ui tests in tests/pass-dep for x86_64-unknown-linux-gnu failed
1: tests failed
Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
error: test failed, to rerun pass `--test ui`
Caused by:
process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/ui-ff8e5f7317669711 --quiet` (exit status: 1)
Build completed unsuccessfully in 0:03:39
local time: Tue Jun 18 13:25:56 UTC 2024
The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)
## Running ui tests in tests/pass-dep for x86_64-unknown-linux-gnu
Compiler: "MIRI_ENV_VAR_TEST"="0" "MIRI_TEMP"="/tmp/miri-uitest-IdRkqL" "RUST_BACKTRACE"="1" /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/miri "--error-format=json" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/miri-sysroot" "-Dwarnings" "-Dunused" "-Ainternal_features" "-Zui-testing" "--target" "x86_64-unknown-linux-gnu" "--out-dir" OUT_DIR
FAILED TEST: tests/pass-dep/libc/libc-socketpair.rs
command: MIRI_ENV_VAR_TEST="0" MIRI_TEMP="/tmp/miri-uitest-IdRkqL" RUST_BACKTRACE="1" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/miri" "--error-format=json" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/miri-sysroot" "-Dwarnings" "-Dunused" "-Ainternal_features" "-Zui-testing" "--target" "x86_64-unknown-linux-gnu" "--extern" "getrandom_01=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libgetrandom-1a84680087822575.rlib" "--extern" "getrandom_01=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libgetrandom-1a84680087822575.rmeta" "--extern" "getrandom_02=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libgetrandom-6a48ada216ae6498.rlib" "--extern" "getrandom_02=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libgetrandom-6a48ada216ae6498.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/liblibc-93e019ca4d5b5d07.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/liblibc-93e019ca4d5b5d07.rmeta" "--extern" "num_cpus=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libnum_cpus-ec1fdd6a89ab23f5.rlib" "--extern" "num_cpus=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libnum_cpus-ec1fdd6a89ab23f5.rmeta" "--extern" "page_size=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libpage_size-1fea7517e9bb7912.rlib" "--extern" "page_size=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libpage_size-1fea7517e9bb7912.rmeta" "--extern" "tempfile=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libtempfile-6fa1a5c89d4e8576.rlib" "--extern" "tempfile=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libtempfile-6fa1a5c89d4e8576.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libtokio-0452b82ad34b265f.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps/libtokio-0452b82ad34b265f.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/x86_64-unknown-linux-gnu/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/miri/debug/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui/tests/pass-dep/libc" "tests/pass-dep/libc/libc-socketpair.rs" "-Zmiri-preemption-rate=0" "--edition" "2021"
error: pass test got exit status: 1, but expected 0
error: actual output differed from expected
Execute `./miri test --bless` to update `tests/pass-dep/libc/libc-socketpair.stderr` to the actual output
Execute `./miri test --bless` to update `tests/pass-dep/libc/libc-socketpair.stderr` to the actual output
--- tests/pass-dep/libc/libc-socketpair.stderr
+++ <stderr output>
+error: unknown start of token: `
+ --> $DIR/libc-socketpair.rs:LL:CC
+ |
+LL | FIXME(obeis): Do not allow `static_mut_refs` lint
+ |
+ |
+help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
+ |
+LL | FIXME(obeis): Do not allow 'static_mut_refs` lint
+
+error: unknown start of token: `
+ --> $DIR/libc-socketpair.rs:LL:CC
+ |
+ |
+LL | FIXME(obeis): Do not allow `static_mut_refs` lint
+ |
+ |
+help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
+ |
+LL | FIXME(obeis): Do not allow `static_mut_refs' lint
+
+
+error: expected one of `!` or `::`, found `(`
+ |
+ |
+LL | FIXME(obeis): Do not allow `static_mut_refs` lint
+ | ^ expected one of `!` or `::`
+error: aborting due to 3 previous errors
+
error: there were 3 unmatched diagnostics
##[error] --> tests/pass-dep/libc/libc-socketpair.rs:5:28
|
5 | FIXME(obeis): Do not allow `static_mut_refs` lint
| ^ Error: unknown start of token: `
| ^ Error: unknown start of token: `
| ^ Error: expected one of `!` or `::`, found `(`
full stderr:
error: unknown start of token: `
##[error] --> tests/pass-dep/libc/libc-socketpair.rs:5:28
##[error] --> tests/pass-dep/libc/libc-socketpair.rs:5:28
|
LL | FIXME(obeis): Do not allow `static_mut_refs` lint
|
|
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
LL | FIXME(obeis): Do not allow 'static_mut_refs` lint
error: unknown start of token: `
##[error] --> tests/pass-dep/libc/libc-socketpair.rs:5:44
|
|
LL | FIXME(obeis): Do not allow `static_mut_refs` lint
|
|
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
LL | FIXME(obeis): Do not allow `static_mut_refs' lint
error: expected one of `!` or `::`, found `(`
|
|
LL | FIXME(obeis): Do not allow `static_mut_refs` lint
| ^ expected one of `!` or `::`
error: aborting due to 3 previous errors
full stdout:
---
Error:
0: ui tests in tests/pass-dep for x86_64-unknown-linux-gnu failed
1: tests failed
Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
error: test failed, to rerun pass `--test ui`
Caused by:
process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/ui-ff8e5f7317669711 --quiet` (exit status: 1)
Build completed unsuccessfully in 0:03:41
local time: Tue Jun 18 14:18:45 UTC 2024
@michaelwoerister Done
:umbrella: The latest upstream changes (presumably #126623) made this pull request unmergeable. Please resolve the merge conflicts.
@rustbot ready
:umbrella: The latest upstream changes (presumably #126996) made this pull request unmergeable. Please resolve the merge conflicts.
The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)
Running tests/compile-test.rs (obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/compile_test-e2f2ae96a28c6a7b)
FAILED TEST: tests/ui/checked_unwrap/simple_conditionals.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-17fa9f95c9b8f88f.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-5fa9affb7f4804a2.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-5726c12621123bb4.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-c05264ebc02d0b99.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-e9aa61e1e4ee057e.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-8dba92144dd323d0.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-0383f3501f3470c2.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-caed1d72b1950c44.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-5c59675e11f6188b.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-2233436f0b800125.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-b8ecf01f7994beb1.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-d534f89567b59ccc.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui/checked_unwrap" "tests/ui/checked_unwrap/simple_conditionals.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/checked_unwrap/simple_conditionals.stderr` to the actual output
--- tests/ui/checked_unwrap/simple_conditionals.stderr
+++ <stderr output>
+++ <stderr output>
error: creating a shared reference to mutable static is discouraged
- --> tests/ui/checked_unwrap/simple_conditionals.rs:175:12
+ --> tests/ui/checked_unwrap/simple_conditionals.rs:174:12
|
LL | if X.is_some() {
error: aborting due to 26 previous errors
full stderr:
error: creating a shared reference to mutable static is discouraged
##[error] --> tests/ui/checked_unwrap/simple_conditionals.rs:174:12
|
LL | if X.is_some() {
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
= note: `-D static-mut-refs` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(static_mut_refs)]`
error: called `unwrap` on `x` after checking its variant with `is_some`
|
|
LL | if x.is_some() {
| -------------- help: try: `if let Some(..) = x`
LL | // unnecessary
LL | x.unwrap();
|
note: the lint level is defined here
--> tests/ui/checked_unwrap/simple_conditionals.rs:2:35
|
|
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: called `expect` on `x` after checking its variant with `is_some`
|
|
LL | if x.is_some() {
| -------------- help: try: `if let Some(..) = x`
...
LL | x.expect("an error message");
error: this call to `unwrap()` will always panic
##[error] --> tests/ui/checked_unwrap/simple_conditionals.rs:53:9
|
|
LL | if x.is_some() {
...
LL | x.unwrap();
| ^^^^^^^^^^
|
---
error: this call to `expect()` will always panic
##[error] --> tests/ui/checked_unwrap/simple_conditionals.rs:56:9
|
LL | if x.is_some() {
...
...
LL | x.expect("an error message");
error: this call to `unwrap()` will always panic
##[error] --> tests/ui/checked_unwrap/simple_conditionals.rs:61:9
|
|
LL | if x.is_none() {
LL | // will panic
LL | x.unwrap();
| ^^^^^^^^^^
error: called `unwrap` on `x` after checking its variant with `is_none`
|
|
LL | if x.is_none() {
| -------------- help: try: `if let Some(..) = x`
LL | x.unwrap();
| ^^^^^^^^^^
error: called `unwrap` on `x` after checking its variant with `is_some`
|
|
LL | if $a.is_some() {
| --------------- help: try: `if let Some(..) = x`
LL | // unnecessary
LL | $a.unwrap();
...
...
LL | m!(x);
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: called `unwrap` on `x` after checking its variant with `is_ok`
|
|
LL | if x.is_ok() {
| ------------ help: try: `if let Ok(..) = x`
LL | // unnecessary
LL | x.unwrap();
error: called `expect` on `x` after checking its variant with `is_ok`
|
|
LL | if x.is_ok() {
| ------------ help: try: `if let Ok(..) = x`
...
LL | x.expect("an error message");
error: this call to `unwrap_err()` will always panic
|
|
LL | if x.is_ok() {
...
LL | x.unwrap_err();
| ^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic
##[error] --> tests/ui/checked_unwrap/simple_conditionals.rs:88:9
|
LL | if x.is_ok() {
...
LL | x.unwrap();
| ^^^^^^^^^^
error: this call to `expect()` will always panic
##[error] --> tests/ui/checked_unwrap/simple_conditionals.rs:91:9
|
LL | if x.is_ok() {
...
...
LL | x.expect("an error message");
error: called `unwrap_err` on `x` after checking its variant with `is_ok`
|
|
LL | if x.is_ok() {
| ------------ help: try: `if let Err(..) = x`
LL | x.unwrap_err();
| ^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic
error: this call to `unwrap()` will always panic
##[error] --> tests/ui/checked_unwrap/simple_conditionals.rs:99:9
|
LL | if x.is_err() {
LL | // will panic
LL | x.unwrap();
| ^^^^^^^^^^
error: called `unwrap_err` on `x` after checking its variant with `is_err`
|
|
LL | if x.is_err() {
| ------------- help: try: `if let Err(..) = x`
LL | x.unwrap_err();
| ^^^^^^^^^^^^^^
error: called `unwrap` on `x` after checking its variant with `is_err`
|
|
LL | if x.is_err() {
| ------------- help: try: `if let Ok(..) = x`
LL | x.unwrap();
| ^^^^^^^^^^
error: this call to `unwrap_err()` will always panic
|
|
LL | if x.is_err() {
...
LL | x.unwrap_err();
| ^^^^^^^^^^^^^^
error: called `unwrap` on `option` after checking its variant with `is_some`
##[error] --> tests/ui/checked_unwrap/simple_conditionals.rs:134:9
|
LL | if option.is_some() {
| ------------------- help: try: `if let Some(..) = &option`
LL | option.as_ref().unwrap();
error: this call to `unwrap()` will always panic
##[error] --> tests/ui/checked_unwrap/simple_conditionals.rs:137:9
|
---
error: called `unwrap` on `result` after checking its variant with `is_ok`
##[error] --> tests/ui/checked_unwrap/simple_conditionals.rs:144:9
|
LL | if result.is_ok() {
| ----------------- help: try: `if let Ok(..) = &result`
LL | result.as_ref().unwrap();
error: this call to `unwrap()` will always panic
##[error] --> tests/ui/checked_unwrap/simple_conditionals.rs:147:9
|
|
LL | if result.is_ok() {
...
LL | result.as_ref().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
---
error: called `unwrap` on `result` after checking its variant with `is_ok`
##[error] --> tests/ui/checked_unwrap/simple_conditionals.rs:162:9
|
LL | if result.is_ok() {
| ----------------- help: try: `if let Ok(..) = &mut result`
LL | result.as_mut().unwrap();
error: this call to `unwrap()` will always panic
##[error] --> tests/ui/checked_unwrap/simple_conditionals.rs:165:9
|
|
LL | if result.is_ok() {
...
LL | result.as_mut().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
@scottmcm or @traviscross, would you mind taking a look at this from a lang-team perspective? The following test file is a good listing of the new warnings/errors emitted: https://github.com/rust-lang/rust/pull/124895/files#diff-552a80382a80cb2f62384de177067696a3931a68e1fa5f9876ecd07ea3c4cc51
It will flag quite a few new cases so, before approving the PR, I wanted to confirm that this is the intended behavior.
I looked over the tests, and these results are what I would expect in terms of the additional places to flag.
Thanks for taking a look!