Skip to content

Panic when using .collect() with ArcSliceMut #17

Description

@ARitz-Cracker

Can't make sense of this...

 thread 'main' panicked at /home/aritz/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arc-slice-0.1.0/src/slice_mut.rs:1214:28:
 Unsupported
 stack backtrace:
    0: __rustc::rust_begin_unwind
              at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/std/src/panicking.rs:697:5
    1: core::panicking::panic_fmt
              at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/core/src/panicking.rs:75:14
    2: panic_reserve
              at /home/aritz/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arc-slice-0.1.0/src/slice_mut.rs:1214:28
    3: reserve<[private_crate_1::config::CompleteTokenInfo], arc_slice::layout::ArcLayout<false, false>>
              at /home/aritz/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arc-slice-0.1.0/src/slice_mut.rs:1217:13
    4: push<[private_crate_1::config::CompleteTokenInfo], arc_slice::layout::ArcLayout<false, false>>
              at /home/aritz/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arc-slice-0.1.0/src/slice_mut.rs:1246:14
    5: extend<[private_crate_1::config::CompleteTokenInfo], arc_slice::layout::ArcLayout<false, false>, core::iter::adapters::GenericShunt<core::iter::adapters::map::Map<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<private_crate_2::config::AggregatorConfigTokenInfo>>, private_crate_1::config::{impl#2}::from_config_items::{closure_env#1}<alloc::sync::Arc<private_crate_2::sol_utils::SolErrorDecoderRegistry, alloc::alloc::Global>>>, core::result::Result<core::convert::Infallible, private_crate_1::config::CompleteConfigError>>>
              at /home/aritz/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arc-slice-0.1.0/src/slice_mut.rs:2069:18
    6: from_iter<[private_crate_1::config::CompleteTokenInfo], arc_slice::layout::ArcLayout<false, false>, core::iter::adapters::GenericShunt<core::iter::adapters::map::Map<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<private_crate_2::config::AggregatorConfigTokenInfo>>, private_crate_1::config::{impl#2}::from_config_items::{closure_env#1}<alloc::sync::Arc<private_crate_2::sol_utils::SolErrorDecoderRegistry, alloc::alloc::Global>>>, core::result::Result<core::convert::Infallible, private_crate_1::config::CompleteConfigError>>>
              at /home/aritz/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arc-slice-0.1.0/src/slice_mut.rs:2078:14
    7: collect<core::iter::adapters::GenericShunt<core::iter::adapters::map::Map<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<private_crate_2::config::AggregatorConfigTokenInfo>>, private_crate_1::config::{impl#2}::from_config_items::{closure_env#1}<alloc::sync::Arc<private_crate_2::sol_utils::SolErrorDecoderRegistry, alloc::alloc::Global>>>, core::result::Result<core::convert::Infallible, private_crate_1::config::CompleteConfigError>>, arc_slice::slice_mut::ArcSliceMut<[private_crate_1::config::CompleteTokenInfo], arc_slice::layout::ArcLayout<false, false>, true>>
...

Though I tried a minimal setup pushing some hard-coded data into a ArcSliceMut<[CompleteTokenInfo]> and it worked fine. Looking at the source code, it seems like the Unsupported error type is only possible if the allocate param of try_reserve_cold is false, yet it seems like the code path of push has it hard-coded to true?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions