diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2019-11-14 14:16:16 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-14 14:16:16 +0900 |
| commit | 79e2afc28c53bbda4b86ae824519430f0a7d7516 (patch) | |
| tree | b4d28d6e19b90e8ed7e62b8e8c4d5700ebf1f821 /src/test/debuginfo/enum-thinlto.rs | |
| parent | 3f07f1cd78432c9901788de2feafc0c2331edee3 (diff) | |
| parent | 2db744ca9d4da28c5d0088f5d21e237e7f678abb (diff) | |
| download | rust-79e2afc28c53bbda4b86ae824519430f0a7d7516.tar.gz rust-79e2afc28c53bbda4b86ae824519430f0a7d7516.zip | |
Rollup merge of #66253 - ohadravid:improve-errors-after-re-rebalance-coherence, r=estebank
Improve errors after re rebalance coherence
Following #65247, I noticed that some error messages should be updated to reflect the changes of `re_rebalance_coherence` (also there was a [note](https://rust-lang.github.io/rfcs/2451-re-rebalancing-coherence.html#teaching-users) in the RFC about it).
First, error message `E0210` was updated to match the RFC, and I also tried to improve a little the error when the "order" of types is problematic.
For code like this:
```
#![feature(re_rebalance_coherence)] // Now stable
struct Wrap<T>(T);
impl<T> From<Wrap<T>> for T {
fn from(x: Wrap<T>) -> T {
x.0
}
}
```
The old error was:
```
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
--> src/lib.rs:5:6
|
5 | impl<T> From<Wrap<T>> for T {
| ^ type parameter `T` must be used as the type parameter for some local type
|
= note: only traits defined in the current crate can be implemented for a type parameter
```
and the new error is:
```
error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Wrap<T>`)
--> main.rs:66:6
|
66 | impl<T> From<Wrap<T>> for T {
| ^ type parameter `T` must be covered by another type when it appears before the first local type (`Wrap<T>`)
|
= note: implementing a foreign trait is only possible if at least one of the types for which is it implemented is local, and no uncovered type parameters appear before that first local type
= note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last
```
I tried to point at the uncovered `T`, but couldn't get something which was reliable (but I'll be happy to try if someone points me in the right direction).
r? @estebank
cc @nikomatsakis
Fixes #65247
Diffstat (limited to 'src/test/debuginfo/enum-thinlto.rs')
0 files changed, 0 insertions, 0 deletions
