about summary refs log tree commit diff
path: root/compiler/rustc_error_messages
AgeCommit message (Collapse)AuthorLines
2023-11-26Remove `rustc_error_messages/messages.ftl`.Nicholas Nethercote-5/+0
It's empty, and it doesn't even make sense, because `rustc_error_messages` is a lower-level crate than `rustc_errors`.
2023-11-15Bump cfg(bootstrap)sMark Rousskov-2/+2
2023-10-30Clean up `rustc_*/Cargo.toml`.Nicholas Nethercote-6/+8
- Sort dependencies and features sections. - Add `tidy` markers to the sorted sections so they stay sorted. - Remove empty `[lib`] sections. - Remove "See more keys..." comments. Excluded files: - rustc_codegen_{cranelift,gcc}, because they're external. - rustc_lexer, because it has external use. - stable_mir, because it has external use.
2023-10-16docs: add Rust logo to more compiler cratesMichael Howell-0/+2
c6e6ecb1afea9695a42d0f148ce153536b279eb5 added it to some of the compiler's crates, but avoided adding it to all of them to reduce bit-rot. This commit adds to more.
2023-08-23Bump cfg(bootstrap)Mark Rousskov-1/+1
2023-08-03Add `internal_features` lintNilstrieb-0/+1
It lints against features that are inteded to be internal to the compiler and standard library. Implements MCP #596. We allow `internal_features` in the standard library and compiler as those use many features and this _is_ the standard library from the "internal to the compiler and standard library" after all. Marking some features as internal wasn't exactly the most scientific approach, I just marked some mostly obvious features. While there is a categorization in the macro, it's not very well upheld (should probably be fixed in another PR). We always pass `-Ainternal_features` in the testsuite About 400 UI tests and several other tests use internal features. Instead of throwing the attribute on each one, just always allow them. There's nothing wrong with testing internal features^^
2023-07-30inline format!() args up to and including rustc_middleMatthias Krüger-5/+5
2023-07-24borrowck/errors: fix i18n error in delayed bugDavid Wood-0/+8
During borrowck, the `MultiSpan` from a buffered diagnostic is cloned and used to emit a delayed bug indicating a diagnostic was buffered - when the buffered diagnostic is translated, then the cloned `MultiSpan` may contain labels which can only render with the diagnostic's arguments, but the delayed bug being emitted won't have those arguments. Adds a function which clones `MultiSpan` without also cloning the contained labels, and use this function when creating the buffered diagnostic delayed bug. Signed-off-by: David Wood <david@davidtw.co>
2023-07-19On nightly, dump ICE backtraces to diskEsteban Küber-0/+7
Implement rust-lang/compiler-team#578. When an ICE is encountered on nightly releases, the new rustc panic handler will also write the contents of the backtrace to disk. If any `delay_span_bug`s are encountered, their backtrace is also added to the file. The platform and rustc version will also be collected.
2023-07-07Require TAITs to be mentioned in the signatures of functions that register ↵Oli Scherer-2/+1
hidden types for them
2023-06-01Use translatable diagnostics in `rustc_const_eval`Deadbeef-0/+4
2023-05-29Use `Cow` in `{D,Subd}iagnosticMessage`.Nicholas Nethercote-18/+14
Each of `{D,Subd}iagnosticMessage::{Str,Eager}` has a comment: ``` // FIXME(davidtwco): can a `Cow<'static, str>` be used here? ``` This commit answers that question in the affirmative. It's not the most compelling change ever, but it might be worth merging. This requires changing the `impl<'a> From<&'a str>` impls to `impl From<&'static str>`, which involves a bunch of knock-on changes that require/result in call sites being a little more precise about exactly what kind of string they use to create errors, and not just `&str`. This will result in fewer unnecessary allocations, though this will not have any notable perf effects given that these are error paths. Note that I was lazy within Clippy, using `to_string` in a few places to preserve the existing string imprecision. I could have used `impl Into<{D,Subd}iagnosticMessage>` in various places as is done in the compiler, but that would have required changes to *many* call sites (mostly changing `&format("...")` to `format!("...")`) which didn't seem worthwhile.
2023-05-06correct literals for dyn thread safeSparrowLii-4/+4
2023-05-06introduce `DynSend` and `DynSync` auto traitSparrowLii-6/+7
2023-05-03Rollup merge of #111104 - Manishearth:icuup, r=compiler-errorsManish Goregaokar-3/+3
Update ICU4X to 1.2 Was released a couple weeks ago. Also needed to make progress on https://github.com/rust-lang/rust/issues/109302 (though this PR does not achieve that part just yet)
2023-05-03Restrict `From<S>` for `{D,Subd}iagnosticMessage`.Nicholas Nethercote-10/+26
Currently a `{D,Subd}iagnosticMessage` can be created from any type that impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static, str>`, which are reasonable. It also includes `&String`, which is pretty weird, and results in many places making unnecessary allocations for patterns like this: ``` self.fatal(&format!(...)) ``` This creates a string with `format!`, takes a reference, passes the reference to `fatal`, which does an `into()`, which clones the reference, doing a second allocation. Two allocations for a single string, bleh. This commit changes the `From` impls so that you can only create a `{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static, str>`. This requires changing all the places that currently create one from a `&String`. Most of these are of the `&format!(...)` form described above; each one removes an unnecessary static `&`, plus an allocation when executed. There are also a few places where the existing use of `&String` was more reasonable; these now just use `clone()` at the call site. As well as making the code nicer and more efficient, this is a step towards possibly using `Cow<'static, str>` in `{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing the `From<&'a str>` impls to `From<&'static str>`, which is doable, but I'm not yet sure if it's worthwhile.
2023-05-02Update ICU4X to 1.2Manish Goregaokar-3/+3
2023-04-18Add `rustc_fluent_macro` to decouple fluent from `rustc_macros`Nilstrieb-1/+3
Fluent, with all the icu4x it brings in, takes quite some time to compile. `fluent_messages!` is only needed in further downstream rustc crates, but is blocking more upstream crates like `rustc_index`. By splitting it out, we allow `rustc_macros` to be compiled earlier, which speeds up `x check compiler` by about 5 seconds (and even more after the needless dependency on `serde_json` is removed from `rustc_data_structures`).
2023-03-29Stabilize a portion of 'once_cell'Trevor Gross-1/+1
Move items not part of this stabilization to 'lazy_cell' or 'once_cell_try'
2023-03-11Simplify message pathsest31-1/+1
This makes it easier to open the messages file while developing on features. The commit was the result of automatted changes: for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done
2023-02-23Handle selecting the default locale bettermejrs-2/+5
2023-02-22various: translation resources from cg backendDavid Wood-1/+1
Extend `CodegenBackend` trait with a function returning the translation resources from the codegen backend, which can be added to the complete list of resources provided to the emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-22errors: generate typed identifiers in each crateDavid Wood-5071/+2
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 <david.wood@huawei.com>
2023-02-21hir-analysis: make one diagnostic translatableTshepang Mbambo-0/+3
2023-02-16Remove save-analysis.Nicholas Nethercote-2/+0
Most tests involving save-analysis were removed, but I kept a few where the `-Zsave-analysis` was an add-on to the main thing being tested, rather than the main thing being tested. For `x.py install`, the `rust-analysis` target has been removed. For `x.py dist`, the `rust-analysis` target has been kept in a degenerate form: it just produces a single file `reduced.json` indicating that save-analysis has been removed. This is necessary for rustup to keep working. Closes #43606.
2023-02-15Rollup merge of #107034 - IntQuant:issue-100717-infer-5, r=oli-obkMatthias Krüger-1/+38
Migrating rustc_infer to session diagnostics (part 4) `@rustbot` label +A-translation r? rust-lang/diagnostics cc https://github.com/rust-lang/rust/issues/100717
2023-02-14Rollup merge of #107673 - lukas-code:update-icu4x, r=davidtwcoMatthias Krüger-4/+3
update ICU4X to 1.1.0 This patch updates the ICU4X crates to version 1.1.0 and regenerates the static data for `rustc_baked_icu_data`. This is mostly an internal and bugfix update. It notably includes https://github.com/unicode-org/icu4x/pull/2834 to fix the future compatibility warning for [`BYTE_SLICE_IN_PACKED_STRUCT_WITH_DERIVE`](https://github.com/rust-lang/rust/issues/107457). [full changelog](https://github.com/unicode-org/icu4x/blob/icu%401.1.0/CHANGELOG.md)
2023-02-14Port PlaceholderRelationLfNotSatisfied diagnosticIQuant-1/+7
2023-02-14Port ConsiderAddingAwaitIQuant-0/+4
2023-02-14Port SuggestRemoveSemiOrReturnBindingIQuant-0/+5
2023-02-14Port WhereClauseSuggestionsNikita Tomashevich-0/+3
2023-02-14Resolve rebaseNikita Tomashevich-2/+0
2023-02-14Port another diagnosticNikita Tomashevich-2/+4
2023-02-14Port RefLongerThanDataNikita Tomashevich-0/+3
2023-02-14Port "BorrowedTooLong" diagnosticNikita Tomashevich-2/+4
2023-02-14Port OutlivesContent, OutlivesBound, FUllfillReqLifetime, ↵Nikita Tomashevich-0/+14
LfBoundNotSatisfied diagnostics
2023-02-12Auto merge of #105601 - BelovDV:change-rlib-with-not-stable, r=petrochenkovbors-1/+1
Enable new rlib in non stable cases If bundled static library uses cfg (unstable) or whole-archive (wasn't supported) bundled libs are packed even without packed_bundled_libs. r? `@petrochenkov`
2023-02-10Cleanup typos in en_US/borrowck.ftlJubilee-3/+3
2023-02-10[link] enable packed bundled lib in non stable casesDaniil Belov-1/+1
2023-02-10Auto merge of #102963 - ilammy:xray-basic, r=estebankbors-0/+2
Add `-Z instrument-xray` flag Implement MCP https://github.com/rust-lang/compiler-team/issues/561, adding `-Z instrument-xray` flag which enables XRay instrumentation in LLVM.
2023-02-09Rollup merge of #107446 - clubby789:rustc-parse-diag-migrate, r=compiler-errorsMatthias Krüger-0/+115
Migrate some of `rustc_parse` to derive diagnostics `@rustbot` label +A-translation r? rust-lang/diagnostics cc #100717
2023-02-09Emit an error if -Z instrument-xray is not supportedOleksii Lozovskyi-0/+2
This is somewhat important because LLVM enables the pass based on target architecture, but support by the target OS also matters. For example, XRay attributes are processed by codegen for macOS targets, but Apple linker fails to process relocations in XRay data sections, so the feature as a whole is not supported there for the time being.
2023-02-06Auto merge of #107727 - Dylan-DPC:rollup-b1yexcl, r=Dylan-DPCbors-0/+3
Rollup of 5 pull requests Successful merges: - #107553 (Suggest std::ptr::null if literal 0 is given to a raw pointer function argument) - #107580 (Recover from lifetimes with default lifetimes in generic args) - #107669 (rustdoc: combine duplicate rules in ayu CSS) - #107685 (Suggest adding a return type for async functions) - #107687 (Adapt SROA MIR opt for aggregated MIR) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-06Migrate `rustc_parse` to derive diagnosticsclubby789-0/+115
2023-02-06Rollup merge of #107580 - ↵Dylan DPC-0/+3
lenko-d:default_value_for_a_lifetime_generic_parameter_produces_confusing_diagnostic, r=compiler-errors Recover from lifetimes with default lifetimes in generic args Fixes [#107492](https://github.com/rust-lang/rust/issues/107492)
2023-02-06Auto merge of #103761 - chenyukang:yukang/fix-103320-must-use, r=compiler-errorsbors-1/+2
Add explanatory message for [#must_use] in ops Fixes #103320
2023-02-05Recover from missing expression in for loopObei Sideg-0/+3
2023-02-04Recover from default value for a lifetime in generic parameters.Lenko Donchev-0/+3
2023-02-04update ICU4X to 1.1.0Lukas Markeffsky-4/+3
2023-02-04Auto merge of #107549 - Zoxc:rustc-shared, r=jyn514bors-12/+12
Move code in `rustc_driver` out to a new `rustc_driver_impl` crate to allow pipelining That adds a `rustc_shared` library which contains all the rustc library crates in a single dylib. It takes over this role from `rustc_driver`. This is done so that `rustc_driver` can be compiled in parallel with other crates. `rustc_shared` is intentionally left empty so it only does linking. An alternative could be to move the code currently in `rustc_driver` into a new crate to avoid changing the name of the distributed library.