summary refs log tree commit diff
path: root/compiler/rustc_passes/src/errors.rs
AgeCommit message (Collapse)AuthorLines
2024-10-12Rollup merge of #131567 - ↵Matthias Krüger-0/+11
CastilloDel:reject-unstable-with-accepted-features, r=jieyouxu Emit an error for unstable attributes that reference already stable features Closes https://github.com/rust-lang/rust/issues/129814
2024-10-12Emit an error for unstable attributes that reference already stable featuresCastilloDel-0/+11
Add missing error annotations and .stderr file Acknowledge comments
2024-10-06various fixes for `naked_asm!` implementationFolkert de Vries-2/+1
- fix for divergence - fix error message - fix another cranelift test - fix some cranelift things - don't set the NORETURN option for naked asm - fix use of naked_asm! in doc comment - fix use of naked_asm! in run-make test - use `span_bug` in unreachable branch
2024-10-06remove checks that are now performed during macro expansion of `naked_asm!`Folkert de Vries-15/+0
2024-10-06disallow `asm!` in `#[naked]` functionsFolkert de Vries-4/+4
also disallow the `noreturn` option, and infer `naked_asm!` as `!`
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-10/+6
2024-09-13Remove unnecessary lifetime from `FeaturePreviouslyDeclared`.Nicholas Nethercote-2/+2
2024-09-10disallow `naked_asm!` outside of `#[naked]` functionsFolkert de Vries-0/+7
2024-09-01Revert "Auto merge of #127537 - veluca93:struct_tf, r=BoxyUwU"Jakub Beránek-9/+0
This reverts commit acb4e8b6251f1d8da36f08e7a70fa23fc581839e, reversing changes made to 100fde5246bf56f22fb5cc85374dd841296fce0e.
2024-08-29Add `warn(unreachable_pub)` to `rustc_passes`.Nicholas Nethercote-183/+183
2024-08-28Implement RFC 3525.Luca Versari-0/+9
2024-08-26Rollup merge of #129544 - mu001999-contrib:dead-code/clean, r=compiler-errorsMatthias Krüger-7/+0
Removes dead code from the compiler Detected by #128637
2024-08-25Removes dead code from the compilermu001999-7/+0
2024-08-24New `#[rustc_pub_transparent]` attributePavel Grigorenko-0/+9
2024-08-21Use bool in favor of Option<()> for diagnosticsMichael Goulet-2/+2
2024-08-18Check that `#[may_dangle]` is properly appliedGoldstein-0/+7
It's only valid when applied to a type or lifetime parameter in `Drop` trait implementation.
2024-08-17Emit an error for invalid use of the linkage attributeShina-0/+9
2024-08-03Assert that all attributes are actually checked via `CheckAttrVisitor` and ↵Oli Scherer-0/+7
aren't accidentally usable on completely unrelated HIR nodes Co-authored-by: Jieyou Xu <jieyouxu@outlook.com>
2024-07-31Emit an error if `#[optimize]` is applied to an incompatible itemclubby789-0/+4
2024-07-29Reformat `use` declarations.Nicholas Nethercote-7/+6
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-27switch to an allowlist approachFolkert-2/+3
- merge error codes - use attribute name that is incompatible in error message - add test for conditional incompatible attribute - add `linkage` to the allowlist
2024-07-16improve error message when `#[naked]` is used with `#[track-caller] and ↵Folkert-1/+1
`#[target-feature]``
2024-07-16improve error message when `#[naked]` is used with `#[inline]`Folkert-14/+10
2024-07-10Report usage of lib features in ast validationMichael Goulet-8/+0
2024-06-29Rollup merge of #127118 - surechen:fix_126789, r=jieyouxuMatthias Krüger-0/+3
Show `used attribute`'s kind for user when find it isn't applied to a `static` variable. For example : ```rust extern "C" { #[used] //~ ERROR attribute must be applied to a `static` variable static FOO: i32; // show the kind of this item to help user understand why the error is reported. } ``` fixes #126789
2024-06-29Show `used attribute`'s kind for user when find it isn't applied to a ↵surechen-0/+3
`static` variable. fixes #126789
2024-06-24coverage: Always error on `#[coverage(..)]` in unexpected placesZalathar-14/+2
This upgrades some warnings to errors, and also catches cases where the attribute was silently ignored.
2024-06-23Add hard error and migration lint for unsafe attrscarbotaniuman-10/+1
2024-06-19Rollup merge of #124580 - gurry:124556-suggest-remove-tuple-field, r=jackh726León Orell Valerian Liehr-6/+13
Suggest removing unused tuple fields if they are the last fields Fixes #124556 We now check if dead/unused fields are the last fields of the tuple and suggest their removal instead of suggesting them to be changed to `()`.
2024-06-18Use a dedicated type instead of a reference for the diagnostic contextOli Scherer-7/+7
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-06Error on unsafe on non-unsafe attributecarbotaniuman-1/+10
2024-05-23Rollup merge of #123623 - surechen:fix_123261, r=estebankMatthias Krüger-2/+2
Fix OutsideLoop's error suggestion: adding label `'block` for `if` block. For OutsideLoop we should not suggest add `'block` label in `if` block, or we wiil get another err: block label not supported here. fixes #123261
2024-05-22For OutsideLoop we should not suggest add 'block label in if block, or we ↵surechen-2/+2
wiil get another err: block label not supported here. fixes #123261
2024-05-21Move `#[do_not_recommend]` to the `#[diagnostic]` namespaceGeorg Semmler-5/+2
This commit moves the `#[do_not_recommend]` attribute to the `#[diagnostic]` namespace. It still requires `#![feature(do_not_recommend)]` to work.
2024-05-13Suggest removing unused tuple fields if they are the last fieldsGurinder Singh-6/+13
2024-05-08Fix Error Messages for `break` Inside CoroutinesVeera-4/+6
Previously, `break` inside `gen` blocks and functions were incorrectly identified to be enclosed by a closure. This PR fixes it by displaying an appropriate error message for async blocks, async closures, async functions, gen blocks, gen closures, gen functions, async gen blocks, async gen closures and async gen functions. Note: gen closure and async gen closure are not supported by the compiler yet but I have added an error message here assuming that they might be implemented in the future. Also, fixes grammar in a few places by replacing `inside of a $coroutine` with `inside a $coroutine`.
2024-05-04Various improvements to entrypoint codeNilstrieb-16/+0
This moves some code around and adds some documentation comments to make it easier to understand what's going on with the entrypoint logic, which is a bit complicated. The only change in behavior is consolidating the error messages for unix_sigpipe to make the code slightly simpler.
2024-05-02Change `SIGPIPE` ui from `#[unix_sigpipe = "..."]` to `-Zon-broken-pipe=...`Martin Nordholts-7/+0
In the stabilization attempt of `#[unix_sigpipe = "sig_dfl"]`, a concern was raised related to using a language attribute for the feature: Long term, we want `fn lang_start()` to be definable by any crate, not just libstd. Having a special language attribute in that case becomes awkward. So as a first step towards towards the next stabilization attempt, this PR changes the `#[unix_sigpipe = "..."]` attribute to a compiler flag `-Zon-broken-pipe=...` to remove that concern, since now the language is not "contaminated" by this feature. Another point was also raised, namely that the ui should not leak **how** it does things, but rather what the **end effect** is. The new flag uses the proposed naming. This is of course something that can be iterated on further before stabilization.
2024-04-23Rollup merge of #124218 - Xiretza:subsubdiagnostics, r=davidtwcoLeón Orell Valerian Liehr-1/+1
Allow nesting subdiagnostics in #[derive(Subdiagnostic)]
2024-04-21Pass translation closure to add_to_diag_with() as referenceXiretza-1/+1
2024-04-17weak lang items are not allowed to be #[track_caller]Ralf Jung-0/+10
2024-03-11Rename `AddToDiagnostic` as `Subdiagnostic`.Nicholas Nethercote-4/+4
To match `derive(Subdiagnostic)`. Also rename `add_to_diagnostic{,_with}` as `add_to_diag{,_with}`.
2024-03-11Rename `IntoDiagnostic` as `Diagnostic`.Nicholas Nethercote-12/+12
To match `derive(Diagnostic)`. Also rename `into_diagnostic` as `into_diag`.
2024-03-05Rename `SubdiagnosticMessageOp` as `SubdiagMessageOp`.Nicholas Nethercote-2/+2
2024-02-28Rename `DiagnosticSymbolList` as `DiagSymbolList`.Nicholas Nethercote-5/+5
2024-02-28Rename `DiagnosticBuilder` as `Diag`.Nicholas Nethercote-13/+12
Much better! Note that this involves renaming (and updating the value of) `DIAGNOSTIC_BUILDER` in clippy.
2024-02-20Reduce capabilities of `Diagnostic`.Nicholas Nethercote-4/+7
Currently many diagnostic modifier methods are available on both `Diagnostic` and `DiagnosticBuilder`. This commit removes most of them from `Diagnostic`. To minimize the diff size, it keeps them within `diagnostic.rs` but changes the surrounding `impl Diagnostic` block to `impl DiagnosticBuilder`. (I intend to move things around later, to give a more sensible code layout.) `Diagnostic` keeps a few methods that it still needs, like `sub`, `arg`, and `replace_args`. The `forward!` macro, which defined two additional methods per call (e.g. `note` and `with_note`), is replaced by the `with_fn!` macro, which defines one additional method per call (e.g. `with_note`). It's now also only used when necessary -- not all modifier methods currently need a `with_*` form. (New ones can be easily added as necessary.) All this also requires changing `trait AddToDiagnostic` so its methods take `DiagnosticBuilder` instead of `Diagnostic`, which leads to many mechanical changes. `SubdiagnosticMessageOp` gains a type parameter `G`. There are three subdiagnostics -- `DelayedAtWithoutNewline`, `DelayedAtWithNewline`, and `InvalidFlushedDelayedDiagnosticLevel` -- that are created within the diagnostics machinery and appended to external diagnostics. These are handled at the `Diagnostic` level, which means it's now hard to construct them via `derive(Diagnostic)`, so instead we construct them by hand. This has no effect on what they look like when printed. There are lots of new `allow` markers for `untranslatable_diagnostics` and `diagnostics_outside_of_impl`. This is because `#[rustc_lint_diagnostics]` annotations were present on the `Diagnostic` modifier methods, but missing from the `DiagnosticBuilder` modifier methods. They're now present.
2024-02-08Rollup merge of #120734 - nnethercote:SubdiagnosticMessageOp, r=compiler-errorsMatthias Krüger-1/+2
Add `SubdiagnosticMessageOp` as a trait alias. It avoids a lot of repetition. r? matthewjasper
2024-02-08Add `SubdiagnosticMessageOp` as a trait alias.Nicholas Nethercote-1/+2
It avoids a lot of repetition.
2024-02-07Rollup merge of #120470 - estebank:issue-54196, r=compiler-errorsGuillaume Boisseau-2/+2
Mark "unused binding" suggestion as maybe incorrect Ignoring unused bindings should be a determination made by a human, `rustfix` shouldn't auto-apply the suggested change. Fix #54196.