Silence `TooGeneric` error
This error may be produced during intermediate failed attempts at evaluation of a generic const, which may nevertheless succeed later.
Fixes https://github.com/rust-lang/rust/issues/66962.
r? @eddyb
Add regression tests for fixed ICEs
Closes#61747 (fixed from 1.41.0-nightly (4007d4ef2 2019-12-01))
Closes#66205 (fixed from 1.41.0-nightly (4007d4ef2 2019-12-01))
Closes#66270 (fixed by #66246)
Closes#67424 (fixed by #67160)
Also picking a minor nit up from #67071 with 101dd7bad9
r? @Centril
Make GATs less ICE-prone.
After this PR simple lifetime-generic associated types can now be used in a compiling program. There are two big limitations:
* #30472 has not been addressed in any way (see src/test/ui/generic-associated-types/iterable.rs)
* Using type- and const-generic associated types errors because bound types and constants aren't handled by trait solving.
* The errors are technically non-fatal, but they happen in a [part of the compiler](4abb0ad273/src/librustc_typeck/lib.rs (L298)) that fairly aggressively stops compiling on errors.
closes#47206closes#49362closes#62521closes#63300closes#64755closes#67089
Indicate origin of where type parameter for uninferred types
Based on #65951 (which is not merge yet), fixes#67277.
This PR improves a little the diagnostic for code like:
```
async fn foo() {
bar().await;
}
async fn bar<T>() -> () {}
```
by showing:
```
error[E0698]: type inside `async fn` body must be known in this context
--> unresolved_type_param.rs:9:5
|
9 | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
...
```
(The
```
declared on the function `bar`
```
part is new)
A small side note: `Vec` and `slice` seem to resist this change, because querying `item_name()` panics, and `get_opt_name()` returns `None`.
r? @estebank
The reason we were invoking `builtin_deref` was to enable comparisons
when the type was `&T`. For the reasons outlined in the comment, those
comparisons failed because the regions disagreed.
This commit corrects the diagnostic note for `async move {}` so that
`await` is mentioned, rather than `yield`.
Signed-off-by: David Wood <david@davidtw.co>
Add `enclosing scope` parameter to `rustc_on_unimplemented`
Adds a new parameter to `#[rustc_on_unimplemented]`, `enclosing scope`, which highlights the function or closure scope with a message.
The wip part refers to adding this annotation to `Try` trait to improve ergonomics (which I don't know how to do since I change both std and librustc)
Closes#61709.
Issue #22750
The error reporting for E0277 (the trait `X` is not implemented for `Foo`)
now checks whether `Foo` implements a trait with the same path as `X`,
which probably means that the programmer wanted to actually use only one
version of the trait `X` instead of the two.
Suggest calling async closure when needed
When using an async closure as a value in a place that expects a future,
suggest calling the closure.
Fix#65923.