Replace usages of `..i + 1` ranges with `..=i`.
Before this change we were using old computer code techniques. After this change we use the new and improved computer code techniques.
Implement chalk unification routines
`ResolventOps` and `AggregateOps` are mostly straightforwardly translated from chalk. I had caught a few bugs already in my `chalk` branch and backported fixes to this branch, but there may be other ones left. EDIT: I hope there are none left now :)
Fixes#54935.
ICE with #![feature(nll)] and elided lifetimes
Fixes#55394.
This commit fixes an ICE and determines the correct return span in cases
with a method implemented on a struct with an an elided lifetime.
r? @pnkfelix
Do not attempt to ascribe projections out of a ty var
If we encounter `_` ascribed to structural pattern like `(a, b)`, just skip relate_types.
Fix#55552
rustc: improve E0669 span
E0669 refers to an operand that cannot be coerced into a single LLVM
value, unfortunately right now this uses the Span for the entire inline
assembly statement, which is less than ideal.
This commit preserves the Span from HIR, which lets us emit the error
using the Span for the operand itself in MIR.
r? @nagisa
cc/ @parched
universes refactor 3
Some more refactorings from my universe branch. These are getting a bit more "invasive" -- they start to plumb the universe information through the canonicalization process. As of yet though I don't **believe** this branch changes our behavior in any notable way, though I'm marking the branch as `WIP` to give myself a chance to verify this.
r? @scalexm
This commit refactors `PlaceContext` to split it into four different
smaller enums based on if the context represents a mutating use,
non-mutating use, maybe-mutating use or a non-use (this is based on the
recommendation from @oli-obk on Zulip[1]).
This commit then introduces a `PlaceContext::AscribeUserTy` variant.
`StatementKind::AscribeUserTy` is now correctly mapped to
`PlaceContext::AscribeUserTy` instead of `PlaceContext::Validate`.
`PlaceContext::AscribeUserTy` can also now be correctly categorized as a
non-use which fixes an issue with constant promotion in statics after a
cast introduces a `AscribeUserTy` statement.
[1]: https://rust-lang.zulipchat.com/#narrow/stream/122657-wg-nll/subject/.2355288.20cast.20fails.20to.20promote.20to.20'static/near/136536949
Update the existing NLL `patterns.rs` test accordingly.
includes changes addressing review feedback:
* Added example to docs for `UserTypeProjections` illustrating how we
build up multiple projections when descending into a pattern with
type ascriptions.
* Adapted niko's suggested docs for `UserTypeProjection`.
* Factored out `projection_ty` from more general `projection_ty_core`
(as a drive-by, made its callback an `FnMut`, as I discovered later
that I need that).
* Add note to docs that `PlaceTy.field_ty(..)` does not normalize its result.
* Normalize as we project out `field_ty`.
I did not think I would need this in the MIR, but in general local
decls are going to need to support this. (That, or we need to be able
define a least-upper-bound for a collection of types encountered via
the pattern compilation.)
(That is, it will pull out some component type held or referenced by
the type annotation.)
Note: this still needs to actually do projection itself. That comes in
a later commit
Shrink `Statement`.
This commit reduces the size of `Statement` from 80 bytes to 56 bytes on
64-bit platforms, by boxing the `AscribeUserType` variant of
`StatementKind`.
This change reduces instruction counts on most benchmarks by 1--3%.
This commit reduces the size of `Statement` from 80 bytes to 56 bytes on
64-bit platforms, by boxing the `AscribeUserType` variant of
`StatementKind`.
This change reduces instruction counts on most benchmarks by 1--3%.
Add regression tests for #55219 and #55241
Also another test where a duplicate-like error appears to have been
suppressed; I'm not 100% sure why this output changes, though I could
imagine that some duplicate suppression is enabled by this PR.
This fixes `issue-28848.rs` -- it also handles another case that the
AST region checker gets wrong (`wf-self-type.rs`). I don't actually
think that this is the *right way* to be enforcing this constraint --
I think we should probably do it more generally, perhaps by editing
`predicates_of` for the impl itself. The chalk-style implied bounds
setup ought to fix this.