-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce an arena type which may be used to allocate a list of types with destructors #59536
Conversation
rustc::ty::subst::SubstsRef<$tcx> | ||
)>, | ||
[decode] specialization_graph: rustc::traits::specialization_graph::Graph, | ||
], $tcx); |
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.
The list of types are declared here with a macro.
r=me on that last commit, very nice! |
#[inline] | ||
default fn arena<'a>(_: &'a Arena<'tcx>) -> Option<&'a TypedArena<Self>> { | ||
None | ||
} |
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.
This impl can conflict with the types in the list :(
error[E0119]: conflicting implementations of trait `arena::ArenaAllocatable<'_>` for type `std::collections::HashSet<hir::item_local_id_inner::ItemLocalId, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`:
--> src\librustc\arena.rs:42:13
|
4 | / macro_rules! arena_types {
5 | | ($macro:path, $args:tt, $tcx:lifetime) => (
6 | | $macro!($args, [
| |_________-
7 | || [] vtable_method: Option<(
8 | || rustc::hir::def_id::DefId,
9 | || rustc::ty::subst::SubstsRef<$tcx>
... ||
15 | || [] item_local_set: rustc::util::nodemap::ItemLocalSet,
16 | || ], $tcx);
| ||_________________- in this macro invocation
17 | | )
18 | | }
| |_- in this expansion of `arena_types!`
...
37 | / macro_rules! impl_arena_allocatable {
38 | | ([], [$($a:tt $name:ident: $ty:ty,)*], $tcx:lifetime) => {
39 | | $(
40 | | impl_specialized_decodable!($a $ty, $tcx);
41 | |
42 | | impl<$tcx> ArenaAllocatable<$tcx> for $ty {
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::collections::HashSet<hir::item_local_id_inner::ItemLocalId, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
... |
49 | | }
50 | | }
| |__- in this expansion of `impl_arena_allocatable!`
...
54 | arena_types!(impl_arena_allocatable, [], 'tcx);
| ----------------------------------------------- in this macro invocation
...
62 | impl<'tcx, T: Copy> ArenaAllocatable<'tcx> for T {
| ------------------------------------------------ first implementation here
|
= note: upstream crates may add new impl of trait `std::marker::Copy` for type `std::collections::HashSet<hir::item_local_id_inner::ItemLocalId, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>` in future versions
error: aborting due to previous error
Do we have some way to express an ArenaAllocatable
or Copy
bound?
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.
Oh wow, it would be nice to be able to rely on sets and maps never being Copy
...
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 found a way around this using a marker trait.
☔ The latest upstream changes (presumably #59561) made this pull request unmergeable. Please resolve the merge conflicts. |
I added a |
@bors try |
🔒 Merge conflict This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again. How do I rebase?Assuming
You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial. Please avoid the "Resolve conflicts" button on GitHub. It uses Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Error message
|
@bors try |
Introduce an arena type which may be used to allocate a list of types with destructors You can also specify that you want deserializers for `&'tcx [T]` and `&'tcx T` for a type in the list, which will allocate those using the arena. Based on #59517 and #59533. Look at the last commit for the interesting changes. An alternative to #56448. cc @michaelwoerister @eddyb r? @oli-obk
☀️ Try build successful - checks-travis |
@rust-timer build bb306b0 |
Success: Queued bb306b0 with parent befeeb7, comparison URL. |
Finished benchmarking try commit bb306b0 |
… with destructors
…se specialization to find the right field
The last 3 commits also need a review here. |
@bors try |
⌛ Trying commit 43e33ea with merge 55ed5f73fc9910209ee1affaa62b5c688ce6b872... |
☀️ Try build successful - checks-travis |
Introduce an arena type which may be used to allocate a list of types with destructors You can also specify that you want deserializers for `&'tcx [T]` and `&'tcx T` for a type in the list, which will allocate those using the arena. Based on #59517 and #59533. Look at the last commit for the interesting changes. An alternative to #56448. cc @michaelwoerister @eddyb r? @oli-obk
☀️ Test successful - checks-travis, status-appveyor |
You can also specify that you want deserializers for
&'tcx [T]
and&'tcx T
for a type in the list, which will allocate those using the arena.Based on #59517 and #59533. Look at the last commit for the interesting changes.
An alternative to #56448. cc @michaelwoerister @eddyb
r? @oli-obk