Skip to content

librustc: Resolve regions and report errors in trait/impl method#15991

Merged
bors merged 1 commit intorust-lang:masterfrom
pcwalton:resolve-regions-in-trait-matching
Jul 26, 2014
Merged

librustc: Resolve regions and report errors in trait/impl method#15991
bors merged 1 commit intorust-lang:masterfrom
pcwalton:resolve-regions-in-trait-matching

Conversation

@pcwalton
Copy link
Contributor

matching.

This breaks code like:

struct Foo<'a,'b> {
    x: &'a int,
    y: &'b int,
}

trait Tr {
    fn foo(x: Self) {}
}

impl<'a,'b> Tr for Foo<'a,'b> {
    fn foo(x: Foo<'b,'a>) {} // <-- bad
}

Change this code to not contain a lifetime mismatch error. For example:

struct Foo<'a,'b> {
    x: &'a int,
    y: &'b int,
}

trait Tr {
    fn foo(x: Self) {}
}

impl<'a,'b> Tr for Foo<'a,'b> {
    fn foo(x: Foo<'a,'b>) {} // OK
}

Closes #15517.

[breaking-change]

r? @alexcrichton

matching.

This breaks code like:

    struct Foo<'a,'b> {
        x: &'a int,
        y: &'b int,
    }

    trait Tr {
        fn foo(x: Self) {}
    }

    impl<'a,'b> Tr for Foo<'a,'b> {
        fn foo(x: Foo<'b,'a>) {} // <-- bad
    }

Change this code to not contain a lifetime mismatch error. For example:

    struct Foo<'a,'b> {
        x: &'a int,
        y: &'b int,
    }

    trait Tr {
        fn foo(x: Self) {}
    }

    impl<'a,'b> Tr for Foo<'a,'b> {
        fn foo(x: Foo<'a,'b>) {} // OK
    }

Closes rust-lang#15517.

[breaking-change]
bors added a commit that referenced this pull request Jul 26, 2014
…g, r=alexcrichton

matching.

This breaks code like:

    struct Foo<'a,'b> {
        x: &'a int,
        y: &'b int,
    }

    trait Tr {
        fn foo(x: Self) {}
    }

    impl<'a,'b> Tr for Foo<'a,'b> {
        fn foo(x: Foo<'b,'a>) {} // <-- bad
    }

Change this code to not contain a lifetime mismatch error. For example:

    struct Foo<'a,'b> {
        x: &'a int,
        y: &'b int,
    }

    trait Tr {
        fn foo(x: Self) {}
    }

    impl<'a,'b> Tr for Foo<'a,'b> {
        fn foo(x: Foo<'a,'b>) {} // OK
    }

Closes #15517.

[breaking-change]

r? @alexcrichton
@bors bors closed this Jul 26, 2014
@bors bors merged commit 5de8ed5 into rust-lang:master Jul 26, 2014
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.

Matching of Self doesn't take lifetime parameters into account

3 participants