about summary refs log tree commit diff
path: root/compiler/rustc_builtin_macros/messages.ftl
AgeCommit message (Collapse)AuthorLines
2025-09-14Move more early buffered lints to dyn lint diagnostics (1/N)León Orell Valerian Liehr-0/+11
2025-08-15Implement `#[derive(From)]`Jakub Beránek-0/+9
2025-08-14Remove the old target checking logicJonathan Brouwer-2/+0
2025-07-14update `cfg_select!` documentationFolkert de Vries-3/+3
and make internal terminology consistent Co-authored-by: Travis Cross <tc@traviscross.com>
2025-07-13make `cfg_select` a builtin macroFolkert de Vries-0/+6
2025-06-24Rollup merge of #142704 - tgross35:remove-concat_idents, r=fee1-deadGuillaume Gomez-4/+0
Remove the deprecated unstable `concat_idents!` macro In [rust-lang/rust#137653], the lang and libs-API teams did a joint FCP to deprecate and eventually remove the long-unstable `concat_idents!` macro. The deprecation is landing in 1.88, so do the removal here (target version 1.90). This macro has been superseded by the more recent `${concat(...)}` metavariable expression language feature, which avoids some of the limitations of `concat_idents!`. The metavar expression is unstably available under the [`macro_metavar_expr_concat`] feature. History is mildly interesting here: `concat_idents!` goes back to 2011 when it was introduced with 513276e595f8 ("Add #concat_idents[] and #ident_to_str[]"). The syntax looks a bit different but it still works about the same: let asdf_fdsa = "<.<"; assert(#concat_idents[asd,f_f,dsa] == "<.<"); assert(#ident_to_str[use_mention_distinction] == "use_mention_distinction"); (That test existed from introduction until its removal here.) Closes: https://github.com/rust-lang/rust/issues/29599 [rust-lang/rust#137653]: https://github.com/rust-lang/rust/pull/137653 [`macro_metavar_expr_concat`]: https://github.com/rust-lang/rust/issues/124225
2025-06-24Remove the deprecated `concat_idents!` macroTrevor Gross-4/+0
In [137653], the lang and libs-API teams did a joint FCP to deprecate and eventually remove the long-unstable `concat_idents!` macro. The deprecation is landing in 1.88, so do the removal here (target version 1.90). This macro has been superseded by the more recent `${concat(...)}` metavariable expression language feature, which avoids some of the limitations of `concat_idents!`. The metavar expression is unstably available under the [`macro_metavar_expr_concat`] feature. History is mildly interesting here: `concat_idents!` goes back to 2011 when it was introduced with 513276e595f8 ("Add #concat_idents[] and about the same: let asdf_fdsa = "<.<"; assert(#concat_idents[asd,f_f,dsa] == "<.<"); assert(#ident_to_str[use_mention_distinction] == "use_mention_distinction"); (That test existed from introduction until its removal here.) Closes: https://www.github.com/rust-lang/rust/issues/29599 [137653]: https://www.github.com/rust-lang/rust/pull/137653 [`macro_metavar_expr_concat`]: https://www.github.com/rust-lang/rust/issues/124225
2025-06-19Improve diagnostics for `concat_bytes!` with C string literalsTrevor Gross-0/+2
Use the same error as other invalid types for `concat_bytes!`, rather than using `ConcatCStrLit` from `concat!`. Also add more information with a note about why this doesn't work, and a suggestion to use a null-terminated byte string instead.
2025-05-28Rollup merge of #140697 - Sa4dUs:split-autodiff, r=ZuseZ4Trevor Gross-1/+0
Split `autodiff` into `autodiff_forward` and `autodiff_reverse` This PR splits `#[autodiff]` macro so `#[autodiff(df, Reverse, args)]` would become `#[autodiff_reverse(df, args)]` and `#[autodiff(df, Forward, args)]` would become `#[autodiff_forwad(df, args)]`.
2025-05-27move asm parsing code into `rustc_parse`Folkert de Vries-23/+4
2025-05-27support `#[cfg(...)]` on arguments to the `asm!` macrosFolkert de Vries-0/+5
2025-05-21Update UI testsMarcelo Domínguez-1/+0
2025-04-19Make `#[naked]` an unsafe attributeFolkert de Vries-2/+2
2025-04-13Improve `-Z crate-attr` diagnosticsjyn-2/+0
- Show the `#![ ... ]` in the span (to make it clear that it should not be included in the CLI argument) - Show more detailed errors when the crate has valid token trees but invalid syntax. Previously, `crate-attr=feature(foo),feature(bar)` would just say "invalid crate attribute" and point at the comma. Now, it explicitly says that the comma was unexpected, which is useful when using `--error-format=short`. It also fixes the column to show the correct span. - Recover from parse errors. Previously we would abort immediately on syntax errors; now we go on to try and type-check the rest of the crate. The new diagnostic code also happens to be slightly shorter.
2025-04-03add the autodiff batch mode frontendManuel Drehwald-0/+1
2025-03-11Combine autodiff errors togetherSa4dUs-2/+1
2025-03-11Fix ICE for invalid return activity and proper error handlingMarcelo Domínguez-0/+2
2024-12-30add suggestion for wrongly ordered format parametersDavis Muro-0/+2
2024-12-21Use E0665 for missing `#[default]` errorEsteban Küber-3/+3
Use orphaned error code for the same error it belonged to before. ``` error[E0665]: `#[derive(Default)]` on enum with no `#[default]` --> $DIR/macros-nonfatal-errors.rs:42:10 | LL | #[derive(Default)] | ^^^^^^^ LL | / enum NoDeclaredDefault { LL | | Foo, LL | | Bar, LL | | } | |_- this enum needs a unit variant marked with `#[default]` | = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) help: make this unit variant default by placing `#[default]` on it | LL | #[default] Foo, | ~~~~~~~~~~~~~~ help: make this unit variant default by placing `#[default]` on it | LL | #[default] Bar, | ~~~~~~~~~~~~~~ ```
2024-12-09Disallow `#[default] Variant {}` regardless of feature flagEsteban Küber-1/+1
2024-12-04make CoercePointee errors translatableDing Xiang Fei-0/+15
2024-10-11Single commit implementing the enzyme/autodiff frontendManuel Drehwald-0/+9
Co-authored-by: Lorenz Schmidt <bytesnake@mailbox.org>
2024-10-07Rollup merge of #128721 - Brezak:pointee-in-strange-places, r=pnkfelixJubilee-0/+2
Don't allow the `#[pointee]` attribute where it doesn't belong Error if the `#[pointee]` attribute is applied to anything but generic type parameters. Closes #128485 Related to #123430
2024-10-06Check that `#[pointee]` is applied only to generic argumentsBrezak-0/+2
2024-10-06implement `naked_asm` macroFolkert-12/+12
2024-08-04Rollup merge of #128305 - folkertdev:asm-parser-unsupported-operand, r=AmanieuMatthias Krüger-0/+3
improve error message when `global_asm!` uses `asm!` operands follow-up to https://github.com/rust-lang/rust/pull/128207 what was ``` error: expected expression, found keyword `in` --> src/lib.rs:1:31 | 1 | core::arch::global_asm!("{}", in(reg)); | ^^ expected expression ``` becomes ``` error: the `in` operand cannot be used with `global_asm!` --> $DIR/parse-error.rs:150:19 | LL | global_asm!("{}", in(reg)); | ^^ the `in` operand is not meaningful for global-scoped inline assembly, remove it ``` the span of the error is just the keyword, which means that we can't create a machine-applicable suggestion here. The alternative would be to attempt to parse the full operand, but then if there are syntax errors in the operand those would be presented to the user, even though the parser already knows that the output won't be valid. Also that would require more complexity in the parser. So I think this is a nice improvement at very low cost.
2024-07-30Add toggle for `parse_meta_item` unsafe parsingcarbotaniuman-3/+0
This makes it possible for the `unsafe(...)` syntax to only be valid at the top level, and the `NestedMetaItem`s will automatically reject `unsafe(...)`.
2024-07-28improve error message when global asm uses inline asm operandsFolkert-0/+3
2024-07-28Rollup merge of #127853 - folkertdev:naked-function-error-messages, r=bjorn3Matthias Krüger-0/+5
`#[naked]`: report incompatible attributes tracking issue: https://github.com/rust-lang/rust/issues/90957 this is a re-implementation of https://github.com/rust-lang/rust/pull/93809 by ``@bstrie`` which was closed 2 years ago due to inactivity. This PR takes some of the final comments into account, specifically providing a little more context in error messages, and using an allow list to determine which attributes are compatible with `#[naked]`. Notable attributes that are incompatible with `#[naked]` are: * `#[inline]` * `#[track_caller]` * ~~`#[target_feature]`~~ (this is now allowed, see PR discussion) * `#[test]`, `#[ignore]`, `#[should_panic]` These attributes just directly conflict with what `#[naked]` should do. Naked functions are still important for systems programming, embedded, and operating systems, so I'd like to move them forward.
2024-07-25improve error message when `global_asm!` uses `asm!` optionsFolkert-0/+4
2024-07-17add error message when `#[naked]` is used with `#[test]`Folkert-0/+5
2024-06-25Migrate some rustc_builtin_macros to SessionDiagnostiche1pa-0/+11
Signed-off-by: he1pa <18012015693@163.com>
2024-06-06Disallow unsafe in derivecarbotaniuman-0/+3
2024-05-21Convert uses of BuiltinLintDiag::Normal to custom variantsXiretza-2/+0
This ensures all diagnostic messages are created at diagnostic emission time, making them translatable.
2024-04-26Move some functions from `rustc_expand` to `rustc_builtin_macros`.Nicholas Nethercote-0/+6
These functions are only used in `rustc_builtin_macros`, so it makes sense for them to live there. This allows them to be changed from `pub` to `pub(crate)`.
2024-04-01Fix error message for `env!` when env var is not valid Unicodebeetrees-0/+2
2024-03-08Rollup merge of #119365 - nbdd0121:asm-goto, r=AmanieuMatthias Krüger-0/+2
Add asm goto support to `asm!` Tracking issue: #119364 This PR implements asm-goto support, using the syntax described in "future possibilities" section of [RFC2873](https://rust-lang.github.io/rfcs/2873-inline-asm.html#asm-goto). Currently I have only implemented the `label` part, not the `fallthrough` part (i.e. fallthrough is implicit). This doesn't reduce the expressive though, since you can use label-break to get arbitrary control flow or simply set a value and rely on jump threading optimisation to get the desired control flow. I can add that later if deemed necessary. r? ``@Amanieu`` cc ``@ojeda``
2024-03-01Remove unused fluent messagesr0cky-6/+0
2024-02-24Forbid asm unwind to work with labelsGary Guo-0/+2
2023-10-05Keep fluent slugs in alphabetical orderfrancorbacho-2/+2
2023-10-05Plurals in format redundant arguments suggestionfrancorbacho-1/+4
2023-10-05Use diagnostic impls and add suggestions in redundant format!() argsfrancorbacho-0/+11
2023-09-06add diagnostic for raw identifiers in format stringLukas Markeffsky-2/+4
2023-08-03Make test harness lint about unnnameable tests.Camille GILLOT-0/+2
2023-07-25builtin_macros: raw str in diagnostic outputDavid Wood-2/+2
If a raw string was used in the `env!` invocation, then it should also be shown in the diagnostic messages as a raw string. Signed-off-by: David Wood <david@davidtw.co>
2023-06-28fix typoHe1pa-1/+1
2023-06-25Migrate some rustc_builtin_macros to SessionDiagnosticHe1pa-0/+25
2023-05-25Ensure Fluent messages are in alphabetical orderclubby789-116/+116
2023-05-05Migrate offset_of from a macro to builtin # syntaxest31-4/+0
2023-04-30Migrate `builtin_macros::asm` diagnostics to translatable diagnosticsclubby789-0/+35