Skip to content

Refactor collections::List<T> to avoid using managed boxes #12620

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

Closed
brunoabinader opened this issue Feb 28, 2014 · 3 comments
Closed

Refactor collections::List<T> to avoid using managed boxes #12620

brunoabinader opened this issue Feb 28, 2014 · 3 comments

Comments

@brunoabinader
Copy link
Contributor

After closing #12344, we should think about the best strategy for replacing usage of managed boxes inside List<T>. @alexcrichton, @bill-myers and @eddyb provided good hints on how we should implement List<T> internally (i.e. instead of using an enum, use a struct-based approach with 'head' and 'tail').

@brunoabinader
Copy link
Contributor Author

My initial idea was to simply replace manage box with owned or even refcounted box. I have some prototypes ready however I'd require some help writing benchmark tests to verify. The idea that Cons and Nil as duplicates for the Option behavior is also correct, so it might be simple to just get rid of enum and go for a struct, Option-based approach.

@huonw
Copy link
Member

huonw commented Feb 28, 2014

Using Rc<...> seems like a good, preferable idea, because it allows for sharing tails.

(With owned boxes, the linked list becomes a plain owned stack, and std::vec_ng::Vec (or, ~[]) are better versions of these stacks on most dimensions: lower memory use, better cache locality, still have (amoritised) O(1) push/pop, O(1) indexing/length...)

@huonw huonw added the A-libs label Feb 28, 2014
@pongad
Copy link
Contributor

pongad commented Apr 2, 2014

Close since List has been removed?

flip1995 pushed a commit to flip1995/rust that referenced this issue May 17, 2024
Handle `rustc_on_unimplemented` in duplicated_attributes

```rust
#[rustc_on_unimplemented(
    on(
        _Self = "&str",
        label = "`a"
    ),
    on(
        _Self = "alloc::string::String",
        label = "a"
    ),
)]
```

The lint treats this as a repetition because `rustc_on_unimplemented::on::label` appears twice, but that's ok.

Fixes rust-lang#12619

changelog: [`duplicated_attributes`]: fix handling of `rustc_on_unimplemented`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants