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.

Activity

  1. added
    A-diagnostics
    T-compiler
    on Jun 8, 2026
  2. s7tya commented on Jun 13, 2026

    @s7tya
    Contributor

    Smaller:

    fn main() {
        let mut samples = Vec::new();
        let packet_buf = Vec::new();
        samples.extend(packet_buf.iter().map(|x| [x, x]));
        samples.extend(packet_buf.chunks_exact(1).map(|x| [x[0], x[0]]));
    }
    error[E0275]: overflow evaluating whether `&_` is well-formed
     --> src/main.rs:2:23
      |
    2 |     let mut samples = Vec::new();
      |                       ^^^
    
    For more information about this error, try `rustc --explain E0275`.
    error: could not compile `playground` (bin "playground") due to 1 previous error
    
  3. Kokoro2336 commented on Jun 25, 2026

    @Kokoro2336
    Contributor

    @rustbot claim

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

Metadata

Metadata

Assignees

Labels

A-diagnosticsT-compiler

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions