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

Help text suggests the code that triggered the error #28219

Closed
seppo0010 opened this issue Sep 4, 2015 · 2 comments
Closed

Help text suggests the code that triggered the error #28219

seppo0010 opened this issue Sep 4, 2015 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@seppo0010
Copy link
Contributor

Got the following output when compiling:

src/lib.rs:41:32: 41:45 error: cannot infer an appropriate lifetime due to conflicting requirements
src/lib.rs:41         guard.get(key).map(|v| BorrowedValue { guard: guard, value: v })
                                             ^~~~~~~~~~~~~
src/lib.rs:40:5: 42:6 help: consider using an explicit lifetime parameter as shown: fn new(guard: RwLockReadGuard<'a, HashMap<K, V>>, key: &K) -> Option<Self>
src/lib.rs:40     fn new(guard: RwLockReadGuard<'a, HashMap<K, V>>, key: &K) -> Option<Self> {
src/lib.rs:41         guard.get(key).map(|v| BorrowedValue { guard: guard, value: v })
src/lib.rs:42     }

Notice the "help" suggests the function definition that is exactly the one used.

Full code to reproduce can be found here: https://github.com/seppo0010/shardhashmap-rs/blob/help-is-not-helpful/src/lib.rs#L40

The rustc version I'm using is rustc 1.4.0-nightly (7780408af 2015-09-01).

@steveklabnik steveklabnik added the A-diagnostics Area: Messages for errors, warnings, and lints label Sep 4, 2015
@leoyvens
Copy link
Contributor

All such suggestions have been removed in #37057 so this is fixed.

@steveklabnik steveklabnik removed the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 9, 2017
@Mark-Simulacrum
Copy link
Member

Yeah, lifetime errors are painful, but we removed the help message (because it was super painful to see the same thing); closing as "fixed."

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

No branches or pull requests

4 participants