1
Fork 0

Rollup merge of #91096 - compiler-errors:elaborate_opaque_trait, r=estebank

Print associated types on opaque `impl Trait` types

This PR generalizes #91021, printing associated types for all opaque `impl Trait` types instead of just special-casing for future.

before:
```
error[E0271]: type mismatch resolving `<impl Iterator as Iterator>::Item == u32`
```

after:
```
error[E0271]: type mismatch resolving `<impl Iterator<Item = usize> as Iterator>::Item == u32`
```

---

Questions:
1. I'm kinda lost in binders hell with this one. Is all of the `rebind`ing necessary?
2. Is there a map collection type that will give me a stable iteration order? Doesn't seem like TraitRef is Ord, so I can't just sort later..
3. I removed the logic that suppresses printing generator projection types. It creates outputs like this [gist](https://gist.github.com/compiler-errors/d6f12fb30079feb1ad1d5f1ab39a3a8d). Should I put that back?
4. I also added spaces between traits, `impl A+B` -> `impl A + B`. I quite like this change, but is there a good reason to keep it like that?

r? ````@estebank````
This commit is contained in:
Matthias Krüger 2021-11-25 15:05:37 +01:00 committed by GitHub
commit 6970cf5a23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 355 additions and 147 deletions

View file

@ -679,6 +679,7 @@ symbols! {
gen_future,
gen_kill,
generator,
generator_return,
generator_state,
generators,
generic_arg_infer,