rust-lang / rust-lang/rust

WF check has error code `E0277` which doesn't say anything about the current error

Open
#135,599 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Code
struct Unsized {
    inner2: [u8],
    inner3: [u8],
}
Current output
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
[...]
Desired output
error: the size for values of type `[u8]` cannot be known at compilation time
[...]

(Don't mention E0277)
Rationale and extra context

When you read up on this error it goes on about whether I'm not implementing a trait. Nothing there talks about Sized, or why we're not implmenting it.

The current output error is very good, but that part is a bit misleading.

Other cases

Rust Version
cargo 1.86.0-nightly (fd784878c 2025-01-03)
Anything else?

No response

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.

Research direction

Start by compiling the provided Unsized Rust snippet and inspect the compiler diagnostic path for E0277, since no source file or test is named in the issue. Done means the current diagnostic remains useful while the misleading E0277 code is omitted for this Sized-related error, with coverage for the reported case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.