rust-lang / rust-lang/rust

Bad error span: "overflow evaluating whether `&_` is well-formed"

Open
#157,619 2 comments 0 reactions 1 assignee View on GitHub

@Kokoro2336 is already working on this.

Since Jun 25, 2026.

A-diagnostics T-compiler
Dominant language
Rust
Stars
119k
Forks
16.2k
PR merge metrics
PR metrics pending

Description

Code

Check out https://github.com/generic-daw/generic-daw/commit/bdb130716b7a2c95f2c4759ac01dad2c0e463716, and apply the following patch:

diff --git a/generic_daw_core/src/sample.rs b/generic_daw_core/src/sample.rs
index 32bb75a9..223b0fec 100644
--- a/generic_daw_core/src/sample.rs
+++ b/generic_daw_core/src/sample.rs
@@ -60,7 +60,7 @@ impl Sample {
 				.copy_to_vec_interleaved(&mut packet_buf);
 
 			if channels == 1 {
-				samples.extend(packet_buf.iter().skip(delay).map(|&x| [x, x]));
+				samples.extend(packet_buf.iter().skip(delay).map(|x| [x, x]));
 			} else if channels != 0 {
 				samples.extend(
 					packet_buf
Current output
error[E0275]: overflow evaluating whether `&_` is well-formed
  --> generic_daw_core/src/sample.rs:49:21
   |
49 |         let mut samples = Vec::with_capacity(num_frames);
   |                           ^^^

For more information about this error, try `rustc --explain E0275`.
error: could not compile `generic_daw_core` (lib) due to 1 previous error
Desired output

Rationale and extra context

The span points quite far away from the actual problem, and the message itself doesn't help much in figuring out what's going on. It would be nice to either point to where the actual recursion is happening, or show more of the problematic type than &_.

Other cases

Rust Version
rustc 1.98.0-nightly (f20a92ec0 2026-06-07)
binary: rustc
commit-hash: f20a92ec01483dc5c58e90e246f266bdad822d86
commit-date: 2026-06-07
host: x86_64-unknown-linux-gnu
release: 1.98.0-nightly
LLVM version: 22.1.6
Anything else?

Reproduces on stable, beta and nightly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.