Uh oh!
There was an error while loading. Please reload this page.
Fix deref impl typedef - #68093
Conversation
360624b to
bd734fcComparedns2utf8
commented
Jan 10, 2020
I like that the unwraps have transitioned to expects. |
GuillaumeGomez
commented
Jan 11, 2020
@dns2utf8 This is a side-effect of my debugging (and I hate |
ollie27
left a comment
There was a problem hiding this comment.
This is now only including impls for the inner item_type but we actually need the impls for the typedef itself as well. Take for example:
pubstructFooA;pubtypeFooB = FooA;pubtypeFooC = FooB;implFooA{pubfnfoo_a(&self){}}implFooB{pubfnfoo_b(&self){}}implFooC{pubfnfoo_c(&self){}}pubstructBar;impl std::ops::DerefforBar{typeTarget = FooC;fnderef(&self) -> &Self::Target{unimplemented!()}}Currently the docs for Bar show only method foo_c but with this PR it shows only foo_a but what we really need is all of foo_a, foo_b and foo_c to be included.
I'm not sure of the best way to do that but maybe Typedef could contain a Vec<Type> or Vec<DefId> containing each inner type rather than just a single Option<Type>.
There was a problem hiding this comment.
What is this change for? I can't see anything in this PR that would require this.
There was a problem hiding this comment.
It's not needed anymore, indeed! It was part of my debugging.
There was a problem hiding this comment.
Again, what is this change for?
GuillaumeGomez
commented
Jan 14, 2020
@ollie27 This is a great point: I didn't think about checking the type alias itself for implementations. I'll need to update the PR to extend it a bit. |
kinnison
left a comment
There was a problem hiding this comment.
I also appreciate the .unwrap() -> .expect("...") changes, and other than wondering about the same points as Ollie did in cache.rs I think this is looking quite OK.
I wonder if, in the process of removing that additional debugging code you might fold the formatting fixes into the requisite commits though, to keep the history a bit cleaner?
90e0a90 to
d66457aComparerust-highfive
commented
Jan 15, 2020
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
d66457a to
e6ad49aCompareGuillaumeGomez
commented
Jan 15, 2020
rust-highfive
commented
Jan 15, 2020
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
3da3171 to
8a9b951CompareGuillaumeGomez
commented
Jan 15, 2020
Ok, fixed all the issues encountered. It now returns all implementations made on the type aliases. |
| Some(DefKind::TyAlias) => Some(cx.tcx.type_of(did).clean(cx)), | ||
| _ => None, | ||
| }); | ||
| if let Some(type_alias) = type_alias { |
There was a problem hiding this comment.
Can you try deduplicating the ret.push with the one afterwards? Maybe for for_ in type_alias.into_iter().chain(self.for_.clean(cx)) {
There was a problem hiding this comment.
If we do it this way, we'll have to clone trait_ and items one extra time. I'll write something else instead to avoid the duplication of code.
GuillaumeGomez
commented
Jan 16, 2020
Updated! |
rust-highfive
commented
Jan 16, 2020
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
GuillaumeGomez
commented
Jan 17, 2020
Fixed formatting. |
oli-obk
commented
Jan 17, 2020
@bors r+ |
bors
commented
Jan 17, 2020
📌 Commit 482dc77 has been approved by |
…ef, r=oli-obk Fix deref impl typedef Fixesrust-lang#35295. r? @kinnison
…ef, r=oli-obk Fix deref impl typedef Fixesrust-lang#35295. r? @kinnison
…ef, r=oli-obk Fix deref impl typedef Fixesrust-lang#35295. r? @kinnison
Rollup of 9 pull requests Successful merges: - #66660 (Don't warn about snake case for field puns.) - #68093 (Fix deref impl typedef) - #68204 (Use named fields for `{ast,hir}::ItemKind::Impl`) - #68256 (Do not ICE on malformed suggestion spans) - #68279 (Clean up E0198 explanation) - #68291 (Update sanitizer tests) - #68312 (Add regression test for integer literals in generic arguments in where clauses) - #68314 (Stop treating `FalseEdges` and `FalseUnwind` as having semantic value for const eval) - #68317 (Clean up E0199 explanation) Failed merges: r? @ghost

Fixes#35295.
r? @kinnison