-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Incr. comp. dep-node for traits, tests #33998
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
These tests reveal that the edges are in some cases too strict.
To handle the general case, we include a vector of def-ids, so that we can account for things like `(Foo, Bar)` which references both `Foo` and `Bar`. This means it is not Copy, so re-jigger some APIs to use borrowing more intelligently.
This way we distinguish, in particular, `Foo: Sized` and `Bar: Sized`, which fixes rust-lang#33850.
TraitSelect(ref d) => op(d).map(TraitSelect), | ||
TraitSelect(ref d, ref type_ds) => { | ||
let d = try_opt!(op(d)); | ||
let type_ds = try_opt!(type_ds.iter().map(|d| op(d)).collect()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why this works. Doesn't the argument to try_opt!()
have to be an Option
of something? But collect()
will return a Vec
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can collect an iterator yielding Option
s into a single Option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonas-schievink Oh, that's interesting. Thanks for enlightening me :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can collect an iterator yielding Options into a single Option
best feature ever
LGTM! r=me with the typo fixed. I'll leave it up to you, if you want to get rid of the avoidable allocation in |
@bors r=mw |
📌 Commit e548c46 has been approved by |
Incr. comp. dep-node for traits, tests Introduce new tests and also make dep-node for trait selection a bit more selective. Fixes #33850 r? @michaelwoerister
Introduce new tests and also make dep-node for trait selection a bit more selective.
Fixes #33850
r? @michaelwoerister