Skip to content

Path to associated type via a struct's type parameter #19558

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

Closed
nrc opened this issue Dec 5, 2014 · 1 comment
Closed

Path to associated type via a struct's type parameter #19558

nrc opened this issue Dec 5, 2014 · 1 comment
Labels
A-associated-items Area: Associated items (types, constants & functions)

Comments

@nrc
Copy link
Member

nrc commented Dec 5, 2014

#![feature(associated_types)]

trait Foo {
    type A;
}

struct B<X: Foo<A=int>>{
    x: X::A,
}

fn main() {
    let b = B { x: 42i };
    let _: int = b.x;
}

The struct definition is OK, but the struct initialiser fails to type check (which I think it should). We don't get as far as the second assignment.

@nrc nrc added the A-associated-items Area: Associated items (types, constants & functions) label Dec 5, 2014
@nikomatsakis
Copy link
Contributor

Dup of #20535, #20470, etc.

lnicola pushed a commit to lnicola/rust that referenced this issue Apr 28, 2025
…hic-effect

fix: Fix a small bug with catastrophic effects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items (types, constants & functions)
Projects
None yet
Development

No branches or pull requests

2 participants