diff options
| author | bors <bors@rust-lang.org> | 2014-07-03 01:06:38 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-07-03 01:06:38 +0000 |
| commit | 67776ba3dab24a3e281931da437d30ccfc3b04c1 (patch) | |
| tree | ff463fd21bdea1f9c6f3b0e2d81962c73afc90b6 /src/libsyntax/parse | |
| parent | c8ae065182d19a098aa397fddcb4f4f4eccc0b32 (diff) | |
| parent | e56dbad9f7c3691bcb12edfaeda5cb3b660496de (diff) | |
| download | rust-67776ba3dab24a3e281931da437d30ccfc3b04c1.tar.gz rust-67776ba3dab24a3e281931da437d30ccfc3b04c1.zip | |
auto merge of #15325 : pcwalton/rust/trait-impl-bound-mismatch, r=pnkfelix
with the corresponding trait parameter bounds.
This is a version of the patch in PR #12611 by Florian Hahn, modified to
address Niko's feedback.
It does not address the issue of duplicate type parameter bounds, nor
does it address the issue of implementation-defined methods that contain
*fewer* bounds than the trait, because Niko's review indicates that this
should not be necessary (and indeed I believe it is not). A test has
been added to ensure that this works.
This will break code like:
trait Foo {
fn bar<T:Baz>();
}
impl Foo for Boo {
fn bar<T:Baz + Quux>() { ... }
// ^~~~ ERROR
}
This will be rejected because the implementation requires *more* bounds
than the trait. It can be fixed by either adding the missing bound to
the trait:
trait Foo {
fn bar<T:Baz + Quux>();
// ^~~~
}
impl Foo for Boo {
fn bar<T:Baz + Quux>() { ... } // OK
}
Or by removing the bound from the impl:
trait Foo {
fn bar<T:Baz>();
}
impl Foo for Boo {
fn bar<T:Baz>() { ... } // OK
// ^ remove Quux
}
This patch imports the relevant tests from #2687, as well as the test
case in #5886, which is fixed as well by this patch.
Closes #2687.
Closes #5886.
[breaking-change]
r? @pnkfelix
Diffstat (limited to 'src/libsyntax/parse')
0 files changed, 0 insertions, 0 deletions
