Repository navigation
Vec box fix #742
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
Draft
alejandro-vaz
wants to merge
16
commits into
servo:v2
Choose a base branch
from
alejandro-vaz:vec-box-fix
base: v2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Vec box fix #742
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
aee0d00
feat: allocator extension for splice
alejandro-vaz f457c6b
chore: inline methods
alejandro-vaz 54f1507
style: formatting
alejandro-vaz 594a982
chore: add repr transparent
alejandro-vaz 3f91a9d
refactor: rename to proxy
alejandro-vaz 3cfbd2f
refactor: better allocator org
alejandro-vaz 287f323
style: reorder
alejandro-vaz 991aebf
fix: clonable
alejandro-vaz d86600d
style: formatting
alejandro-vaz 1a91bb0
Merge branch 'v2' into new-alloc-org
alejandro-vaz ee58199
refactor: allocator like trait
alejandro-vaz a940350
refactor: remove infallible
alejandro-vaz 58be4a1
Merge branch 'v2' into vec-box-fix
alejandro-vaz bd2428d
fix: errors
alejandro-vaz 97f44c2
style: formatting
alejandro-vaz ba0760d
fix: remove warning
alejandro-vaz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,19 @@ | ||
| #[cfg(not(feature = "allocator-api2"))] | ||
| pub use alloc::boxed::Box; | ||
| #[cfg(feature = "allocator-api2")] | ||
| pub use allocator_api2::boxed::Box; | ||
| use { | ||
| super::{ | ||
| Allocator, | ||
| like::Like, | ||
| requirement::Requirement | ||
| }, | ||
| core::marker::PhantomData | ||
| }; | ||
|
|
||
| pub struct Box<Item: ?Sized, Heap: Allocator + Requirement>(PhantomData<(Heap, Item)>); | ||
|
|
||
| impl<Item: ?Sized, Heap: Allocator + Requirement> Like for Box<Item, Heap> { | ||
| #[cfg(not(feature = "allocator-api"))] | ||
| type Type = alloc::boxed::Box<Item>; | ||
| #[cfg(all(feature = "allocator-api", not(feature = "allocator-api2")))] | ||
| type Type = alloc::boxed::Box<Item, Heap>; | ||
| #[cfg(feature = "allocator-api2")] | ||
| type Type = allocator_api2::boxed::Box<Item, Heap>; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| pub trait Like { | ||
| type Type; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #[cfg(all(feature = "allocator-api", not(feature = "allocator-api2")))] | ||
| pub use alloc::alloc::Allocator as Requirement; | ||
| #[cfg(feature = "allocator-api2")] | ||
| pub use allocator_api2::alloc::Allocator as Requirement; | ||
| #[cfg(not(feature = "allocator-api"))] | ||
| pub use core::marker::Sized as Requirement; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,23 @@ | ||
| #[cfg(not(feature = "allocator-api2"))] | ||
| #[rustfmt::skip] | ||
| pub use alloc::{ | ||
| vec, | ||
| vec::Vec | ||
| }; | ||
|
|
||
| pub use alloc::vec; | ||
| #[cfg(feature = "allocator-api2")] | ||
| #[rustfmt::skip] | ||
| pub use allocator_api2::{ | ||
| vec, | ||
| vec::Vec | ||
| pub use allocator_api2::vec; | ||
| use { | ||
| super::{ | ||
| Allocator, | ||
| like::Like, | ||
| requirement::Requirement | ||
| }, | ||
| core::marker::PhantomData | ||
| }; | ||
|
|
||
| pub struct Vec<Item, Heap: Allocator + Requirement>(PhantomData<(Heap, Item)>); | ||
|
|
||
| impl<Item, Heap: Allocator + Requirement> Like for Vec<Item, Heap> { | ||
| #[cfg(not(feature = "allocator-api"))] | ||
| type Type = alloc::vec::Vec<Item>; | ||
| #[cfg(all(feature = "allocator-api", not(feature = "allocator-api2")))] | ||
| type Type = alloc::vec::Vec<Item, Heap>; | ||
| #[cfg(feature = "allocator-api2")] | ||
| type Type = allocator_api2::vec::Vec<Item, Heap>; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.