Hard-to-read ICEs when fluent translation uses non-existing variable #128340
Open
Description
opened on Jul 29, 2024
When I screw up the variable names in a messages.flt file, I am getting the following error:
thread 'rustc' panicked at compiler/rustc_errors/src/json.rs:412:56:
called `Result::unwrap()` on an `Err` value: Two { primary: One { id: "const_eval_pointer_out_of_bounds", args: FluentArgs([("alloc_size", Number(FluentNumber { value: 4.0, options: FluentNumberOptions { style: Decimal, currency: None, currency_display: Symbol, use_grouping: true, minimum_integer_digits: None, minimum_fraction_digits: None, maximum_fraction_digits: None, minimum_significant_digits: None, maximum_significant_digits: None } })), ("alloc_size_minus_ptr_offset", Number(FluentNumber { value: 4.0, options: FluentNumberOptions { style: Decimal, currency: None, currency_display: Symbol, use_grouping: true, minimum_integer_digits: None, minimum_fraction_digits: None, maximum_fraction_digits: None, minimum_significant_digits: None, maximum_significant_digits: None } })), ("bad_pointer_message", String("out-of-bounds `offset_from`")), ("error_kind", String("const")), ("inbounds_size_abs", Number(FluentNumber { value: 10.0, options: FluentNumberOptions { style: Decimal, currency: None, currency_display: Symbol, use_grouping: true, minimum_integer_digits: None, minimum_fraction_digits: None, maximum_fraction_digits: None, minimum_significant_digits: None, maximum_significant_digits: None } })), ("inbounds_size_is_neg", String("false")), ("instance", String("")), ("pointer", String("alloc30")), ("ptr_offset_is_neg", String("false"))]), kind: PrimaryBundleMissing }, fallback: One { id: "const_eval_pointer_out_of_bounds", args: FluentArgs([("alloc_size", Number(FluentNumber { value: 4.0, options: FluentNumberOptions { style: Decimal, currency: None, currency_display: Symbol, use_grouping: true, minimum_integer_digits: None, minimum_fraction_digits: None, maximum_fraction_digits: None, minimum_significant_digits: None, maximum_significant_digits: None } })), ("alloc_size_minus_ptr_offset", Number(FluentNumber { value: 4.0, options: FluentNumberOptions { style: Decimal, currency: None, currency_display: Symbol, use_grouping: true, minimum_integer_digits: None, minimum_fraction_digits: None, maximum_fraction_digits: None, minimum_significant_digits: None, maximum_significant_digits: None } })), ("bad_pointer_message", String("out-of-bounds `offset_from`")), ("error_kind", String("const")), ("inbounds_size_abs", Number(FluentNumber { value: 10.0, options: FluentNumberOptions { style: Decimal, currency: None, currency_display: Symbol, use_grouping: true, minimum_integer_digits: None, minimum_fraction_digits: None, maximum_fraction_digits: None, minimum_significant_digits: None, maximum_significant_digits: None } })), ("inbounds_size_is_neg", String("false")), ("instance", String("")), ("pointer", String("alloc30")), ("ptr_offset_is_neg", String("false"))]), kind: Fluent { errs: [ResolverError(Reference(Variable { id: "pointer_xx" }))] } } }
Needless to say, this is not exactly a pleasant debugging experience. Would be nice to get a clear message saying what went wrong. :)
In this case, the string const_eval_pointer_out_of_bounds
referenced $pointer_xx
which does not exist.
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Translation infrastructure, and migrating existing diagnostics to SessionDiagnosticDiagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.Diagnostics: An error or lint that needs small tweaks.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.
Activity