Previously normalization was broken, which caused a lot of fake errors.
This fix most type mismatches of the new solver, and it also reverts many test regressions.
The downside is that now `chalk_ir::TyKind::AssociatedType`/`chalk_ir::TyKind::Alias` cannot be trusted anymore with their roles, namely: `AssociatedType` is always fully normalized and `Alias` only if it can possibly be normalized further. That seems okay as the new solver does not have this distinction at all (due to it being a lazy normalizer), so this will only hold for the migration time. This does mean we have to change some APIs, notably `hir::Type::walk()` and `TyFingerprint`, to treat `Alias` the same as `AssociatedType`.
Another small thing this commit does is to isolate processing of user-written types (currently involving replacing error types and normalizing, but in the future validation will also be needed) to separate functions.
More correctly, a `TyKind::AssociatedType` is not the same as `TyKind::Projection`.
We used to map next-solver `TyKind::Alias` to Chalk's `TyKind::AssociatedType`. This is very incorrect, as `AssociatedType` is assumed to be fully normalized, and caused a lot of type mismatches.
Unfortunately fixing this causes a lot of stack overflows, because the next solver doesn't have something akin to `AssociatedType` so we normalize again and again. The reason is that is the lazy-normalization nature of the next solver, which means we need to stop normalizing everything. This will be fixed in the next commit.
They have to do with diagnostics, we could probably not support them but we will also someday want good diagnostics.
The code is mostly copied from rustc.
That is, resolve them globally, not from the test's location.
This *should* result in more robust resolution; for example, previously the code failed to detect the presence of snapshot testing if the snapshot library was renamed in the dependency or was an indirect dependency.
The first sentence a new user should see should ideally answer the
questions:
* What is rust-analyzer?
* Why might I want to use it?
The vast majority of users will be interested in using rust-analyzer
inside their favourite editor. We should clarify that rust-analyzer is
an LSP implementation and that it supports all the classic IDE
features.
Whilst it's also true that rust-analyzer is modular and organised into
libraries, the first impression should (I think) focus on an overview
and the primary use case.
The main changes are (there are some other small changes):
- Using a specific type for trait IDs in the new solver, allowing us to simplify a lot of code.
- Add `BoundConst` similar to `BoundTy` and `BoundRegion` (previously consts used `BoundVar` directly), due to a new trait requirement.
Because duplicates can be found with traits. Worse, the inherent methods could be private, and we'll discover that only later. But even if they're not they're different methods, and its seems worthy to present them all to the user.