about summary refs log tree commit diff
path: root/compiler/rustc_macros/src
AgeCommit message (Collapse)AuthorLines
2023-04-11Auto merge of #110092 - clubby789:builtin-macros-translatable, r=compiler-errorsbors-2/+4
Migrate most of `rustc_builtin_macros` to diagnostic impls cc #100717 This is a couple of days work, but I decided to stop for now before the PR becomes too big. There's around 50 unresolved failures when `rustc::untranslatable_diagnostic` is denied, which I'll finish addressing once this PR goes thtough A couple of outputs have changed, but in all instances I think the changes are an improvement/are more consistent with other diagnostics (although I'm happy to revert any which seem worse)
2023-04-10Migrate most of `rustc_builtin_macros` to diagnostic implsclubby789-2/+4
Co-authored-by: Joe ST <joe@fbstj.net> Co-authored-by: Michael Goulet <michael@errs.io>
2023-04-09Inline format_argsNilstrieb-1/+1
Co-authored-by: Michael Goulet <michael@errs.io>
2023-04-09Fix some clippy::complexityNilstrieb-2/+2
2023-04-09Some simple `clippy::perf` fixesNilstrieb-1/+1
2023-04-08Remove `remap_env_constness` in queriesDeadbeef-8/+0
2023-04-06address commentsDeadbeef-45/+50
2023-04-06fix errorsDeadbeef-1/+2
2023-04-06fix and bless ui tests 1/2Deadbeef-1/+19
2023-04-06migrate rustc_macros to syn 2.0Deadbeef-336/+255
2023-03-31Don't emit the OS error in a noteest31-3/+6
This makes it possible to make the normalization of the error message more precise, allowing us to not normalize all notes away.
2023-03-31Use std::fs::read_to_file in fluent_messages macroest31-11/+3
2023-03-29Check for escape sequences in Fluent resourcesclubby789-0/+12
2023-02-27Allow using `bool` for optional diagnosticsclubby789-5/+18
2023-02-25Emit the enum discriminant separately for the Encodable macroJohn Kåre Alsaker-17/+30
2023-02-22Auto merge of #108340 - eggyal:remove_traversal_trait_aliases, r=oli-obkbors-6/+6
Remove type-traversal trait aliases #107924 moved the type traversal (folding and visiting) traits into the type library, but created trait aliases in `rustc_middle` to minimise both the API churn for trait consumers and the arising boilerplate. As mentioned in that PR, an alternative approach of defining subtraits with blanket implementations of the respective supertraits was also considered at that time but was ruled out as not adding much value. Unfortunately, it has since emerged that rust-analyzer has difficulty with these trait aliases at present, resulting in a degraded contributor experience (see the recent [r-a has become useless](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/r-a.20has.20become.20useless) topic on the #t-compiler/help Zulip stream). This PR removes the trait aliases, and accordingly the underlying type library traits are now used directly; they are parameterised by `TyCtxt<'tcx>` rather than just the `'tcx` lifetime, and imports have been updated to reflect the fact that the trait aliases' explicitly named traits are no longer automatically brought into scope. These changes also roll-back the (no-longer required) workarounds to #107747 that were made in b409329c624b9e3bbd7d8e07697e2e9f861a45b6. Since this PR is just a find+replace together with the changes necessary for compilation & tidy to pass, it's currently just one mega-commit. Let me know if you'd like it broken up. r? `@oli-obk`
2023-02-22Remove type-traversal trait aliasesAlan Egerton-6/+6
2023-02-22errors: generate typed identifiers in each crateDavid Wood-241/+230
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-14Use derive attributes for uninteresting traversalsAlan Egerton-7/+64
2023-02-13Make folding traits generic over the InternerAlan Egerton-1/+1
2023-02-13Make visiting traits generic over the InternerAlan Egerton-1/+1
2023-02-13Alias folding/visiting traits instead of re-exportAlan Egerton-4/+4
2023-02-01Forbid #[suggestion_*(...)] on VecsXiretza-43/+66
It is ambiguous whether this should produce several `.span_suggestions()` calls or one `.multipart_suggestions()` call.
2023-01-27Detect references to non-existant messages in Fluent resourcesclubby789-2/+32
2023-01-17Stop using `BREAK` & `CONTINUE` in compilerScott McMurray-1/+1
Switching them to `Break(())` and `Continue(())` instead. libs-api would like to remove these constants, so stop using them in compiler to make the removal PR later smaller.
2023-01-11Support eager subdiagnostics againmejrs-4/+21
2023-01-05Fix `uninlined_format_args` for some compiler cratesnils-24/+19
Convert all the crates that have had their diagnostic migration completed (except save_analysis because that will be deleted soon and apfloat because of the licensing problem).
2023-01-04Simplify some iterator combinatorsMichael Goulet-2/+1
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-2/+2
2022-12-20Auto merge of #105880 - Nilstrieb:make-newtypes-less-not-rust, r=oli-obkbors-102/+53
Improve syntax of `newtype_index` This makes it more like proper Rust and also makes the implementation a lot simpler. Mostly just turns weird flags in the body into proper attributes. It should probably also be converted to an attribute macro instead of function-like, but that can be done in a future PR.
2022-12-18A few small cleanups for `newtype_index`Nilstrieb-25/+13
Remove the `..` from the body, only a few invocations used it and it's inconsistent with rust syntax. Use `;` instead of `,` between consts. As the Rust syntax gods inteded.
2022-12-18Make `#[debug_format]` an attribute in `newtype_index`Nilstrieb-45/+21
This removes the `custom` format functionality as its only user was trivially migrated to using a normal format. If a new use case for a custom formatting impl pops up, you can add it back.
2022-12-18Make `#[max]` an attribute in `newtype_index`Nilstrieb-10/+11
2022-12-18Make `#[no_ord_impl]` an attribute in `newtype_index`Nilstrieb-8/+4
2022-12-18Make `#[custom_encodable]` an attribute for `newtype_index`Nilstrieb-10/+12
Makes the syntax a little more rusty.
2022-12-18Use `#[derive]` instead of custom syntax in all `newtype_index`Nilstrieb-12/+0
2022-12-18use &str / String literals instead of format!()Matthias Krüger-8/+4
2022-12-15more clippy::complexity fixesMatthias Krüger-1/+1
2022-12-14Auto merge of #105233 - mejrs:always_eager, r=estebankbors-36/+11
Always evaluate vecs of subdiagnostics eagerly See https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20lists!/near/310186705 for context
2022-12-06Auto merge of #105220 - oli-obk:feeding, r=cjgillotbors-4/+0
feed resolver_for_lowering instead of storing it in a field r? `@cjgillot` opening this as * a discussion for `no_hash` + `feedable` queries. I think we'll want those, but I don't quite understand why they are rejected beyond a double check of the stable hashes for situations where the query is fed but also read from incremental caches. * and a discussion on removing all untracked fields from TyCtxt and setting it up so that they are fed queries instead
2022-12-05feed resolver_for_lowering instead of storing it in a fieldOli Scherer-4/+0
2022-12-04Always evaluate vecs of subdiagnostics eagerlymejrs-36/+11
2022-12-01Remove useless borrows and derefsMaybe Waffle-32/+32
2022-11-29Sanity check computed value for feeable queries.Camille GILLOT-0/+9
2022-11-29Allow to set a query's result as a side effect.Camille GILLOT-1/+20
2022-11-26Auto merge of #103556 - clubby789:specialize-option-partial-eq, r=scottmcmbors-1/+27
Manually implement PartialEq for Option<T> and specialize non-nullable types This PR manually implements `PartialEq` and `StructuralPartialEq` for `Option`, which seems to produce slightly better codegen than the automatically derived implementation. It also allows specializing on the `core::num::NonZero*` and `core::ptr::NonNull` types, taking advantage of the niche optimization by transmuting the `Option<T>` to `T` to be compared directly, which can be done in just two instructions. A comparison of the original, new and specialized code generation is available [here](https://godbolt.org/z/dE4jxdYsa).
2022-11-21Improve slug name errormejrs-53/+45
2022-11-21Fix testsmejrs-31/+39
2022-11-21Match crate and slug namesmejrs-1/+53
2022-11-18couple of clippy::perf fixesMatthias Krüger-1/+1