about summary refs log tree commit diff
path: root/compiler/rustc_passes/src
AgeCommit message (Collapse)AuthorLines
2023-02-16Rename some region-specific stuffMichael Goulet-1/+1
2023-02-15Auto merge of #108006 - cjgillot:def-impl, r=oli-obkbors-23/+18
Avoid accessing HIR when it can be avoided Experiment to see if it helps some incremental cases. Will be rebased once https://github.com/rust-lang/rust/pull/107942 gets merged. r? `@ghost`
2023-02-14Do not fetch HIR for reachable.Camille GILLOT-16/+13
2023-02-14Add `of_trait` to DefKind::Impl.Camille GILLOT-7/+5
2023-02-14add a `#[rustc_coinductive]` attributelcnr-0/+15
2023-02-08const_eval: `implies_by` in `rustc_const_unstable`David Wood-0/+9
Extend support for `implies_by` (from `#[stable]` and `#[unstable]`) to `#[rustc_const_stable]` and `#[rustc_const_unstable]`. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-05rustc_passes: remove huge error importsest31-56/+57
2023-02-03Auto merge of #107569 - petrochenkov:optattr, r=nnethercotebors-3/+2
ast: Optimize list and value extraction primitives for attributes It's not necessary to convert the whole attribute into a meta item to extract something specific.
2023-02-02Rollup merge of #107515 - Swatinem:hirvalidator, r=compiler-errorsMatthias Krüger-25/+14
Improve pretty-printing of `HirIdValidator` errors This now uses `node_to_string` for both missing and seen Ids, which includes the snippet of code for which the Id was allocated. Also removes the duplicated printing of `HirId`, as `node_to_string` also includes that.
2023-02-01Improve pretty-printing of `HirIdValidator` errorsArpad Borsos-25/+14
This now uses `node_to_string` for both missing and seen Ids, which includes the snippet of code for which the Id was allocated. Also removes the duplicated printing of `HirId`, as `node_to_string` includes that already. Similarly, changes all other users of `node_to_string` that do so, and changes the output of `node_to_string`, which is now "$hirid ($what `$span` in $path)".
2023-02-01ast: Optimize list and value extraction primitives for attributesVadim Petrochenkov-3/+2
It's not necessary to convert the whole attribute into a meta item to extract something specific
2023-02-01Auto merge of #107257 - inquisitivecrystal:ffi-attr, r=davidtwcobors-0/+63
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-31Rollup merge of #107467 - WaffleLapkin:uneq, r=oli-obkGuillaume Gomez-27/+33
Improve enum checks Some light refactoring.
2023-01-31Auto merge of #100754 - davidtwco:translation-incremental, r=compiler-errorsbors-2/+9
incremental: migrate diagnostics - Apply the diagnostic migration lints to more functions on `Session`, namely: `span_warn`, `span_warn_with_code`, `warn` `note_without_error`, `span_note_without_error`, `struct_note_without_error`. - Add impls of `IntoDiagnosticArg` for `std::io::Error`, `std::path::Path` and `std::path::PathBuf`. - Migrate the `rustc_incremental` crate's diagnostics to translatable diagnostic structs. r? `@compiler-errors` cc #100717
2023-01-30session: diagnostic migration lint on more fnsDavid Wood-2/+9
Apply the diagnostic migration lint to more functions on `Session`. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-30Replace some `_ == _ || _ == _`s with `matches!(_, _ | _)`sMaybe Waffle-1/+1
2023-01-30Replace enum `==`s with `match`es where it makes senseMaybe Waffle-26/+32
2023-01-30Consider `#[allow(dead_code)]` before lang itemsMaybe Waffle-2/+2
2023-01-30Split `has_allow_dead_code_or_lang_attr` into sub functionsMaybe Waffle-16/+18
2023-01-28Remove `HirId -> LocalDefId` map from HIR.Camille GILLOT-41/+33
2023-01-28Take a LocalDefId in hir::Visitor::visit_fn.Camille GILLOT-1/+2
2023-01-26fixup new usages of fn_sig, bound_fn_sig after rebasingKyle Matsuda-1/+2
2023-01-26Auto merge of #106745 - m-ou-se:format-args-ast, r=oli-obkbors-2/+2
Move format_args!() into AST (and expand it during AST lowering) Implements https://github.com/rust-lang/compiler-team/issues/541 This moves FormatArgs from rustc_builtin_macros to rustc_ast_lowering. For now, the end result is the same. But this allows for future changes to do smarter things with format_args!(). It also allows Clippy to directly access the ast::FormatArgs, making things a lot easier. This change turns the format args types into lang items. The builtin macro used to refer to them by their path. After this change, the path is no longer relevant, making it easier to make changes in `core`. This updates clippy to use the new language items, but this doesn't yet make clippy use the ast::FormatArgs structure that's now available. That should be done after this is merged.
2023-01-26Rollup merge of #106407 - mejrs:attr_check, r=compiler-errorsMatthias Krüger-6/+190
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/+63
2023-01-19Auto merge of #106810 - oli-obk:resolver_reverse_plumbing, r=petrochenkovbors-1/+1
Various cleanups around pre-TyCtxt queries and functions part of #105462 based on https://github.com/rust-lang/rust/pull/106776 (everything starting at [0e2b39f](https://github.com/rust-lang/rust/pull/106810/commits/0e2b39fd1ffde51b50d45ccbe41de52b85136b8b) is new in this PR) r? `@petrochenkov` I think this should be most of the uncontroversial part of #105462.
2023-01-17Rollup merge of #104505 - WaffleLapkin:no-double-spaces-in-comments, r=jackh726Matthias Krüger-15/+15
Remove double spaces after dots in comments Most of the comments do not have double spaces, so I assume these are typos.
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-15/+15
2023-01-17Auto merge of #106627 - Ezrashaw:no-e0711-without-staged-api, r=Mark-Simulacrumbors-0/+6
fix: don't emit `E0711` if `staged_api` not enabled Fixes #106589 Simple fix, added UI test. As an aside, it seems a lot of features are susceptible to this, `E0711` stands out to me because it's perma-unstable and we are effectively exposing an implementation detail.
2023-01-16Move compiler input and ouput paths into sessionOli Scherer-1/+1
2023-01-14fix: don't emit `E0711` if `staged_api` not enabledEzra Shaw-0/+6
2023-01-14change impl_trait_ref query to return EarlyBinder; remove ↵Kyle Matsuda-4/+4
bound_impl_trait_ref query; add EarlyBinder to impl_trait_ref in metadata
2023-01-14change usages of impl_trait_ref to bound_impl_trait_refKyle Matsuda-4/+4
2023-01-12[RFC 2397] Deny incorrect locationsCaio-0/+18
2023-01-12Expand format_args!() in rust_ast_lowering.Mara Bos-2/+2
2023-01-12Address feedbackmejrs-20/+36
2023-01-12Improve proc macro attribute diagnosticsmejrs-6/+174
2022-12-28Rename `Rptr` to `Ref` in AST and HIRNilstrieb-2/+2
The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already as well.
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-12-20rustc: Remove needless lifetimesJeremy Stucki-26/+18
2022-12-20Auto merge of #105880 - Nilstrieb:make-newtypes-less-not-rust, r=oli-obkbors-6/+4
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-19Rollup merge of #105864 - matthiaskrgr:compl, r=NilstriebDylan DPC-1/+0
clippy::complexity fixes filter_next needless_question_mark bind_instead_of_map manual_find derivable_impls map_identity redundant_slicing skip_while_next unnecessary_unwrap needless_bool r? `@compiler-errors`
2022-12-19clippy::complexity fixesMatthias Krüger-1/+0
filter_next needless_question_mark bind_instead_of_map manual_find derivable_impls map_identity redundant_slicing skip_while_next unnecessary_unwrap needless_bool
2022-12-18A few small cleanups for `newtype_index`Nilstrieb-4/+2
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-2/+2
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-18Rollup merge of #105875 - matthiaskrgr:needless_borrowed_reference, r=oli-obkMatthias Krüger-2/+2
don't destuct references just to reborrow
2022-12-18don't restuct references just to reborrowMatthias Krüger-2/+2
2022-12-18avoid .into() conversion to identical typesMatthias Krüger-2/+0
2022-12-07Rollup merge of #105267 - compiler-errors:issue-104613, r=oli-obkMatthias Krüger-3/+3
Don't ICE in ExprUseVisitor on FRU for non-existent struct Fixes #104613 Fixes #105202