about summary refs log tree commit diff
path: root/compiler/rustc_mir_build/src
AgeCommit message (Collapse)AuthorLines
2022-12-17Migrate "function cannot return without recursing" diagnosticTheOddGarlic-14/+19
2022-12-16Support call and drop terminators in custom mirJakob Degen-0/+49
2022-12-16Auto merge of #103880 - b-naber:field-ty-mir, r=lcnrbors-83/+309
Use non-ascribed type as field's type in mir Fixes https://github.com/rust-lang/rust/issues/96514 r? `@lcnr`
2022-12-15Auto merge of #105356 - JakobDegen:more-custom-mir, r=oli-obkbors-9/+109
Custom MIR: Many more improvements Commits are each atomic changes, best reviewed one at a time, with the exception that the last commit includes all the documentation. ### First commit Unsafetyck was not correctly disabled before for `dialect = "built"` custom MIR. This is fixed and a regression test is added. ### Second commit Implements `Discriminant`, `SetDiscriminant`, and `SwitchInt`. ### Third commit Implements indexing, field, and variant projections. ### Fourth commit Documents the previous commits and everything else. There is some amount of weirdness here due to having to beat Rust syntax into cooperating with MIR concepts, but it hopefully should not be too much. All of it is documented. r? `@oli-obk`
2022-12-14address reviewb-naber-90/+52
2022-12-14Remove one more usage of `mk_substs_trait`Oli Scherer-1/+1
2022-12-14Let `mk_fn_def` take an iterator instead to simplify some call sitesOli Scherer-2/+0
2022-12-14Support more projections in custom mirJakob Degen-6/+37
2022-12-14Support common enum operations in custom mirJakob Degen-3/+72
2022-12-14Auto merge of #104986 - compiler-errors:opaques, r=oli-obkbors-3/+5
Combine `ty::Projection` and `ty::Opaque` into `ty::Alias` Implements https://github.com/rust-lang/types-team/issues/79. This PR consolidates `ty::Projection` and `ty::Opaque` into a single `ty::Alias`, with an `AliasKind` and `AliasTy` type (renamed from `ty::ProjectionTy`, which is the inner data of `ty::Projection`) defined as so: ``` enum AliasKind { Projection, Opaque, } struct AliasTy<'tcx> { def_id: DefId, substs: SubstsRef<'tcx>, } ``` Since we don't have access to `TyCtxt` in type flags computation, and because repeatedly calling `DefKind` on the def-id is expensive, these two types are distinguished with `ty::AliasKind`, conveniently glob-imported into `ty::{Projection, Opaque}`. For example: ```diff match ty.kind() { - ty::Opaque(..) => + ty::Alias(ty::Opaque, ..) => {} _ => {} } ``` This PR also consolidates match arms that treated `ty::Opaque` and `ty::Projection` identically. r? `@ghost`
2022-12-13Rollup merge of #105476 - estebank:moves-n-borrows, r=compiler-errorsMatthias Krüger-1/+1
Change pattern borrowing suggestions to be verbose and remove invalid suggestion Synthesize a more accurate span and use verbose suggestion output to make the message clearer. Do not suggest borrowing binding in pattern in let else. Fix #104838.
2022-12-13Rollup merge of #105147 - nbdd0121:inline_const_unsafe, r=oli-obkMatthias Krüger-16/+26
Allow unsafe through inline const Handle similar to closures. Address https://github.com/rust-lang/rust/pull/104087#issuecomment-1324173328 Note that this PR does not fix the issue for `unsafe { [0; function_requiring_unsafe()] }`. This is fundamentally unfixable for MIR unsafeck IMO. This PR also does not fix unsafety checking for inline const in pattern position. It actually breaks it, allowing unsafe functions to be used in inline const in pattern position without unsafe blocks. Inline const in pattern position is not visible in MIR so ignored by MIR unsafety checking (currently it is also not checked by borrow checker, which is the reason why it's considered an incomplete feature). `@rustbot` label: +T-lang +F-inline_const
2022-12-13Do not suggest borrowing binding in pattern in let elseEsteban Küber-1/+1
Fix #104838.
2022-12-13Combine projection and opaque into aliasMichael Goulet-3/+5
2022-12-13Extract shared logic into a new functionGary Guo-20/+14
2022-12-13Remove unnecessary recursive call to parent unsafeckGary Guo-3/+0
All bodies are unsafe checked anyway. Current MIR unsafeck also just returns for closures.
2022-12-13Ensure valid local_data is set for custom mir buildingGary Guo-1/+7
MIR unsafety checking requires this to be valid
2022-12-13Allow unsafe through inline const for THIR unsafety checkerGary Guo-12/+25
The closure handling code is changed slightly to avoid allocation when THIR building failed.
2022-12-12Rollup merge of #105615 - WaffleLapkin:remove_opt_scope_span_mention, ↵Matthias Krüger-4/+2
r=compiler-errors Fixup method doc that mentions removed param The param was removed in https://github.com/rust-lang/rust/pull/61872 (101a2f59b490650c12c5f9e4561a7390bfce78d3)
2022-12-12Fixup method doc that mentions removed paramMaybe Waffle-4/+2
2022-12-12Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkovbors-4/+4
Remove `token::Lit` from `ast::MetaItemLit`. Currently `ast::MetaItemLit` represents the literal kind twice. This PR removes that redundancy. Best reviewed one commit at a time. r? `@petrochenkov`
2022-12-11Rollup merge of #105537 - kadiwa4:remove_some_imports, r=fee1-deadMatthias Krüger-3/+1
compiler: remove unnecessary imports and qualified paths Some of these imports were necessary before Edition 2021, others were already in the prelude. I hope it's fine that this PR is so spread-out across files :/
2022-12-10compiler: remove unnecessary imports and qualified pathsKaDiWa-3/+1
2022-12-09Remove unneeded field from `SwitchTargets`Jakob Degen-7/+5
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-05Move -Z maximal-hir-to-mir-coverage implementation to new ↵Will Crichton-32/+44
`maybe_new_source_scope` method
2022-12-04drive-by: move field_index to typeck resultsMichael Goulet-3/+3
2022-12-04Auto merge of #105121 - oli-obk:simpler-cheaper-dump_mir, r=nnethercotebors-1/+1
Cheaper `dump_mir` take two alternative to #105083 r? `@nnethercote`
2022-12-02Use zero based indexing for pass_countOli Scherer-1/+1
2022-12-02Add `StrStyle` to `ast::LitKind::ByteStr`.Nicholas Nethercote-4/+4
This is required to distinguish between cooked and raw byte string literals in an `ast::LitKind`, without referring to an adjacent `token::Lit`. It's a prerequisite for the next commit.
2022-11-29Improve spans in custom mirJakob Degen-5/+13
2022-11-29Support statics in custom mirJakob Degen-0/+23
2022-11-29Support most constant kinds in custom mirJakob Degen-78/+96
2022-11-29reduce allocationsb-naber-38/+111
2022-11-28Remove `Const::from_value`Maybe Waffle-1/+1
...it's just `mk_const` but without the sparcles
2022-11-28Simplify calls to `tcx.mk_const`Maybe Waffle-1/+1
`mk_const(ty::ConstKind::X(...), ty)` can now be simplified to `mk_cosnt(..., ty)`. I searched with the following regex: \mk_const\([\n\s]*(ty::)?ConstKind\ I've left `ty::ConstKind::{Bound, Error}` as-is, they seem clearer this way.
2022-11-27Prefer doc comments over `//`-comments in compilerMaybe Waffle-18/+22
2022-11-24Rollup merge of #103908 - estebank:consider-cloning, r=compiler-errorsMatthias Krüger-4/+12
Suggest `.clone()` or `ref binding` on E0382
2022-11-24Auto merge of #104507 - WaffleLapkin:asderefsyou, r=wesleywiserbors-9/+7
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-23use no type in ProjectionElem::Field for PlaceBuilder::UpVarb-naber-36/+64
2022-11-23Account for `x @ y` and suggest `ref x @ ref y`Esteban Küber-4/+12
2022-11-23include closures and generators in try_compute_field_tyb-naber-3/+39
2022-11-23get field ty during projectingb-naber-168/+187
2022-11-23address reviewb-naber-4/+21
2022-11-23properly handle enum field projectionsb-naber-49/+35
2022-11-23use non-ascribed type as field type in mirb-naber-1/+48
2022-11-23implement PlaceBuilder::try_tyb-naber-0/+58
2022-11-23Auto merge of #103947 - camsteffen:place-clones, r=cjgillotbors-150/+134
Reduce `PlaceBuilder` cloning Some API tweaks with an eye towards reducing clones.
2022-11-22Auto merge of #104711 - Dylan-DPC:rollup-gkw1qr8, r=Dylan-DPCbors-17/+20
Rollup of 6 pull requests Successful merges: - #104295 (Check generics parity before collecting return-position `impl Trait`s in trait) - #104464 (Reduce exceptions overallocation on non Windows x86_64) - #104615 (Create def_id for async fns during lowering) - #104669 (Only declare bindings for if-let guards once per arm) - #104701 (Remove a lifetime resolution hack from `compare_predicate_entailment`) - #104710 (disable strict-provenance-violating doctests in Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-22Rollup merge of #104669 - LeSeulArtichaut:88015-if-let-guard-bindings, ↵Dylan DPC-17/+20
r=cjgillot Only declare bindings for if-let guards once per arm Currently, each candidate for a match arm uses separate locals for the bindings in the if-let guard, causing problems (#88015) when those branches converge in the arm body. Fixes #88015 (🤞)