summary refs log tree commit diff
path: root/compiler/rustc_error_messages/src
diff options
context:
space:
mode:
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2022-11-09 22:37:17 +0100
committerNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2022-11-09 22:38:10 +0100
commitbd3c4fb2f6accf64c23ac3aff9e4e96506e2f7b1 (patch)
treed0521ea87ff3eabb9671a530d43a7a481bc13769 /compiler/rustc_error_messages/src
parentcc9b259b5e94e4543b96dca236e3a1af5ec496c9 (diff)
downloadrust-bd3c4fb2f6accf64c23ac3aff9e4e96506e2f7b1.tar.gz
rust-bd3c4fb2f6accf64c23ac3aff9e4e96506e2f7b1.zip
Display help message when fluent arg was referenced incorrectly
The fluent argument syntax is a little special and easy to get wrong, so
we emit a small help message when someone gets it wrong.

Example:
```
parser_mismatched_closing_delimiter = mismatched closing delimiter: `${delimiter}`
```
panics with
```
thread 'rustc' panicked at 'Encountered errors while formatting message for `parser_mismatched_closing_delimiter`
help: Argument `delimiter` exists but was not referenced correctly. Try using `{$delimiter}` instead
attr: `None`
args: `FluentArgs([("delimiter", String("}"))])`
errors: `[ResolverError(Reference(Message { id: "delimiter", attribute: None }))]`', compiler/rustc_errors/src/translation.rs:123:21
```
Diffstat (limited to 'compiler/rustc_error_messages/src')
-rw-r--r--compiler/rustc_error_messages/src/lib.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_error_messages/src/lib.rs b/compiler/rustc_error_messages/src/lib.rs
index 9465051dd10..3467dfdbb47 100644
--- a/compiler/rustc_error_messages/src/lib.rs
+++ b/compiler/rustc_error_messages/src/lib.rs
@@ -30,7 +30,8 @@ use intl_memoizer::concurrent::IntlLangMemoizer;
 #[cfg(not(parallel_compiler))]
 use intl_memoizer::IntlLangMemoizer;
 
-pub use fluent_bundle::{FluentArgs, FluentError, FluentValue};
+pub use fluent_bundle::{self, FluentArgs, FluentError, FluentValue};
+
 pub use unic_langid::{langid, LanguageIdentifier};
 
 // Generates `DEFAULT_LOCALE_RESOURCES` static and `fluent_generated` module.