Skip to content

Commit 3e14bba

Browse files
committed
errors: generate typed identifiers in each crate
Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. Signed-off-by: David Wood <[email protected]>
1 parent 4238ce2 commit 3e14bba

File tree

2 files changed

+66
-1
lines changed

2 files changed

+66
-1
lines changed

locales/en-US.ftl

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
codegen_gcc_unwinding_inline_asm =
2+
GCC backend does not support unwinding from inline asm
3+
4+
codegen_gcc_lto_not_supported =
5+
LTO is not supported. You may get a linker error.
6+
7+
codegen_gcc_invalid_monomorphization_basic_integer =
8+
invalid monomorphization of `{$name}` intrinsic: expected basic integer type, found `{$ty}`
9+
10+
codegen_gcc_invalid_monomorphization_invalid_float_vector =
11+
invalid monomorphization of `{$name}` intrinsic: unsupported element type `{$elem_ty}` of floating-point vector `{$vec_ty}`
12+
13+
codegen_gcc_invalid_monomorphization_not_float =
14+
invalid monomorphization of `{$name}` intrinsic: `{$ty}` is not a floating-point type
15+
16+
codegen_gcc_invalid_monomorphization_unrecognized =
17+
invalid monomorphization of `{$name}` intrinsic: unrecognized intrinsic `{$name}`
18+
19+
codegen_gcc_invalid_monomorphization_expected_signed_unsigned =
20+
invalid monomorphization of `{$name}` intrinsic: expected element type `{$elem_ty}` of vector type `{$vec_ty}` to be a signed or unsigned integer type
21+
22+
codegen_gcc_invalid_monomorphization_unsupported_element =
23+
invalid monomorphization of `{$name}` intrinsic: unsupported {$name} from `{$in_ty}` with element `{$elem_ty}` to `{$ret_ty}`
24+
25+
codegen_gcc_invalid_monomorphization_invalid_bitmask =
26+
invalid monomorphization of `{$name}` intrinsic: invalid bitmask `{$ty}`, expected `u{$expected_int_bits}` or `[u8; {$expected_bytes}]`
27+
28+
codegen_gcc_invalid_monomorphization_simd_shuffle =
29+
invalid monomorphization of `{$name}` intrinsic: simd_shuffle index must be an array of `u32`, got `{$ty}`
30+
31+
codegen_gcc_invalid_monomorphization_expected_simd =
32+
invalid monomorphization of `{$name}` intrinsic: expected SIMD {$expected_ty} type, found non-SIMD `{$found_ty}`
33+
34+
codegen_gcc_invalid_monomorphization_mask_type =
35+
invalid monomorphization of `{$name}` intrinsic: mask element type is `{$ty}`, expected `i_`
36+
37+
codegen_gcc_invalid_monomorphization_return_length =
38+
invalid monomorphization of `{$name}` intrinsic: expected return type of length {$in_len}, found `{$ret_ty}` with length {$out_len}
39+
40+
codegen_gcc_invalid_monomorphization_return_length_input_type =
41+
invalid monomorphization of `{$name}` intrinsic: expected return type with length {$in_len} (same as input type `{$in_ty}`), found `{$ret_ty}` with length {$out_len}
42+
43+
codegen_gcc_invalid_monomorphization_return_element =
44+
invalid monomorphization of `{$name}` intrinsic: expected return element type `{$in_elem}` (element of input `{$in_ty}`), found `{$ret_ty}` with element type `{$out_ty}`
45+
46+
codegen_gcc_invalid_monomorphization_return_type =
47+
invalid monomorphization of `{$name}` intrinsic: expected return type `{$in_elem}` (element of input `{$in_ty}`), found `{$ret_ty}`
48+
49+
codegen_gcc_invalid_monomorphization_inserted_type =
50+
invalid monomorphization of `{$name}` intrinsic: expected inserted type `{$in_elem}` (element of input `{$in_ty}`), found `{$out_ty}`
51+
52+
codegen_gcc_invalid_monomorphization_return_integer_type =
53+
invalid monomorphization of `{$name}` intrinsic: expected return type with integer elements, found `{$ret_ty}` with non-integer `{$out_ty}`
54+
55+
codegen_gcc_invalid_monomorphization_mismatched_lengths =
56+
invalid monomorphization of `{$name}` intrinsic: mismatched lengths: mask length `{$m_len}` != other vector length `{$v_len}`
57+
58+
codegen_gcc_invalid_monomorphization_unsupported_cast =
59+
invalid monomorphization of `{$name}` intrinsic: unsupported cast from `{$in_ty}` with element `{$in_elem}` to `{$ret_ty}` with element `{$out_elem}`
60+
61+
codegen_gcc_invalid_monomorphization_unsupported_operation =
62+
invalid monomorphization of `{$name}` intrinsic: unsupported operation on `{$in_ty}` with element `{$in_elem}`

src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModul
7373
use rustc_codegen_ssa::target_features::supported_target_features;
7474
use rustc_codegen_ssa::traits::{CodegenBackend, ExtraBackendMethods, ModuleBufferMethods, ThinBufferMethods, WriteBackendMethods};
7575
use rustc_data_structures::fx::FxHashMap;
76-
use rustc_errors::{ErrorGuaranteed, Handler};
76+
use rustc_errors::{DiagnosticMessage, ErrorGuaranteed, Handler, SubdiagnosticMessage};
77+
use rustc_macros::fluent_messages;
7778
use rustc_metadata::EncodedMetadata;
7879
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
7980
use rustc_middle::ty::TyCtxt;
@@ -84,6 +85,8 @@ use rustc_span::Symbol;
8485
use rustc_span::fatal_error::FatalError;
8586
use tempfile::TempDir;
8687

88+
fluent_messages! { "../locales/en-US.ftl" }
89+
8790
pub struct PrintOnPanic<F: Fn() -> String>(pub F);
8891

8992
impl<F: Fn() -> String> Drop for PrintOnPanic<F> {

0 commit comments

Comments
 (0)