Skip to content

Conversation

@reddevilmidzy
Copy link
Contributor

@reddevilmidzy reddevilmidzy commented Nov 19, 2025

resolve: #148467

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 19, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)

8    |
9 help: consider making this binding mutable
10    |
- LL |     for &(mut num) num in nums {
-    |          +++++++++
+ LL |     for &mut num in nums {
+    |          +++
13 help: to modify the original value, take a borrow instead
14    |
15 LL |     for &ref mut num in nums {


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args borrowck/borrowck-for-loop-deref-pattern-assignment.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/borrowck/borrowck-for-loop-deref-pattern-assignment.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/borrowck/borrowck-for-loop-deref-pattern-assignment" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0384]: cannot assign twice to immutable variable `num`
##[error]  --> /checkout/tests/ui/borrowck/borrowck-for-loop-deref-pattern-assignment.rs:4:9
   |
LL |     for &num in nums {
   |          --- first assignment to `num`
LL |         num *= 2; //~ ERROR cannot assign twice to immutable variable `num`
   |         ^^^^^^^^ cannot assign twice to immutable variable
   |
help: consider making this binding mutable
   |
LL |     for &mut num in nums {
   |          +++
help: to modify the original value, take a borrow instead
   |
LL |     for &ref mut num in nums {
   |          +++++++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0384`.

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compiler incorrectly suggest converting &x ->&mut x instead of &(mut x) when matching on a &T(T : Copy)

3 participants