about summary refs log tree commit diff
path: root/compiler/rustc_mir_build/src/build
AgeCommit message (Collapse)AuthorLines
2022-09-13Also compute implicit params in THIR.Camille GILLOT-79/+35
2022-09-13Compute explicit MIR params on THIR.Camille GILLOT-54/+13
2022-09-13Simplify MIR building entry.Camille GILLOT-281/+250
2022-09-13Use tcx.hir() utils for spans in MIR building.Camille GILLOT-43/+16
This corrects the `span_with_body` in the case of closures, which was incorrectly shortened to the `def_span`.
2022-09-13Only keep one version of ImplicitSelfKind.Camille GILLOT-8/+2
2022-09-12Call destructors when dyn* object goes out of scopeEric Holk-4/+1
2022-09-12dyn* through more typechecking and MIREric Holk-0/+5
2022-09-10Auto merge of #100968 - cjgillot:mir-upvar-vec, r=wesleywiserbors-152/+83
Only compute captures once when building MIR.
2022-09-10Remove unused temp.Camille Gillot-2/+1
Co-authored-by: Wesley Wiser <wwiser@gmail.com>
2022-09-06Shrink span for bindings with subpatterns.Camille GILLOT-1/+1
2022-09-02Use boxed slices in `PatKind`.Nicholas Nethercote-3/+3
To shrink it a little more.
2022-09-02Box `CanonicalUserTypeAnnotation::CanonicalUserType`.Nicholas Nethercote-12/+12
This shrinks `Ascription`, which shrinks `PatKind::AscribeUserType`, which shrinks `Pat`.
2022-09-02Box `PatKind::Range`.Nicholas Nethercote-14/+14
Because it's the biggest variant. Also, make `PatRange` non-`Copy`, because it's 104 bytes, which is pretty big.
2022-09-02Avoid some clones.Nicholas Nethercote-6/+9
`Builder::expr_into_pattern` has a single call site. Currently the `pattern` argument at the call site is always cloned. This commit changes things so that we instead do a clone within `expr_into_pattern`, but only if the pattern has the `PatKind::AscribeUserType` kind, and we only clone the annotation within the pattern instead of the entire pattern.
2022-09-02Clean up THIR patterns.Nicholas Nethercote-36/+33
`thir::Pat::kind` is a `Box<PatKind>`, which doesn't follow the usual pattern in AST/HIR/THIR which is that the "kind" enum for a node is stored inline within the parent struct. This commit makes the `PatKind` directly inline within the `Pat`. This requires using `Box<Pat>` in all the types that hold a `Pat. Ideally, `Pat` would be stored in `Thir` like `Expr` and `Stmt` and referred to with a `PatId` rather than `Box<Pat>`. But this is hard to do because lots of `Pat`s get created after the destruction of the `Cx` that does normal THIR building. But this does get us a step closer to `PatId`, because all the `Box<Pat>` occurrences would be replaced with `PatId` if `PatId` ever happened. At 128 bytes, `Pat` is large. Subsequent commits will shrink it.
2022-09-01Directly use the `instrument` macro instead of its full pathOli Scherer-1/+1
2022-08-31Fix a bunch of typoDezhi Wu-1/+1
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-29Rollup merge of #99027 - tmiasko:basic-blocks, r=oli-obkMatthias Krüger-1/+1
Replace `Body::basic_blocks()` with field access Since the refactoring in #98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
2022-08-26Replace `Body::basic_blocks()` with field accessTomasz Miąsko-1/+1
2022-08-26Auto merge of #100944 - nnethercote:shrink-thir-Expr, r=cjgillotbors-40/+61
Shrink `thir::Expr` r? `@cjgillot`
2022-08-25Rollup merge of #99954 - dingxiangfei2009:break-out-let-else-higher-up, ↵Yuki Okushi-2/+19
r=oli-obk let-else: break out to one scope higher for let-else ```@est31``` This PR follows up with #99518 which is to break out to the last remainder scope. It breaks to the out-most `region_scope` of the block if the first statement is a `let-else`.
2022-08-24Rename `thir::Adt` as `thir::AdtExpr`.Nicholas Nethercote-2/+7
This matches the naming scheme used elsewhere, e.g. in the AST, and avoids name clashes with the `ExprKind::Closure` variant.
2022-08-24Box `thir::ExprKind::InlineAsm`.Nicholas Nethercote-1/+1
This shrinks `thir::Expr`.
2022-08-24Box `thir::ExprKind::Closure`.Nicholas Nethercote-1/+7
This shrinks `thir::Expr`.
2022-08-24Store blocks in `Thir`.Nicholas Nethercote-19/+29
Like expressions, statements, and match arms. This shrinks `thir::Stmt` and is a precursor to further shrinking `thir::Expr`.
2022-08-24Box `user_ty` fields in `thir::ExprKind`.Nicholas Nethercote-18/+18
This shrinks several large variants of `ExprKind`.
2022-08-23Only compute captures once when building MIR.Camille GILLOT-152/+84
2022-08-23Remove the symbol from `ast::LitKind::Err`.Nicholas Nethercote-1/+1
Because it's never used meaningfully.
2022-08-22Fix span for consts in mir builderNilstrieb-3/+13
2022-08-11Rollup merge of #99110 - audunhalland:match_has_guard_from_candidate, r=pnkfelixDylan DPC-1/+1
Determine match_has_guard from candidates instead of looking up thir table again Currently looking through mir build of matches because of interest in deref patterns. Finding some micro-optimizable things.
2022-08-04Use (actually) dummy place for let-else divergenceMichael Goulet-1/+1
2022-07-31provide a clearer explanation of scope breakingDing Xiang Fei-1/+3
2022-07-30Use LocalDefId for closures moreCameron Steffen-13/+9
2022-07-31break out to one scope higher for let-elseDing Xiang Fei-2/+17
2022-07-21break out scopes when let-else fails to matchDing Xiang Fei-42/+49
2022-07-20Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"Oli Scherer-122/+145
This reverts commit 6f8fb911ad504b77549cf3256a09465621beab9d, reversing changes made to 7210e46dc69a4b197a313d093fe145722c248b7d.
2022-07-15Allow destructuring opaque types, since the patterns constrain the opaque typesOli Scherer-6/+33
2022-07-15Some tracing helpersOli Scherer-0/+3
2022-07-15Reuse a helper method instead of manually rolling itOli Scherer-3/+1
2022-07-15Remove early return that would likely have caused miscompilations if it ever ↵Oli Scherer-13/+3
happened
2022-07-15Pass one argument instead of fetching two fields of it at every call siteOli Scherer-100/+60
2022-07-15Add some tracing instrumentationOli Scherer-27/+24
2022-07-15Introduce opaque type to hidden type projectionOli Scherer-0/+2
2022-07-14Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillotDylan DPC-3/+4
Implement `for<>` lifetime binder for closures This PR implements RFC 3216 ([TI](https://github.com/rust-lang/rust/issues/97362)) and allows code like the following: ```rust let _f = for<'a, 'b> |a: &'a A, b: &'b B| -> &'b C { b.c(a) }; // ^^^^^^^^^^^--- new! ``` cc ``@Aaron1011`` ``@cjgillot``
2022-07-12Add an indirection for closures in `hir::ExprKind`Maybe Waffle-3/+4
This helps bring `hir::Expr` size down, `Closure` was the biggest variant, especially after `for<>` additions.
2022-07-11lower let-else in MIR insteadDing Xiang Fei-13/+97
2022-07-10Determine match_has_guard from candidates instead of looking up thir table againAudun Halland-1/+1
2022-07-09tweak names and output and blessRalf Jung-1/+1
2022-07-09review feedbackRalf Jung-1/+1
2022-07-09don't allow ZST in ScalarIntRalf Jung-1/+16
There are several indications that we should not ZST as a ScalarInt: - We had two ways to have ZST valtrees, either an empty `Branch` or a `Leaf` with a ZST in it. `ValTree::zst()` used the former, but the latter could possibly arise as well. - Likewise, the interpreter had `Immediate::Uninit` and `Immediate::Scalar(Scalar::ZST)`. - LLVM codegen already had to special-case ZST ScalarInt. So instead add new ZST variants to those types that did not have other variants which could be used for this purpose.