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

Incorrect lifetime suggested in diagnostics help message #35619

Closed
viraptor opened this issue Aug 12, 2016 · 8 comments
Closed

Incorrect lifetime suggested in diagnostics help message #35619

viraptor opened this issue Aug 12, 2016 · 8 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@viraptor
Copy link

I got the following suggestion for correcting error:

help: consider using an explicit lifetime parameter as shown: fn string_by_path<'a, 'b>(doc: &'a Json, path: &'b [&'b str])
 -> Result<String, Box<Error+ 'c>>
  --> src/main.rs:16:1
   |
16 | fn string_by_path<'a,'b,'c>(doc: &'a Json, path: &'b [&'b str]) -> Result<String, Box<Error + 'c>> {
   | ^

But (irrelevant if this is going towards better solution or not) the suggestion is clearly illegal, because it's missing 'c which exists in the return type.

@brson brson added A-diagnostics Area: Messages for errors, warnings, and lints I-wrong labels Aug 12, 2016
@brson brson changed the title Rustc should never suggest obviously illegal solutions Incorrect lifetime suggested in diagnostics help message Aug 12, 2016
@brson brson added T-lang Relevant to the language team, which will review and decide on the PR/issue. I-nominated labels Aug 12, 2016
@brson
Copy link
Contributor

brson commented Aug 12, 2016

I agree that incorrect help suggestions are terrible and we should try much harder not to make them. I changed the title to be more about this specific message though since ISTM that "never suggest obviously illegal solutions" is quite a tall order. Let's solve this one!

cc @jonathandturner bogus help is super counterproductive.

@brson brson added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Aug 12, 2016
@arielb1 arielb1 removed the I-wrong label Aug 18, 2016
@nikomatsakis
Copy link
Contributor

So this particular problem appears to be that we are failing to check trait object bounds, which didn't exist at the time this code was implemented. But there are also deeper problems with this check -- for example, it doesn't consider the possibility 'a: 'b-style where-clauses. There are probably a number of fixes that could be done here.

@nikomatsakis
Copy link
Contributor

triage: P-medium

@rust-highfive rust-highfive added P-medium Medium priority and removed I-nominated labels Aug 18, 2016
@arielb1
Copy link
Contributor

arielb1 commented Aug 18, 2016

@brson

I-wrong is only for wrong-codegen issues, which is not one of.

@brson
Copy link
Contributor

brson commented Aug 23, 2016

@arielb1 I don't know how you came to this conclusion, but codegen is only one of Rust's many functions, and many of them can be "wrong". Which I-tag do you think applies here?

@arielb1
Copy link
Contributor

arielb1 commented Aug 28, 2016

The compiler team was using I-wrong for bugs where the compiler silently emits wrong code. I suppose that silent standard library breakage also counts.

Diagnostic problems are just A-diagnostics.

@leoyvens
Copy link
Contributor

leoyvens commented Jan 29, 2017

Explicit lifetime suggestions were removed, this is fixed.

@steveklabnik
Copy link
Member

Specifically, removed in #37057

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 P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants