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

The each_char method on &str doesn't work because multiple applicable methods are in scope #6281

Closed
Thiez opened this issue May 6, 2013 · 2 comments

Comments

@Thiez
Copy link
Contributor

Thiez commented May 6, 2013

The following program

fn main() {
    do "somestr".each_char |_| { false }
}

Gives this error:

treegrep.rs:2:39: 2:40 error: multiple applicable methods in scope
treegrep.rs:2     do "somestr".each_char |_| { false }
                                                     ^
treegrep.rs:2:39: 2:40 note: candidate #1 is `core::io::__extensions__::each_char`
treegrep.rs:2     do "somestr".each_char |_| { false }
                                                     ^
treegrep.rs:2:39: 2:40 note: candidate #2 is `core::str::__extensions__::each_char`
treegrep.rs:2     do "somestr".each_char |_| { false }
                                                     ^
treegrep.rs:2:39: 2:40 error: failed to find an implementation of trait core::io::Reader for &'static str
treegrep.rs:2     do "somestr".each_char |_| { false }
                                                     ^

It seems this significantly reduces the utility of each_char. Interestingly the last error (failed to find an implementation...) only shows up about half the time.
I'm not entirely sure how &str implements ReaderUtil.

@Dretch
Copy link
Contributor

Dretch commented May 16, 2013

This is the same bug as #5664.

@Thiez
Copy link
Contributor Author

Thiez commented May 16, 2013

So it is.

@Thiez Thiez closed this as completed May 16, 2013
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

No branches or pull requests

2 participants