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

Call default methods on bound typarams more correctly #4101

Merged
merged 1 commit into from
Dec 7, 2012

Conversation

brson
Copy link
Contributor

@brson brson commented Dec 3, 2012

r? @pcwalton

This makes test cases like the following work:

trait A {
    fn g() -> int { 10 }
}

impl int: A { }

fn f<T: A>(i: T) {
    assert i.g() == 10;
}

fn main () {
    f(0);
}

What doesn't work is if trait A is itself parameterized. This commit includes such testcases, xfailed. As with each of my commits to traits, the hacks involved make me feel uncomfortable. Trans isn't told specifically that it's implementing a default method - instead method lookup on the impl fails so trans decides that must be what's going on then starts grovelling for default implementations.

@brson
Copy link
Contributor Author

brson commented Dec 3, 2012

This also doesn't handle the cross-crate case in trans.

@pcwalton
Copy link
Contributor

pcwalton commented Dec 4, 2012

r=me

brson added a commit that referenced this pull request Dec 7, 2012
Call default methods on bound typarams more correctly
@brson brson merged commit e71081e into rust-lang:incoming Dec 7, 2012
RalfJung added a commit to RalfJung/rust that referenced this pull request Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants