about summary refs log tree commit diff
path: root/compiler/rustc_passes/src
AgeCommit message (Collapse)AuthorLines
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
2022-12-06Rollup merge of #105174 - chenyukang:yukang/fix-105028-unused, r=eholkMatthias Krüger-1/+7
Suggest removing struct field from destructive binding only in shorthand scenario Fixes #105028
2022-12-04drive-by: move field_index to typeck resultsMichael Goulet-3/+3
2022-12-01rustc_hir: Change representation of import paths to support multiple resolutionsVadim Petrochenkov-1/+1
2022-12-01rustc_hir: Relax lifetime requirements on `Visitor::visit_path`Vadim Petrochenkov-5/+5
2022-12-01fix #105028, Only suggest removing struct field from destructive binding in ↵yukang-1/+7
shorthand scenario
2022-11-29Rollup merge of #105023 - tmiasko:asm-sym-static-reachable, r=wesleywiserMatthias Krüger-0/+11
Statics used in reachable function's inline asm are reachable Fixes #104925.
2022-11-29Auto merge of #104947 - cjgillot:verify-hir-nest, r=oli-obkbors-24/+51
Verify that HIR parenting and Def parenting match. This relationship is relied upon for `tcx.hir_owner_parent` query to return an accurate result.
2022-11-28Statics used in reachable function's inline asm are reachableTomasz Miąsko-0/+11
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-26Verify that HIR parenting and Def parenting match.Camille GILLOT-24/+51
2022-11-24Auto merge of #104507 - WaffleLapkin:asderefsyou, r=wesleywiserbors-5/+4
Use `as_deref` in compiler (but only where it makes sense) This simplifies some code :3 (there are some changes that are not exacly `as_deref`, but more like "clever `Option`/`Result` method use")
2022-11-20Change to Ty::is_inhabited_fromCameron Steffen-13/+12
2022-11-18couple of clippy::perf fixesMatthias Krüger-2/+2
2022-11-17Auto merge of #104170 - cjgillot:hir-def-id, r=fee1-deadbors-41/+22
Record `LocalDefId` in HIR nodes instead of a side table This is part of an attempt to remove the `HirId -> LocalDefId` table from HIR. This attempt is a prerequisite to creation of `LocalDefId` after HIR lowering (https://github.com/rust-lang/rust/pull/96840), by controlling how `def_id` information is accessed. This first part adds the information to HIR nodes themselves instead of a table. The second part is https://github.com/rust-lang/rust/pull/103902 The third part will be to make `hir::Visitor::visit_fn` take a `LocalDefId` as last parameter. The fourth part will be to completely remove the side table.
2022-11-16Use `as_deref` in compiler (but only where it makes sense)Maybe Waffle-5/+4
2022-11-13Rollup merge of #104320 - fee1-dead-contrib:use-derive-const-in-std, r=oli-obkMatthias Krüger-0/+8
Use `derive_const` and rm manual StructuralEq impl This does not change any semantics of the impl except for the const stability. It should be fine because trait methods and const bounds can never be used in stable without enabling `const_trait_impl`. cc `@oli-obk`
2022-11-13Store a LocalDefId in hir::Variant & hir::Field.Camille GILLOT-20/+16
2022-11-13Store a LocalDefId in hir::GenericParam.Camille GILLOT-3/+2
2022-11-13Store LocalDefId in hir::Closure.Camille GILLOT-6/+4
2022-11-13Ensure codegen_fn_attrs during collection.Camille GILLOT-12/+0
2022-11-12Auto merge of #103812 - clubby789:improve-include-bytes, r=petrochenkovbors-1/+2
Delay `include_bytes` to AST lowering Hopefully addresses #65818. This PR introduces a new `ExprKind::IncludedBytes` which stores the path and bytes of a file included with `include_bytes!()`. We can then create a literal from the bytes during AST lowering, which means we don't need to escape the bytes into valid UTF8 which is the cause of most of the overhead of embedding large binary blobs.
2022-11-12Use `derive_const` and rm manual StructuralEq implDeadbeef-0/+8
2022-11-12Rollup merge of #103970 - oli-obk:unhide_unknown_spans, r=estebankDylan DPC-13/+45
Unhide unknown spans r? ```@estebank```
2022-11-11Introduce `ExprKind::IncludedBytes`clubby789-1/+2
2022-11-11Print all labels, even if they have no span. Fall back to main item's span.Oli Scherer-13/+45
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-11-09DiagnosticBuilder -> DiagnosticMichael Goulet-1/+2
2022-11-06Auto merge of #103720 - crlf0710:most_translation_attr, r=compiler-errorsbors-2/+0
Lint against usages of `struct_span_lint_hir`. r? `@compiler-errors`
2022-11-05Specify that `break` cannot be used outside of loop *or* labeled blockclubby789-1/+2
2022-11-04Rollup merge of #103397 - crlf0710:port_dead_code_lint, r=davidtwcoMatthias Krüger-92/+143
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-22/+1
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-29Simplify lang item groupsCameron Steffen-3/+0
2022-10-29Cleanup weak lang itemsCameron Steffen-6/+6
2022-10-29Factor out ITEM_REFSCameron Steffen-8/+7
2022-10-29Encode LangItem directlyCameron Steffen-8/+8
2022-10-29Improve LanguageItems apiCameron Steffen-5/+3
2022-10-29Lint against usages of `struct_span_lint_hir`.Charles Lew-2/+0
2022-10-29Rename some `OwnerId` fields.Nicholas Nethercote-70/+70
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-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-26privacy: Rename "accessibility levels" to "effective visibilities"Vadim Petrochenkov-17/+20
And a couple of other naming tweaks Related to https://github.com/rust-lang/rust/issues/48054
2022-10-24Port `dead_code` lints to be translatable.Charles Lew-92/+163
2022-10-23Migrate all diagnosticsNilstrieb-207/+206
2022-10-19Allow #[unstable] impl for fn() -> UnstableType.Mara Bos-7/+19
(But not fn() -> !, which is stable.)
2022-10-19Allow #[unstable] impls for fn() with unstable abi.Mara Bos-3/+8