abby: always store nextgen region constraints in canonical form title. introduce an `And`/`Or`/`LeafConstraint`/ types to reason about the structure of our region constraints. Never produce arbitrarily nested or/ands and always have constraints in an evaluated form. I kinda mucked up this PR and accidentally did two things at the same time. Not only do we immediately put everything into canonical form, we also change what it means for a region constraint to be in canonical form. Whoops :> Rough overview of what a `RegionConstraint` is: - `RegionConstraint` contains two things: an `AND of LEAFs` and an `OR of AND of LEAFs`. Another way of thinking about it would be to say its an `AND` consisting of arbitrarily many LEAFs and a single `OR of AND of LEAFs` - There are never any region constraints shared between all ANDs of the OR, instead they're moved into the top level AND - If the OR constraint is `false` then we wipe the top level `AND` as it doesn't matter what they are, the constraint is always going to be false - ORs never have two equivalent ANDs within them. Similarly, ANDs never have two equivalent LEAFs within them this simplifies a lot of things conceptually as we now no longer need to worry about what state our region constraints are in. and our algorithms also don't need to handle arbitrary nesting of ors/ands :) and its a lot easier to read the debug logs 😅 I also wound up needing to do this while trying to compile `std`/`core` with `-Zassumptions-on-binders` as we would otherwise OOM from having both: - Lots of duplicate region constraints (e.g. `And('a: 'b, 'a: 'b)`) - Lots of region constraints shared across all elements of an `OR` (e.g. `Or(And('a: 'b, 'b: 'c), And('a: 'b, 'b: 'd))`) Some future work: - Remove `RegionConstraint::splatted_and_constraints` it's kind of weird to even need it and probably encourages bad-for-perf patterns - we Probably want some kind of fast path for pushing new leaf constraints to the region constraint storage. slash have a way to register a leaf constraint directly rather than having to make a `RegionConstraint`. Perf stuff :3 In theory this PR should mostly not have functional changes. In practice it might affect some things due to changing the exact repr of things affecting query responses. There's probably also some behaviour differences here due to us falling on our face more or less in WIP parts of abby now that we have different region constraints. I don't think any of this should be meaningful though. This PR is intended to not fundamentally change the abby algorithm :3 This PR should be reviewed commit-by-commit. There are a bunch of commits restructuring existing logic to assume their input is in canonical form as it will be by the end of the PR. Then there's the core change in `always canonical form` which actually replaces `RegionConstraint` with all the new types and updates all the locations using them. Finally there's `propagate ambiguity not evaluate` which deals with the leftover `evaluate_solver_constraint` which was mostly unnecessary now due to moving its main logic into construction of `RegionConstraint` and friends. I didn't want to make actual bug fixes in this PR so I just left some FIXMEs about some of the issues that `propagate_ambiguity` has instead of fixing them here. Fixes rust-lang/project-assumptions-on-binders#14 |
||
|---|---|---|
| .github | ||
| compiler | ||
| library | ||
| LICENSES | ||
| src | ||
| tests | ||
| .clang-format | ||
| .editorconfig | ||
| .git-blame-ignore-revs | ||
| .gitattributes | ||
| .gitignore | ||
| .gitmodules | ||
| .ignore | ||
| .mailmap | ||
| AGENTS.md | ||
| bootstrap.example.toml | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CLAUDE.md | ||
| CODE_OF_CONDUCT.md | ||
| configure | ||
| CONTRIBUTING.md | ||
| COPYRIGHT | ||
| INSTALL.md | ||
| LICENSE-APACHE | ||
| license-metadata.json | ||
| LICENSE-MIT | ||
| package.json | ||
| README.md | ||
| RELEASES.md | ||
| REUSE.toml | ||
| rust-bors.toml | ||
| rustfmt.toml | ||
| triagebot.toml | ||
| typos.toml | ||
| x | ||
| x.ps1 | ||
| x.py | ||
| yarn.lock | ||
This is the main source code repository for Rust. It contains the compiler, standard library, and documentation.
Why Rust?
-
Performance: Fast and memory-efficient, suitable for critical services, embedded devices, and easily integrated with other languages.
-
Reliability: Our rich type system and ownership model ensure memory and thread safety, reducing bugs at compile-time.
-
Productivity: Comprehensive documentation, a compiler committed to providing great diagnostics, and advanced tooling including package manager and build tool (Cargo), auto-formatter (rustfmt), linter (Clippy) and editor support (rust-analyzer).
Quick Start
Read "Installation" from The Book.
Installing from Source
If you really want to install from source (though this is not recommended), see INSTALL.md.
Getting Help
See https://www.rust-lang.org/community for a list of chat platforms and forums.
Contributing
See CONTRIBUTING.md.
For a detailed explanation of the compiler's architecture and how to begin contributing, see the rustc-dev-guide.
License
Rust is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.
See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.
Trademark
The Rust Foundation owns and protects the Rust and Cargo trademarks and logos (the "Rust Trademarks").
If you want to use these names or brands, please read the Rust language trademark policy.
Third-party logos may be subject to third-party copyrights and trademarks. See Licenses for details.