-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Update E0393 to new error format #36114
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @jonathandturner (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
@zjhmale - thanks for the PR. Looks like part of the problem is that you're using .span_label for everything. In the issue, there are a few parts that need to be updated: "E0393 needs a span_label, updated title, and a note, changing it from:" The span_label, you figured out. The title is the error message title, which you also got. The note is the .note() feature. So instead of: struct_span_err!(tcx.sess, span, E0393,
"the type parameter `{}` must be explicitly specified",
def.name)
.span_label(span, &format!("missing reference to `{}`", def.name))
.emit(); You can do: let mut err = struct_span_err!(tcx.sess, span, E0393,
"the type parameter `{}` must be explicitly specified",
def.name);
err.span_label(span, &format!("missing reference to `{}`", def.name));
err.note(&format!("because of the default `Self` reference, type parameters must be specified on object types"));
err.emit(); |
@jonathandturner awesome! thx for pointing out |
Great, thanks for updating. We're getting closer. The next step is to pass the
You can run these yourself using this command:
|
@jonathandturner tidied up the code. |
Great! @bors r+ rollup |
📌 Commit 25c9097 has been approved by |
Update E0393 to new error format Fixes rust-lang#35632. Part of rust-lang#35233. r? @jonathandturner and a wired thing is that if i add another label ```rust .span_label(span, &format!("missing reference to `{}`", def.name)) .span_label(span, &format!("because of the default `Self` reference, type parameters must be specified on object types")) ``` and add a new note in the test case like ```rust trait A<T=Self> {} fn together_we_will_rule_the_galaxy(son: &A) {} //~^ ERROR E0393 //~| NOTE missing reference to `T` //~| NOTE because of the default `Self` reference, type parameters must be specified on object types ``` it will complain that ``` running 1 test test [compile-fail] compile-fail/E0393.rs ... FAILED failures: ---- [compile-fail] compile-fail/E0393.rs stdout ---- error: /Users/zjh/Documents/rustspace/rust/src/test/compile-fail/E0393.rs:13: unexpected "error": '13:43: 13:44: the type parameter `T` must be explicitly specified [E0393]' unexpected errors (from JSON output): [ Error { line_num: 13, kind: Some( Error ), msg: "13:43: 13:44: the type parameter `T` must be explicitly specified [E0393]" } ] ``` it is a little bit confusing and through the blog post we can use `//~^` and `//~|` to support multiple notes, @jonathandturner am i missing something here?
@bors r- Looks like there are a few more tests you'll need to update:
When you make the changes, make sure to run the check (there are some tips in the blog post)
|
@jonathandturner fixed these tests! and sorry that i just used |
Hehe, no worries. I do the same thing sometimes. @bors r+ rollup |
📌 Commit 189dee6 has been approved by |
Update E0393 to new error format Fixes rust-lang#35632. Part of rust-lang#35233. r? @jonathandturner and a wired thing is that if i add another label ```rust .span_label(span, &format!("missing reference to `{}`", def.name)) .span_label(span, &format!("because of the default `Self` reference, type parameters must be specified on object types")) ``` and add a new note in the test case like ```rust trait A<T=Self> {} fn together_we_will_rule_the_galaxy(son: &A) {} //~^ ERROR E0393 //~| NOTE missing reference to `T` //~| NOTE because of the default `Self` reference, type parameters must be specified on object types ``` it will complain that ``` running 1 test test [compile-fail] compile-fail/E0393.rs ... FAILED failures: ---- [compile-fail] compile-fail/E0393.rs stdout ---- error: /Users/zjh/Documents/rustspace/rust/src/test/compile-fail/E0393.rs:13: unexpected "error": '13:43: 13:44: the type parameter `T` must be explicitly specified [E0393]' unexpected errors (from JSON output): [ Error { line_num: 13, kind: Some( Error ), msg: "13:43: 13:44: the type parameter `T` must be explicitly specified [E0393]" } ] ``` it is a little bit confusing and through the blog post we can use `//~^` and `//~|` to support multiple notes, @jonathandturner am i missing something here?
Fixes #35632.
Part of #35233.
r? @jonathandturner
and a wired thing is that if i add another label
and add a new note in the test case like
it will complain that
it is a little bit confusing and through the blog post we can use
//~^
and//~|
to support multiple notes, @jonathandturner am i missing something here?