about summary refs log tree commit diff
path: root/compiler/rustc_mir_build/src/build
AgeCommit message (Collapse)AuthorLines
2022-12-22Rollup merge of #106012 - JakobDegen:retag-raw, r=RalfJungMatthias Krüger-3/+0
Clarify that raw retags are not permitted in Mir Not sure when this changed, but documentation and the validator needed to be updated. This also removes raw retags from custom mir. cc rust-lang/miri#2735 r? `@RalfJung`
2022-12-21Clarify that raw retags are not permitted in MirJakob Degen-3/+0
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-8/+8
2022-12-20Some style nitsOli Scherer-3/+3
2022-12-20Auto merge of #105880 - Nilstrieb:make-newtypes-less-not-rust, r=oli-obkbors-2/+2
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-19Revert "Auto merge of #103880 - b-naber:field-ty-mir, r=lcnr"Rémy Rakic-309/+83
This reverts commit 03770f0e2b60c02db8fcf52fed5fb36aac70cedc, reversing changes made to 01ef4b21dc5251b58bd9c6fd6face2ae95d56da1.
2022-12-18Rollup merge of #105873 - matthiaskrgr:clippy_fmt, r=NilstriebMatthias Krüger-1/+1
use &str / String literals instead of format!()
2022-12-18A few small cleanups for `newtype_index`Nilstrieb-2/+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-18Rollup merge of #105875 - matthiaskrgr:needless_borrowed_reference, r=oli-obkMatthias Krüger-9/+8
don't destuct references just to reborrow
2022-12-18don't restuct references just to reborrowMatthias Krüger-9/+8
2022-12-18avoid .into() conversion to identical typesMatthias Krüger-1/+1
2022-12-18use &str / String literals instead of format!()Matthias Krüger-1/+1
2022-12-17Rollup merge of #105814 - JakobDegen:custom-mir-terms, r=oli-obkMatthias Krüger-0/+49
Support call and drop terminators in custom mir The only caveat with this change is that cleanup blocks are not supported. I would like to add them, but it's not quite clear to me what the best way to do that is, so I'll have to think about it some more. r? ``@oli-obk``
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-1/+3
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-1/+7
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-1/+3
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-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-2/+2
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-2/+0
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-2/+0
2022-12-09Remove unneeded field from `SwitchTargets`Jakob Degen-7/+5
2022-12-05Move -Z maximal-hir-to-mir-coverage implementation to new ↵Will Crichton-32/+44
`maybe_new_source_scope` method
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-2/+2
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-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-23use no type in ProjectionElem::Field for PlaceBuilder::UpVarb-naber-36/+64
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