- `T: ~const Drop` has a special meaning in Rust 1.61 that we don't implement.
(So ideally, we'd only ignore `~const Drop`, but this should be fine
for now.)
- `Destruct` impls are built-in in 1.62 (current nightlies as of 08-04-2022), so until
the builtin impls are supported by Chalk, we ignore them as well.
Since `Destruct` is implemented for everything in non-const contexts
IIUC, this should also work fine.
Fixes#11932.
11920: Consider types of const generics r=flodiebold a=HKalbasi
fix#11913
We should emit type_mismatch in const generics, probably after #7434. Currently they will lead to a misleading, time of use type error (like the added test).
Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
11925: internal: Add and use `HirFormatter::write_{str,char}` r=Veykril a=lnicola
Saves slightly over 3 KB of `text`, but comparing the total with that from two weeks ago in #11776, this is a losing battle (we're 951 KB larger).
```
text data bss dec hex filename
24693512 1542704 4424 26240640 1906680 rust-analyzer-baseline
24690216 1542112 4424 26236752 1905750 rust-analyzer-pr
```
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
rustc has removed the use of lang items to mark the primitive impls, so
just look through the crate graph for them (this should be fine
performance-wise since we cache the crates that contain these impls).
Fixes#11876.
11878: fix: Paper over GAT panic r=flodiebold a=flodiebold
TIL that Chalk expects the arguments to a generic associated type to come *before* the ones for the parent trait, not *after* as we have been doing with all other nested generics. Fixing this requires a larger refactoring, so for now this just papers over the problem by completely ignoring parameters of associated types.
Fixes#11769.
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
TIL that Chalk expects the arguments to a generic associated type to
come *before* the ones for the parent trait, not *after* as we have been
doing with all other nested generics. Fixing this requires a larger
refactoring, so for now this just papers over the problem by completely
ignoring parameters of associated types.
Fixes#11769.
E.g. when there's a type mismatch on the return value of a function. To
fix this, we have to return the expected type as the type of the block
when there's a mismatch. That meant some IDE code that expected
otherwise had to be adapted, in particular the "add return type" assist.
For the "wrap in Ok/Some" quickfix, this sadly means it usually can't be applied
in all branches of an if expression at the same time anymore, because
there's a type mismatch for each branch that has the wrong type.
11840: Fix another const generic panic r=flodiebold a=HKalbasi
fix#11835
If I change `dyn` to `impl` in the test, it will infer the type as `IntoIterator::Item<impl Iterator<Item = [Ar<u8, 7>; 9]> + ?Sized>` instead of `[Ar<u8, 7>; 9]`. Maybe it needs some action?
Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
11805: fix: Don't try to resolve methods on unknown types r=Veykril a=flodiebold
Fixes#10454, and some type mismatches.
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
11774: feat: Tag macro calls as unsafe if they expand to unsafe expressions r=Veykril a=Veykril
as long as they aren't inside an unsafe block inside the macro that is.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>