Skip to content

Rename Alloc to AllocRef #1154

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

Merged
merged 2 commits into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
698fcd38fa9548e64a2092ff48c9d15ceb57d40c
3761dcd3467441f78939ccb3b341b03b6a7558d7
2 changes: 1 addition & 1 deletion tests/compile-fail/deallocate-bad-alignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
extern crate alloc;

use alloc::alloc::Global;
use std::alloc::*;
use std::alloc::{AllocRef, Layout};

// error-pattern: incorrect alloc info: expected size 1 and align 2, got size 1 and align 1

Expand Down
2 changes: 1 addition & 1 deletion tests/compile-fail/deallocate-bad-size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
extern crate alloc;

use alloc::alloc::Global;
use std::alloc::*;
use std::alloc::{AllocRef, Layout};

// error-pattern: incorrect alloc info: expected size 2 and align 1, got size 1 and align 1

Expand Down
2 changes: 1 addition & 1 deletion tests/compile-fail/deallocate-twice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
extern crate alloc;

use alloc::alloc::Global;
use std::alloc::*;
use std::alloc::{AllocRef, Layout};

// error-pattern: tried to deallocate dangling pointer

Expand Down
2 changes: 1 addition & 1 deletion tests/compile-fail/reallocate-bad-size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
extern crate alloc;

use alloc::alloc::Global;
use std::alloc::*;
use std::alloc::{AllocRef, Layout};

// error-pattern: incorrect alloc info: expected size 2 and align 1, got size 1 and align 1

Expand Down
2 changes: 1 addition & 1 deletion tests/compile-fail/reallocate-change-alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
extern crate alloc;

use alloc::alloc::Global;
use std::alloc::*;
use std::alloc::{AllocRef, Layout};

fn main() {
unsafe {
Expand Down
2 changes: 1 addition & 1 deletion tests/compile-fail/reallocate-dangling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
extern crate alloc;

use alloc::alloc::Global;
use std::alloc::*;
use std::alloc::{AllocRef, Layout};

// error-pattern: dangling pointer was dereferenced

Expand Down
6 changes: 3 additions & 3 deletions tests/run-pass/heap_allocator.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#![feature(allocator_api)]

use std::ptr::NonNull;
use std::alloc::{Global, Alloc, Layout, System};
use std::alloc::{Global, AllocRef, Layout, System};
use std::slice;

fn check_alloc<T: Alloc>(mut allocator: T) { unsafe {
fn check_alloc<T: AllocRef>(mut allocator: T) { unsafe {
for &align in &[4, 8, 16, 32] {
let layout = Layout::from_size_align(20, align).unwrap();

Expand Down Expand Up @@ -40,7 +40,7 @@ fn check_alloc<T: Alloc>(mut allocator: T) { unsafe {
}
} }

fn check_align_requests<T: Alloc>(mut allocator: T) {
fn check_align_requests<T: AllocRef>(mut allocator: T) {
for &size in &[2, 8, 64] { // size less than and bigger than alignment
for &align in &[4, 8, 16, 32] { // Be sure to cover less than and bigger than `MIN_ALIGN` for all architectures
let iterations = 32;
Expand Down