Improve fluent error messages#106427
Improve fluent error messages#106427bors merged 3 commits intorust-lang:masterfrom mejrs:translation_errors
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 |
davidtwco
left a comment
There was a problem hiding this comment.
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.
ok_or eagerly evaluated, looks not ok?
There was a problem hiding this comment.
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.
| let value = match attr { | ||
| Some(attr) => message | ||
| .get_attribute(attr) | ||
| .ok_or(TranslateError::attribute(identifier, args, attr))? |
| .get_attribute(attr) | ||
| .ok_or(TranslateError::attribute(identifier, args, attr))? | ||
| .value(), | ||
| None => message.value().ok_or(TranslateError::value(identifier, args))?, |
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.