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

Migrate rustc_trait_selection::traits::error_reporting::suggestions to SessionDiagnostic #101466

Conversation

str4d
Copy link
Contributor

@str4d str4d commented Sep 6, 2022

Part of #100717.

@rustbot rustbot added A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 6, 2022
@rust-highfive
Copy link
Collaborator

r? @nagisa

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 6, 2022
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
configure: rust.debug-assertions := True
configure: rust.overflow-checks := True
configure: llvm.assertions      := True
configure: dist.missing-tools   := True
configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
configure: writing `config.toml` in current directory
configure: 
configure: run `python /checkout/x.py --help`
Attempting with retry: make prepare
---
* highest error code: E0790
Found 506 error codes
Found 0 error(s) in error codes
Done!
tidy error: /checkout/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs:1469: TODO is deprecated; use FIXME
tidy error: /checkout/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs:1491: TODO is deprecated; use FIXME
tidy error: /checkout/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs:1501: TODO is deprecated; use FIXME
tidy error: /checkout/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs:1503: TODO is deprecated; use FIXME
tidy error: /checkout/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs:1532: TODO is deprecated; use FIXME
tidy error: /checkout/compiler/rustc_trait_selection/src/errors/suggestions.rs:96: TODO is deprecated; use FIXME
tidy error: /checkout/compiler/rustc_trait_selection/src/errors/suggestions.rs:276: TODO is deprecated; use FIXME
tidy error: /checkout/compiler/rustc_trait_selection/src/errors/suggestions.rs:278: TODO is deprecated; use FIXME
some tidy checks failed
Build completed unsuccessfully in 0:00:09

@davidtwco
Copy link
Member

r? @davidtwco

@rust-highfive rust-highfive assigned davidtwco and unassigned nagisa Sep 6, 2022
@bors
Copy link
Contributor

bors commented Sep 13, 2022

☔ The latest upstream changes (presumably #101736) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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];",
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just include example_a and example_b in the Fluent message?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might be able to do this with a

trait_selection_empty = {""}

assoc_span,
predicate: predicate.to_string(),
item_name,
kind: kind.to_string(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might be able to implement IntoDiagnosticArg for TraitPredPrintModifiersAndPath too

@davidtwco davidtwco mentioned this pull request Sep 22, 2022
84 tasks
@Nilstrieb
Copy link
Member

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, parser::cool_thing is now parser_cool_thing and parser::suggestion just suggestion.
You should rebase to the latest master and change your fluent message references as described above. Thanks!

@jackh726 jackh726 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 10, 2023
@Dylan-DPC
Copy link
Member

@str4d any updates on this?

@Dylan-DPC
Copy link
Member

Closing this pr as inactive

@Dylan-DPC Dylan-DPC closed this Jul 26, 2023
@Dylan-DPC Dylan-DPC added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants