Suggestion when encountering assoc types from hrtb#69048
Suggestion when encountering assoc types from hrtb#69048bors merged 2 commits intorust-lang:masterfrom
Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
|
cc @nagisa |
There was a problem hiding this comment.
Hmm, this says "not representable", but you can still do things like:
pub trait Foo<T> {
type A;
fn get(&self, t: T) -> Self::A;
}
struct SomeStruct<'a, I : for<'x> Foo<&'x isize>> {
field: <I as Foo<&'a isize>>::A
}And it’ll work fine, likely doing exactly what you’d expect?
There was a problem hiding this comment.
I'll have a follow up PR with only the logic for this suggestion, as it will be more involved.
Added a very hacky version of the appropriate suggestion that would require some extra logic to be always accurate, but as a first approach it LGTM.
|
Very cool overall! I think we should remove the "not representable" message for now (or implement an alternative suggestion) and r=me then. |
|
cc @eddyb |
When encountering E0212, detect whether this is a representable case or not, i.e. if it's happening on an `fn` or on an ADT. If the former, provide a structured suggestion, otherwise note that this can't be represented in Rust.
|
Could someone take this over? I have too many assigned PRs. |
|
@bors r+ |
|
📌 Commit bde9677 has been approved by |
Suggestion when encountering assoc types from hrtb When encountering E0212, detect whether this is a representable case or not, i.e. if it's happening on an `fn` or on an ADT. If the former, provide a structured suggestion, otherwise note that this can't be represented in Rust. Fix rust-lang#69000.
Rollup of 9 pull requests Successful merges: - #67642 (Relax bounds on HashMap/HashSet) - #68848 (Hasten macro parsing) - #69008 (Properly use parent generics for opaque types) - #69048 (Suggestion when encountering assoc types from hrtb) - #69049 (Optimize image sizes) - #69050 (Micro-optimize the heck out of LEB128 reading and writing.) - #69068 (Make the SGX arg cleanup implementation a NOP) - #69082 (When expecting `BoxFuture` and using `async {}`, suggest `Box::pin`) - #69104 (bootstrap: Configure cmake when building sanitizer runtimes) Failed merges: r? @ghost
…=ecstatic-morse Select an appropriate unused lifetime name in suggestion Follow up to rust-lang#69048.
…=ecstatic-morse Select an appropriate unused lifetime name in suggestion Follow up to rust-lang#69048.
When encountering E0212, detect whether this is a representable case or
not, i.e. if it's happening on an
fnor on an ADT. If the former,provide a structured suggestion, otherwise note that this can't be
represented in Rust.
Fix #69000.