Skip to content

Hard-to-read ICEs when fluent translation uses non-existing variable #128340

Open
@RalfJung

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-translationArea: Translation infrastructure, and migrating existing diagnostics to SessionDiagnosticD-diagnostic-infraDiagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.D-papercutDiagnostics: An error or lint that needs small tweaks.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions