Skip to content

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

Description

@edwloef

Code

Check out generic-daw/generic-daw@bdb1307, 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.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions