Skip to content

Conversation

catamorphism
Copy link
Contributor

No description provided.

bors added a commit that referenced this pull request Oct 23, 2013
@bors bors closed this Oct 23, 2013
@bors bors merged commit 567a03d into rust-lang:master Oct 23, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Dec 17, 2022
Fix 10021

This PR proposes a fix for rust-lang#10021.

The problem is similar to the one that `@mikerite` described in rust-lang#9505. The compiler is generating an empty substitution for a call, even though the type of `Self` seems to be needed for a predicate. In `@mikerite's` case, the call was to [`IntoFuture::into_future`](https://doc.rust-lang.org/std/future/trait.IntoFuture.html#tymethod.into_future). In this case, the call is to [`Try::branch`](https://doc.rust-lang.org/std/ops/trait.Try.html#tymethod.branch).

The proposed fix is to verify that the parameter whose type is changing has an index within the substitution. The strikes me as a reasonable approach, since if the check were to fail, the following code would be a no-op:

https://github.com/rust-lang/rust-clippy/blob/4c123a06ba3c2ec17d3a4dfa251dccdc5368b712/clippy_lints/src/methods/unnecessary_to_owned.rs#L420-L428

Like `@mikerite's` original solution, this solution turns ICEs into false negatives.

changelog: fix `unnecessary_to_owned` false positive involving `Try::branch`
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