-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Improve fluent error messages #106427
Improve fluent error messages #106427
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @TaKO8Ki (or someone else) soon. Please see the contribution instructions for more information. |
cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you able to add tests to this? Or at least post examples of the output before and after?
I'll take a look at adding some tests 👍
|
This comment has been minimized.
This comment has been minimized.
@bors r+ |
|bundle: &'a FluentBundle| -> Result<Cow<'_, str>, TranslateError<'_>> { | ||
let message = bundle | ||
.get_message(identifier) | ||
.ok_or(TranslateError::message(identifier, args))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok_or
eagerly evaluated, looks not ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These constructors don't call any functions themselves, so this is just the construction of an enum variant which should be effectively free. As such it shouldn't matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, i see now.
let value = match attr { | ||
Some(attr) => message | ||
.get_attribute(attr) | ||
.ok_or(TranslateError::attribute(identifier, args, attr))? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
.get_attribute(attr) | ||
.ok_or(TranslateError::attribute(identifier, args, attr))? | ||
.value(), | ||
None => message.value().ok_or(TranslateError::value(identifier, args))?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
Improve fluent error messages These have been really frustrating me while migrating diagnostics.
Rollup of 9 pull requests Successful merges: - rust-lang#106321 (Collect and emit proper backtraces for `delay_span_bug`s) - rust-lang#106397 (Check `impl`'s `where` clauses in `consider_impl_candidate` in experimental solver) - rust-lang#106427 (Improve fluent error messages) - rust-lang#106570 (add tests for div_duration_* functions) - rust-lang#106648 (Polymorphization cleanup) - rust-lang#106664 (Remove unnecessary lseek syscall when using std::fs::read) - rust-lang#106709 (Disable "split dwarf inlining" by default.) - rust-lang#106715 (Autolabel and ping wg for changes to new solver) - rust-lang#106717 (fix typo LocalItemId -> ItemLocalId) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Restore behavior when primary bundle is missing Fixes rust-lang#106755 by restoring some of the behavior prior to rust-lang#106427 Still, I have no idea how this debug assertion can even hit while using `en-US` as primary bundle. r? `@davidtwco`
Restore behavior when primary bundle is missing Fixes rust-lang#106755 by restoring some of the behavior prior to rust-lang#106427 Still, I have no idea how this debug assertion can even hit while using `en-US` as primary bundle. r? ``@davidtwco``
Restore behavior when primary bundle is missing Fixes rust-lang#106755 by restoring some of the behavior prior to rust-lang#106427 Still, I have no idea how this debug assertion can even hit while using `en-US` as primary bundle. r? ```@davidtwco```
These have been really frustrating me while migrating diagnostics.