Call out the types that are non local on E0117#65318
Conversation
|
r? @varkor (rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
src/test/ui/coherence/coherence-fundamental-trait-objects.old.stderr
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
This should just be MyType.
There was a problem hiding this comment.
I'm not sure why this error is emitted at all, I think it might be due to the tuple? I don't know how we'd change the wording to be more accurate.
There was a problem hiding this comment.
If it's possible to impl for MyType, it should also be possible to impl for (MyType, MyType), so I think we should emit the types that are causing the root problem.
There was a problem hiding this comment.
Implementing a trait external to the current crate on a tuple, array or slice of a type from the current crate is not ever allowed. I extended the output to make that a bit clearer, but can add more text if that would help.
There was a problem hiding this comment.
I think this should be `coherence_fundamental_trait_lib::Fundamental<Local>` is not defined in the current crate. Having the dyn and lifetime bound is confusing (also + 'static is default, so needn't be included).
There was a problem hiding this comment.
I couldn't remove the dyn, but that shouldn't be too big of a problem.
There was a problem hiding this comment.
Does anyone know what the proper way of "reversing" resolve_vars_if_possible would be?
There was a problem hiding this comment.
I think we can get away with just printing the path, without dyn or the generics, etc. E.g. here we would just have:
`coherence_fundamental_trait_lib::Fundamental` is not defined in the current crate
because dyn and <Local> are red herrings: they're not what's causing the error (if they were, we should have specific error messages calling them out, like array impls).
There was a problem hiding this comment.
Ah, sorry, I just read your comment here: #65318 (comment). Sorry if I seem like a broken record: I'm just worried that these more specific error messages might be more confusing when they contain this extra information.
There was a problem hiding this comment.
I'm looking over the current test output, and the only cases where we mention dyn already have dyn in the code (or would if the user follows the warnings). The dyn is written unconditionally in the pprinting machinery, and removing would only work for some cases (you could have (dyn T + K), which couldn't be represented with acurately bare path).
There was a problem hiding this comment.
The span for usize is a bit odd: I would expect it to point to the generic argument.
There was a problem hiding this comment.
We don't have a way to point at specific type params at the moment, but if be happy to add that in a follow up PR.
I do believe it will be fairly involved to get the right span, which is why I'd like to do it after merging this.
src/librustc/traits/coherence.rs
Outdated
There was a problem hiding this comment.
It would be nice having a comment here explaining what the field means.
|
r=me with the small span comment addressed. |
|
@bors r=varkor |
|
📌 Commit dc41d6f18c6c9756e83a53193e2376531f0cdfeb has been approved by |
|
☔ The latest upstream changes (presumably #65869) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@bors r=varkor |
|
📌 Commit 627691f has been approved by |
Call out the types that are non local on E0117 CC rust-lang#24745.
Call out the types that are non local on E0117 CC rust-lang#24745.
Call out the types that are non local on E0117 CC rust-lang#24745.
Rollup of 5 pull requests Successful merges: - #65294 (Lint ignored `#[inline]` on function prototypes) - #65318 (Call out the types that are non local on E0117) - #65531 (Update backtrace to 0.3.40) - #65562 (Improve the "try using a variant of the expected type" hint.) - #65809 (Add new EFIAPI ABI) Failed merges: r? @ghost
|
☔ The latest upstream changes (presumably #65919) made this pull request unmergeable. Please resolve the merge conflicts. |
CC #24745.