Strangly [E0275]: overflow evaluating the requirement

Open
#165,413 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

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

Research direction

Start by reproducing the snippet with rand = "0.10.3", then compare it with the turbofish variant random::<i32> to see where inference fails. The error comes from the StandardUniform: Distribution<T> bound on RngExt::random in rand's src/rng.rs, so trace how the trait solver reports overflow for that bound. Done means the diagnostic names the unresolved type and gives a usable hint, which the issue's placeholder desired output does not yet specify.

Written by the indexing model from the issue text.

Description

A-diagnostics T-compiler T-types WG-trait-system-refactor
Code
fn foo() {
    rand::RngExt::random(&mut rand::rng())%50i32;
}
Current output
error[E0275]: overflow evaluating the requirement `StandardUniform: rand::distr::Distribution<_>`
  --> src/lib.rs:2:5
   |
 2 |     rand::RngExt::random(&mut rand::rng())%50i32;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: required by a bound in `rand::RngExt::random`
  --> /home/lrne/.cargo/registry/src/rsproxy.cn-e3de039b2554c837/rand-0.10.3/src/rng.rs:95:26
   |
56 | pub trait RngExt: Rng {
...
93 |     fn random<T>(&mut self) -> T
94 |     where
95 |         StandardUniform: Distribution<T>,
   |                          ^^^^^^^^^^^^^^^ required by this bound in `RngExt::random`
Desired output
Some types, generics, bounds diagnostics...
Rationale and extra context
rand = "0.10.3"
Other cases
fn foo() {
    rand::RngExt::random::<i32>(&mut rand::rng())%50i32;
}
Rust Version
rustc 1.101.0-nightly (7df81381d 2026-10-14)
binary: rustc
commit-hash: 7df81381d027710708209f36b98d11b1c88f8d2e
commit-date: 2026-10-14
host: aarch64-unknown-linux-gnu
release: 1.101.0-nightly
LLVM version: 23.1.3
Anything else?

No response

Dominant language
Rust
Stars
121k
Forks
17.3k
Avg merge
2d 21h
Merged PRs (30d)
531

Getting set up

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.

More from rust-lang/rust

All issues in rust-lang/rust

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.