-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed as duplicate of#24066
Labels
A-inferenceArea: Type inferenceArea: Type inferenceA-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
In the function f
I have to specify bool
explicitly while f
differs from g
in constrains only:
use rand::Rng;
use rand::distributions::{Distribution, Standard};
fn f<S, R>(rng: &mut R) -> bool
where
R: Rng,
Standard: Distribution<S>,
{
rng.gen::<bool>()
}
fn g<R>(rng: &mut R) -> bool
where
R: Rng
{
rng.gen()
}
Not sure if it's an actual bug but it looks like the type inference should work the same way in both cases.
installgentoo and torokati44
Metadata
Metadata
Assignees
Labels
A-inferenceArea: Type inferenceArea: Type inferenceA-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.