about summary refs log tree commit diff
path: root/compiler/rustc_passes/src/check_attr.rs
AgeCommit message (Collapse)AuthorLines
2023-03-30Rename doc(primitive) into rustc_doc_primitiveGuillaume Gomez-11/+0
2023-03-22rustc: Remove unused `Session` argument from some attribute functionsVadim Petrochenkov-1/+1
2023-03-14Tighter spansMichael Goulet-2/+35
2023-03-14Simplify proc macro signature validity checkMichael Goulet-88/+58
2023-03-13Better names?Michael Goulet-1/+1
2023-02-22Add check for invalid \`#[macro_export]\` argumentsblyxyas-2/+29
2023-02-22errors: generate typed identifiers in each crateDavid Wood-5/+5
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-17Auto merge of #107753 - kylematsuda:type-of, r=BoxyUwUbors-1/+1
Switch to `EarlyBinder` for `type_of` query Part of the work to finish #105779 and implement https://github.com/rust-lang/types-team/issues/78. Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `type_of` query and removes `bound_type_of`. r? `@lcnr`
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-1/+1
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-1/+1
2023-02-16Rename some region-specific stuffMichael Goulet-1/+1
2023-02-14add a `#[rustc_coinductive]` attributelcnr-0/+15
2023-02-05rustc_passes: remove huge error importsest31-32/+36
2023-02-01Auto merge of #107257 - inquisitivecrystal:ffi-attr, r=davidtwcobors-0/+35
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-30Replace enum `==`s with `match`es where it makes senseMaybe Waffle-26/+32
2023-01-28Remove `HirId -> LocalDefId` map from HIR.Camille GILLOT-2/+4
2023-01-26fixup new usages of fn_sig, bound_fn_sig after rebasingKyle Matsuda-1/+2
2023-01-26Rollup merge of #106407 - mejrs:attr_check, r=compiler-errorsMatthias Krüger-6/+140
Improve proc macro attribute diagnostics Closes https://github.com/rust-lang/rust/issues/102923
2023-01-24Make sure FFI attrs aren't used on foreign staticsinquisitivecrystal-9/+9
Previously, we verified that FFI attrs were used on foreign items, but this allowed them on both foreign functions and foreign statics. This change only allows them on foreign functions.
2023-01-24Move FFI attribute validation to `check_attr`inquisitivecrystal-0/+35
2023-01-12[RFC 2397] Deny incorrect locationsCaio-0/+11
2023-01-12Address feedbackmejrs-20/+36
2023-01-12Improve proc macro attribute diagnosticsmejrs-6/+124
2022-12-25fix more clippy::style findingsMatthias Krüger-3/+1
match_result_ok obfuscated_if_else single_char_add writeln_empty_string collapsible_match iter_cloned_collect unnecessary_mut_passed
2022-11-28Rename `NestedMetaItem::[Ll]iteral` as `NestedMetaItem::[Ll]it`.Nicholas Nethercote-6/+3
We already use a mix of `Literal` and `Lit`. The latter is better because it is shorter without causing any ambiguity.
2022-11-28Rename `ast::Lit` as `ast::MetaItemLit`.Nicholas Nethercote-2/+5
2022-11-18couple of clippy::perf fixesMatthias Krüger-1/+1
2022-11-13Store a LocalDefId in hir::Variant & hir::Field.Camille GILLOT-1/+1
2022-11-13Store a LocalDefId in hir::GenericParam.Camille GILLOT-2/+1
2022-11-13Ensure codegen_fn_attrs during collection.Camille GILLOT-12/+0
2022-11-12Rollup merge of #103970 - oli-obk:unhide_unknown_spans, r=estebankDylan DPC-13/+42
Unhide unknown spans r? ```@estebank```
2022-11-11Print all labels, even if they have no span. Fall back to main item's span.Oli Scherer-13/+42
2022-11-10Consider `#[must_use]` annotation on `async fn` as also affecting the ↵Esteban Küber-12/+2
`Future::Output` No longer lint against `#[must_use] async fn foo()`. When encountering a statement that awaits on a `Future`, check if the `Future`'s parent item is annotated with `#[must_use]` and emit a lint if so. This effectively makes `must_use` an annotation on the `Future::Output` instead of only the `Future` itself. Fix #78149.
2022-10-29Rename some `OwnerId` fields.Nicholas Nethercote-1/+1
spastorino noticed some silly expressions like `item_id.def_id.def_id`. This commit renames several `def_id: OwnerId` fields as `owner_id`, so those expressions become `item_id.owner_id.def_id`. `item_id.owner_id.local_def_id` would be even clearer, but the use of `def_id` for values of type `LocalDefId` is *very* widespread, so I left that alone.
2022-10-23Migrate all diagnosticsNilstrieb-6/+6
2022-10-15Rollup merge of #102954 - GuillaumeGomez:cfg-hide-attr-checks, r=ManishearthDylan DPC-0/+23
Add missing checks for `doc(cfg_hide(...))` Part of #43781. The `doc(cfg_hide(...))` attribute can only be used at the crate level and takes a list of attributes as argument. r? ```@Manishearth```
2022-10-14Add missing checks for `doc(cfg_hide(...))` attributeGuillaume Gomez-0/+23
2022-10-14more dupe word typosRageking8-14/+14
2022-10-12Rollup merge of #102110 - CleanCut:migrate_rustc_passes_diagnostics, r=davidtwcoDylan DPC-90/+61
Migrate rustc_passes diagnostics Picks up abandoned work from https://github.com/rust-lang/rust/pull/100870 I would like to do this collaboratively, as there is a lot of work! Here's the process: - Comment below that you are willing to help and I will add you as a collaborator to my `rust` fork (that gives you write access) - Indicate which file/task you would like to work on (so we don't duplicate work) from the list below - Do the work, push up a commit, comment that you're done with that file/task - Repeat until done 😄 ### Files to Migrate (in `compiler/rustc_passes/src/`) - [x] check_attr.rs ``@CleanCut`` - [x] check_const.rs ``@CleanCut`` - [x] dead.rs ``@CleanCut`` - [x] debugger_visualizer.rs ``@CleanCut`` - [x] diagnostic_items.rs ``@CleanCut`` - [x] entry.rs ``@CleanCut`` - [x] lang_items.rs ``@CleanCut`` - [x] layout_test.rs ``@CleanCut`` - [x] lib_features.rs ``@CleanCut`` - [x] ~liveness.rs~ ``@CleanCut`` Nothing to do - [x] loops.rs ``@CleanCut`` - [x] naked_functions.rs ``@CleanCut`` - [x] stability.rs ``@CleanCut`` - [x] weak_lang_items.rs ``@CleanCut`` ### Tasks - [x] Rebase on current `master` ``@CleanCut`` - [x] Review work from [the earlier PR](https://github.com/rust-lang/rust/pull/100870) and make sure it all looks good - [x] compiler/rustc_error_messages/locales/en-US/passes.ftl ``@CleanCut`` - [x] compiler/rustc_passes/src/check_attr.rs ``@CleanCut`` - [x] compiler/rustc_passes/src/errors.rs ``@CleanCut`` - [x] compiler/rustc_passes/src/lang_items.rs ``@CleanCut`` - [x] compiler/rustc_passes/src/lib.rs ``@CleanCut`` - [x] compiler/rustc_passes/src/weak_lang_items.rs ``@CleanCut``
2022-10-09ImplItemKind::TyAlias => ImplItemKind::TypeMichael Goulet-1/+1
2022-10-07avoid string dispatch in fluentNathan Stocks-15/+31
2022-10-07migrate the rest of check_attr.rs to translateable diagnosticsNathan Stocks-62/+33
2022-10-07use consistent namesNathan Stocks-2/+2
2022-10-07Migrate InvalidAttrAtCrateLevelrdvdev2-21/+7
Co-authored-by: Nathan Stocks <cleancut@github.com> Co-authored-by: rdvdev2 <rdvdev2@gmail.com>
2022-10-07Migrate derivable diagnostics in check_attr.rsrdvdev2-8/+6
2022-10-01Refactor rustc lint APIMaybe Waffle-22/+31
2022-09-27rustc_typeck to rustc_hir_analysislcnr-1/+1
2022-09-24separate definitions and `HIR` ownersTakayuki Maeda-6/+8
fix a ui test use `into` fix clippy ui test fix a run-make-fulldeps test implement `IntoQueryParam<DefId>` for `OwnerId` use `OwnerId` for more queries change the type of `ParentOwnerIterator::Item` to `(OwnerId, OwnerNode)`
2022-09-22use appropriate variable namesTakayuki Maeda-6/+6
2022-09-16more simple formattingRageking8-1/+2