Merge pull request #103 from Gankro/layout-array

Use the alloc_layout_extra feature for Layout::array::<T>
pull/104/head
Steve Klabnik 6 years ago committed by GitHub
commit cf92c5c409
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,6 +3,7 @@
```rust ```rust
#![feature(ptr_internals)] #![feature(ptr_internals)]
#![feature(allocator_api)] #![feature(allocator_api)]
#![feature(alloc_layout_extra)]
use std::ptr::{Unique, NonNull, self}; use std::ptr::{Unique, NonNull, self};
use std::mem; use std::mem;
@ -331,7 +332,7 @@ impl<'a, T> Drop for Drain<'a, T> {
# assert_eq!(5, x); # assert_eq!(5, x);
# assert_eq!(1, v.len()); # assert_eq!(1, v.len());
# } # }
# #
# pub fn iter_test() { # pub fn iter_test() {
# let mut v = Vec::new(); # let mut v = Vec::new();
# for i in 0..10 { # for i in 0..10 {
@ -344,7 +345,7 @@ impl<'a, T> Drop for Drain<'a, T> {
# assert_eq!(0, *first); # assert_eq!(0, *first);
# assert_eq!(9, *last); # assert_eq!(9, *last);
# } # }
# #
# pub fn test_drain() { # pub fn test_drain() {
# let mut v = Vec::new(); # let mut v = Vec::new();
# for i in 0..10 { # for i in 0..10 {
@ -361,19 +362,19 @@ impl<'a, T> Drop for Drain<'a, T> {
# v.push(Box::new(1)); # v.push(Box::new(1));
# assert_eq!(1, *v.pop().unwrap()); # assert_eq!(1, *v.pop().unwrap());
# } # }
# #
# pub fn test_zst() { # pub fn test_zst() {
# let mut v = Vec::new(); # let mut v = Vec::new();
# for _i in 0..10 { # for _i in 0..10 {
# v.push(()) # v.push(())
# } # }
# #
# let mut count = 0; # let mut count = 0;
# #
# for _ in v.into_iter() { # for _ in v.into_iter() {
# count += 1 # count += 1
# } # }
# #
# assert_eq!(10, count); # assert_eq!(10, count);
# } # }
# } # }

Loading…
Cancel
Save