Skip to content
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

-Ztranslate-additional-ftl for a broken fluent bundle with stray interpolation argument unexpectedly ICEs #135817

Open
jieyouxu opened this issue Jan 21, 2025 · 1 comment
Labels
A-run-make Area: port run-make Makefiles to rmake.rs A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jieyouxu
Copy link
Member

https://github.com/rust-lang/rust/blob/ebbe63891f1fae21734cb97f2f863b08b1d44bf8/tests/run-make/translation/Makefile has a test comment and test case:

# Check that a primary bundle with a broken message (e.g. a interpolated
# variable is missing) will use the fallback bundle.
missing: test.rs missing.ftl
$(RUSTC) $< -Ztranslate-additional-ftl=$(CURDIR)/missing.ftl 2>&1 | $(CGREP) "struct literal body without path"

Ignoring that this is using the wrong .ftl file (it should be using broken.ftl to correspond to the test comment, where broken.ftl contains a slug that has a stray fluent interpolation argument), this must have regressed over the years because

rustc test.rs -Ztranslate-additional-ftl=broken.ftl

actually ICEs locally due to

thread 'rustc' panicked at compiler/rustc_errors/src/emitter.rs:1465:84:
called `Result::unwrap()` on an `Err` value: failed while formatting fluent string `parse_struct_literal_body_without_path`:
the fluent string has an argument `foo` that was not found.
help: no arguments are available

Pinging back to #132181.

I assume this is not the intended behavor.

@jieyouxu jieyouxu added A-run-make Area: port run-make Makefiles to rmake.rs A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 21, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 21, 2025
@jieyouxu jieyouxu added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 21, 2025
@jieyouxu jieyouxu changed the title Discrepancy between tests/run-make/translation test comment versus actual behavior -Ztranslate-additional-ftl=broken.ftl for a broken fluent bundle with stray interpolation argument unexpectedly ICEs Jan 21, 2025
@jieyouxu jieyouxu changed the title -Ztranslate-additional-ftl=broken.ftl for a broken fluent bundle with stray interpolation argument unexpectedly ICEs -Ztranslate-additional-ftl for a broken fluent bundle with stray interpolation argument unexpectedly ICEs Jan 21, 2025
@jieyouxu
Copy link
Member Author

jieyouxu commented Jan 21, 2025

The Makefile test didn't catch it because it didn't set

SHELL=/bin/bash -o pipefail

and the Makefile test indeed fails against latest master if pipefail is set due to the ICE.

jieyouxu added a commit to jieyouxu/rust that referenced this issue Jan 22, 2025
…mpiler-errors

tests: Port `translation` to rmake.rs

Part of rust-lang#121876.

This PR partially supersedes rust-lang#129011 and is co-authored with `@Oneirical.`

## Summary

This PR ports `tests/run-make/translation` to rmake.rs. Notable changes from the Makefile version include:

- We now actually fail if the rustc invocations fail... The Makefile did not have `SHELL=/bin/bash -o pipefail`, so all the piped rustc invocations to grep vacuously succeeded, even if the broken ftl test case actually regressed over time and ICEs on current master.
    - That test case is converted to assert it ICEs with a FIXME backlinking to rust-lang#135817.
- The test coverage is expanded to not ignore windows. Instead, the test now uses symlink capability detection to gate test execution.
- Added some backlinks to relevant tracking issues and the initial translation infra implementation PR.

## Review advice

Best reviewed commit-by-commit.

r? compiler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-run-make Area: port run-make Makefiles to rmake.rs A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants