about summary refs log tree commit diff
path: root/compiler/rustc_passes/src/errors.rs
AgeCommit message (Collapse)AuthorLines
2023-10-26Tweak suggestion spans for invalid crate-level inner attributeEsteban Küber-5/+15
CC #89566.
2023-10-24Store 'since' attribute as parsed VersionDavid Tolnay-10/+0
2023-10-19Rollup merge of #116829 - fmease:rust-aint-c, r=compiler-errorsLeón Orell Valerian Liehr-1/+8
Make `#[repr(Rust)]` incompatible with other (non-modifier) representation hints like `C` and `simd` Read more about this change here: https://github.com/rust-lang/rust/pull/116829#issuecomment-1768618240. Fixes [after backport] #116825.
2023-10-18Make `#[repr(Rust)]` and `#[repr(C)]` incompatible with one anotherLeón Orell Valerian Liehr-1/+8
2023-10-13Format all the let chains in compilerMichael Goulet-1/+3
2023-10-09Suggest labeling block if `break` is in bare blockEsteban Küber-0/+10
Fix #103982.
2023-09-25Gate and validate #[rustc_safe_intrinsic]León Orell Valerian Liehr-0/+9
2023-09-18Prevent using `#[target_feature]` on lang item functionsEduardo Sánchez Muñoz-0/+10
2023-09-14Auto merge of #114656 - bossmc:rework-no-coverage-attr, r=oli-obkbors-8/+8
Rework `no_coverage` to `coverage(off)` As discussed at the tail of https://github.com/rust-lang/rust/issues/84605 this replaces the `no_coverage` attribute with a `coverage` attribute that takes sub-parameters (currently `off` and `on`) to control the coverage instrumentation. Allows future-proofing for things like `coverage(off, reason="Tested live", issue="#12345")` or similar.
2023-09-08Rework no_coverage to coverage(off)Andy Caldwell-8/+8
2023-09-07add support for rustc_abi(assert_eq) and use it to test some ↵Ralf Jung-0/+9
repr(transparent) cases
2023-09-06rustc_layout/abi: error when attribute is applied to the wrong thingRalf Jung-8/+22
2023-08-27add rustc_abi debugging attributeRalf Jung-0/+9
2023-08-07check_attrs: Warn when #[macro_export] is used on macros 2.0Arthur Cohen-0/+4
The compiler should emit a more specific error when the `#[macro_export]` attribute is present on a decl macro, instead of silently ignoring it. This commit adds the required error message in rustc_passes/messages.ftl, as well as a note. A new variant is added to the `errors::MacroExport` enum, specifically for the case where the attribute is added to a macro 2.0.
2023-07-24validate `doc(masked)`Lukas Markeffsky-0/+19
2023-07-16Add infrastructure `#[rustc_confusables]` attribute to allow targeted许杰友 Jieyou Xu (Joe)-0/+32
"no method" errors on standard library types The standard library developer can annotate methods on e.g. `BTreeSet::push` with `#[rustc_confusables("insert")]`. When the user mistypes `btreeset.push()`, `BTreeSet::insert` will be suggested if there are no other candidates to suggest.
2023-06-28Auto merge of #111269 - clubby789:validate-fluent-variables, r=davidtwcobors-8/+0
Validate fluent variable references in tests Closes #101109 Under `cfg(test)`, the `fluent_messages` macro will emit a list of variables referenced by each message and its attributes. The derive attribute will now emit a `#[test]` that checks that each referenced variable exists in the structure it's applied to.
2023-06-20Merge attrs, better validationMichael Goulet-7/+0
2023-05-29Avoid ICE on `#![doc(test(...)]` with literal parameterObei Sideg-0/+4
2023-05-26Fix diagnostics with errorsclubby789-8/+0
2023-04-26Migrate `rustc_passes` to translatable diagnosticsclubby789-1/+159
2023-04-16Allow all associated functions and add testDeadbeef-2/+2
2023-04-14allow `repr(align = x)` on inherent methodsDeadbeef-2/+2
2023-03-30Rename doc(primitive) into rustc_doc_primitiveGuillaume Gomez-4/+0
2023-03-14Simplify proc macro signature validity checkMichael Goulet-43/+2
2023-02-26Merge the two diagnostics.Camille GILLOT-11/+5
2023-02-22Add check for invalid \`#[macro_export]\` argumentsblyxyas-2/+10
2023-02-22errors: generate typed identifiers in each crateDavid Wood-47/+45
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-01Auto merge of #107257 - inquisitivecrystal:ffi-attr, r=davidtwcobors-0/+28
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-30session: diagnostic migration lint on more fnsDavid Wood-0/+7
Apply the diagnostic migration lint to more functions on `Session`. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-26Rollup merge of #106407 - mejrs:attr_check, r=compiler-errorsMatthias Krüger-0/+50
Improve proc macro attribute diagnostics Closes https://github.com/rust-lang/rust/issues/102923
2023-01-24Move FFI attribute validation to `check_attr`inquisitivecrystal-0/+28
2023-01-12[RFC 2397] Deny incorrect locationsCaio-0/+7
2023-01-12Improve proc macro attribute diagnosticsmejrs-0/+50
2022-11-11Print all labels, even if they have no span. Fall back to main item's span.Oli Scherer-0/+3
2022-11-05Specify that `break` cannot be used outside of loop *or* labeled blockclubby789-0/+1
2022-11-04Rollup merge of #103397 - crlf0710:port_dead_code_lint, r=davidtwcoMatthias Krüger-1/+59
Port `dead_code` lints to be translatable. This adds an additional comma to lists with three or more items, to be consistent with list formatters like `icu4x`. r? `@davidtwco`
2022-11-04Use `derive(Subdiagnostic)` for `ChangeFieldsToBeOfUnitType`.Charles Lew-23/+3
2022-11-01Rollup merge of #103575 - Xiretza:suggestions-style-attr, r=davidtwcoManish Goregaokar-1/+1
Change #[suggestion_*] attributes to use style="..." As discussed [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20tool_only_span_suggestion), this changes `#[(multipart_)suggestion_{short,verbose,hidden}(...)]` attributes to plain `#[(multipart_)suggestion(...)]` attributes with a `style = "{short,verbose,hidden}"` parameter. It also adds a new style, `tool-only`, that corresponds to `tool_only_span_suggestion`/`tool_only_multipart_suggestion` and causes the suggestion to not be shown in human-readable output at all. Best reviewed commit-by-commit, there's a bit of noise in there. cc #100717 `@compiler-errors` r? `@davidtwco`
2022-11-01Auto merge of #103217 - mejrs:track, r=eholkbors-0/+5
Track where diagnostics were created. This implements the `-Ztrack-diagnostics` flag, which uses `#[track_caller]` to track where diagnostics are created. It is meant as a debugging tool much like `-Ztreat-err-as-bug`. For example, the following code... ```rust struct A; struct B; fn main(){ let _: A = B; } ``` ...now emits the following error message: ``` error[E0308]: mismatched types --> src\main.rs:5:16 | 5 | let _: A = B; | - ^ expected struct `A`, found struct `B` | | | expected due to this -Ztrack-diagnostics: created at compiler\rustc_infer\src\infer\error_reporting\mod.rs:2275:31 ```
2022-10-31Rewrite implementation of `#[alloc_error_handler]`Amanieu d'Antras-8/+0
The new implementation doesn't use weak lang items and instead changes `#[alloc_error_handler]` to an attribute macro just like `#[global_allocator]`. The attribute will generate the `__rg_oom` function which is called by the compiler-generated `__rust_alloc_error_handler`. If no `__rg_oom` function is defined in any crate then the compiler shim will call `__rdl_oom` in the alloc crate which will simply panic. This also fixes link errors with `-C link-dead-code` with `default_alloc_error_handler`: `__rg_oom` was previously defined in the alloc crate and would attempt to reference the `oom` lang item, even if it didn't exist. This worked as long as `__rg_oom` was excluded from linking since it was not called. This is a prerequisite for the stabilization of `default_alloc_error_handler` (#102318).
2022-10-31Add more track_callermejrs-0/+5
2022-10-26Convert all #[suggestion_*] attributes to #[suggestion(style = "...")]Xiretza-1/+1
Using the following command: find compiler/ -type f -name '*.rs' -exec perl -i -gpe \ 's/(#\[\w*suggestion)_(short|verbose|hidden)\(\s*(\S+,)?/\1(\3style = "\2",/g' \ '{}' +
2022-10-24Port `dead_code` lints to be translatable.Charles Lew-1/+79
2022-10-23Migrate all diagnosticsNilstrieb-201/+200
2022-10-14Add missing checks for `doc(cfg_hide(...))` attributeGuillaume Gomez-0/+4
2022-10-07avoid string dispatch in fluentNathan Stocks-7/+36
2022-10-07avoid string dispatch in fluentNathan Stocks-7/+15
2022-10-07Remove code that was removed in master, and the corresponding diagnosticNathan Stocks-9/+0
2022-10-07First batch of review feedback changes from #102110Nathan Stocks-9/+1