summary refs log tree commit diff
path: root/compiler/rustc_error_messages
AgeCommit message (Collapse)AuthorLines
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.
2023-02-04Fix #103320, add explanatory message for [#must_use]yukang-1/+2
2023-02-03Fix suggestion for coercing Option<&String> to Option<&str>clubby789-0/+2
2023-02-02Rollup merge of #107493 - clubby789:range-fat-arrow-followup, r=estebankMatthias Krüger-2/+3
Improve diagnostic for missing space in range pattern Improves the diagnostic in #107425 by turning it into a note explaining the parsing issue. r? `@compiler-errors`
2023-02-02Improve diagnostic for missing space in range patternclubby789-2/+3
2023-02-02Add a new `rustc_driver` dylib to rexport `rustc_driver_impl`John Kåre Alsaker-12/+12
2023-02-02Recover _ as .. in field patternMichael Goulet-2/+2
2023-02-01Make "use latest edition" subdiagnostic translatableXiretza-0/+8
2023-02-01migrate parser::ty to diagnostic structsXiretza-0/+35
2023-02-01rustc_parse: migrate more to diagnostic structsXiretza-0/+149
2023-02-01Auto merge of #107257 - inquisitivecrystal:ffi-attr, r=davidtwcobors-0/+12
Strengthen validation of FFI attributes Previously, `codegen_attrs` validated the attributes `#[ffi_pure]`, `#[ffi_const]`, and `#[ffi_returns_twice]` to make sure that they were only used on foreign functions. However, this validation was insufficient in two ways: 1. `codegen_attrs` only sees items for which code must be generated, so it was unable to raise errors when the attribute was incorrectly applied to macros and the like. 2. the validation code only checked that the item with the attr was foreign, but not that it was a foreign function, allowing these attributes to be applied to foreign statics as well. This PR moves the validation to `check_attr`, which sees all items. It additionally changes the validation to ensure that the attribute's target is `Target::ForeignFunction`, only allowing the attributes on foreign functions and not foreign statics. Because these attributes are unstable, there is no risk for backwards compatibility. The changes also ending up making the code much easier to read. This PR is best reviewed commit by commit. Additionally, I was considering moving the tests to the `attribute` subdirectory, to get them out of the general UI directory. I could do that as part of this PR or a follow-up, as the reviewer prefers. CC: #58328, #58329
2023-01-30incremental: migrate diagnosticsDavid Wood-0/+119
Migrate the `rustc_incremental` crate's diagnostics to translatable diagnostic structs. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-30session: diagnostic migration lint on more fnsDavid Wood-1/+75
Apply the diagnostic migration lint to more functions on `Session`. Signed-off-by: David Wood <david.wood@huawei.com>