Migrate rustc_trait_selection::traits::error_reporting::suggestions to SessionDiagnostic#101466
Migrate rustc_trait_selection::traits::error_reporting::suggestions to SessionDiagnostic#101466str4d wants to merge 1 commit intorust-lang:masterfrom
rustc_trait_selection::traits::error_reporting::suggestions to SessionDiagnostic#101466Conversation
… to `SessionDiagnostic` Part of rust-lang#100717.
|
r? @nagisa (rust-highfive has picked a reviewer for you, use r? to override) |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
r? @davidtwco |
|
☔ The latest upstream changes (presumably #101736) made this pull request unmergeable. Please resolve the merge conflicts. |
davidtwco
left a comment
There was a problem hiding this comment.
Apologies that it took so long for me to get to this review!
| // FIXME: Ensure that the create_err() calls below are equivalent to: | ||
| // err.code(error_code!(E0746)); | ||
| // err.set_primary_message("return type cannot have an unboxed trait object"); | ||
| // err.children.clear(); |
There was a problem hiding this comment.
create_err creates an entirely new error so it might not be exactly the same but if it isn't observable in testing then it's probably fine.
| err.subdiagnostic(NoteObligation::RepeatElementCopyHelpConstFn { | ||
| example_a: "const VAL: Type = const_fn();", | ||
| example_b: "let x = [VAL; 42];", | ||
| }); |
There was a problem hiding this comment.
Why not just include example_a and example_b in the Fluent message?
There was a problem hiding this comment.
This way, the translators don't need to deal with the Rust code, we ensure that it is identical across all translations with no typos, and if the Rust code needs updating we can potentially do so without altering the translations.
| }, | ||
| ); | ||
| if ty.references_error() { | ||
| err.span_label(span, &String::new()); |
There was a problem hiding this comment.
You might be able to do this with a
trait_selection_empty = {""}| assoc_span, | ||
| predicate: predicate.to_string(), | ||
| item_name, | ||
| kind: kind.to_string(), |
There was a problem hiding this comment.
Can we implement IntoDiagnosticArg on this?
| _ => err.note(&msg), | ||
| _ => err.subdiagnostic(NoteObligation::ImplDerivedObligation { | ||
| ty: parent_trait_pred.skip_binder().self_ty(), | ||
| trait_path: parent_trait_pred.print_modifiers_and_trait_path().to_string(), |
There was a problem hiding this comment.
We might be able to implement IntoDiagnosticArg for TraitPredPrintModifiersAndPath too
|
Hi, I've seen you changed some diagnostic structs in your PR. After #103345, the way we refer to fluent messages changed. They are now in a flat namespace with the same identifier as in the fluent file. For example, |
|
@str4d any updates on this? |
|
Closing this pr as inactive |
Part of #100717.