| Age | Commit message (Collapse) | Author | Lines |
|
|
|
Only compute captures once when building MIR.
|
|
Co-authored-by: Wesley Wiser <wwiser@gmail.com>
|
|
Shrink `hir::Ty` and `hir::Pat`
r? `@ghost`
|
|
Shrink span for bindings with subpatterns.
Bindings with nested patterns (`binding @ pat` syntax) currently point to the full pattern. This PR proposes to shrink the span to stop before the ````@`.``` This makes the diagnostics for move/mutability conflicts clearer, as they not point to the `binding` only, instead of the full pat.
r? ```@estebank```
|
|
This shrinks `hir::Pat` from 88 to 72 bytes.
|
|
|
|
Include enum path in variant suggestion
(except for `Result` and `Option`, which we should have via the prelude)
Fixes #101356
|
|
|
|
|
|
|
|
To shrink it a little more.
|
|
This shrinks `Ascription`, which shrinks `PatKind::AscribeUserType`,
which shrinks `Pat`.
|
|
Because it's the biggest variant. Also, make `PatRange` non-`Copy`,
because it's 104 bytes, which is pretty big.
|
|
`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.
|
|
`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.
|
|
|
|
by module
|
|
|
|
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
|
|
This reverts commit 326646074940222d602f3683d0559088690830f4.
This is the revert against master, the beta revert was already done in #100538.
|
|
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.
|
|
|
|
Shrink `thir::Expr`
r? `@cjgillot`
|
|
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`.
|
|
This matches the naming scheme used elsewhere, e.g. in the AST, and
avoids name clashes with the `ExprKind::Closure` variant.
|
|
This shrinks `thir::Expr`.
|
|
This shrinks `thir::Expr`.
|
|
Like expressions, statements, and match arms. This shrinks `thir::Stmt`
and is a precursor to further shrinking `thir::Expr`.
|
|
This shrinks several large variants of `ExprKind`.
|
|
|
|
Because it's never used meaningfully.
|
|
Rollup of 8 pull requests
Successful merges:
- #98200 (Expand potential inner `Or` pattern for THIR)
- #99770 (Make some const prop mir-opt tests `unit-test`s)
- #99957 (Rework Ipv6Addr::is_global to check for global reachability rather than global scope - rebase)
- #100331 (Guarantee `try_reserve` preserves the contents on error)
- #100336 (Fix two const_trait_impl issues)
- #100713 (Convert diagnostics in parser/expr to SessionDiagnostic)
- #100820 (Use pointer `is_aligned*` methods)
- #100872 (Add guarantee that Vec::default() does not alloc)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Expand potential inner `Or` pattern for THIR
Code assumed there wouldn't be a deeper `Or` pattern inside expanded `PatStack` this fixes it by looking for the `Or` pattern inside expanded `PatStack`.
A more ideal solution would be recursively doing this but I haven't found a good way to do that.
_fixes #97898_
|
|
|
|
never consider unsafe blocks unused if they would be required with deny(unsafe_op_in_unsafe_fn)
Judging from https://github.com/rust-lang/rust/issues/71668#issuecomment-1200317370 the consensus nowadays seems to be that we should never consider an unsafe block unused if it was required with `deny(unsafe_op_in_unsafe_fn)`, no matter whether that lint is actually enabled or not. So let's adjust rustc accordingly.
The first commit does the change, the 2nd does some cleanup.
|
|
|
|
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.
|
|
Fail gracefully when const pattern is not structural match.
Fixes https://github.com/rust-lang/rust/issues/82909
|
|
|
|
|
|
Use (actually) dummy place for let-else divergence
Fixes #100103
|
|
r=petrochenkov
Enable unused_parens for match arms
Fixes: https://github.com/rust-lang/rust/issues/92751
Currently I can't get the `stderr` to work with `./x.py test`, but this should fix the issue. Help would be appreciated!
|
|
|
|
Some `is_useful` cleanups
#98582 was reverted because it was a perf regression.
https://github.com/rust-lang/rust/pull/99806 reintroduces the changes, but this PR picks individual ones that have no regressions.
|
|
|
|
|
|
unsafe_op_in_unsafe_fn
|
|
|
|
|