-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
nested bounds on traits aren't properly checked #5886
Labels
Milestone
Comments
Wow, that seems pretty bad. Nominating well-covered milestone. |
accepted for production ready |
Accepted as 1.0 blocker. Assigning P-backcompat-lang. |
cc me, cc #5527 |
Fixed by my WIP patch for #2687. |
bors
added a commit
that referenced
this issue
Jul 3, 2014
…felix 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
flip1995
pushed a commit
to flip1995/rust
that referenced
this issue
Aug 11, 2020
…r=Manishearth Avoid or_fun_call for const_fn with no args Based on rust-lang#5682 by @lzutao This avoids a subset of false positives, specifically those related to `const fn`s that take no arguments. For the rest, a much more involved fix would be needed, see rust-lang/rust-clippy#5682 (comment). So this does *not* solve rust-lang#5658 changelog: Avoid triggering [`or_fun_call`] with `const fn`s that take no arguments. Fixes rust-lang#5886
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
U: Iterator<U>
is used in the trait andU: Iterator<B>
in the implThe text was updated successfully, but these errors were encountered: