Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc fails to infer default types that appear inside a path #55227

Open
MaikKlein opened this issue Oct 20, 2018 · 1 comment
Open

rustc fails to infer default types that appear inside a path #55227

MaikKlein opened this issue Oct 20, 2018 · 1 comment
Labels
A-inference Area: Type inference

Comments

@MaikKlein
Copy link
Contributor

type MyWorld = World<u32>;
struct World<S = u32> {
    s: S,
}
impl<S> World<S> {
    pub fn new() -> Self {
        unimplemented!()
    }
}
fn main() {
    //let mut world = World::new(); // Doesn't compile
    let mut world: World = World::new(); // <= This works :/
    let mut world = MyWorld::new(); // This also works
}

playground

let mut world = World::new(); // Doesn't compile
let mut world: World = World::new(); // This works

To me this seems like an oversight in how types are inferred inside a path.

@memoryruins memoryruins added the A-inference Area: Type inference label Oct 29, 2018
@Spoonbender
Copy link

Triage: no change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inference Area: Type inference
Projects
None yet
Development

No branches or pull requests

3 participants