Skip to content

Conversation

@davidbarsky
Copy link
Contributor

@davidbarsky davidbarsky commented Jan 17, 2026

Hello! I didn't meant to convert this to a PR (let alone a draft PR), but this branch implements "Relink, Don't Rebuild", which was approved this major change proposal. The idea behind RDR is to treat changes to non-public items as not a factor in considering whether dependent crates also need to be rebuild. The trick, of course, if defining what "non-public" items are. This changes considers two classes:

  • Spans, which I've split out into a separate .spans file. This approach was suggested by David Lattimore in this Zulip post.
  • Items, and which ones are public.

This feature is currently exposed as "-Zseparate-spans", but it would probably make sense to add a separate feature flag for the stable version hash changes. I didn't do that before opening this as a draft pull request because, well, I accidentally published this pull request.

On my work project, this brought down incremental cargo check times from 4 seconds to:

For rust-analyzer, whose compile times have been optimized to a ridiculous degree, RDR reduced cargo check times (after changing a non-public item in hir-ty) from 3 seconds to 1.5 seconds.

AI Disclosure: I used Claude Code (Opus 4.5) and Codex (GPT-5.2-codex) to implement this. This is not ready for review; but I've been using this change for the last day or so.

Part of the RDR (Relink, Don't Rebuild) work to separate span 
data from .rmeta files. This commit converts Span fields to SpanRef
in two areas:

1. ExpnData (hygiene.rs): Convert call_site and def_site from Span
   to SpanRef. The constructors convert incoming Spans internally,
   keeping the API stable.

2. rmeta tables (mod.rs, encoder.rs, decoder.rs, cstore_impl.rs):
   - Predicate tables: (Clause/PolyTraitRef, Span) → SpanRef
   - Direct span tables: def_span, def_ident_span, proc_macro_quoted_spans  
   - Type-span table: assumed_wf_types_for_rpitit
   - Added ProcessQueryValue impls and macro variants for SpanRef decoding
@rustbot
Copy link
Collaborator

rustbot commented Jan 17, 2026

rustc_error_messages was changed

cc @davidtwco, @TaKO8Ki

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-run-make Area: port run-make Makefiles to rmake.rs A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 17, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 17, 2026

r? @nnethercote

rustbot has assigned @nnethercote.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@davidbarsky davidbarsky marked this pull request as draft January 17, 2026 18:16
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 17, 2026
@davidbarsky davidbarsky changed the title Push ukyuqwxxwmxr feature: implement Relink, Don't Build (RDR) Jan 17, 2026
@rust-log-analyzer

This comment has been minimized.

///
/// The `spans_hash` parameter stores a hash of the spans at the time this work product was
/// created. For metadata work products compiled with `-Z separate-spans`, this hash is used
/// to determine whether diagnostics should be replayed when reusing the metadata.
Copy link
Member

Choose a reason for hiding this comment

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

Why specifically metadata work products? Codegen can also result in diagnostics. And why does reusing the metadata have any effect on diagnostics?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I accidentally published this as a pull request. this is not yet ready for review!

Add IdentRef type that stores identifiers with SpanRef instead of Span,
preserving SyntaxContext for hygiene while avoiding absolute byte 
positions in metadata.

Changes:
- rustc_span/symbol.rs: New IdentRef struct with name/span fields,
  bidirectional conversion methods (to_ident_ref/ident), and proper
  PartialEq/Hash using SyntaxContext
- rustc_span/lib.rs: Re-export IdentRef  
- rmeta: Change fn_arg_idents table from LazyArray<Option<Ident>>
  to LazyArray<Option<IdentRef>>, with encoding/decoding support
Update diagnostic types to serialize Span fields as SpanRef to avoid
storing absolute byte positions in metadata.

Unlike other span-containing types which store SpanRef internally,
diagnostic types keep Span internally for performance (diagnostics are
created/modified frequently; serialization is rare). Custom 
Encodable/Decodable impls convert at serialization boundaries:

- MultiSpan: primary_spans and span_labels  
- SubstitutionPart: span field
- TrimmedSubstitutionPart: original_span and span
- DiagInner: sort_span field
When compiling with -Zseparate-spans, the source_map is now written to a
separate .spans file instead of being embedded in .rmeta. This allows
.rmeta to remain stable when only span positions change (e.g., adding
whitespace or comments), enabling Relink, Don't Rebuild (RDR).

Changes:
- SpanFileRoot: new struct with source_map field for .spans files
- CrateRoot: conditionally excludes source_map when separate_spans enabled
- Encoder: writes source_map to .spans file with required_source_files
- Decoder: loads source_map from .spans file when present
- locator.rs: get_span_metadata_section() to load .spans files
- CrateMetadata: stores span_blob and span_source_map for decoding
Load .spans files on-demand during span resolution instead of eagerly
when crates are loaded. This avoids I/O overhead for crates where spans
are never actually resolved.

Changes:
- CrateMetadata: stores span_file_path instead of loaded blob
- SpanFileData: new struct for lazily-loaded span blob and source_map
- span_file_data: OnceLock for lazy initialization  
- CrateMetadata::span_file_data(): loads span file on first access
- creader.rs: only checks if span file exists, does not load it
Handle missing .spans files gracefully by returning dummy spans with
preserved SyntaxContext, allowing diagnostics to proceed without 
precise location info.

Changes:
- ImportedSourceFileState enum: Loaded/Unavailable variants to track
  three states (not yet loaded, loaded, unavailable)
- imported_source_file(): returns Option<ImportedSourceFile>
- Returns DUMMY_SP with preserved SyntaxContext when source files
  are unavailable
- Caches unavailable state to avoid repeated load attempts
Replace the derived HashStable_Generic on SpanRef with a custom impl
that respects hash_spans(). When hash_spans() returns false (e.g., with
-Zincremental-ignore-spans), SpanRef contributes nothing to the hash.
This is essential for RDR where span-only changes should not trigger
downstream rebuilds.

The implementation mirrors Span's HashStable behavior:
- Early return when !ctx.hash_spans()
- When hashing, include discriminant tag and all fields
- SyntaxContext is hashed for hygiene correctness

Also adds -Zseparate-spans flag and comprehensive incremental tests:
- rdr_add_println_private: adding println to private fn
- rdr_add_private_fn: adding a private function  
- rdr_metadata_spans: metadata span stability
- rdr_private_span_changes: private span changes
- rdr_separate_spans: separate span file handling
- rdr_span_hash_cross_crate: cross-crate span hashing
Add the core infrastructure for RDR span resolution across crates:

SpanBlob/SpanBlobDecodeContext: Wrapper for span file data with header
validation and root decoding, parallel to BlobDecodeContext.

CrateMetadata additions:
- span_file_data(): lazily loads and caches span file
- load_span_file(): loads span file and validates against rmeta hash

TyCtxtSpanResolver: Implements SpanResolver trait
- resolve_span_ref(): converts SpanRef to Span via source file lookups
- span_ref_from_span(): converts Span to SpanRef with file-relative offsets

find_and_import_source_file_by_stable_id(): Searches external crates
for source files needed to resolve spans.

Also includes tests for include_str!/include_bytes! handling with
separate spans.
Add safety mechanism to prevent diagnostics from being emitted after
codegen begins, when span files may be unavailable for relinking.

Changes:
- Session::diagnostics_allowed(): tracks whether diagnostics can be emitted
- Session::enter_codegen_phase(): marks transition to codegen
- Dep graph integration: force diagnostics before codegen starts
- Codegen backends: call enter_codegen_phase() at appropriate points
- SpanRef resolution: check diagnostics_allowed() before resolving
- Work product handling: track span file dependencies

Run-make tests:
- rdr-diagnostic-gating: verify gating works correctly
- rdr-hygiene-hash-collision: test hygiene context handling  
- rdr-missing-spans-fallback: test graceful degradation
Implement "Relink, Don't Rebuild" (RDR) by modifying the Strict
Version Hash (SVH) computation to only include publicly-visible API
elements, rather than the entire HIR.

Previously, any change to a crate (including private function bodies)
would change the SVH, causing all downstream crates to rebuild. Now,
the SVH only changes when the public API changes.

The new `public_api_hash` query hashes:
- Public item signatures (types, bounds, generics, predicates)
- Inlinable function bodies (#[inline] and generic functions)
- Trait implementations

Private function bodies are excluded from the hash, so modifying them
no longer triggers downstream rebuilds.

Internal incremental compilation continues to work correctly because it
uses the query system's fine-grained dependency tracking, which is
separate from the SVH.
Add run-make tests to verify RDR works correctly with:

1. Panic locations (rdr-panic-location):
   - Verifies panic messages show correct file:line:col
   - Tests public functions, private functions, and format strings
   - Ensures span resolution works for panic messages

2. Debug info (rdr-debuginfo):
   - Verifies DWARF debug info contains correct source references
   - Tests with -Cdebuginfo=2 and -Zseparate-spans
   - Checks reproducibility of debug line tables

3. Coverage instrumentation (rdr-coverage):
   - Verifies coverage profiling works with -Zseparate-spans
   - Tests generation of profraw data
   - Exercises various control flow patterns (branches, loops)
The RDR changes now correctly hash syntax context even with
-Zincremental-ignore-spans. This is a correctness fix: hygiene
information must always be considered to avoid false cache hits
when macro expansion contexts differ.

For change_return_impl_trait, the trait bounds (Clone vs Copy)
are semantic differences that should invalidate typeck regardless
of span handling settings. The previous test expectation was
incorrect - it relied on the old behavior where spans contributed
nothing to the hash with -Zincremental-ignore-spans.
@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)
test [ui] tests/ui/imports/ambiguous-2.rs ... ok
test [ui] tests/ui/imports/ambiguous-7.rs ... ok
test [ui] tests/ui/imports/ambiguous-4.rs ... ok
test [ui] tests/ui/imports/ambiguous-9.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-glob-vs-multiouter.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-globvsglob.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-no-implicit-prelude.rs ... ok
test [ui] tests/ui/imports/ambiguous-8.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-non-prelude-core-glob.rs ... ok
test [ui] tests/ui/imports/ambiguous-glob-vs-expanded-extern.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-non-prelude-std-glob.rs ... ok
---

9 LL |         x().await;
10    |         ^ value used here after move
11    |
- note: `async_call_once` takes ownership of the receiver `self`, which moves `x`
-   --> $SRC_DIR/core/src/ops/async_function.rs:LL:COL
+    = note: `async_call_once` takes ownership of the receiver `self`, which moves `x`
14 help: you could `clone` the value and consume it, if the `NoCopy: Clone` trait bound could be satisfied
15    |
16 LL |         x.clone()().await;


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 async-await/async-closures/move-consuming-capture.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/async-await/async-closures/move-consuming-capture.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/async-await/async-closures/move-consuming-capture" "-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" "-L" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/async-await/async-closures/move-consuming-capture/auxiliary" "--edition=2021"
stdout: none
--- stderr -------------------------------
error[E0382]: use of moved value: `x`
##[error]  --> /checkout/tests/ui/async-await/async-closures/move-consuming-capture.rs:15:9
   |
LL |         let x = async move || {
   |             - move occurs because `x` has type `{async closure@/checkout/tests/ui/async-await/async-closures/move-consuming-capture.rs:11:17: 11:30}`, which does not implement the `Copy` trait
...
LL |         x().await;
   |         --- `x` moved due to this method call
LL |         x().await;
   |         ^ value used here after move
   |
   = note: `async_call_once` takes ownership of the receiver `self`, which moves `x`
help: you could `clone` the value and consume it, if the `NoCopy: Clone` trait bound could be satisfied
   |
LL |         x.clone()().await;
   |          ++++++++
help: consider annotating `NoCopy` with `#[derive(Clone)]`
   |
LL + #[derive(Clone)]
LL | struct NoCopy;
---

8 LL |     f.await;
9    |     ^ value used here after move
10    |
- note: `into_future` takes ownership of the receiver `self`, which moves `f`
-   --> $SRC_DIR/core/src/future/into_future.rs:LL:COL
+    = note: `into_future` takes ownership of the receiver `self`, which moves `f`
13 help: you can `clone` the value and consume it, but this might not be your desired behavior
14    |
15 LL |     f.clone().await;


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 async-await/clone-suggestion.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/async-await/clone-suggestion.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/async-await/clone-suggestion" "-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" "--edition=2021"
stdout: none
--- stderr -------------------------------
error[E0382]: use of moved value: `f`
##[error]  --> /checkout/tests/ui/async-await/clone-suggestion.rs:24:5
   |
LL |     let f = SharedFuture;
   |         - move occurs because `f` has type `SharedFuture`, which does not implement the `Copy` trait
LL |     f.await;
   |       ----- `f` moved due to this await
LL |     f.await;
   |     ^ value used here after move
   |
   = note: `into_future` takes ownership of the receiver `self`, which moves `f`
help: you can `clone` the value and consume it, but this might not be your desired behavior
   |
LL |     f.clone().await;
   |      ++++++++

error: aborting due to 1 previous error
---

10 LL |     for await i in iter {
11    |                    ^^^^ value used here after move
12    |
- note: `into_async_iter` takes ownership of the receiver `self`, which moves `iter`
-   --> $SRC_DIR/core/src/async_iter/async_iter.rs:LL:COL
+    = note: `into_async_iter` takes ownership of the receiver `self`, which moves `iter`
15 help: you can `clone` the value and consume it, but this might not be your desired behavior
16    |
17 LL |     for await i in iter.clone() {


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 async-await/for-await-consumes-iter.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/async-await/for-await-consumes-iter.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/async-await/for-await-consumes-iter" "-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" "--edition=2021"
stdout: none
--- stderr -------------------------------
error[E0382]: use of moved value: `iter`
##[error]  --> /checkout/tests/ui/async-await/for-await-consumes-iter.rs:14:20
   |
---
...
LL |     for await i in iter {
   |                    ^^^^ value used here after move
   |
   = note: `into_async_iter` takes ownership of the receiver `self`, which moves `iter`
help: you can `clone` the value and consume it, but this might not be your desired behavior
   |
LL |     for await i in iter.clone() {
   |                        ++++++++

error: aborting due to 1 previous error
---
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/binop/binary-op-suggest-deref/binary-op-suggest-deref.stderr`
diff of stderr:

303    |
304    = help: the trait `BitAnd<str>` is not implemented for `i32`
305 help: the following other types implement trait `BitAnd<Rhs>`
-   --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
-    |
-    = note: `i32` implements `BitAnd`
-   ::: $SRC_DIR/core/src/ops/bit.rs:LL:COL
-    |
-    = note: in this macro invocation
312   --> $SRC_DIR/core/src/internal_macros.rs:LL:COL
313    |
314    = note: `&i32` implements `BitAnd<i32>`

318   ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
319    |
320    = note: `&i32` implements `BitAnd`
-    = note: this error originates in the macro `bitand_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
+   --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
+    |
+    = note: `i32` implements `BitAnd`
+   ::: $SRC_DIR/core/src/ops/bit.rs:LL:COL
+    |
+    = note: in this macro invocation
---
To only update this specific test, also pass `--test-args binop/binary-op-suggest-deref.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/binop/binary-op-suggest-deref.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/binop/binary-op-suggest-deref" "-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[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:6:12
   |
LL |     if i < 0 {}
   |            ^ expected `&i64`, found integer
   |
help: consider dereferencing the borrow
   |
LL |     if *i < 0 {}
   |        +

error[E0277]: can't compare `&&{integer}` with `{integer}`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:15:13
   |
LL |     _ = foo == 0;
   |             ^^ no implementation for `&&{integer} == {integer}`
   |
   = help: the trait `PartialEq<{integer}>` is not implemented for `&&{integer}`
help: consider dereferencing here
   |
LL |     _ = **foo == 0;
   |         ++

error[E0277]: can't compare `&{integer}` with `{integer}`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:17:13
   |
LL |     _ = foo == &0;
   |             ^^ no implementation for `&{integer} == {integer}`
   |
   = help: the trait `PartialEq<{integer}>` is not implemented for `&{integer}`
   = note: required for `&&{integer}` to implement `PartialEq<&{integer}>`
help: consider dereferencing here
   |
LL |     _ = *foo == &0;
   |         +

error[E0277]: can't compare `&&&&&&{integer}` with `{integer}`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:19:17
   |
LL |     _ = &&&&foo == 0;
   |                 ^^ no implementation for `&&&&&&{integer} == {integer}`
   |
   = help: the trait `PartialEq<{integer}>` is not implemented for `&&&&&&{integer}`
help: consider removing the borrows and dereferencing instead
   |
LL -     _ = &&&&foo == 0;
LL +     _ = **foo == 0;
   |

error[E0277]: can't compare `&{integer}` with `{integer}`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:21:14
   |
LL |     _ = *foo == 0;
   |              ^^ no implementation for `&{integer} == {integer}`
   |
   = help: the trait `PartialEq<{integer}>` is not implemented for `&{integer}`
help: consider dereferencing here
   |
LL |     _ = **foo == 0;
   |         +

error[E0277]: can't compare `&&{integer}` with `{integer}`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:23:15
   |
LL |     _ = &&foo == &&0;
   |               ^^ no implementation for `&&{integer} == {integer}`
   |
   = help: the trait `PartialEq<{integer}>` is not implemented for `&&{integer}`
   = note: required for `&&&{integer}` to implement `PartialEq<&{integer}>`
   = note: 1 redundant requirement hidden
   = note: required for `&&&&{integer}` to implement `PartialEq<&&{integer}>`
help: consider removing the borrows
   |
LL -     _ = &&foo == &&0;
LL +     _ = foo == &&0;
   |

error[E0277]: can't compare `&Box<{integer}>` with `{integer}`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:25:23
   |
LL |     _ = &Box::new(42) == 42;
   |                       ^^ no implementation for `&Box<{integer}> == {integer}`
   |
   = help: the trait `PartialEq<{integer}>` is not implemented for `&Box<{integer}>`
help: consider removing the borrow and dereferencing instead
   |
LL -     _ = &Box::new(42) == 42;
LL +     _ = *Box::new(42) == 42;
   |

error[E0277]: can't compare `&Box<&Box<&{integer}>>` with `{integer}`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:27:35
   |
LL |     _ = &Box::new(&Box::new(&42)) == 42;
   |                                   ^^ no implementation for `&Box<&Box<&{integer}>> == {integer}`
   |
   = help: the trait `PartialEq<{integer}>` is not implemented for `&Box<&Box<&{integer}>>`
help: consider removing the borrow and dereferencing instead
   |
LL -     _ = &Box::new(&Box::new(&42)) == 42;
LL +     _ = ****Box::new(&Box::new(&42)) == 42;
   |

error[E0277]: can't compare `{integer}` with `&&{integer}`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:31:11
   |
LL |     _ = 0 == foo;
   |           ^^ no implementation for `{integer} == &&{integer}`
   |
   = help: the trait `PartialEq<&&{integer}>` is not implemented for `{integer}`
help: consider dereferencing here
   |
LL |     _ = 0 == **foo;
   |              ++

error[E0277]: can't compare `{integer}` with `&{integer}`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:33:12
   |
LL |     _ = &0 == foo;
   |            ^^ no implementation for `{integer} == &{integer}`
   |
   = help: the trait `PartialEq<&{integer}>` is not implemented for `{integer}`
   = note: required for `&{integer}` to implement `PartialEq<&&{integer}>`
help: consider dereferencing here
   |
LL |     _ = &0 == *foo;
   |               +

error[E0277]: can't compare `{integer}` with `&&&&&&{integer}`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:35:11
   |
LL |     _ = 0 == &&&&foo;
   |           ^^ no implementation for `{integer} == &&&&&&{integer}`
   |
   = help: the trait `PartialEq<&&&&&&{integer}>` is not implemented for `{integer}`
help: consider removing the borrows and dereferencing instead
   |
LL -     _ = 0 == &&&&foo;
LL +     _ = 0 == **foo;
   |

error[E0277]: can't compare `{integer}` with `&{integer}`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:37:11
   |
LL |     _ = 0 == *foo;
   |           ^^ no implementation for `{integer} == &{integer}`
   |
   = help: the trait `PartialEq<&{integer}>` is not implemented for `{integer}`
help: consider dereferencing here
   |
LL |     _ = 0 == **foo;
   |              +

error[E0277]: can't compare `{integer}` with `&&{integer}`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:39:13
   |
LL |     _ = &&0 == &&foo;
   |             ^^ no implementation for `{integer} == &&{integer}`
   |
   = help: the trait `PartialEq<&&{integer}>` is not implemented for `{integer}`
   = note: required for `&{integer}` to implement `PartialEq<&&&{integer}>`
   = note: 1 redundant requirement hidden
   = note: required for `&&{integer}` to implement `PartialEq<&&&&{integer}>`
help: consider removing the borrows
   |
LL -     _ = &&0 == &&foo;
LL +     _ = &&0 == foo;
   |

error[E0277]: can't compare `Box<Box<{integer}>>` with `&&{integer}`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:43:33
   |
LL |     _ = &Box::new(Box::new(42)) == &foo;
   |                                 ^^ no implementation for `Box<Box<{integer}>> == &&{integer}`
   |
   = help: the trait `PartialEq<&&{integer}>` is not implemented for `Box<Box<{integer}>>`
   = note: required for `&Box<Box<{integer}>>` to implement `PartialEq<&&&{integer}>`
help: consider dereferencing both sides of the expression
   |
LL -     _ = &Box::new(Box::new(42)) == &foo;
LL +     _ = **Box::new(Box::new(42)) == **foo;
   |

error[E0277]: can't compare `Box<{integer}>` with `&&{integer}`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:45:23
   |
LL |     _ = &Box::new(42) == &foo;
   |                       ^^ no implementation for `Box<{integer}> == &&{integer}`
   |
   = help: the trait `PartialEq<&&{integer}>` is not implemented for `Box<{integer}>`
   = note: required for `&Box<{integer}>` to implement `PartialEq<&&&{integer}>`
help: consider dereferencing both sides of the expression
   |
LL -     _ = &Box::new(42) == &foo;
LL +     _ = *Box::new(42) == **foo;
   |

error[E0277]: can't compare `Box<Box<Box<Box<{integer}>>>>` with `&&{integer}`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:47:53
   |
LL |     _ = &Box::new(Box::new(Box::new(Box::new(42)))) == &foo;
   |                                                     ^^ no implementation for `Box<Box<Box<Box<{integer}>>>> == &&{integer}`
   |
   = help: the trait `PartialEq<&&{integer}>` is not implemented for `Box<Box<Box<Box<{integer}>>>>`
   = note: required for `&Box<Box<Box<Box<{integer}>>>>` to implement `PartialEq<&&&{integer}>`
help: consider dereferencing both sides of the expression
   |
LL -     _ = &Box::new(Box::new(Box::new(Box::new(42)))) == &foo;
LL +     _ = ****Box::new(Box::new(Box::new(Box::new(42)))) == **foo;
   |

error[E0277]: can't compare `&&{integer}` with `Box<Box<Box<Box<{integer}>>>>`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:49:14
   |
LL |     _ = &foo == &Box::new(Box::new(Box::new(Box::new(42))));
   |              ^^ no implementation for `&&{integer} == Box<Box<Box<Box<{integer}>>>>`
   |
   = help: the trait `PartialEq<Box<Box<Box<Box<{integer}>>>>>` is not implemented for `&&{integer}`
   = note: required for `&&&{integer}` to implement `PartialEq<&Box<Box<Box<Box<{integer}>>>>>`
help: consider dereferencing both sides of the expression
   |
LL -     _ = &foo == &Box::new(Box::new(Box::new(Box::new(42))));
LL +     _ = **foo == ****Box::new(Box::new(Box::new(Box::new(42))));
   |

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:53:25
   |
LL |     _ = Box::new(42) == 42;
   |         ------------    ^^ expected `Box<{integer}>`, found integer
   |         |
   |         expected because this is `Box<{integer}>`
   |
   = note: expected struct `Box<{integer}>`
                found type `{integer}`
   = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html
help: store this in the heap by calling `Box::new`
   |
LL |     _ = Box::new(42) == Box::new(42);
   |                         +++++++++  +

error[E0277]: can't compare `&&{integer}` with `Foo`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:58:13
   |
LL |     _ = &&0 == Foo;
   |             ^^ no implementation for `&&{integer} == Foo`
   |
   = help: the trait `PartialEq<Foo>` is not implemented for `&&{integer}`
   = help: the following other types implement trait `PartialEq<Rhs>`:
             f128
             f16
             f32
             f64
             i128
             i16
             i32
             i64
           and 8 others

error[E0369]: binary operation `==` cannot be applied to type `Foo`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:60:13
   |
LL |     _ = Foo == &&0;
   |         --- ^^ --- &&{integer}
   |         |
   |         Foo
   |
note: an implementation of `PartialEq<&&{integer}>` might be missing for `Foo`
  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:57:5
   |
LL |     struct Foo;
   |     ^^^^^^^^^^ must implement `PartialEq<&&{integer}>`

error[E0277]: can't compare `&String` with `str`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:69:20
   |
LL |     _ = string_ref == partial[..3];
   |                    ^^ no implementation for `&String == str`
   |
   = help: the trait `PartialEq<str>` is not implemented for `&String`
help: consider dereferencing here
   |
LL |     _ = *string_ref == partial[..3];
   |         +

error[E0277]: can't compare `str` with `&String`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:71:22
   |
LL |     _ = partial[..3] == string_ref;
   |                      ^^ no implementation for `str == &String`
   |
   = help: the trait `PartialEq<&String>` is not implemented for `str`
help: consider dereferencing here
   |
LL |     _ = partial[..3] == *string_ref;
   |                         +

error[E0277]: no implementation for `i32 & str`
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:78:17
   |
LL |     let _ = FOO & (*"Sized".to_string().into_boxed_str());
   |                 ^ no implementation for `i32 & str`
   |
   = help: the trait `BitAnd<str>` is not implemented for `i32`
help: the following other types implement trait `BitAnd<Rhs>`
  --> /rustc/FAKE_PREFIX/library/core/src/internal_macros.rs:22:8
   |
   = note: `&i32` implements `BitAnd<i32>`
  ::: /rustc/FAKE_PREFIX/library/core/src/internal_macros.rs:33:8
   |
   = note: `i32` implements `BitAnd<&i32>`
  ::: /rustc/FAKE_PREFIX/library/core/src/internal_macros.rs:44:8
   |
   = note: `&i32` implements `BitAnd`
  --> /rustc/FAKE_PREFIX/library/core/src/ops/bit.rs:174:8
   |
   = note: `i32` implements `BitAnd`
  ::: /rustc/FAKE_PREFIX/library/core/src/ops/bit.rs:187:0
   |
   = note: in this macro invocation
   = note: this error originates in the macro `forward_ref_binop` which comes from the expansion of the macro `bitand_impl` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the size for values of type `str` cannot be known at compilation time
##[error]  --> /checkout/tests/ui/binop/binary-op-suggest-deref.rs:78:17
   |
LL |     let _ = FOO & (*"Sized".to_string().into_boxed_str());
   |                 ^ doesn't have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `str`

error: aborting due to 24 previous errors
---
-   --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
+    = note: calling this operator moves the left-hand side
20 help: consider further restricting type parameter `A` with trait `Copy`
21    |
22 LL | fn add<A: Add<B, Output=()> + Copy, B>(lhs: A, rhs: B) {

62    |        ^ consider constraining this type parameter with `Clone`
63 LL |     lhs - rhs;
64    |     --- you could clone this value
- note: calling this operator moves the left-hand side
-   --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
+    = note: calling this operator moves the left-hand side
67 help: consider further restricting type parameter `A` with trait `Copy`
68    |
69 LL | fn sub<A: Sub<B, Output=()> + Copy, B>(lhs: A, rhs: B) {

109    |        ^ consider constraining this type parameter with `Clone`
110 LL |     lhs * rhs;
111    |     --- you could clone this value
- note: calling this operator moves the left-hand side
-   --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
+    = note: calling this operator moves the left-hand side
114 help: consider further restricting type parameter `A` with trait `Copy`
115    |
116 LL | fn mul<A: Mul<B, Output=()> + Copy, B>(lhs: A, rhs: B) {

156    |        ^ consider constraining this type parameter with `Clone`
157 LL |     lhs / rhs;
158    |     --- you could clone this value
- note: calling this operator moves the left-hand side
-   --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
+    = note: calling this operator moves the left-hand side
161 help: consider further restricting type parameter `A` with trait `Copy`
162    |
163 LL | fn div<A: Div<B, Output=()> + Copy, B>(lhs: A, rhs: B) {

203    |        ^ consider constraining this type parameter with `Clone`
204 LL |     lhs % rhs;
205    |     --- you could clone this value
- note: calling this operator moves the left-hand side
-   --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
+    = note: calling this operator moves the left-hand side
208 help: consider further restricting type parameter `A` with trait `Copy`
209    |
210 LL | fn rem<A: Rem<B, Output=()> + Copy, B>(lhs: A, rhs: B) {

250    |           ^ consider constraining this type parameter with `Clone`
251 LL |     lhs & rhs;
252    |     --- you could clone this value
- note: calling this operator moves the left-hand side
-   --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
+    = note: calling this operator moves the left-hand side
255 help: consider further restricting type parameter `A` with trait `Copy`
256    |
257 LL | fn bitand<A: BitAnd<B, Output=()> + Copy, B>(lhs: A, rhs: B) {

297    |          ^ consider constraining this type parameter with `Clone`
298 LL |     lhs | rhs;
299    |     --- you could clone this value
- note: calling this operator moves the left-hand side
-   --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
+    = note: calling this operator moves the left-hand side
302 help: consider further restricting type parameter `A` with trait `Copy`
303    |
304 LL | fn bitor<A: BitOr<B, Output=()> + Copy, B>(lhs: A, rhs: B) {

344    |           ^ consider constraining this type parameter with `Clone`
345 LL |     lhs ^ rhs;
346    |     --- you could clone this value
- note: calling this operator moves the left-hand side
-   --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
+    = note: calling this operator moves the left-hand side
349 help: consider further restricting type parameter `A` with trait `Copy`
350    |
351 LL | fn bitxor<A: BitXor<B, Output=()> + Copy, B>(lhs: A, rhs: B) {

391    |        ^ consider constraining this type parameter with `Clone`
392 LL |     lhs << rhs;
393    |     --- you could clone this value
- note: calling this operator moves the left-hand side
-   --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
+    = note: calling this operator moves the left-hand side
396 help: consider further restricting type parameter `A` with trait `Copy`
397    |
398 LL | fn shl<A: Shl<B, Output=()> + Copy, B>(lhs: A, rhs: B) {

438    |        ^ consider constraining this type parameter with `Clone`
439 LL |     lhs >> rhs;
440    |     --- you could clone this value
- note: calling this operator moves the left-hand side
-   --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
+    = note: calling this operator moves the left-hand side
443 help: consider further restricting type parameter `A` with trait `Copy`
444    |
445 LL | fn shr<A: Shr<B, Output=()> + Copy, B>(lhs: A, rhs: B) {


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 binop/binop-consume-args.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/binop/binop-consume-args.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/binop/binop-consume-args" "-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[E0382]: use of moved value: `lhs`
##[error]  --> /checkout/tests/ui/binop/binop-consume-args.rs:7:10
   |
LL | fn add<A: Add<B, Output=()>, B>(lhs: A, rhs: B) {
   |                                 --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
LL |     lhs + rhs;
   |     --------- `lhs` moved due to usage in operator
LL |     drop(lhs);  //~ ERROR use of moved value: `lhs`
   |          ^^^ value used here after move
   |
help: if `A` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-consume-args.rs:5:8
   |
LL | fn add<A: Add<B, Output=()>, B>(lhs: A, rhs: B) {
   |        ^ consider constraining this type parameter with `Clone`
LL |     lhs + rhs;
   |     --- you could clone this value
   = note: calling this operator moves the left-hand side
help: consider further restricting type parameter `A` with trait `Copy`
   |
LL | fn add<A: Add<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
   |                             ++++++

error[E0382]: use of moved value: `rhs`
##[error]  --> /checkout/tests/ui/binop/binop-consume-args.rs:8:10
   |
LL | fn add<A: Add<B, Output=()>, B>(lhs: A, rhs: B) {
   |                                         --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
LL |     lhs + rhs;
   |           --- value moved here
LL |     drop(lhs);  //~ ERROR use of moved value: `lhs`
LL |     drop(rhs);  //~ ERROR use of moved value: `rhs`
   |          ^^^ value used here after move
   |
help: if `B` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-consume-args.rs:5:30
   |
LL | fn add<A: Add<B, Output=()>, B>(lhs: A, rhs: B) {
   |                              ^ consider constraining this type parameter with `Clone`
LL |     lhs + rhs;
   |           --- you could clone this value
help: consider restricting type parameter `B` with trait `Copy`
   |
LL | fn add<A: Add<B, Output=()>, B: Copy>(lhs: A, rhs: B) {
   |                               ++++++

error[E0382]: use of moved value: `lhs`
##[error]  --> /checkout/tests/ui/binop/binop-consume-args.rs:13:10
   |
LL | fn sub<A: Sub<B, Output=()>, B>(lhs: A, rhs: B) {
   |                                 --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
LL |     lhs - rhs;
   |     --------- `lhs` moved due to usage in operator
LL |     drop(lhs);  //~ ERROR use of moved value: `lhs`
   |          ^^^ value used here after move
   |
help: if `A` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-consume-args.rs:11:8
   |
LL | fn sub<A: Sub<B, Output=()>, B>(lhs: A, rhs: B) {
   |        ^ consider constraining this type parameter with `Clone`
LL |     lhs - rhs;
   |     --- you could clone this value
   = note: calling this operator moves the left-hand side
help: consider further restricting type parameter `A` with trait `Copy`
   |
LL | fn sub<A: Sub<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
   |                             ++++++

error[E0382]: use of moved value: `rhs`
##[error]  --> /checkout/tests/ui/binop/binop-consume-args.rs:14:10
   |
LL | fn sub<A: Sub<B, Output=()>, B>(lhs: A, rhs: B) {
   |                                         --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
LL |     lhs - rhs;
   |           --- value moved here
LL |     drop(lhs);  //~ ERROR use of moved value: `lhs`
LL |     drop(rhs);  //~ ERROR use of moved value: `rhs`
   |          ^^^ value used here after move
   |
help: if `B` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-consume-args.rs:11:30
   |
LL | fn sub<A: Sub<B, Output=()>, B>(lhs: A, rhs: B) {
   |                              ^ consider constraining this type parameter with `Clone`
LL |     lhs - rhs;
   |           --- you could clone this value
help: consider restricting type parameter `B` with trait `Copy`
   |
LL | fn sub<A: Sub<B, Output=()>, B: Copy>(lhs: A, rhs: B) {
   |                               ++++++

error[E0382]: use of moved value: `lhs`
##[error]  --> /checkout/tests/ui/binop/binop-consume-args.rs:19:10
   |
LL | fn mul<A: Mul<B, Output=()>, B>(lhs: A, rhs: B) {
   |                                 --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
LL |     lhs * rhs;
   |     --------- `lhs` moved due to usage in operator
LL |     drop(lhs);  //~ ERROR use of moved value: `lhs`
   |          ^^^ value used here after move
   |
help: if `A` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-consume-args.rs:17:8
   |
LL | fn mul<A: Mul<B, Output=()>, B>(lhs: A, rhs: B) {
   |        ^ consider constraining this type parameter with `Clone`
LL |     lhs * rhs;
   |     --- you could clone this value
   = note: calling this operator moves the left-hand side
help: consider further restricting type parameter `A` with trait `Copy`
   |
LL | fn mul<A: Mul<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
   |                             ++++++

error[E0382]: use of moved value: `rhs`
##[error]  --> /checkout/tests/ui/binop/binop-consume-args.rs:20:10
   |
LL | fn mul<A: Mul<B, Output=()>, B>(lhs: A, rhs: B) {
   |                                         --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
LL |     lhs * rhs;
   |           --- value moved here
LL |     drop(lhs);  //~ ERROR use of moved value: `lhs`
LL |     drop(rhs);  //~ ERROR use of moved value: `rhs`
   |          ^^^ value used here after move
   |
help: if `B` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-consume-args.rs:17:30
   |
LL | fn mul<A: Mul<B, Output=()>, B>(lhs: A, rhs: B) {
   |                              ^ consider constraining this type parameter with `Clone`
LL |     lhs * rhs;
   |           --- you could clone this value
help: consider restricting type parameter `B` with trait `Copy`
   |
LL | fn mul<A: Mul<B, Output=()>, B: Copy>(lhs: A, rhs: B) {
   |                               ++++++

error[E0382]: use of moved value: `lhs`
##[error]  --> /checkout/tests/ui/binop/binop-consume-args.rs:25:10
   |
LL | fn div<A: Div<B, Output=()>, B>(lhs: A, rhs: B) {
   |                                 --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
LL |     lhs / rhs;
   |     --------- `lhs` moved due to usage in operator
LL |     drop(lhs);  //~ ERROR use of moved value: `lhs`
   |          ^^^ value used here after move
   |
help: if `A` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-consume-args.rs:23:8
   |
LL | fn div<A: Div<B, Output=()>, B>(lhs: A, rhs: B) {
   |        ^ consider constraining this type parameter with `Clone`
LL |     lhs / rhs;
   |     --- you could clone this value
   = note: calling this operator moves the left-hand side
help: consider further restricting type parameter `A` with trait `Copy`
   |
LL | fn div<A: Div<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
   |                             ++++++

error[E0382]: use of moved value: `rhs`
##[error]  --> /checkout/tests/ui/binop/binop-consume-args.rs:26:10
   |
LL | fn div<A: Div<B, Output=()>, B>(lhs: A, rhs: B) {
   |                                         --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
LL |     lhs / rhs;
   |           --- value moved here
LL |     drop(lhs);  //~ ERROR use of moved value: `lhs`
LL |     drop(rhs);  //~ ERROR use of moved value: `rhs`
   |          ^^^ value used here after move
   |
help: if `B` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-consume-args.rs:23:30
   |
LL | fn div<A: Div<B, Output=()>, B>(lhs: A, rhs: B) {
   |                              ^ consider constraining this type parameter with `Clone`
LL |     lhs / rhs;
   |           --- you could clone this value
help: consider restricting type parameter `B` with trait `Copy`
   |
LL | fn div<A: Div<B, Output=()>, B: Copy>(lhs: A, rhs: B) {
   |                               ++++++

error[E0382]: use of moved value: `lhs`
##[error]  --> /checkout/tests/ui/binop/binop-consume-args.rs:31:10
   |
LL | fn rem<A: Rem<B, Output=()>, B>(lhs: A, rhs: B) {
   |                                 --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
LL |     lhs % rhs;
   |     --------- `lhs` moved due to usage in operator
LL |     drop(lhs);  //~ ERROR use of moved value: `lhs`
   |          ^^^ value used here after move
   |
help: if `A` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-consume-args.rs:29:8
   |
LL | fn rem<A: Rem<B, Output=()>, B>(lhs: A, rhs: B) {
   |        ^ consider constraining this type parameter with `Clone`
LL |     lhs % rhs;
   |     --- you could clone this value
   = note: calling this operator moves the left-hand side
help: consider further restricting type parameter `A` with trait `Copy`
   |
LL | fn rem<A: Rem<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
   |                             ++++++

error[E0382]: use of moved value: `rhs`
##[error]  --> /checkout/tests/ui/binop/binop-consume-args.rs:32:10
   |
LL | fn rem<A: Rem<B, Output=()>, B>(lhs: A, rhs: B) {
   |                                         --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
LL |     lhs % rhs;
   |           --- value moved here
LL |     drop(lhs);  //~ ERROR use of moved value: `lhs`
LL |     drop(rhs);  //~ ERROR use of moved value: `rhs`
   |          ^^^ value used here after move
   |
help: if `B` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-consume-args.rs:29:30
   |
LL | fn rem<A: Rem<B, Output=()>, B>(lhs: A, rhs: B) {
   |                              ^ consider constraining this type parameter with `Clone`
LL |     lhs % rhs;
   |           --- you could clone this value
help: consider restricting type parameter `B` with trait `Copy`
   |
LL | fn rem<A: Rem<B, Output=()>, B: Copy>(lhs: A, rhs: B) {
   |                               ++++++

error[E0382]: use of moved value: `lhs`
##[error]  --> /checkout/tests/ui/binop/binop-consume-args.rs:37:10
   |
LL | fn bitand<A: BitAnd<B, Output=()>, B>(lhs: A, rhs: B) {
   |                                       --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
LL |     lhs & rhs;
   |     --------- `lhs` moved due to usage in operator
LL |     drop(lhs);  //~ ERROR use of moved value: `lhs`
   |          ^^^ value used here after move
   |
help: if `A` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-consume-args.rs:35:11
   |
LL | fn bitand<A: BitAnd<B, Output=()>, B>(lhs: A, rhs: B) {
   |           ^ consider constraining this type parameter with `Clone`
LL |     lhs & rhs;
   |     --- you could clone this value
   = note: calling this operator moves the left-hand side
help: consider further restricting type parameter `A` with trait `Copy`
   |
LL | fn bitand<A: BitAnd<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
   |                                   ++++++

error[E0382]: use of moved value: `rhs`
##[error]  --> /checkout/tests/ui/binop/binop-consume-args.rs:38:10
   |
LL | fn bitand<A: BitAnd<B, Output=()>, B>(lhs: A, rhs: B) {
   |                                               --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
LL |     lhs & rhs;
   |           --- value moved here
LL |     drop(lhs);  //~ ERROR use of moved value: `lhs`
LL |     drop(rhs);  //~ ERROR use of moved value: `rhs`
   |          ^^^ value used here after move
   |
help: if `B` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-consume-args.rs:35:36
   |
LL | fn bitand<A: BitAnd<B, Output=()>, B>(lhs: A, rhs: B) {
   |                                    ^ consider constraining this type parameter with `Clone`
LL |     lhs & rhs;
   |           --- you could clone this value
help: consider restricting type parameter `B` with trait `Copy`
   |
LL | fn bitand<A: BitAnd<B, Output=()>, B: Copy>(lhs: A, rhs: B) {
   |                                     ++++++

error[E0382]: use of moved value: `lhs`
##[error]  --> /checkout/tests/ui/binop/binop-consume-args.rs:43:10
   |
LL | fn bitor<A: BitOr<B, Output=()>, B>(lhs: A, rhs: B) {
   |                                     --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
LL |     lhs | rhs;
   |     --------- `lhs` moved due to usage in operator
LL |     drop(lhs);  //~ ERROR use of moved value: `lhs`
   |          ^^^ value used here after move
   |
help: if `A` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-consume-args.rs:41:10
   |
LL | fn bitor<A: BitOr<B, Output=()>, B>(lhs: A, rhs: B) {
   |          ^ consider constraining this type parameter with `Clone`
LL |     lhs | rhs;
   |     --- you could clone this value
   = note: calling this operator moves the left-hand side
help: consider further restricting type parameter `A` with trait `Copy`
   |
LL | fn bitor<A: BitOr<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
   |                                 ++++++

error[E0382]: use of moved value: `rhs`
##[error]  --> /checkout/tests/ui/binop/binop-consume-args.rs:44:10
   |
LL | fn bitor<A: BitOr<B, Output=()>, B>(lhs: A, rhs: B) {
   |                                             --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
LL |     lhs | rhs;
   |           --- value moved here
LL |     drop(lhs);  //~ ERROR use of moved value: `lhs`
LL |     drop(rhs);  //~ ERROR use of moved value: `rhs`
   |          ^^^ value used here after move
   |
help: if `B` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-consume-args.rs:41:34
   |
LL | fn bitor<A: BitOr<B, Output=()>, B>(lhs: A, rhs: B) {
   |                                  ^ consider constraining this type parameter with `Clone`
LL |     lhs | rhs;
   |           --- you could clone this value
help: consider restricting type parameter `B` with trait `Copy`
   |
LL | fn bitor<A: BitOr<B, Output=()>, B: Copy>(lhs: A, rhs: B) {
   |                                   ++++++

error[E0382]: use of moved value: `lhs`
##[error]  --> /checkout/tests/ui/binop/binop-consume-args.rs:49:10
   |
LL | fn bitxor<A: BitXor<B, Output=()>, B>(lhs: A, rhs: B) {
   |                                       --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
LL |     lhs ^ rhs;
   |     --------- `lhs` moved due to usage in operator
LL |     drop(lhs);  //~ ERROR use of moved value: `lhs`
   |          ^^^ value used here after move
   |
help: if `A` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-consume-args.rs:47:11
   |
LL | fn bitxor<A: BitXor<B, Output=()>, B>(lhs: A, rhs: B) {
   |           ^ consider constraining this type parameter with `Clone`
LL |     lhs ^ rhs;
   |     --- you could clone this value
   = note: calling this operator moves the left-hand side
help: consider further restricting type parameter `A` with trait `Copy`
   |
LL | fn bitxor<A: BitXor<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
   |                                   ++++++

error[E0382]: use of moved value: `rhs`
##[error]  --> /checkout/tests/ui/binop/binop-consume-args.rs:50:10
   |
LL | fn bitxor<A: BitXor<B, Output=()>, B>(lhs: A, rhs: B) {
   |                                               --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
LL |     lhs ^ rhs;
   |           --- value moved here
LL |     drop(lhs);  //~ ERROR use of moved value: `lhs`
LL |     drop(rhs);  //~ ERROR use of moved value: `rhs`
   |          ^^^ value used here after move
   |
help: if `B` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-consume-args.rs:47:36
   |
LL | fn bitxor<A: BitXor<B, Output=()>, B>(lhs: A, rhs: B) {
   |                                    ^ consider constraining this type parameter with `Clone`
LL |     lhs ^ rhs;
   |           --- you could clone this value
help: consider restricting type parameter `B` with trait `Copy`
   |
LL | fn bitxor<A: BitXor<B, Output=()>, B: Copy>(lhs: A, rhs: B) {
   |                                     ++++++

error[E0382]: use of moved value: `lhs`
##[error]  --> /checkout/tests/ui/binop/binop-consume-args.rs:55:10
   |
LL | fn shl<A: Shl<B, Output=()>, B>(lhs: A, rhs: B) {
   |                                 --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
LL |     lhs << rhs;
   |     ---------- `lhs` moved due to usage in operator
LL |     drop(lhs);  //~ ERROR use of moved value: `lhs`
   |          ^^^ value used here after move
   |
help: if `A` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-consume-args.rs:53:8
   |
LL | fn shl<A: Shl<B, Output=()>, B>(lhs: A, rhs: B) {
   |        ^ consider constraining this type parameter with `Clone`
LL |     lhs << rhs;
   |     --- you could clone this value
   = note: calling this operator moves the left-hand side
help: consider further restricting type parameter `A` with trait `Copy`
   |
LL | fn shl<A: Shl<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
   |                             ++++++

error[E0382]: use of moved value: `rhs`
##[error]  --> /checkout/tests/ui/binop/binop-consume-args.rs:56:10
   |
---
-   --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
+    = note: calling this operator moves the left-hand side
23 help: consider further restricting type parameter `T` with trait `Copy`
24    |
25 LL | fn double_move<T: Add<Output=()> + Copy>(x: T) {

102 LL | |     *n;
103    | |______- `*m` moved due to usage in operator
104    |
- note: calling this operator moves the left-hand side
-   --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
+    = note: calling this operator moves the left-hand side
107 help: if `T` implemented `Clone`, you could clone the value
---
To only update this specific test, also pass `--test-args binop/binop-move-semantics.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/binop/binop-move-semantics.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/binop/binop-move-semantics" "-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[E0382]: use of moved value: `x`
##[error]  --> /checkout/tests/ui/binop/binop-move-semantics.rs:8:5
   |
LL |   fn double_move<T: Add<Output=()>>(x: T) {
   |                                     - move occurs because `x` has type `T`, which does not implement the `Copy` trait
LL | /     x
LL | |     +
LL | |     x;  //~ ERROR: use of moved value
   | |     ^
   | |     |
   | |_____value used here after move
   |       `x` moved due to usage in operator
   |
help: if `T` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-move-semantics.rs:5:16
   |
LL | fn double_move<T: Add<Output=()>>(x: T) {
   |                ^ consider constraining this type parameter with `Clone`
LL |     x
   |     - you could clone this value
   = note: calling this operator moves the left-hand side
help: consider further restricting type parameter `T` with trait `Copy`
   |
LL | fn double_move<T: Add<Output=()> + Copy>(x: T) {
   |                                  ++++++

error[E0382]: borrow of moved value: `x`
##[error]  --> /checkout/tests/ui/binop/binop-move-semantics.rs:14:5
   |
LL | fn move_then_borrow<T: Add<Output=()> + Clone>(x: T) {
   |                                                - move occurs because `x` has type `T`, which does not implement the `Copy` trait
LL |     x
   |     - value moved here
LL |     +
LL |     x.clone();  //~ ERROR: borrow of moved value
   |     ^ value borrowed here after move
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL |     x.clone()
   |      ++++++++
help: consider further restricting type parameter `T` with trait `Copy`
   |
LL | fn move_then_borrow<T: Add<Output=()> + Clone + Copy>(x: T) {
   |                                               ++++++

error[E0505]: cannot move out of `x` because it is borrowed
##[error]  --> /checkout/tests/ui/binop/binop-move-semantics.rs:21:5
   |
LL | fn move_borrowed<T: Add<Output=()>>(x: T, mut y: T) {
   |                                     - binding `x` declared here
LL |     let m = &x;
   |             -- borrow of `x` occurs here
...
LL |     x  //~ ERROR: cannot move out of `x` because it is borrowed
   |     ^ move out of `x` occurs here
...
LL |     use_mut(n); use_imm(m);
   |                         - borrow later used here
   |
help: if `T` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-move-semantics.rs:17:18
   |
LL | fn move_borrowed<T: Add<Output=()>>(x: T, mut y: T) {
   |                  ^ consider constraining this type parameter with `Clone`
LL |     let m = &x;
   |              - you could clone this value

error[E0505]: cannot move out of `y` because it is borrowed
##[error]  --> /checkout/tests/ui/binop/binop-move-semantics.rs:23:5
   |
LL | fn move_borrowed<T: Add<Output=()>>(x: T, mut y: T) {
   |                                           ----- binding `y` declared here
LL |     let m = &x;
LL |     let n = &mut y;
   |             ------ borrow of `y` occurs here
...
LL |     y;  //~ ERROR: cannot move out of `y` because it is borrowed
   |     ^ move out of `y` occurs here
LL |     use_mut(n); use_imm(m);
   |             - borrow later used here
   |
help: if `T` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-move-semantics.rs:17:18
   |
LL | fn move_borrowed<T: Add<Output=()>>(x: T, mut y: T) {
   |                  ^ consider constraining this type parameter with `Clone`
LL |     let m = &x;
LL |     let n = &mut y;
   |                  - you could clone this value

error[E0507]: cannot move out of `*m` which is behind a mutable reference
##[error]  --> /checkout/tests/ui/binop/binop-move-semantics.rs:30:5
   |
LL |       *m  //~ ERROR: cannot move
   |       -^
   |       |
   |  _____move occurs because `*m` has type `T`, which does not implement the `Copy` trait
   | |
LL | |     +
LL | |     *n;  //~ ERROR: cannot move
   | |______- `*m` moved due to usage in operator
   |
   = note: calling this operator moves the left-hand side
help: if `T` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-move-semantics.rs:26:24
   |
LL | fn illegal_dereference<T: Add<Output=()>>(mut x: T, y: T) {
   |                        ^ consider constraining this type parameter with `Clone`
...
LL |     *m  //~ ERROR: cannot move
   |     -- you could clone this value

error[E0507]: cannot move out of `*n` which is behind a shared reference
##[error]  --> /checkout/tests/ui/binop/binop-move-semantics.rs:32:5
   |
LL |     *n;  //~ ERROR: cannot move
   |     ^^ move occurs because `*n` has type `T`, which does not implement the `Copy` trait
   |
help: if `T` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/binop/binop-move-semantics.rs:26:24
   |
LL | fn illegal_dereference<T: Add<Output=()>>(mut x: T, y: T) {
   |                        ^ consider constraining this type parameter with `Clone`
...
LL |     *n;  //~ ERROR: cannot move
   |     -- you could clone this value

error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable
##[error]  --> /checkout/tests/ui/binop/binop-move-semantics.rs:54:5
   |
LL |       &mut f
   |       ------
   |       |
   |  _____mutable borrow occurs here
   | |
LL | |     +
LL | |     &f;  //~ ERROR: cannot borrow `f` as immutable because it is also borrowed as mutable
   | |     ^-
   | |_____||
   |       |mutable borrow later used here
   |       immutable borrow occurs here

---
   |       |
   |  _____immutable borrow occurs here
   | |
LL | |     +
LL | |     &mut f;  //~ ERROR: cannot borrow `f` as mutable because it is also borrowed as immutable
   | |     ^^^^^-
   | |_____|____|
   |       |    immutable borrow later used here
   |       mutable borrow occurs here

---
------------------------------------------

---- [ui] tests/ui/binop/binop-move-semantics.rs stdout end ----
---- [ui] tests/ui/borrowck/borrow-of-moved-value-in-for-loop-61108.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/borrowck/borrow-of-moved-value-in-for-loop-61108/borrow-of-moved-value-in-for-loop-61108.stderr`
diff of stderr:

9 LL |     bad_letters.push('s');
10    |     ^^^^^^^^^^^ value borrowed here after move
11    |
- note: `into_iter` takes ownership of the receiver `self`, which moves `bad_letters`
-   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    = note: `into_iter` takes ownership of the receiver `self`, which moves `bad_letters`
14 help: consider iterating over a slice of the `Vec<char>`'s content to avoid moving into the `for` loop
15    |
16 LL |     for l in &bad_letters {


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/borrow-of-moved-value-in-for-loop-61108.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/borrow-of-moved-value-in-for-loop-61108.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/borrow-of-moved-value-in-for-loop-61108" "-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[E0382]: borrow of moved value: `bad_letters`
##[error]  --> /checkout/tests/ui/borrowck/borrow-of-moved-value-in-for-loop-61108.rs:7:5
   |
LL |     let mut bad_letters = vec!['e', 't', 'o', 'i'];
   |         --------------- move occurs because `bad_letters` has type `Vec<char>`, which does not implement the `Copy` trait
LL |     for l in bad_letters {
   |              ----------- `bad_letters` moved due to this implicit call to `.into_iter()`
...
LL |     bad_letters.push('s'); //~ ERROR borrow of moved value: `bad_letters`
   |     ^^^^^^^^^^^ value borrowed here after move
   |
   = note: `into_iter` takes ownership of the receiver `self`, which moves `bad_letters`
help: consider iterating over a slice of the `Vec<char>`'s content to avoid moving into the `for` loop
   |
LL |     for l in &bad_letters {
   |              +

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0382`.
---
-   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    = note: `into_iter` takes ownership of the receiver `self`, which moves value
11 help: you can `clone` the value and consume it, but this might not be your desired behavior
12    |
13 LL |     let _x = <Vec<i32> as Clone>::clone(&Rc::new(vec![1, 2])).into_iter();


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-move-out-of-overloaded-auto-deref.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-move-out-of-overloaded-auto-deref.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-move-out-of-overloaded-auto-deref" "-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[E0507]: cannot move out of an `Rc`
##[error]  --> /checkout/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs:5:14
   |
LL |     let _x = Rc::new(vec![1, 2]).into_iter();
   |              ^^^^^^^^^^^^^^^^^^^ ----------- value moved due to this method call
   |              |
   |              move occurs because value has type `Vec<i32>`, which does not implement the `Copy` trait
   |
   = note: `into_iter` takes ownership of the receiver `self`, which moves value
help: you can `clone` the value and consume it, but this might not be your desired behavior
   |
LL |     let _x = <Vec<i32> as Clone>::clone(&Rc::new(vec![1, 2])).into_iter();
   |              ++++++++++++++++++++++++++++                   +
help: consider cloning the value if the performance cost is acceptable
   |
LL |     let _x = Rc::new(vec![1, 2]).clone().into_iter();
   |                                 ++++++++

error: aborting due to 1 previous error

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

27 LL |     let _y = foo;
28    |              ^^^ value used here after move
29    |
- note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `foo`
-   --> $SRC_DIR/core/src/option.rs:LL:COL
+    = note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `foo`
32 help: you could `clone` the value and consume it, if the `Struct: Clone` trait bound could be satisfied
33    |
34 LL |     let _x = foo.clone().unwrap();

61 LL |     } else if true {
62 LL |         foo = Some(Struct2);
63    |         ^^^^^^^^^^^^^^^^^^^
- note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `foo`
-   --> $SRC_DIR/core/src/option.rs:LL:COL
+    = note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `foo`
66 help: you could `clone` the value and consume it, if the `Struct2: Clone` trait bound could be satisfied
67    |
68 LL |     let _x = foo.clone().unwrap();


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/issue-83760.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/issue-83760.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/issue-83760" "-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[E0382]: use of moved value
##[error]  --> /checkout/tests/ui/borrowck/issue-83760.rs:10:20
   |
LL |     while let Some(foo) = val { //~ ERROR use of moved value
   |                    ^^^ value moved here, in previous iteration of loop
LL |         if true {
LL |             val = None;
   |             ---------- this reinitialization might get skipped
   |
   = note: move occurs because value has type `Struct`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
   |
LL |     while let Some(ref foo) = val { //~ ERROR use of moved value
   |                    +++

error[E0382]: use of moved value: `foo`
##[error]  --> /checkout/tests/ui/borrowck/issue-83760.rs:26:14
   |
---
LL |     if true {
LL |         foo = Some(Struct);
   |         ------------------ this reinitialization might get skipped
...
LL |     let _y = foo; //~ ERROR use of moved value: `foo`
   |              ^^^ value used here after move
   |
   = note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `foo`
help: you could `clone` the value and consume it, if the `Struct: Clone` trait bound could be satisfied
   |
LL |     let _x = foo.clone().unwrap();
   |                 ++++++++
help: consider annotating `Struct` with `#[derive(Clone)]`
   |
---
   |         ------- move occurs because `foo` has type `Option<Struct2>`, which does not implement the `Copy` trait
LL |     let _x = foo.unwrap();
   |                  -------- `foo` moved due to this method call
...
LL |     let _y = foo; //~ ERROR use of moved value: `foo`
   |              ^^^ value used here after move
   |
note: these 3 reinitializations and 1 other might get skipped
  --> /checkout/tests/ui/borrowck/issue-83760.rs:35:9
   |
LL |         foo = Some(Struct2);
   |         ^^^^^^^^^^^^^^^^^^^
LL |     } else if true {
LL |         foo = Some(Struct2);
   |         ^^^^^^^^^^^^^^^^^^^
LL |     } else if true {
LL |         foo = Some(Struct2);
   |         ^^^^^^^^^^^^^^^^^^^
   = note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `foo`
help: you could `clone` the value and consume it, if the `Struct2: Clone` trait bound could be satisfied
   |
LL |     let _x = foo.clone().unwrap();
   |                 ++++++++
help: consider annotating `Struct2` with `#[derive(Clone)]`
   |
---

10 LL |     for n in v {
11    |              ^ value used here after move
12    |
- note: `into_iter` takes ownership of the receiver `self`, which moves `v`
-   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    = note: `into_iter` takes ownership of the receiver `self`, which moves `v`
15 help: consider creating a fresh reborrow of `v` here
16    |
17 LL |     for n in &mut *v {


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/issue-83924.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/issue-83924.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/issue-83924" "-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[E0382]: use of moved value: `v`
##[error]  --> /checkout/tests/ui/borrowck/issue-83924.rs:15:14
   |
LL |     let v = &mut values;
   |         - move occurs because `v` has type `&mut Vec<i32>`, which does not implement the `Copy` trait
...
LL |     for n in v {
   |              - `v` moved due to this implicit call to `.into_iter()`
...
LL |     for n in v {
   |              ^ value used here after move
   |
   = note: `into_iter` takes ownership of the receiver `self`, which moves `v`
help: consider creating a fresh reborrow of `v` here
   |
LL |     for n in &mut *v {
   |              ++++++

error: aborting due to 1 previous error

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

10    |                    |
11    |                    value used here after move
12    |
- note: `into_iter` takes ownership of the receiver `self`, which moves `orig`
-   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    = note: `into_iter` takes ownership of the receiver `self`, which moves `orig`
15 help: consider iterating over a slice of the `Vec<bool>`'s content to avoid moving into the `for` loop
16    |
17 LL |     for _val in &orig {}


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/moved-value-in-closure-suggestion-64559.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/moved-value-in-closure-suggestion-64559.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/moved-value-in-closure-suggestion-64559" "-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[E0382]: use of moved value: `orig`
##[error]  --> /checkout/tests/ui/borrowck/moved-value-in-closure-suggestion-64559.rs:5:20
   |
LL |     let orig = vec![true];
   |         ---- move occurs because `orig` has type `Vec<bool>`, which does not implement the `Copy` trait
LL |     for _val in orig {}
   |                 ---- `orig` moved due to this implicit call to `.into_iter()`
LL |     let _closure = || orig;
   |                    ^^ ---- use occurs due to use in closure
   |                    |
   |                    value used here after move
   |
   = note: `into_iter` takes ownership of the receiver `self`, which moves `orig`
help: consider iterating over a slice of the `Vec<bool>`'s content to avoid moving into the `for` loop
   |
LL |     for _val in &orig {}
   |                 +

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0382`.
---
To only update this specific test, also pass `--test-args borrowck/reborrow-sugg-move-then-borrow.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/reborrow-sugg-move-then-borrow.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/reborrow-sugg-move-then-borrow" "-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[E0382]: borrow of moved value: `state`
##[error]  --> /checkout/tests/ui/borrowck/reborrow-sugg-move-then-borrow.rs:20:18
   |
---
---- [ui] tests/ui/borrowck/suggest-as-ref-on-mut-closure.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/borrowck/suggest-as-ref-on-mut-closure/suggest-as-ref-on-mut-closure.stderr`
diff of stderr:

7    |     help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents
8    |     move occurs because `*cb` has type `Option<&mut dyn FnMut()>`, which does not implement the `Copy` trait
9    |
- note: `Option::<T>::map` takes ownership of the receiver `self`, which moves `*cb`
-   --> $SRC_DIR/core/src/option.rs:LL:COL
+    = note: `Option::<T>::map` takes ownership of the receiver `self`, which moves `*cb`
12 help: you could `clone` the value and consume it, if the `&mut dyn FnMut(): Clone` trait bound could be satisfied
13    |
14 LL |     <Option<&mut dyn FnMut()> as Clone>::clone(&cb).map(|cb| cb());


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/suggest-as-ref-on-mut-closure.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/suggest-as-ref-on-mut-closure.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/suggest-as-ref-on-mut-closure" "-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[E0507]: cannot move out of `*cb` which is behind a mutable reference
##[error]  --> /checkout/tests/ui/borrowck/suggest-as-ref-on-mut-closure.rs:7:5
   |
LL |     cb.map(|cb| cb());
   |     ^^ -------------- `*cb` moved due to this method call
   |     |
   |     help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents
   |     move occurs because `*cb` has type `Option<&mut dyn FnMut()>`, which does not implement the `Copy` trait
   |
   = note: `Option::<T>::map` takes ownership of the receiver `self`, which moves `*cb`
help: you could `clone` the value and consume it, if the `&mut dyn FnMut(): Clone` trait bound could be satisfied
   |
LL |     <Option<&mut dyn FnMut()> as Clone>::clone(&cb).map(|cb| cb());
   |     ++++++++++++++++++++++++++++++++++++++++++++  +

error[E0596]: cannot borrow `*cb` as mutable, as it is behind a `&` reference
##[error]  --> /checkout/tests/ui/borrowck/suggest-as-ref-on-mut-closure.rs:12:26
   |
LL |     cb.as_ref().map(|cb| cb());
   |                          ^^ `cb` is a `&` reference, so it cannot be borrowed as mutable

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0507, E0596.
For more information about an error, try `rustc --explain E0507`.
---
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr`
diff of stderr:

15    |
16 LL | fn call<F>(f: F) where F : Fn() {
17    |                            ^^^^
- note: `into_iter` takes ownership of the receiver `self`, which moves `y`
-   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    = note: `into_iter` takes ownership of the receiver `self`, which moves `y`
20 help: you can `clone` the value and consume it, but this might not be your desired behavior
21    |
22 LL |         <Vec<String> as Clone>::clone(&y).into_iter();


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/unboxed-closures-move-upvar-from-non-once-ref-closure.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/unboxed-closures-move-upvar-from-non-once-ref-closure.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/unboxed-closures-move-upvar-from-non-once-ref-closure" "-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[E0507]: cannot move out of `y`, a captured variable in an `Fn` closure
##[error]  --> /checkout/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:12:9
   |
LL |     let y = vec![format!("World")];
   |         - captured outer variable
LL |     call(|| {
   |          -- captured by this `Fn` closure
LL |         y.into_iter();
   |         ^ ----------- `y` moved due to this method call
   |         |
   |         move occurs because `y` has type `Vec<String>`, which does not implement the `Copy` trait
   |
help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once
  --> /checkout/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:5:28
   |
LL | fn call<F>(f: F) where F : Fn() {
   |                            ^^^^
   = note: `into_iter` takes ownership of the receiver `self`, which moves `y`
help: you can `clone` the value and consume it, but this might not be your desired behavior
   |
LL |         <Vec<String> as Clone>::clone(&y).into_iter();
   |         +++++++++++++++++++++++++++++++ +
help: consider cloning the value if the performance cost is acceptable
   |
LL |         y.clone().into_iter();
   |          ++++++++

error: aborting due to 1 previous error

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

---- [ui] tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs stdout end ----
---- [ui] tests/ui/codemap_tests/tab_3.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/codemap_tests/tab_3/tab_3.stderr`
diff of stderr:

9 LL |         println!("{:?}", some_vec);
10    |                          ^^^^^^^^ value borrowed here after move
11    |
- note: `into_iter` takes ownership of the receiver `self`, which moves `some_vec`
-   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    = note: `into_iter` takes ownership of the receiver `self`, which moves `some_vec`
14    = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
15 help: you can `clone` the value and consume it, but this might not be your desired behavior
16    |


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 codemap_tests/tab_3.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/codemap_tests/tab_3.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/codemap_tests/tab_3" "-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[E0382]: borrow of moved value: `some_vec`
##[error]  --> /checkout/tests/ui/codemap_tests/tab_3.rs:7:20
   |
LL |     let some_vec = vec!["hi"];
   |         -------- move occurs because `some_vec` has type `Vec<&str>`, which does not implement the `Copy` trait
LL |     some_vec.into_iter();
   |              ----------- `some_vec` moved due to this method call
LL |     {
LL |         println!("{:?}", some_vec); //~ ERROR borrow of moved
   |                          ^^^^^^^^ value borrowed here after move
   |
   = note: `into_iter` takes ownership of the receiver `self`, which moves `some_vec`
   = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can `clone` the value and consume it, but this might not be your desired behavior
   |
LL |     some_vec.clone().into_iter();
   |             ++++++++

error: aborting due to 1 previous error
---
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/errors/remap-path-prefix-sysroot.without-remap/remap-path-prefix-sysroot.without-remap.stderr`
diff of stderr:

6    |         |
7    |         move occurs because `self.thread` has type `JoinHandle<()>`, which does not implement the `Copy` trait
8    |
- note: `JoinHandle::<T>::join` takes ownership of the receiver `self`, which moves `self.thread`
-   --> $SRC_DIR_REAL/std/src/thread/join_handle.rs:LL:COL
-    |
- LL |     pub fn join(self) -> Result<T> {
-    |                 ^^^^
+    = note: `JoinHandle::<T>::join` takes ownership of the receiver `self`, which moves `self.thread`
14 
15 error: aborting due to 1 previous error
16 


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 errors/remap-path-prefix-sysroot.rs`

error in revision `without-remap`: 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/errors/remap-path-prefix-sysroot.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" "--cfg" "without_remap" "--check-cfg" "cfg(test,FALSE,with_remap,without_remap)" "--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/errors/remap-path-prefix-sysroot.without-remap" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-g" "-Ztranslate-remapped-path-to-local-path=yes"
stdout: none
--- stderr -------------------------------
error[E0507]: cannot move out of `self.thread` which is behind a mutable reference
##[error]  --> /checkout/tests/ui/errors/remap-path-prefix-sysroot.rs:19:9
   |
LL |         self.thread.join().unwrap();
   |         ^^^^^^^^^^^ ------ `self.thread` moved due to this method call
   |         |
   |         move occurs because `self.thread` has type `JoinHandle<()>`, which does not implement the `Copy` trait
   |
   = note: `JoinHandle::<T>::join` takes ownership of the receiver `self`, which moves `self.thread`

error: aborting due to 1 previous error

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

---- [ui] tests/ui/errors/remap-path-prefix-sysroot.rs#without-remap stdout end ----
---- [ui] tests/ui/errors/remap-path-prefix-sysroot.rs#with-remap stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/errors/remap-path-prefix-sysroot.with-remap/remap-path-prefix-sysroot.with-remap.stderr`
diff of stderr:

6    |         |
7    |         move occurs because `self.thread` has type `JoinHandle<()>`, which does not implement the `Copy` trait
8    |
- note: `JoinHandle::<T>::join` takes ownership of the receiver `self`, which moves `self.thread`
-   --> remapped/library/std/src/thread/join_handle.rs:LL:COL
-    |
- LL |     pub fn join(self) -> Result<T> {
-    |                 ^^^^
+    = note: `JoinHandle::<T>::join` takes ownership of the receiver `self`, which moves `self.thread`
14 
15 error: aborting due to 1 previous error
16 


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 errors/remap-path-prefix-sysroot.rs`

error in revision `with-remap`: 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/errors/remap-path-prefix-sysroot.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" "--cfg" "with_remap" "--check-cfg" "cfg(test,FALSE,with_remap,without_remap)" "--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/errors/remap-path-prefix-sysroot.with-remap" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-g" "-Ztranslate-remapped-path-to-local-path=yes" "--remap-path-prefix=/checkout=remapped" "--remap-path-prefix=/checkout/tests/ui=remapped-tests-ui"
stdout: none
--- stderr -------------------------------
error[E0507]: cannot move out of `self.thread` which is behind a mutable reference
##[error]  --> remapped-tests-ui/errors/remap-path-prefix-sysroot.rs:19:9
   |
LL |         self.thread.join().unwrap();
   |         ^^^^^^^^^^^ ------ `self.thread` moved due to this method call
   |         |
   |         move occurs because `self.thread` has type `JoinHandle<()>`, which does not implement the `Copy` trait
   |
   = note: `JoinHandle::<T>::join` takes ownership of the receiver `self`, which moves `self.thread`

error: aborting due to 1 previous error

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

9 LL |     let z = x;
10    |             ^ value used here after move
11    |
- note: `into_iter` takes ownership of the receiver `self`, which moves `x`
-   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    = note: `into_iter` takes ownership of the receiver `self`, which moves `x`
14 help: consider iterating over a slice of the `Vec<S>`'s content to avoid moving into the `for` loop
15    |
16 LL |     for y in &x {


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 loops/issue-82916.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/loops/issue-82916.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/loops/issue-82916" "-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[E0382]: use of moved value: `x`
##[error]  --> /checkout/tests/ui/loops/issue-82916.rs:7:13
   |
LL | fn foo(x: Vec<S>) {
   |        - move occurs because `x` has type `Vec<S>`, which does not implement the `Copy` trait
LL |     for y in x {
   |              - `x` moved due to this implicit call to `.into_iter()`
...
LL |     let z = x; //~ ERROR use of moved value: `x`
   |             ^ value used here after move
   |
   = note: `into_iter` takes ownership of the receiver `self`, which moves `x`
help: consider iterating over a slice of the `Vec<S>`'s content to avoid moving into the `for` loop
   |
LL |     for y in &x {
   |              +

error: aborting due to 1 previous error

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

6 LL |     val.0;
7    |     ^^^^^ value used here after move
8    |
- note: `into_iter` takes ownership of the receiver `self`, which moves `val.0`
-   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    = note: `into_iter` takes ownership of the receiver `self`, which moves `val.0`
11    = note: move occurs because `val.0` has type `Vec<bool>`, which does not implement the `Copy` trait
12 help: you can `clone` the value and consume it, but this might not be your desired behavior
13    |

140 ...
141 LL |     foo_add + Foo;
142    |     ------- you could clone this value
- note: calling this operator moves the left-hand side
-   --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
+    = note: calling this operator moves the left-hand side
145 
146 error[E0382]: use of moved value: `implicit_into_iter`
147   --> $DIR/move-fn-self-receiver.rs:63:5


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 moves/move-fn-self-receiver.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/moves/move-fn-self-receiver.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/moves/move-fn-self-receiver" "-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[E0382]: use of moved value: `val.0`
##[error]  --> /checkout/tests/ui/moves/move-fn-self-receiver.rs:30:5
   |
LL |     val.0.into_iter().next();
   |           ----------- `val.0` moved due to this method call
LL |     val.0; //~ ERROR use of moved
   |     ^^^^^ value used here after move
   |
   = note: `into_iter` takes ownership of the receiver `self`, which moves `val.0`
   = note: move occurs because `val.0` has type `Vec<bool>`, which does not implement the `Copy` trait
help: you can `clone` the value and consume it, but this might not be your desired behavior
   |
LL |     val.0.clone().into_iter().next();
   |          ++++++++

error[E0382]: use of moved value: `foo`
---
   |         ---------- `foo` moved due to this method call
LL |     foo; //~ ERROR use of moved
   |     ^^^ value used here after move
   |
note: `Foo::use_self` takes ownership of the receiver `self`, which moves `foo`
  --> /checkout/tests/ui/moves/move-fn-self-receiver.rs:13:17
   |
LL |     fn use_self(self) {}
   |                 ^^^^

error[E0382]: use of moved value: `second_foo`
##[error]  --> /checkout/tests/ui/moves/move-fn-self-receiver.rs:38:5
   |
LL |     let second_foo = Foo;
   |         ---------- move occurs because `second_foo` has type `Foo`, which does not implement the `Copy` trait
LL |     second_foo.use_self();
   |                ---------- `second_foo` moved due to this method call
LL |     second_foo; //~ ERROR use of moved
   |     ^^^^^^^^^^ value used here after move

error[E0382]: use of moved value: `boxed_foo`
##[error]  --> /checkout/tests/ui/moves/move-fn-self-receiver.rs:42:5
   |
LL |     let boxed_foo = Box::new(Foo);
   |         --------- move occurs because `boxed_foo` has type `Box<Foo>`, which does not implement the `Copy` trait
LL |     boxed_foo.use_box_self();
   |               -------------- `boxed_foo` moved due to this method call
LL |     boxed_foo; //~ ERROR use of moved
   |     ^^^^^^^^^ value used here after move
   |
note: `Foo::use_box_self` takes ownership of the receiver `self`, which moves `boxed_foo`
  --> /checkout/tests/ui/moves/move-fn-self-receiver.rs:14:21
   |
LL |     fn use_box_self(self: Box<Self>) {}
   |                     ^^^^
help: you could `clone` the value and consume it, if the `Foo: Clone` trait bound could be satisfied
   |
LL |     boxed_foo.clone().use_box_self();
   |              ++++++++
help: consider annotating `Foo` with `#[derive(Clone)]`
   |
LL + #[derive(Clone)]
LL | struct Foo;
   |

error[E0382]: use of moved value: `pin_box_foo`
##[error]  --> /checkout/tests/ui/moves/move-fn-self-receiver.rs:46:5
   |
LL |     let pin_box_foo = Box::pin(Foo);
   |         ----------- move occurs because `pin_box_foo` has type `Pin<Box<Foo>>`, which does not implement the `Copy` trait
LL |     pin_box_foo.use_pin_box_self();
   |                 ------------------ `pin_box_foo` moved due to this method call
LL |     pin_box_foo; //~ ERROR use of moved
   |     ^^^^^^^^^^^ value used here after move
   |
note: `Foo::use_pin_box_self` takes ownership of the receiver `self`, which moves `pin_box_foo`
  --> /checkout/tests/ui/moves/move-fn-self-receiver.rs:15:25
   |
LL |     fn use_pin_box_self(self: Pin<Box<Self>>) {}
   |                         ^^^^
help: you could `clone` the value and consume it, if the `Foo: Clone` trait bound could be satisfied
   |
LL |     pin_box_foo.clone().use_pin_box_self();
   |                ++++++++
help: consider annotating `Foo` with `#[derive(Clone)]`
   |
LL + #[derive(Clone)]
LL | struct Foo;
   |

error[E0505]: cannot move out of `mut_foo` because it is borrowed
##[error]  --> /checkout/tests/ui/moves/move-fn-self-receiver.rs:50:5
   |
LL |     let mut mut_foo = Foo;
   |         ----------- binding `mut_foo` declared here
LL |     let ret = mut_foo.use_mut_self();
   |               ------- borrow of `mut_foo` occurs here
LL |     mut_foo; //~ ERROR cannot move out
   |     ^^^^^^^ move out of `mut_foo` occurs here
LL |     ret;
   |     --- borrow later used here

error[E0382]: use of moved value: `rc_foo`
##[error]  --> /checkout/tests/ui/moves/move-fn-self-receiver.rs:55:5
   |
LL |     let rc_foo = Rc::new(Foo);
   |         ------ move occurs because `rc_foo` has type `Rc<Foo>`, which does not implement the `Copy` trait
LL |     rc_foo.use_rc_self();
   |            ------------- `rc_foo` moved due to this method call
LL |     rc_foo; //~ ERROR use of moved
   |     ^^^^^^ value used here after move
   |
note: `Foo::use_rc_self` takes ownership of the receiver `self`, which moves `rc_foo`
  --> /checkout/tests/ui/moves/move-fn-self-receiver.rs:16:20
   |
LL |     fn use_rc_self(self: Rc<Self>) {}
   |                    ^^^^
help: you can `clone` the value and consume it, but this might not be your desired behavior
   |
LL |     rc_foo.clone().use_rc_self();
   |           ++++++++

error[E0382]: use of moved value: `foo_add`
##[error]  --> /checkout/tests/ui/moves/move-fn-self-receiver.rs:59:5
   |
LL |     let foo_add = Foo;
   |         ------- move occurs because `foo_add` has type `Foo`, which does not implement the `Copy` trait
LL |     foo_add + Foo;
   |     ------------- `foo_add` moved due to usage in operator
LL |     foo_add; //~ ERROR use of moved
   |     ^^^^^^^ value used here after move
   |
note: if `Foo` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/moves/move-fn-self-receiver.rs:5:1
   |
LL | struct Foo;
   | ^^^^^^^^^^ consider implementing `Clone` for this type
...
LL |     foo_add + Foo;
   |     ------- you could clone this value
   = note: calling this operator moves the left-hand side

error[E0382]: use of moved value: `implicit_into_iter`
##[error]  --> /checkout/tests/ui/moves/move-fn-self-receiver.rs:63:5
   |
LL |     let implicit_into_iter = vec![true];
   |         ------------------ move occurs because `implicit_into_iter` has type `Vec<bool>`, which does not implement the `Copy` trait
LL |     for _val in implicit_into_iter {}
   |                 ------------------ `implicit_into_iter` moved due to this implicit call to `.into_iter()`
LL |     implicit_into_iter; //~ ERROR use of moved
   |     ^^^^^^^^^^^^^^^^^^ value used here after move
   |
help: consider iterating over a slice of the `Vec<bool>`'s content to avoid moving into the `for` loop
   |
LL |     for _val in &implicit_into_iter {}
   |                 +

error[E0382]: use of moved value: `explicit_into_iter`
##[error]  --> /checkout/tests/ui/moves/move-fn-self-receiver.rs:67:5
   |
LL |     let explicit_into_iter = vec![true];
   |         ------------------ move occurs because `explicit_into_iter` has type `Vec<bool>`, which does not implement the `Copy` trait
LL |     for _val in explicit_into_iter.into_iter() {}
   |                                    ----------- `explicit_into_iter` moved due to this method call
LL |     explicit_into_iter; //~ ERROR use of moved
   |     ^^^^^^^^^^^^^^^^^^ value used here after move
   |
help: you can `clone` the value and consume it, but this might not be your desired behavior
   |
LL |     for _val in explicit_into_iter.clone().into_iter() {}
   |                                   ++++++++

error[E0382]: use of moved value: `container`
##[error]  --> /checkout/tests/ui/moves/move-fn-self-receiver.rs:71:5
   |
LL |     let container = Container(vec![]);
   |         --------- move occurs because `container` has type `Container`, which does not implement the `Copy` trait
LL |     for _val in container.custom_into_iter() {}
   |                           ------------------ `container` moved due to this method call
LL |     container; //~ ERROR use of moved
   |     ^^^^^^^^^ value used here after move
   |
note: `Container::custom_into_iter` takes ownership of the receiver `self`, which moves `container`
  --> /checkout/tests/ui/moves/move-fn-self-receiver.rs:23:25
   |
LL |     fn custom_into_iter(self) -> impl Iterator<Item = bool> {
---
LL |     let foo2 = Foo;
   |         ---- move occurs because `foo2` has type `Foo`, which does not implement the `Copy` trait
LL |     loop {
   |     ---- inside of this loop
LL |         foo2.use_self(); //~ ERROR use of moved
   |         ^^^^ ---------- `foo2` moved due to this method call, in previous iteration of loop

error: aborting due to 12 previous errors

Some errors have detailed explanations: E0382, E0505.
For more information about an error, try `rustc --explain E0382`.
------------------------------------------

---- [ui] tests/ui/moves/move-fn-self-receiver.rs stdout end ----
---- [ui] tests/ui/moves/moves-based-on-type-access-to-field.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/moves/moves-based-on-type-access-to-field/moves-based-on-type-access-to-field.stderr`
diff of stderr:

8 LL |     touch(&x[0]);
9    |            ^ value borrowed here after move
10    |
- note: `into_iter` takes ownership of the receiver `self`, which moves `x`
-   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    = note: `into_iter` takes ownership of the receiver `self`, which moves `x`
13 help: you can `clone` the value and consume it, but this might not be your desired behavior
14    |
15 LL |     consume(x.clone().into_iter().next().unwrap());


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 moves/moves-based-on-type-access-to-field.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/moves/moves-based-on-type-access-to-field.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/moves/moves-based-on-type-access-to-field" "-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[E0382]: borrow of moved value: `x`
##[error]  --> /checkout/tests/ui/moves/moves-based-on-type-access-to-field.rs:11:12
   |
LL |     let x = vec!["hi".to_string()];
   |         - move occurs because `x` has type `Vec<String>`, which does not implement the `Copy` trait
LL |     consume(x.into_iter().next().unwrap());
   |               ----------- `x` moved due to this method call
LL |     touch(&x[0]); //~ ERROR borrow of moved value: `x`
   |            ^ value borrowed here after move
   |
   = note: `into_iter` takes ownership of the receiver `self`, which moves `x`
help: you can `clone` the value and consume it, but this might not be your desired behavior
   |
LL |     consume(x.clone().into_iter().next().unwrap());
   |              ++++++++

error: aborting due to 1 previous error

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

---- [ui] tests/ui/moves/moves-based-on-type-access-to-field.rs stdout end ----
---- [ui] tests/ui/moves/moves-based-on-type-exprs.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/moves/moves-based-on-type-exprs/moves-based-on-type-exprs.stderr`
diff of stderr:

160 LL |     touch(&x);
161    |           ^^ value borrowed here after move
162    |
- note: `into_iter` takes ownership of the receiver `self`, which moves `x`
-   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    = note: `into_iter` takes ownership of the receiver `self`, which moves `x`
165 help: you can `clone` the value and consume it, but this might not be your desired behavior
166    |
167 LL |     let _y = x.clone().into_iter().next().unwrap();

177 LL |     touch(&x);
178    |           ^^ value borrowed here after move
179    |
- note: `into_iter` takes ownership of the receiver `self`, which moves `x`
-   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    = note: `into_iter` takes ownership of the receiver `self`, which moves `x`
182 help: you can `clone` the value and consume it, but this might not be your desired behavior
183    |
184 LL |     let _y = [x.clone().into_iter().next().unwrap(); 1];


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 moves/moves-based-on-type-exprs.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/moves/moves-based-on-type-exprs.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/moves/moves-based-on-type-exprs" "-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[E0382]: borrow of moved value: `x`
##[error]  --> /checkout/tests/ui/moves/moves-based-on-type-exprs.rs:12:11
   |
LL |     let x = "hi".to_string();
   |         - move occurs because `x` has type `String`, which does not implement the `Copy` trait
LL |     let _y = Foo { f:x };
   |                      - value moved here
LL |     touch(&x); //~ ERROR borrow of moved value: `x`
   |           ^^ value borrowed here after move
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL |     let _y = Foo { f:x.clone() };
   |                       ++++++++

error[E0382]: borrow of moved value: `x`
##[error]  --> /checkout/tests/ui/moves/moves-based-on-type-exprs.rs:18:11
   |
LL |     let x = "hi".to_string();
   |         - move occurs because `x` has type `String`, which does not implement the `Copy` trait
LL |     let _y = (x, 3);
   |               - value moved here
LL |     touch(&x); //~ ERROR borrow of moved value: `x`
   |           ^^ value borrowed here after move
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL |     let _y = (x.clone(), 3);
   |                ++++++++

error[E0382]: borrow of moved value: `x`
##[error]  --> /checkout/tests/ui/moves/moves-based-on-type-exprs.rs:35:11
   |
LL |     let x = "hi".to_string();
   |         - move occurs because `x` has type `String`, which does not implement the `Copy` trait
...
LL |         x
   |         - value moved here
...
LL |     touch(&x); //~ ERROR borrow of moved value: `x`
   |           ^^ value borrowed here after move
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL |         x.clone()
   |          ++++++++

error[E0382]: borrow of moved value: `y`
##[error]  --> /checkout/tests/ui/moves/moves-based-on-type-exprs.rs:36:11
   |
LL |     let y = "ho".to_string();
   |         - move occurs because `y` has type `String`, which does not implement the `Copy` trait
...
LL |         y
   |         - value moved here
...
LL |     touch(&y); //~ ERROR borrow of moved value: `y`
   |           ^^ value borrowed here after move
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL |         y.clone()
   |          ++++++++

error[E0382]: borrow of moved value: `x`
##[error]  --> /checkout/tests/ui/moves/moves-based-on-type-exprs.rs:46:11
   |
LL |     let x = "hi".to_string();
   |         - move occurs because `x` has type `String`, which does not implement the `Copy` trait
...
LL |         true => x,
   |                 - value moved here
...
LL |     touch(&x); //~ ERROR borrow of moved value: `x`
   |           ^^ value borrowed here after move
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL |         true => x.clone(),
   |                  ++++++++

error[E0382]: borrow of moved value: `y`
##[error]  --> /checkout/tests/ui/moves/moves-based-on-type-exprs.rs:47:11
   |
LL |     let y = "ho".to_string();
   |         - move occurs because `y` has type `String`, which does not implement the `Copy` trait
...
LL |         false => y
   |                  - value moved here
...
LL |     touch(&y); //~ ERROR borrow of moved value: `y`
   |           ^^ value borrowed here after move
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL |         false => y.clone()
   |                   ++++++++

error[E0382]: borrow of moved value: `x`
##[error]  --> /checkout/tests/ui/moves/moves-based-on-type-exprs.rs:58:11
   |
LL |     let x = "hi".to_string();
   |         - move occurs because `x` has type `String`, which does not implement the `Copy` trait
...
LL |         _ if guard(x) => 10,
   |                    - value moved here
...
LL |     touch(&x); //~ ERROR borrow of moved value: `x`
   |           ^^ value borrowed here after move
   |
note: consider changing this parameter type in function `guard` to borrow instead if owning the value isn't necessary
  --> /checkout/tests/ui/moves/moves-based-on-type-exprs.rs:6:14
   |
LL | fn guard(_s: String) -> bool {panic!()}
   |    -----     ^^^^^^ this parameter takes ownership of the value
   |    |
   |    in this function
help: consider cloning the value if the performance cost is acceptable
   |
LL |         _ if guard(x.clone()) => 10,
   |                     ++++++++

error[E0382]: borrow of moved value: `x`
##[error]  --> /checkout/tests/ui/moves/moves-based-on-type-exprs.rs:65:11
   |
LL |     let x = "hi".to_string();
   |         - move occurs because `x` has type `String`, which does not implement the `Copy` trait
LL |     let _y = [x];
   |               - value moved here
LL |     touch(&x); //~ ERROR borrow of moved value: `x`
   |           ^^ value borrowed here after move
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL |     let _y = [x.clone()];
   |                ++++++++

error[E0382]: borrow of moved value: `x`
##[error]  --> /checkout/tests/ui/moves/moves-based-on-type-exprs.rs:71:11
   |
LL |     let x = "hi".to_string();
   |         - move occurs because `x` has type `String`, which does not implement the `Copy` trait
LL |     let _y = vec![x];
   |                   - value moved here
LL |     touch(&x); //~ ERROR borrow of moved value: `x`
   |           ^^ value borrowed here after move
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL |     let _y = vec![x.clone()];
   |                    ++++++++

error[E0382]: borrow of moved value: `x`
##[error]  --> /checkout/tests/ui/moves/moves-based-on-type-exprs.rs:77:11
   |
LL |     let x = vec!["hi".to_string()];
   |         - move occurs because `x` has type `Vec<String>`, which does not implement the `Copy` trait
LL |     let _y = x.into_iter().next().unwrap();
   |                ----------- `x` moved due to this method call
LL |     touch(&x); //~ ERROR borrow of moved value: `x`
   |           ^^ value borrowed here after move
   |
   = note: `into_iter` takes ownership of the receiver `self`, which moves `x`
help: you can `clone` the value and consume it, but this might not be your desired behavior
   |
LL |     let _y = x.clone().into_iter().next().unwrap();
   |               ++++++++

error[E0382]: borrow of moved value: `x`
##[error]  --> /checkout/tests/ui/moves/moves-based-on-type-exprs.rs:83:11
   |
LL |     let x = vec!["hi".to_string()];
   |         - move occurs because `x` has type `Vec<String>`, which does not implement the `Copy` trait
LL |     let _y = [x.into_iter().next().unwrap(); 1];
   |                 ----------- `x` moved due to this method call
LL |     touch(&x); //~ ERROR borrow of moved value: `x`
   |           ^^ value borrowed here after move
   |
   = note: `into_iter` takes ownership of the receiver `self`, which moves `x`
help: you can `clone` the value and consume it, but this might not be your desired behavior
   |
LL |     let _y = [x.clone().into_iter().next().unwrap(); 1];
   |                ++++++++

error: aborting due to 11 previous errors

For more information about this error, try `rustc --explain E0382`.
---
To only update this specific test, also pass `--test-args moves/needs-clone-through-deref.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/moves/needs-clone-through-deref.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/moves/needs-clone-through-deref" "-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[E0507]: cannot move out of dereference of `S`
##[error]  --> /checkout/tests/ui/moves/needs-clone-through-deref.rs:15:18
   |
LL |         for _ in self.clone().into_iter() {} //~ ERROR cannot move out of dereference of `S`
   |                  ^^^^^^^^^^^^ ----------- value moved due to this method call
   |                  |
   |                  move occurs because value has type `Vec<usize>`, which does not implement the `Copy` trait
   |
   = note: `into_iter` takes ownership of the receiver `self`, which moves value
help: you can `clone` the value and consume it, but this might not be your desired behavior
   |
LL -         for _ in self.clone().into_iter() {} //~ ERROR cannot move out of dereference of `S`
LL +         for _ in <Vec<usize> as Clone>::clone(&self).into_iter() {} //~ ERROR cannot move out of dereference of `S`
   |

error: aborting due to 1 previous error

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

8 LL |     foo(r.get_mut());
9    |         ^ value used here after move
10    |
- note: `Pin::<&'a mut T>::get_mut` takes ownership of the receiver `self`, which moves `r`
-   --> $SRC_DIR/core/src/pin.rs:LL:COL
+    = note: `Pin::<&'a mut T>::get_mut` takes ownership of the receiver `self`, which moves `r`
13 help: consider reborrowing the `Pin` instead of moving it
14    |
15 LL |     foo(r.as_mut().get_mut());


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 moves/pin-mut-reborrow-infer-var-issue-107419.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/moves/pin-mut-reborrow-infer-var-issue-107419.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/moves/pin-mut-reborrow-infer-var-issue-107419" "-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[E0382]: use of moved value: `r`
##[error]  --> /checkout/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.rs:10:9
   |
LL |     let mut r = Pin::new(&mut uwu);
   |         ----- move occurs because `r` has type `Pin<&mut ()>`, which does not implement the `Copy` trait
LL |     foo(r.get_mut());
   |           --------- `r` moved due to this method call
LL |     foo(r.get_mut()); //~ ERROR use of moved value
   |         ^ value used here after move
   |
   = note: `Pin::<&'a mut T>::get_mut` takes ownership of the receiver `self`, which moves `r`
help: consider reborrowing the `Pin` instead of moving it
   |
LL |     foo(r.as_mut().get_mut());
   |          +++++++++

error: aborting due to 1 previous error
---
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/moves/suggest-clone-when-some-obligation-is-unmet/suggest-clone-when-some-obligation-is-unmet.stderr`
diff of stderr:

6    |                            |
7    |                            move occurs because value has type `HashMap<T, U, Hash128_1>`, which does not implement the `Copy` trait
8    |
- note: `HashMap::<K, V, S, A>::into_values` takes ownership of the receiver `self`, which moves value
-   --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
+    = note: `HashMap::<K, V, S, A>::into_values` takes ownership of the receiver `self`, which moves value
11 note: if `Hash128_1` implemented `Clone`, you could clone the value
12   --> $DIR/suggest-clone-when-some-obligation-is-unmet.rs:8:1
13    |


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 moves/suggest-clone-when-some-obligation-is-unmet.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/moves/suggest-clone-when-some-obligation-is-unmet.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/moves/suggest-clone-when-some-obligation-is-unmet" "-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[E0507]: cannot move out of a shared reference
##[error]  --> /checkout/tests/ui/moves/suggest-clone-when-some-obligation-is-unmet.rs:20:28
   |
LL |     let mut copy: Vec<U> = map.clone().into_values().collect(); //~ ERROR
   |                            ^^^^^^^^^^^ ------------- value moved due to this method call
   |                            |
   |                            move occurs because value has type `HashMap<T, U, Hash128_1>`, which does not implement the `Copy` trait
   |
   = note: `HashMap::<K, V, S, A>::into_values` takes ownership of the receiver `self`, which moves value
note: if `Hash128_1` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/moves/suggest-clone-when-some-obligation-is-unmet.rs:8:1
   |
LL | pub struct Hash128_1;
   | ^^^^^^^^^^^^^^^^^^^^ consider implementing `Clone` for this type
...
LL |     let mut copy: Vec<U> = map.clone().into_values().collect(); //~ ERROR
   |                            ----------- you could clone this value
help: you could `clone` the value and consume it, if the `Hash128_1: Clone` trait bound could be satisfied
   |
LL -     let mut copy: Vec<U> = map.clone().into_values().collect(); //~ ERROR
LL +     let mut copy: Vec<U> = <HashMap<T, U, Hash128_1> as Clone>::clone(&map).into_values().collect(); //~ ERROR
   |
help: consider annotating `Hash128_1` with `#[derive(Clone)]`
   |
LL + #[derive(Clone)]
LL | pub struct Hash128_1;
---
---- [ui] tests/ui/proc-macro/meta-macro-hygiene.rs stdout ----
Saved the actual stdout to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/proc-macro/meta-macro-hygiene/meta-macro-hygiene.stdout`
diff of stdout:

- Def site: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4)
+ Def site: no-location (#4)
2 Input: TokenStream [Ident { ident: "$crate", span: $DIR/meta-macro-hygiene.rs:26:37: 26:43 (#3) }, Punct { ch: ':', spacing: Joint, span: $DIR/meta-macro-hygiene.rs:26:43: 26:44 (#3) }, Punct { ch: ':', spacing: Alone, span: $DIR/meta-macro-hygiene.rs:26:44: 26:45 (#3) }, Ident { ident: "dummy", span: $DIR/meta-macro-hygiene.rs:26:45: 26:50 (#3) }, Punct { ch: '!', spacing: Alone, span: $DIR/meta-macro-hygiene.rs:26:50: 26:51 (#3) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: $DIR/meta-macro-hygiene.rs:26:51: 26:53 (#3) }]
- Respanned: TokenStream [Ident { ident: "$crate", span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4) }, Punct { ch: ':', spacing: Joint, span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4) }, Punct { ch: ':', spacing: Alone, span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4) }, Ident { ident: "dummy", span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4) }, Punct { ch: '!', spacing: Alone, span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4) }]
+ Respanned: TokenStream [Ident { ident: "$crate", span: no-location (#4) }, Punct { ch: ':', spacing: Joint, span: no-location (#4) }, Punct { ch: ':', spacing: Alone, span: no-location (#4) }, Ident { ident: "dummy", span: no-location (#4) }, Punct { ch: '!', spacing: Alone, span: no-location (#4) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: no-location (#4) }]
4 #![feature /* 0#0 */(prelude_import)]
5 //@ aux-build:make-macro.rs
6 //@ proc-macro: meta-macro.rs


The actual stdout differed from the expected stdout
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args proc-macro/meta-macro-hygiene.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
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/proc-macro/meta-macro-hygiene.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/proc-macro/meta-macro-hygiene" "-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" "-L" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/proc-macro/meta-macro-hygiene/auxiliary" "--edition=2018" "-Z" "span-debug" "-Z" "macro-backtrace" "-Z" "unpretty=expanded,hygiene" "-Z" "trim-diagnostic-paths=no" "--extern" "meta_macro=/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/proc-macro/meta-macro-hygiene/auxiliary/libmeta_macro.so"
--- stdout -------------------------------
Def site: no-location (#4)
Input: TokenStream [Ident { ident: "$crate", span: /checkout/tests/ui/proc-macro/meta-macro-hygiene.rs:26:37: 26:43 (#3) }, Punct { ch: ':', spacing: Joint, span: /checkout/tests/ui/proc-macro/meta-macro-hygiene.rs:26:43: 26:44 (#3) }, Punct { ch: ':', spacing: Alone, span: /checkout/tests/ui/proc-macro/meta-macro-hygiene.rs:26:44: 26:45 (#3) }, Ident { ident: "dummy", span: /checkout/tests/ui/proc-macro/meta-macro-hygiene.rs:26:45: 26:50 (#3) }, Punct { ch: '!', spacing: Alone, span: /checkout/tests/ui/proc-macro/meta-macro-hygiene.rs:26:50: 26:51 (#3) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: /checkout/tests/ui/proc-macro/meta-macro-hygiene.rs:26:51: 26:53 (#3) }]
Respanned: TokenStream [Ident { ident: "$crate", span: no-location (#4) }, Punct { ch: ':', spacing: Joint, span: no-location (#4) }, Punct { ch: ':', spacing: Alone, span: no-location (#4) }, Ident { ident: "dummy", span: no-location (#4) }, Punct { ch: '!', spacing: Alone, span: no-location (#4) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: no-location (#4) }]
#![feature /* 971#0 */(prelude_import)]
//@ aux-build:make-macro.rs
//@ proc-macro: meta-macro.rs
//@ edition:2018
//@ compile-flags: -Z span-debug -Z macro-backtrace -Z unpretty=expanded,hygiene -Z trim-diagnostic-paths=no
//@ check-pass
// ignore-tidy-linelength
//@ normalize-stdout: "\d+#" -> "0#"
//@ normalize-stdout: "expn\d{3,}" -> "expnNNN"
//@ normalize-stdout: "extern crate compiler_builtins /\* \d+ \*/" -> "extern crate compiler_builtins /* NNN */"
//
// We don't care about symbol ids, so we set them all to 0
// in the stdout

#![no_std /* 1484#0 */]
extern crate core /* 705#1 */;
#[prelude_import /* 1656#1 */]
use core /* 705#1 */::prelude /* 1655#1 */::rust_2018 /* 1805#1 */::*;
// Don't load unnecessary hygiene information from std
extern crate std /* 2092#0 */;

extern crate meta_macro /* 2999#0 */;

macro_rules! produce_it
    /*
    3000#0
    */ {
    () =>
    {
        meta_macro::print_def_site!($crate::dummy!());
        // `print_def_site!` will respan the `$crate` identifier
        // with `Span::def_site()`. This should cause it to resolve
        // relative to `meta_macro`, *not* `make_macro` (despite
        // the fact that `print_def_site` is produced by a
        // `macro_rules!` macro in `make_macro`).
    };
}

fn main /* 1303#0 */() { ; }

/*
Expansions:
crate0::{{expn0}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Root
crate0::{{expn1}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: AstPass(StdImports)
crate0::{{expn2}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "produce_it")
crate0::{{expn3}}: parent: crate0::{{expn2}}, call_site_ctxt: #3, def_site_ctxt: #0, kind: Macro(Bang, "meta_macro::print_def_site")
crate0::{{expn4}}: parent: crate0::{{expn3}}, call_site_ctxt: #4, def_site_ctxt: #0, kind: Macro(Bang, "$crate::dummy")

SyntaxContexts:
#0: parent: #0, outer_mark: (crate0::{{expn0}}, Opaque)
#1: parent: #0, outer_mark: (crate0::{{expn1}}, Opaque)
#2: parent: #0, outer_mark: (crate0::{{expn1}}, Transparent)
#3: parent: #0, outer_mark: (crate0::{{expn2}}, SemiOpaque)
#4: parent: #0, outer_mark: (crate0::{{expn3}}, Opaque)
#5: parent: #3, outer_mark: (crate0::{{expn3}}, Transparent)
#6: parent: #0, outer_mark: (crate0::{{expn3}}, SemiOpaque)
#7: parent: #0, outer_mark: (crate0::{{expn4}}, Opaque)
#8: parent: #4, outer_mark: (crate0::{{expn4}}, Transparent)
#9: parent: #4, outer_mark: (crate0::{{expn4}}, SemiOpaque)
*/
------------------------------------------
stderr: none

---- [ui] tests/ui/proc-macro/meta-macro-hygiene.rs stdout end ----
---
To only update this specific test, also pass `--test-args proc-macro/meta-macro.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
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/proc-macro/meta-macro.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)" "-O" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/proc-macro/meta-macro/a" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/proc-macro/meta-macro/auxiliary" "--edition=2018" "-Z" "span-debug" "--extern" "meta_macro=/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/proc-macro/meta-macro/auxiliary/libmeta_macro.so"
--- stdout -------------------------------
Def site: no-location (#3)
Input: TokenStream []
Respanned: TokenStream []
------------------------------------------
stderr: none

---- [ui] tests/ui/proc-macro/meta-macro.rs stdout end ----
---- [ui] tests/ui/suggestions/as-ref-2.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/suggestions/as-ref-2/as-ref-2.stderr`
diff of stderr:

10 LL |     let _y = foo;
11    |              ^^^ value used here after move
12    |
- note: `Option::<T>::map` takes ownership of the receiver `self`, which moves `foo`
-   --> $SRC_DIR/core/src/option.rs:LL:COL
+    = note: `Option::<T>::map` takes ownership of the receiver `self`, which moves `foo`
15 help: you could `clone` the value and consume it, if the `Struct: Clone` trait bound could be satisfied
16    |
17 LL |     let _x: Option<Struct> = foo.clone().map(|s| bar(&s));


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 suggestions/as-ref-2.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/suggestions/as-ref-2.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/suggestions/as-ref-2" "-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[E0382]: use of moved value: `foo`
##[error]  --> /checkout/tests/ui/suggestions/as-ref-2.rs:10:14
   |
LL |     let foo = Some(Struct);
   |         --- move occurs because `foo` has type `Option<Struct>`, which does not implement the `Copy` trait
LL |     let _x: Option<Struct> = foo.map(|s| bar(&s));
   |                              --- ---------------- `foo` moved due to this method call
   |                              |
   |                              help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents
LL |     let _y = foo; //~ERROR use of moved value: `foo`
   |              ^^^ value used here after move
   |
   = note: `Option::<T>::map` takes ownership of the receiver `self`, which moves `foo`
help: you could `clone` the value and consume it, if the `Struct: Clone` trait bound could be satisfied
   |
LL |     let _x: Option<Struct> = foo.clone().map(|s| bar(&s));
   |                                 ++++++++
help: consider annotating `Struct` with `#[derive(Clone)]`
   |
LL + #[derive(Clone)]
LL | struct Struct;
---
---- [ui] tests/ui/suggestions/borrow-for-loop-head.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/suggestions/borrow-for-loop-head/borrow-for-loop-head.stderr`
diff of stderr:

23 LL |         for j in a {
24    |                  ^ `a` moved due to this implicit call to `.into_iter()`, in previous iteration of loop
25    |
- note: `into_iter` takes ownership of the receiver `self`, which moves `a`
-   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    = note: `into_iter` takes ownership of the receiver `self`, which moves `a`
28 help: consider iterating over a slice of the `Vec<i32>`'s content to avoid moving into the `for` loop
29    |
30 LL |         for j in &a {


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 suggestions/borrow-for-loop-head.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/suggestions/borrow-for-loop-head.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/suggestions/borrow-for-loop-head" "-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[E0505]: cannot move out of `a` because it is borrowed
##[error]  --> /checkout/tests/ui/suggestions/borrow-for-loop-head.rs:4:18
   |
---
   |                  ^ move out of `a` occurs here
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL |     for i in &a.clone() {
   |                ++++++++

error[E0382]: use of moved value: `a`
##[error]  --> /checkout/tests/ui/suggestions/borrow-for-loop-head.rs:4:18
   |
LL |     let a = vec![1, 2, 3];
   |         - move occurs because `a` has type `Vec<i32>`, which does not implement the `Copy` trait
LL |     for i in &a {
   |     ----------- inside of this loop
LL |         for j in a {
   |                  ^ `a` moved due to this implicit call to `.into_iter()`, in previous iteration of loop
   |
   = note: `into_iter` takes ownership of the receiver `self`, which moves `a`
help: consider iterating over a slice of the `Vec<i32>`'s content to avoid moving into the `for` loop
   |
LL |         for j in &a {
   |                  +

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0382, E0505.
---
---- [ui] tests/ui/suggestions/for-i-in-vec.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/suggestions/for-i-in-vec/for-i-in-vec.stderr`
diff of stderr:

7    |                  `self.v` moved due to this implicit call to `.into_iter()`
8    |                  move occurs because `self.v` has type `Vec<u32>`, which does not implement the `Copy` trait
9    |
- note: `into_iter` takes ownership of the receiver `self`, which moves `self.v`
-   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    = note: `into_iter` takes ownership of the receiver `self`, which moves `self.v`
12 help: consider iterating over a slice of the `Vec<u32>`'s content to avoid moving into the `for` loop
13    |
14 LL |         for _ in &self.v {

45    |                   value moved due to this implicit call to `.into_iter()`
46    |                   move occurs because value has type `Vec<&u8>`, which does not implement the `Copy` trait
47    |
- note: `into_iter` takes ownership of the receiver `self`, which moves value
-   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    = note: `into_iter` takes ownership of the receiver `self`, which moves value
50 help: consider iterating over a slice of the `Vec<&u8>`'s content to avoid moving into the `for` loop
51    |
52 LL |     for loader in &*LOADERS {


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 suggestions/for-i-in-vec.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/suggestions/for-i-in-vec.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/suggestions/for-i-in-vec" "-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[E0507]: cannot move out of `self.v` which is behind a shared reference
##[error]  --> /checkout/tests/ui/suggestions/for-i-in-vec.rs:11:18
   |
LL |         for _ in self.v { //~ ERROR cannot move out of `self.v` which is behind a shared reference
   |                  ^^^^^^
   |                  |
   |                  `self.v` moved due to this implicit call to `.into_iter()`
   |                  move occurs because `self.v` has type `Vec<u32>`, which does not implement the `Copy` trait
   |
   = note: `into_iter` takes ownership of the receiver `self`, which moves `self.v`
help: consider iterating over a slice of the `Vec<u32>`'s content to avoid moving into the `for` loop
   |
LL |         for _ in &self.v { //~ ERROR cannot move out of `self.v` which is behind a shared reference
   |                  +
help: consider cloning the value if the performance cost is acceptable
   |
LL |         for _ in self.v.clone() { //~ ERROR cannot move out of `self.v` which is behind a shared reference
   |                        ++++++++

error[E0507]: cannot move out of `self.h` which is behind a shared reference
##[error]  --> /checkout/tests/ui/suggestions/for-i-in-vec.rs:13:18
   |
LL |         for _ in self.h { //~ ERROR cannot move out of `self.h` which is behind a shared reference
   |                  ^^^^^^
   |                  |
   |                  `self.h` moved due to this implicit call to `.into_iter()`
   |                  move occurs because `self.h` has type `HashMap<i32, i32>`, which does not implement the `Copy` trait
   |
help: consider iterating over a slice of the `HashMap<i32, i32>`'s content to avoid moving into the `for` loop
   |
LL |         for _ in &self.h { //~ ERROR cannot move out of `self.h` which is behind a shared reference
   |                  +
help: consider cloning the value if the performance cost is acceptable
   |
LL |         for _ in self.h.clone() { //~ ERROR cannot move out of `self.h` which is behind a shared reference
   |                        ++++++++

error[E0507]: cannot move out of a shared reference
##[error]  --> /checkout/tests/ui/suggestions/for-i-in-vec.rs:21:19
   |
LL |     for loader in *LOADERS { //~ ERROR cannot move out of a shared reference
   |                   ^^^^^^^^
   |                   |
   |                   value moved due to this implicit call to `.into_iter()`
   |                   move occurs because value has type `Vec<&u8>`, which does not implement the `Copy` trait
   |
   = note: `into_iter` takes ownership of the receiver `self`, which moves value
help: consider iterating over a slice of the `Vec<&u8>`'s content to avoid moving into the `for` loop
   |
LL |     for loader in &*LOADERS { //~ ERROR cannot move out of a shared reference
   |                   +
help: consider cloning the value if the performance cost is acceptable
   |
LL -     for loader in *LOADERS { //~ ERROR cannot move out of a shared reference
LL +     for loader in LOADERS.clone() { //~ ERROR cannot move out of a shared reference
   |

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0507`.
---
diff of stderr:

28    |         ^^^^ value borrowed here after move
29    |
30    = note: a for loop advances the iterator for you, the result is stored in `_i`
- note: `into_iter` takes ownership of the receiver `self`, which moves `iter`
-   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    = note: `into_iter` takes ownership of the receiver `self`, which moves `iter`
33 help: if you want to call `next` on a iterator within the loop, consider using `while let`
34    |
35 LL -     for _i in iter {

66    |         ^^^^ value borrowed here after move
67    |
68    = note: a for loop advances the iterator for you, the result is stored in its pattern
- note: `into_iter` takes ownership of the receiver `self`, which moves `iter`
-   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    = note: `into_iter` takes ownership of the receiver `self`, which moves `iter`
71 help: if you want to call `next` on a iterator within the loop, consider using `while let`
72    |
73 LL -     for () in iter {


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 suggestions/issue-102972.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/suggestions/issue-102972.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/suggestions/issue-102972" "-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[E0499]: cannot borrow `chars` as mutable more than once at a time
##[error]  --> /checkout/tests/ui/suggestions/issue-102972.rs:6:9
   |
LL |     for _c in chars.by_ref() {
   |               --------------
   |               |
   |               first mutable borrow occurs here
   |               first borrow later used here
LL |         chars.next(); //~ ERROR cannot borrow `chars` as mutable more than once at a time
   |         ^^^^^ second mutable borrow occurs here
   |
   = note: a for loop advances the iterator for you, the result is stored in `_c`
help: if you want to call `next` on a iterator within the loop, consider using `while let`
   |
LL ~     let iter = chars.by_ref();
LL ~     while let Some(_c) = iter.next() {
LL ~         iter.next(); //~ ERROR cannot borrow `chars` as mutable more than once at a time
   |

error[E0382]: borrow of moved value: `iter`
##[error]  --> /checkout/tests/ui/suggestions/issue-102972.rs:14:9
   |
LL |     let mut iter = v.iter();
   |         -------- move occurs because `iter` has type `std::slice::Iter<'_, i32>`, which does not implement the `Copy` trait
LL |     for _i in iter {
   |               ---- `iter` moved due to this implicit call to `.into_iter()`
LL |         iter.next(); //~ ERROR borrow of moved value: `iter`
   |         ^^^^ value borrowed here after move
   |
   = note: a for loop advances the iterator for you, the result is stored in `_i`
   = note: `into_iter` takes ownership of the receiver `self`, which moves `iter`
help: if you want to call `next` on a iterator within the loop, consider using `while let`
   |
LL -     for _i in iter {
LL +     while let Some(_i) = iter.next() {
   |

error[E0499]: cannot borrow `i` as mutable more than once at a time
##[error]  --> /checkout/tests/ui/suggestions/issue-102972.rs:22:9
   |
LL |     for () in i.by_ref() {
   |               ----------
   |               |
   |               first mutable borrow occurs here
   |               first borrow later used here
LL |         i.next(); //~ ERROR cannot borrow `i`
   |         ^ second mutable borrow occurs here
   |
   = note: a for loop advances the iterator for you, the result is stored in its pattern
help: if you want to call `next` on a iterator within the loop, consider using `while let`
   |
LL ~     let iter = i.by_ref();
LL ~     while let Some(()) = iter.next() {
LL ~         iter.next(); //~ ERROR cannot borrow `i`
   |

error[E0382]: borrow of moved value: `iter`
##[error]  --> /checkout/tests/ui/suggestions/issue-102972.rs:30:9
   |
LL |     let mut iter = v.iter();
   |         -------- move occurs because `iter` has type `std::slice::Iter<'_, ()>`, which does not implement the `Copy` trait
LL |     for () in iter {
   |               ---- `iter` moved due to this implicit call to `.into_iter()`
LL |         iter.next(); //~ ERROR borrow of moved value: `iter`
   |         ^^^^ value borrowed here after move
   |
   = note: a for loop advances the iterator for you, the result is stored in its pattern
   = note: `into_iter` takes ownership of the receiver `self`, which moves `iter`
help: if you want to call `next` on a iterator within the loop, consider using `while let`
   |
LL -     for () in iter {
LL +     while let Some(()) = iter.next() {
   |

---
---- [ui] tests/ui/suggestions/option-content-move.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/suggestions/option-content-move/option-content-move.stderr`
diff of stderr:

7    |                    help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents
8    |                    move occurs because `selection.1` has type `Option<String>`, which does not implement the `Copy` trait
9    |
- note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `selection.1`
-   --> $SRC_DIR/core/src/option.rs:LL:COL
+    = note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `selection.1`
12 help: you can `clone` the value and consume it, but this might not be your desired behavior
13    |
14 LL |                 if <Option<String> as Clone>::clone(&selection.1).unwrap().contains(selection.0) {

27    |                    help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents
28    |                    move occurs because `selection.1` has type `Result<String, String>`, which does not implement the `Copy` trait
29    |
- note: `Result::<T, E>::unwrap` takes ownership of the receiver `self`, which moves `selection.1`
-   --> $SRC_DIR/core/src/result.rs:LL:COL
+    = note: `Result::<T, E>::unwrap` takes ownership of the receiver `self`, which moves `selection.1`
32 help: you can `clone` the value and consume it, but this might not be your desired behavior
33    |
34 LL |                 if <Result<String, String> as Clone>::clone(&selection.1).unwrap().contains(selection.0) {


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 suggestions/option-content-move.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/suggestions/option-content-move.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/suggestions/option-content-move" "-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[E0507]: cannot move out of `selection.1` which is behind a shared reference
##[error]  --> /checkout/tests/ui/suggestions/option-content-move.rs:10:20
   |
LL |                 if selection.1.unwrap().contains(selection.0) {
   |                    ^^^^^^^^^^^ -------- `selection.1` moved due to this method call
   |                    |
   |                    help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents
   |                    move occurs because `selection.1` has type `Option<String>`, which does not implement the `Copy` trait
   |
   = note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `selection.1`
help: you can `clone` the value and consume it, but this might not be your desired behavior
   |
LL |                 if <Option<String> as Clone>::clone(&selection.1).unwrap().contains(selection.0) {
   |                    ++++++++++++++++++++++++++++++++++           +
help: consider cloning the value if the performance cost is acceptable
   |
LL |                 if selection.1.clone().unwrap().contains(selection.0) {
   |                               ++++++++

error[E0507]: cannot move out of `selection.1` which is behind a shared reference
##[error]  --> /checkout/tests/ui/suggestions/option-content-move.rs:28:20
   |
LL |                 if selection.1.unwrap().contains(selection.0) {
   |                    ^^^^^^^^^^^ -------- `selection.1` moved due to this method call
   |                    |
   |                    help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents
   |                    move occurs because `selection.1` has type `Result<String, String>`, which does not implement the `Copy` trait
   |
   = note: `Result::<T, E>::unwrap` takes ownership of the receiver `self`, which moves `selection.1`
help: you can `clone` the value and consume it, but this might not be your desired behavior
   |
LL |                 if <Result<String, String> as Clone>::clone(&selection.1).unwrap().contains(selection.0) {
   |                    ++++++++++++++++++++++++++++++++++++++++++           +
help: consider cloning the value if the performance cost is acceptable
   |
LL |                 if selection.1.clone().unwrap().contains(selection.0) {
   |                               ++++++++
---
14 help: consider cloning the value if the performance cost is acceptable
15    |
16 LL |     !x.clone();

74    |     |move occurs because `*m` has type `T`, which does not implement the `Copy` trait
75    |     `*m` moved due to usage in operator
76    |
- note: calling this operator moves the value
-   --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
+    = note: calling this operator moves the value
79 help: if `T` implemented `Clone`, you could clone the value
---
To only update this specific test, also pass `--test-args unop/unop-move-semantics.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/unop/unop-move-semantics.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/unop/unop-move-semantics" "-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[E0382]: borrow of moved value: `x`
##[error]  --> /checkout/tests/ui/unop/unop-move-semantics.rs:8:5
   |
LL | fn move_then_borrow<T: Not<Output=T> + Clone>(x: T) {
   |                                               - move occurs because `x` has type `T`, which does not implement the `Copy` trait
LL |     !x;
   |     -- `x` moved due to usage in operator
LL |
LL |     x.clone();  //~ ERROR: borrow of moved value
   |     ^ value borrowed here after move
   |
   = note: calling this operator moves the value
help: consider cloning the value if the performance cost is acceptable
   |
LL |     !x.clone();
   |       ++++++++
help: consider further restricting type parameter `T` with trait `Copy`
   |
LL | fn move_then_borrow<T: Not<Output=T> + Clone + Copy>(x: T) {
   |                                              ++++++

error[E0505]: cannot move out of `x` because it is borrowed
##[error]  --> /checkout/tests/ui/unop/unop-move-semantics.rs:15:6
   |
LL | fn move_borrowed<T: Not<Output=T>>(x: T, mut y: T) {
   |                                    - binding `x` declared here
LL |     let m = &x;
   |             -- borrow of `x` occurs here
...
LL |     !x;  //~ ERROR: cannot move out of `x` because it is borrowed
   |      ^ move out of `x` occurs here
...
LL |     use_mut(n); use_imm(m);
   |                         - borrow later used here
   |
help: if `T` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/unop/unop-move-semantics.rs:11:18
   |
LL | fn move_borrowed<T: Not<Output=T>>(x: T, mut y: T) {
   |                  ^ consider constraining this type parameter with `Clone`
LL |     let m = &x;
   |              - you could clone this value

error[E0505]: cannot move out of `y` because it is borrowed
##[error]  --> /checkout/tests/ui/unop/unop-move-semantics.rs:17:6
   |
LL | fn move_borrowed<T: Not<Output=T>>(x: T, mut y: T) {
   |                                          ----- binding `y` declared here
LL |     let m = &x;
LL |     let n = &mut y;
   |             ------ borrow of `y` occurs here
...
LL |     !y;  //~ ERROR: cannot move out of `y` because it is borrowed
   |      ^ move out of `y` occurs here
LL |     use_mut(n); use_imm(m);
   |             - borrow later used here
   |
help: if `T` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/unop/unop-move-semantics.rs:11:18
   |
LL | fn move_borrowed<T: Not<Output=T>>(x: T, mut y: T) {
   |                  ^ consider constraining this type parameter with `Clone`
LL |     let m = &x;
LL |     let n = &mut y;
   |                  - you could clone this value

error[E0507]: cannot move out of `*m` which is behind a mutable reference
##[error]  --> /checkout/tests/ui/unop/unop-move-semantics.rs:24:6
   |
LL |     !*m;  //~ ERROR: cannot move out of `*m`
   |     -^^
   |     ||
   |     |move occurs because `*m` has type `T`, which does not implement the `Copy` trait
   |     `*m` moved due to usage in operator
   |
   = note: calling this operator moves the value
help: if `T` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/unop/unop-move-semantics.rs:20:24
   |
LL | fn illegal_dereference<T: Not<Output=T>>(mut x: T, y: T) {
   |                        ^ consider constraining this type parameter with `Clone`
...
LL |     !*m;  //~ ERROR: cannot move out of `*m`
   |      -- you could clone this value

error[E0507]: cannot move out of `*n` which is behind a shared reference
##[error]  --> /checkout/tests/ui/unop/unop-move-semantics.rs:26:6
   |
LL |     !*n;  //~ ERROR: cannot move out of `*n`
   |     -^^
   |     ||
   |     |move occurs because `*n` has type `T`, which does not implement the `Copy` trait
   |     `*n` moved due to usage in operator
   |
help: if `T` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/unop/unop-move-semantics.rs:20:24
   |
LL | fn illegal_dereference<T: Not<Output=T>>(mut x: T, y: T) {
   |                        ^ consider constraining this type parameter with `Clone`
...
LL |     !*n;  //~ ERROR: cannot move out of `*n`
   |      -- you could clone this value

error: aborting due to 5 previous errors

Some errors have detailed explanations: E0382, E0505, E0507.
For more information about an error, try `rustc --explain E0382`.
---
To only update this specific test, also pass `--test-args where-clauses/ignore-err-clauses.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/where-clauses/ignore-err-clauses.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/where-clauses/ignore-err-clauses" "-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[E0425]: cannot find type `UUU` in this scope
##[error]  --> /checkout/tests/ui/where-clauses/ignore-err-clauses.rs:6:5
   |
LL |     UUU: Copy,
   |     ^^^ not found in this scope

error[E0382]: use of moved value: `x`
##[error]  --> /checkout/tests/ui/where-clauses/ignore-err-clauses.rs:9:9
   |
LL | fn dbl<T>(x: T) -> <T as Add>::Output
   |           - move occurs because `x` has type `T`, which does not implement the `Copy` trait
...
LL |     x + x
   |     ----^
   |     |   |
   |     |   value used here after move
   |     `x` moved due to usage in operator
   |
help: if `T` implemented `Clone`, you could clone the value
  --> /checkout/tests/ui/where-clauses/ignore-err-clauses.rs:3:8
   |
LL | fn dbl<T>(x: T) -> <T as Add>::Output
   |        ^ consider constraining this type parameter with `Clone`
...
LL |     x + x
   |     - you could clone this value
   = note: calling this operator moves the left-hand side

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

Labels

A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-run-make Area: port run-make Makefiles to rmake.rs A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic 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.

5 participants