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

Issue with suggestion for Clone #27165

Closed
areteCocoa opened this issue Jul 20, 2015 · 3 comments · Fixed by #32439
Closed

Issue with suggestion for Clone #27165

areteCocoa opened this issue Jul 20, 2015 · 3 comments · Fixed by #32439
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@areteCocoa
Copy link

I wrote an implementation for Clone but forgot to import it. Here's the error I got initially:

src/server/service.rs:123:67: 123:74 error: no method named `clone` found for type `server::service::OpenTime` in the current scope
src/server/service.rs:123             s.open_times.insert(key.clone().to_string(), (*value).clone());
                                                                                            ^~~~~~~
note: in expansion of for loop expansion
src/server/service.rs:122:9: 124:10 note: expansion site
src/server/service.rs:123:67: 123:74 help: items from traits can only be used if the trait is implemented and in scope; the following trait defines an item `clone`, perhaps you need to implement it:
src/server/service.rs:123:67: 123:74 help: candidate #1: `core::clone::Clone`

After importing core, this came next:

src/server/service.rs:8:1: 8:19 error: use of unstable library feature 'core'
src/server/service.rs:8 extern crate core;

It's a bit misleading to suggest core and not the std library version of it.

@apasel422
Copy link
Contributor

Clone is in the prelude, so it shouldn't need to be imported, but it's possible you aren't using the prelude.

In any case, the issue with suggesting core is basically #23355 and #23224.

@steveklabnik steveklabnik added the A-diagnostics Area: Messages for errors, warnings, and lints label Jul 21, 2015
@apasel422
Copy link
Contributor

#26635 is similar.

@areteCocoa
Copy link
Author

You are correct, I was not using the prelude.

bors added a commit that referenced this issue Mar 31, 2016
diagnostics: make paths to external items more visible

This PR changes the reported path for an external item so that it is visible from at least one local module (i.e. it does not use any inaccessible external modules) if possible. If the external item's crate was declared with an `extern crate`, the path is guarenteed to use the `extern crate`.

Fixes #23224, fixes #23355, fixes #26635, fixes #27165.

r? @nrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants