Remove duplicate predicates in explicit_predicates_of#54780
Remove duplicate predicates in explicit_predicates_of#54780bors merged 1 commit intorust-lang:masterfrom
explicit_predicates_of#54780Conversation
src/librustc_typeck/collect.rs
Outdated
There was a problem hiding this comment.
Do predicates need to contain copies of the elements in uniques? Since both have the same elements and the Vec is used only (as far as I understand) to keep the order, maybe it could hold just references to the elements in uniques instead? On the other hand, Predicate is Copy...
There was a problem hiding this comment.
Yes everything is Copy (these are references to arena-allocated memory) so I didn’t care to do such an optimization :)
|
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 |
966afaf to
8327976
Compare
| /// compile-fail UI tests. | ||
| struct UniquePredicates<'tcx> { | ||
| predicates: Vec<(ty::Predicate<'tcx>, Span)>, | ||
| uniques: FxHashSet<(ty::Predicate<'tcx>, Span)>, |
There was a problem hiding this comment.
Hmm, I wonder if we should add the indexmap crate and use that instead.
|
@bors r+ |
|
📌 Commit 8327976 has been approved by |
Remove duplicate predicates in `explicit_predicates_of` I took a more brutal approach than described in rust-lang#52187. I could have used the `linked_hash_map` crate but this seems overkill, especially as we need a vec storage in the end. r? @nikomatsakis
Remove duplicate predicates in `explicit_predicates_of` I took a more brutal approach than described in rust-lang#52187. I could have used the `linked_hash_map` crate but this seems overkill, especially as we need a vec storage in the end. r? @nikomatsakis
Rollup of 10 pull requests Successful merges: - #53523 (Add doc for impl From for Std Error) - #54746 (simplify some unused lints code) - #54761 (Make spec_extend use for_each()) - #54769 (Fix typo in CONTRIBUTING.md) - #54773 (Update a FIXME in memory.rs) - #54777 (abolish ICE when pretty-printing async block) - #54780 (Remove duplicate predicates in `explicit_predicates_of`) - #54788 (A handful of cleanups for rustc/mir) - #54789 (Introduce `TyKind::UnnormalizedProjection`) - #54795 (remove padding from multiline format string label) Failed merges: r? @ghost
I took a more brutal approach than described in #52187. I could have used the
linked_hash_mapcrate but this seems overkill, especially as we need a vec storage in the end.r? @nikomatsakis