Skip to content
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

fixes for Box<[T]> #17110

Merged
merged 1 commit into from
Sep 11, 2014
Merged

fixes for Box<[T]> #17110

merged 1 commit into from
Sep 11, 2014

Conversation

thestinger
Copy link
Contributor

The pointer in the slice must not be null, because enum representations
make that assumption. The exchange_malloc function returns a non-null
sentinel for the zero size case, and it must not be passed to the
exchange_free lang item.

Since the length is always equal to the true capacity, a branch on the
length is enough for most types. Slices of zero size types are
statically special cased to never attempt deallocation. This is the same
implementation as Vec<T>.

Closes #14395

The pointer in the slice must not be null, because enum representations
make that assumption. The `exchange_malloc` function returns a non-null
sentinel for the zero size case, and it must not be passed to the
`exchange_free` lang item.

Since the length is always equal to the true capacity, a branch on the
length is enough for most types. Slices of zero size types are
statically special cased to never attempt deallocation. This is the same
implementation as `Vec<T>`.

Closes #14395
bors added a commit that referenced this pull request Sep 11, 2014
The pointer in the slice must not be null, because enum representations
make that assumption. The `exchange_malloc` function returns a non-null
sentinel for the zero size case, and it must not be passed to the
`exchange_free` lang item.

Since the length is always equal to the true capacity, a branch on the
length is enough for most types. Slices of zero size types are
statically special cased to never attempt deallocation. This is the same
implementation as `Vec<T>`.

Closes #14395
@bors bors closed this Sep 11, 2014
@bors bors merged commit 9639caf into rust-lang:master Sep 11, 2014
@thestinger thestinger deleted the dst branch September 16, 2014 06:42
lnicola pushed a commit to lnicola/rust that referenced this pull request Apr 20, 2024
Cargo script mvp

Based on rust-lang/rust-analyzer#15456,

As the original PR stated, detached files are still horrendous to work with.
lnicola pushed a commit to lnicola/rust that referenced this pull request Apr 20, 2024
Cargo script mvp

Based on rust-lang/rust-analyzer#15456,

As the original PR stated, detached files are still horrendous to work with.
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

Successfully merging this pull request may close these issues.

Remove null check from heap::deallocate
2 participants