auto merge of #15208 : alexcrichton/rust/snapshots, r=pcwalton

This change registers new snapshots, allowing `*T` to be removed from the language. This is a large breaking change, and it is recommended that if compiler errors are seen that any FFI calls are audited to determine whether they should be actually taking `*mut T`.
This commit is contained in:
bors 2014-06-28 20:11:34 +00:00
commit fe8bc17801
228 changed files with 1813 additions and 1685 deletions

View file

@ -64,7 +64,7 @@ pub mod testtypes {
// As with ty_str, what type should be used for ty_vec?
// Tests ty_ptr
pub type FooPtr = *u8;
pub type FooPtr = *const u8;
// Skipping ty_rptr

View file

@ -18,13 +18,13 @@ static global0: int = 4;
pub static global2: &'static int = &global0;
pub fn verify_same(a: &'static int) {
let a = a as *int as uint;
let b = &global as *int as uint;
let a = a as *const int as uint;
let b = &global as *const int as uint;
assert_eq!(a, b);
}
pub fn verify_same2(a: &'static int) {
let a = a as *int as uint;
let b = global2 as *int as uint;
let a = a as *const int as uint;
let b = global2 as *const int as uint;
assert_eq!(a, b);
}

View file

@ -21,7 +21,7 @@ use std::uint;
// return.
#[start]
fn start(argc: int, argv: **u8) -> int {
fn start(argc: int, argv: *const *const u8) -> int {
green::start(argc, argv, rustuv::event_loop, main)
}

View file

@ -17,7 +17,7 @@ extern crate green;
extern crate rustuv;
#[start]
fn start(argc: int, argv: **u8) -> int {
fn start(argc: int, argv: *const *const u8) -> int {
green::start(argc, argv, rustuv::event_loop, main)
}

View file

@ -14,7 +14,7 @@
use std::ops::Deref;
struct Rc<T> {
value: *T
value: *const T
}
impl<T> Deref<T> for Rc<T> {

View file

@ -14,7 +14,7 @@
use std::ops::Deref;
struct Rc<T> {
value: *T
value: *const T
}
impl<T> Deref<T> for Rc<T> {

View file

@ -9,7 +9,7 @@
// except according to those terms.
fn foo(x: *Box<int>) -> Box<int> {
fn foo(x: *const Box<int>) -> Box<int> {
let y = *x; //~ ERROR dereference of unsafe pointer requires unsafe function or block
return y;
}

View file

@ -28,12 +28,12 @@ pub fn main() {
borrow(x.f, |b_x| {
//~^ ERROR cannot borrow `x` as mutable because `*x.f` is also borrowed as immutable
assert_eq!(*b_x, 3);
assert_eq!(&(*x.f) as *int, &(*b_x) as *int);
assert_eq!(&(*x.f) as *const int, &(*b_x) as *const int);
//~^ NOTE borrow occurs due to use of `x` in closure
x = box(GC) F {f: box 4};
println!("&*b_x = {:p}", &(*b_x));
assert_eq!(*b_x, 3);
assert!(&(*x.f) as *int != &(*b_x) as *int);
assert!(&(*x.f) as *const int != &(*b_x) as *const int);
})
}

View file

@ -28,12 +28,12 @@ pub fn main() {
borrow(x.f, |b_x| {
//~^ ERROR cannot borrow `x` as mutable because `*x.f` is also borrowed as immutable
assert_eq!(*b_x, 3);
assert_eq!(&(*x.f) as *int, &(*b_x) as *int);
assert_eq!(&(*x.f) as *const int, &(*b_x) as *const int);
//~^ NOTE borrow occurs due to use of `x` in closure
*x = box(GC) F{f: box 4};
println!("&*b_x = {:p}", &(*b_x));
assert_eq!(*b_x, 3);
assert!(&(*x.f) as *int != &(*b_x) as *int);
assert!(&(*x.f) as *const int != &(*b_x) as *const int);
})
}

View file

@ -26,12 +26,12 @@ pub fn main() {
borrow(x, |b_x| {
//~^ ERROR cannot borrow `x` as mutable because `*x` is also borrowed as immutable
assert_eq!(*b_x, 3);
assert_eq!(&(*x) as *int, &(*b_x) as *int);
assert_eq!(&(*x) as *const int, &(*b_x) as *const int);
//~^ NOTE borrow occurs due to use of `x` in closure
x = box(GC) 22;
println!("&*b_x = {:p}", &(*b_x));
assert_eq!(*b_x, 3);
assert!(&(*x) as *int != &(*b_x) as *int);
assert!(&(*x) as *const int != &(*b_x) as *const int);
})
}

View file

@ -28,12 +28,12 @@ pub fn main() {
borrow((*x).f, |b_x| {
//~^ ERROR cannot borrow `x` as mutable because `*x.f` is also borrowed as immutable
assert_eq!(*b_x, 3);
assert_eq!(&(*x.f) as *int, &(*b_x) as *int);
assert_eq!(&(*x.f) as *const int, &(*b_x) as *const int);
//~^ NOTE borrow occurs due to use of `x` in closure
x = box(GC) F {f: box 4};
println!("&*b_x = {:p}", &(*b_x));
assert_eq!(*b_x, 3);
assert!(&(*x.f) as *int != &(*b_x) as *int);
assert!(&(*x.f) as *const int != &(*b_x) as *const int);
})
}

View file

@ -9,8 +9,8 @@
// except according to those terms.
static a: &'static str = "foo";
static b: *u8 = a as *u8; //~ ERROR non-scalar cast
static c: *u8 = &a as *u8; //~ ERROR mismatched types
static b: *const u8 = a as *const u8; //~ ERROR non-scalar cast
static c: *const u8 = &a as *const u8; //~ ERROR mismatched types
fn main() {
}

View file

@ -9,7 +9,7 @@
// except according to those terms.
static a: [u8, ..3] = ['h' as u8, 'i' as u8, 0 as u8];
static b: *i8 = &a as *i8; //~ ERROR mismatched types
static b: *const i8 = &a as *const i8; //~ ERROR mismatched types
fn main() {
}

View file

@ -24,7 +24,7 @@ impl BarTy {
fn b(&self) {}
}
impl Foo for *BarTy {
impl Foo for *const BarTy {
fn bar(&self) {
baz();
//~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?
@ -76,7 +76,7 @@ impl Foo for Box<BarTy> {
}
}
impl Foo for *int {
impl Foo for *const int {
fn bar(&self) {
baz();
//~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn bad (p: *int) {
fn bad (p: *const int) {
let _q: &int = p as &int; //~ ERROR non-scalar cast
}

View file

@ -11,6 +11,6 @@
enum bottom { }
fn main() {
let x = &() as *() as *bottom;
let x = &() as *const () as *const bottom;
match x { } //~ ERROR non-exhaustive patterns
}

View file

@ -9,7 +9,7 @@
// except according to those terms.
#[start]
fn start(argc: int, argv: **u8, crate_map: *u8) -> int {
//~^ ERROR start function expects type: `fn(int, **u8) -> int`
fn start(argc: int, argv: *const *const u8, crate_map: *const u8) -> int {
//~^ ERROR start function expects type: `fn(int, *const *const u8) -> int`
0
}

View file

@ -60,8 +60,8 @@ fn test<'a,T,U:Copy>(_: &'a int) {
assert_copy::<||>(); //~ ERROR does not fulfill
// unsafe ptrs are ok
assert_copy::<*int>();
assert_copy::<*&'a mut int>();
assert_copy::<*const int>();
assert_copy::<*const &'a mut int>();
// regular old ints and such are ok
assert_copy::<int>();

View file

@ -52,8 +52,8 @@ fn test<'a,T,U:Send>(_: &'a int) {
// assert_send::<Box<Dummy+'a>>(); // ERROR does not fulfill `Send`
// unsafe ptrs are ok unless they point at unsendable things
assert_send::<*int>();
assert_send::<*&'a int>(); //~ ERROR does not fulfill `Send`
assert_send::<*const int>();
assert_send::<*const &'a int>(); //~ ERROR does not fulfill `Send`
}
fn main() {

View file

@ -11,7 +11,7 @@
#![feature(linkage)]
extern {
#[linkage = "foo"] static foo: *i32;
#[linkage = "foo"] static foo: *const i32;
//~^ ERROR: invalid linkage specified
}

View file

@ -15,11 +15,11 @@ extern crate libc;
extern {
pub fn bare_type1(size: int); //~ ERROR: found rust type
pub fn bare_type2(size: uint); //~ ERROR: found rust type
pub fn ptr_type1(size: *int); //~ ERROR: found rust type
pub fn ptr_type2(size: *uint); //~ ERROR: found rust type
pub fn ptr_type1(size: *const int); //~ ERROR: found rust type
pub fn ptr_type2(size: *const uint); //~ ERROR: found rust type
pub fn good1(size: *libc::c_int);
pub fn good2(size: *libc::c_uint);
pub fn good1(size: *const libc::c_int);
pub fn good2(size: *const libc::c_uint);
}
fn main() {

View file

@ -37,7 +37,7 @@ pub static used_static2: int = used_static;
static USED_STATIC: int = 0;
static STATIC_USED_IN_ENUM_DISCRIMINANT: uint = 10;
pub type typ = *UsedStruct4;
pub type typ = *const UsedStruct4;
pub struct PubStruct;
struct PrivStruct; //~ ERROR: code is never used
struct UsedStruct1 {
@ -58,11 +58,11 @@ struct StructUsedInEnum;
struct StructUsedInGeneric;
pub struct PubStruct2 {
#[allow(dead_code)]
struct_used_as_field: *StructUsedAsField
struct_used_as_field: *const StructUsedAsField
}
pub enum pub_enum { foo1, bar1 }
pub enum pub_enum2 { a(*StructUsedInEnum) }
pub enum pub_enum2 { a(*const StructUsedInEnum) }
pub enum pub_enum3 { Foo = STATIC_USED_IN_ENUM_DISCRIMINANT }
enum priv_enum { foo2, bar2 } //~ ERROR: code is never used
enum used_enum { foo3, bar3 }
@ -106,4 +106,4 @@ fn h() {}
// Similarly, lang items are live
#[lang="fail_"]
fn fail(_: *u8, _: *u8, _: uint) -> ! { loop {} }
fn fail(_: *const u8, _: *const u8, _: uint) -> ! { loop {} }

View file

@ -36,7 +36,7 @@ fn dead_fn2() {} //~ ERROR: code is never used
fn used_fn() {}
#[start]
fn start(_: int, _: **u8) -> int {
fn start(_: int, _: *const *const u8) -> int {
used_fn();
let foo = Foo;
foo.bar2();

View file

@ -54,8 +54,8 @@ mod blah {
enum c_void {}
extern {
fn free(p: *c_void);
fn malloc(size: size_t) -> *c_void;
fn free(p: *const c_void);
fn malloc(size: size_t) -> *const c_void;
}
pub fn baz() {
@ -65,7 +65,7 @@ mod blah {
enum c_void {} //~ ERROR: code is never used
extern {
fn free(p: *c_void); //~ ERROR: code is never used
fn free(p: *const c_void); //~ ERROR: code is never used
}
// Check provided method

View file

@ -14,7 +14,7 @@
#[deriving(Clone)]
struct Foo {
x: *int //~ ERROR use of `#[deriving]` with a raw pointer
x: *const int //~ ERROR use of `#[deriving]` with a raw pointer
}
#[deriving(Clone)]
@ -22,14 +22,14 @@ struct Bar(*mut int); //~ ERROR use of `#[deriving]` with a raw pointer
#[deriving(Clone)]
enum Baz {
A(*int), //~ ERROR use of `#[deriving]` with a raw pointer
A(*const int), //~ ERROR use of `#[deriving]` with a raw pointer
B { x: *mut int } //~ ERROR use of `#[deriving]` with a raw pointer
}
#[deriving(Clone)]
struct Buzz {
x: (*int, //~ ERROR use of `#[deriving]` with a raw pointer
*uint) //~ ERROR use of `#[deriving]` with a raw pointer
x: (*const int, //~ ERROR use of `#[deriving]` with a raw pointer
*const uint) //~ ERROR use of `#[deriving]` with a raw pointer
}
fn main() {}

View file

@ -11,8 +11,8 @@
extern crate libc;
fn main() {
let x : *Vec<int> = &vec!(1,2,3);
let y : *libc::c_void = x as *libc::c_void;
let x : *const Vec<int> = &vec!(1,2,3);
let y : *const libc::c_void = x as *const libc::c_void;
unsafe {
let _z = (*y).clone();
//~^ ERROR does not implement any method in scope

View file

@ -184,4 +184,4 @@ pub mod mytest {
}
}
#[start] fn main(_: int, _: **u8) -> int { 3 }
#[start] fn main(_: int, _: *const *const u8) -> int { 3 }

View file

@ -33,5 +33,5 @@ fn test2() {
//~^ ERROR unresolved import `bar::glob::foo`. There is no `foo` in `bar::glob`
}
#[start] fn main(_: int, _: **u8) -> int { 3 }
#[start] fn main(_: int, _: *const *const u8) -> int { 3 }

View file

@ -30,4 +30,4 @@ fn test1() {
gpriv();
}
#[start] fn main(_: int, _: **u8) -> int { 3 }
#[start] fn main(_: int, _: *const *const u8) -> int { 3 }

View file

@ -29,4 +29,4 @@ fn test2() {
gpriv();
}
#[start] fn main(_: int, _: **u8) -> int { 3 }
#[start] fn main(_: int, _: *const *const u8) -> int { 3 }

View file

@ -9,7 +9,7 @@
// except according to those terms.
fn f(p: *u8) {
fn f(p: *const u8) {
*p = 0u8; //~ ERROR dereference of unsafe pointer requires unsafe function or block
return;
}

View file

@ -12,7 +12,7 @@ struct Rec {
f: int
}
fn f(p: *Rec) -> int {
fn f(p: *const Rec) -> int {
// Test that * ptrs do not autoderef. There is a deeper reason for
// prohibiting this, beyond making unsafe things annoying (which doesn't
@ -26,7 +26,7 @@ fn f(p: *Rec) -> int {
// are prohibited by various checks, such as that the enum is
// instantiable and so forth).
return p.f; //~ ERROR attempted access of field `f` on type `*Rec`
return p.f; //~ ERROR attempted access of field `f` on type `*const Rec`
}
fn main() {

View file

@ -9,7 +9,7 @@
// except according to those terms.
fn f(p: *u8) -> u8 {
fn f(p: *const u8) -> u8 {
return *p; //~ ERROR dereference of unsafe pointer requires unsafe function or block
}

View file

@ -9,7 +9,7 @@
// except according to those terms.
extern "stdcall" {
fn printf(_: *u8, ...); //~ ERROR: variadic function must have C calling convention
fn printf(_: *const u8, ...); //~ ERROR: variadic function must have C calling convention
}
extern {

View file

@ -18,9 +18,9 @@ struct X {
fn main() {
let x1 = X { y: [0, 0] };
let p1: *u8 = &x1.y as *_; //~ ERROR mismatched types
let t1: *[u8, ..2] = &x1.y as *_;
let h1: *[u8, ..2] = &x1.y as *[u8, ..2];
let p1: *const u8 = &x1.y as *const _; //~ ERROR mismatched types
let t1: *const [u8, ..2] = &x1.y as *const _;
let h1: *const [u8, ..2] = &x1.y as *const [u8, ..2];
let mut x1 = X { y: [0, 0] };

View file

@ -13,7 +13,7 @@
mod xx {
extern {
pub fn strlen(str: *u8) -> uint; //~ ERROR found rust type `uint`
pub fn strlen(str: *const u8) -> uint; //~ ERROR found rust type `uint`
pub fn foo(x: int, y: uint); //~ ERROR found rust type `int`
//~^ ERROR found rust type `uint`
}

View file

@ -14,7 +14,7 @@
extern crate native;
#[start]
fn start(argc: int, argv: **u8) -> int {
fn start(argc: int, argv: *const *const u8) -> int {
native::start(argc, argv, proc() {
fail!();
})

View file

@ -22,7 +22,7 @@ fn failfn() {
}
struct r {
v: *int,
v: *const int,
}
impl Drop for r {
@ -33,7 +33,7 @@ impl Drop for r {
}
}
fn r(v: *int) -> r {
fn r(v: *const int) -> r {
r {
v: v
}

View file

@ -15,7 +15,7 @@ extern crate rustuv;
extern crate green;
#[no_mangle] // this needs to get called from C
pub extern "C" fn foo(argc: int, argv: **u8) -> int {
pub extern "C" fn foo(argc: int, argv: *const *const u8) -> int {
green::start(argc, argv, rustuv::event_loop, proc() {
spawn(proc() {
println!("hello");

View file

@ -14,7 +14,7 @@
extern crate native;
#[no_mangle] // this needs to get called from C
pub extern "C" fn foo(argc: int, argv: **u8) -> int {
pub extern "C" fn foo(argc: int, argv: *const *const u8) -> int {
native::start(argc, argv, proc() {
spawn(proc() {
println!("hello");

View file

@ -10,6 +10,6 @@
#[start]
fn start(_argc: int, _argv: **u8) -> int {
fn start(_argc: int, _argv: *const *const u8) -> int {
return 0;
}

View file

@ -18,7 +18,9 @@ use std::finally::Finally;
use std::str;
#[start]
fn start(argc: int, argv: **u8) -> int { native::start(argc, argv, main) }
fn start(argc: int, argv: *const *const u8) -> int {
native::start(argc, argv, main)
}
#[inline(never)]
fn foo() {

View file

@ -52,9 +52,9 @@ fn test_box() {
fn test_ptr() {
unsafe {
let p1: *u8 = ::std::mem::transmute(0u);
let p2: *u8 = ::std::mem::transmute(0u);
let p3: *u8 = ::std::mem::transmute(1u);
let p1: *const u8 = ::std::mem::transmute(0u);
let p2: *const u8 = ::std::mem::transmute(0u);
let p3: *const u8 = ::std::mem::transmute(1u);
assert_eq!(p1, p2);
assert!(p1 != p3);
@ -86,8 +86,8 @@ fn test_class() {
unsafe {
println!("q = {:x}, r = {:x}",
(::std::mem::transmute::<*p, uint>(&q)),
(::std::mem::transmute::<*p, uint>(&r)));
(::std::mem::transmute::<*const p, uint>(&q)),
(::std::mem::transmute::<*const p, uint>(&r)));
}
assert_eq!(q, r);
r.y = 17;

View file

@ -18,8 +18,8 @@ fn borrow(x: &int, f: |x: &int|) {
fn test1(x: Gc<Box<int>>) {
borrow(&*(*x).clone(), |p| {
let x_a = &**x as *int;
assert!((x_a as uint) != (p as *int as uint));
let x_a = &**x as *const int;
assert!((x_a as uint) != (p as *const int as uint));
assert_eq!(unsafe{*x_a}, *p);
})
}

View file

@ -16,8 +16,8 @@ mod mlibc {
use libc::{c_char, c_long, c_longlong};
extern {
pub fn atol(x: *c_char) -> c_long;
pub fn atoll(x: *c_char) -> c_longlong;
pub fn atol(x: *const c_char) -> c_long;
pub fn atoll(x: *const c_char) -> c_longlong;
}
}

View file

@ -31,7 +31,7 @@ impl Logger for MyWriter {
}
#[start]
fn start(argc: int, argv: **u8) -> int {
fn start(argc: int, argv: *const *const u8) -> int {
native::start(argc, argv, proc() {
main();
})

View file

@ -10,5 +10,5 @@
pub fn main() {
let x = 3;
println!("&x={:x}", (&x as *int as uint));
println!("&x={:x}", (&x as *const int as uint));
}

View file

@ -13,7 +13,7 @@
struct Foo {
a: uint,
b: *()
b: *const ()
}
fn foo<T>(a: T) -> T {
@ -25,7 +25,7 @@ static BLOCK_EXPLICIT_UNIT: () = { () };
static BLOCK_IMPLICIT_UNIT: () = { };
static BLOCK_FLOAT: f64 = { 1.0 };
static BLOCK_ENUM: Option<uint> = { Some(100) };
static BLOCK_STRUCT: Foo = { Foo { a: 12, b: 0 as *() } };
static BLOCK_STRUCT: Foo = { Foo { a: 12, b: 0 as *const () } };
static BLOCK_UNSAFE: uint = unsafe { 1000 };
// FIXME: #13970
@ -50,7 +50,7 @@ pub fn main() {
assert_eq!(BLOCK_IMPLICIT_UNIT, ());
assert_eq!(BLOCK_FLOAT, 1.0_f64);
assert_eq!(BLOCK_STRUCT.a, 12);
assert_eq!(BLOCK_STRUCT.b, 0 as *());
assert_eq!(BLOCK_STRUCT.b, 0 as *const ());
assert_eq!(BLOCK_ENUM, Some(100));
assert_eq!(BLOCK_UNSAFE, 1000);

View file

@ -10,7 +10,7 @@
use std::ptr;
static a: *u8 = 0 as *u8;
static a: *const u8 = 0 as *const u8;
pub fn main() {
assert_eq!(a, ptr::null());

View file

@ -13,11 +13,11 @@ extern crate libc;
extern fn foo() {}
static x: extern "C" fn() = foo;
static y: *libc::c_void = x as *libc::c_void;
static y: *const libc::c_void = x as *const libc::c_void;
static a: &'static int = &10;
static b: *int = a as *int;
static b: *const int = a as *const int;
pub fn main() {
assert_eq!(x as *libc::c_void, y);
assert_eq!(a as *int, b);
assert_eq!(x as *const libc::c_void, y);
assert_eq!(a as *const int, b);
}

View file

@ -14,5 +14,5 @@ static x: &'static Big = &([13, 14, 10, 13, 11, 14, 14, 15]);
static y: &'static Pair<'static> = &Pair {a: 15, b: x};
pub fn main() {
assert_eq!(x as *Big, y.b as *Big);
assert_eq!(x as *const Big, y.b as *const Big);
}

View file

@ -12,16 +12,16 @@ use std::str;
static A: [u8, ..2] = ['h' as u8, 'i' as u8];
static B: &'static [u8, ..2] = &A;
static C: *u8 = B as *u8;
static C: *const u8 = B as *const u8;
pub fn main() {
unsafe {
let foo = &A as *u8;
let foo = &A as *const u8;
assert_eq!(str::raw::from_utf8(A), "hi");
assert_eq!(str::raw::from_buf_len(foo, A.len()), "hi".to_string());
assert_eq!(str::raw::from_buf_len(C, B.len()), "hi".to_string());
assert!(*C == A[0]);
assert!(*(&B[0] as *u8) == A[0]);
assert!(*(&B[0] as *const u8) == A[0]);
let bar = str::raw::from_utf8(A).to_c_str();
assert_eq!(bar.with_ref(|buf| str::raw::from_c_str(buf)), "hi".to_string());

View file

@ -54,7 +54,7 @@ macro_rules! iotest (
)
#[cfg(test)] #[start]
fn start(argc: int, argv: **u8) -> int {
fn start(argc: int, argv: *const *const u8) -> int {
green::start(argc, argv, rustuv::event_loop, __test::main)
}

View file

@ -11,7 +11,7 @@
use std::mem;
fn addr_of<T>(ptr: &T) -> uint {
ptr as *T as uint
ptr as *const T as uint
}
fn is_aligned<T>(ptr: &T) -> bool {

View file

@ -9,7 +9,7 @@
// except according to those terms.
extern {
pub fn free(p: *u8);
pub fn free(p: *const u8);
}
pub fn main() {

View file

@ -30,7 +30,7 @@ pub fn main() {
extern fn callback(data: libc::uintptr_t) {
unsafe {
let data: *int = mem::transmute(data);
let data: *const int = mem::transmute(data);
assert_eq!(*data, 100);
}
}

View file

@ -18,7 +18,7 @@ mod mlibc {
extern {
#[link_name = "strlen"]
pub fn my_strlen(str: *c_char) -> size_t;
pub fn my_strlen(str: *const c_char) -> size_t;
}
}

View file

@ -24,7 +24,7 @@ mod mlibc {
use libc::{c_int, c_void, size_t, ssize_t};
extern {
pub fn write(fd: c_int, buf: *c_void, count: size_t) -> ssize_t;
pub fn write(fd: c_int, buf: *const c_void, count: size_t) -> ssize_t;
}
}

View file

@ -17,14 +17,14 @@ struct Foo {
y: Box<uint>,
}
fn foo(Foo {x, ..}: Foo) -> *uint {
let addr: *uint = &*x;
fn foo(Foo {x, ..}: Foo) -> *const uint {
let addr: *const uint = &*x;
addr
}
pub fn main() {
let obj = box 1;
let objptr: *uint = &*obj;
let objptr: *const uint = &*obj;
let f = Foo {x: obj, y: box 2};
let xptr = foo(f);
assert_eq!(objptr, xptr);

View file

@ -15,8 +15,8 @@
// pattern.
fn getaddr(box ref x: Box<uint>) -> *uint {
let addr: *uint = &*x;
fn getaddr(box ref x: Box<uint>) -> *const uint {
let addr: *const uint = &*x;
addr
}
@ -26,7 +26,7 @@ fn checkval(box ref x: Box<uint>) -> uint {
pub fn main() {
let obj = box 1;
let objptr: *uint = &*obj;
let objptr: *const uint = &*obj;
let xptr = getaddr(obj);
assert_eq!(objptr, xptr);

View file

@ -69,7 +69,7 @@ pub fn main() {
t!(format!("{:X}", 10u), "A");
t!(format!("{:s}", "foo"), "foo");
t!(format!("{:s}", "foo".to_string()), "foo");
t!(format!("{:p}", 0x1234 as *int), "0x1234");
t!(format!("{:p}", 0x1234 as *const int), "0x1234");
t!(format!("{:p}", 0x1234 as *mut int), "0x1234");
t!(format!("{:d}", A), "aloha");
t!(format!("{:d}", B), "adios");

View file

@ -14,7 +14,7 @@ use std::ptr;
// even though it would be if the nxt field had type @foo:
struct foo(X);
struct X { x: uint, nxt: *foo }
struct X { x: uint, nxt: *const foo }
pub fn main() {
let _x = foo(X {x: 0, nxt: ptr::null()});

View file

@ -16,8 +16,8 @@ mod rusti {
pub fn atomic_cxchg_acq<T>(dst: *mut T, old: T, src: T) -> T;
pub fn atomic_cxchg_rel<T>(dst: *mut T, old: T, src: T) -> T;
pub fn atomic_load<T>(src: *T) -> T;
pub fn atomic_load_acq<T>(src: *T) -> T;
pub fn atomic_load<T>(src: *const T) -> T;
pub fn atomic_load_acq<T>(src: *const T) -> T;
pub fn atomic_store<T>(dst: *mut T, val: T);
pub fn atomic_store_rel<T>(dst: *mut T, val: T);

View file

@ -23,7 +23,7 @@ pub fn main() {
unsafe {
let x = box 1i;
let mut y = rusti::init();
let mut z: *uint = transmute(&x);
let mut z: *const uint = transmute(&x);
rusti::move_val_init(&mut y, x);
assert_eq!(*y, 1);
assert_eq!(*z, 0); // `x` is nulled out, not directly visible

View file

@ -14,7 +14,7 @@ extern crate green;
extern crate rustuv;
#[start]
fn start(argc: int, argv: **u8) -> int {
fn start(argc: int, argv: *const *const u8) -> int {
green::start(argc, argv, rustuv::event_loop, main)
}

View file

@ -14,7 +14,7 @@ extern crate native;
use std::io::timer;
#[start]
fn start(argc: int, argv: **u8) -> int {
fn start(argc: int, argv: *const *const u8) -> int {
native::start(argc, argv, main)
}

View file

@ -19,7 +19,7 @@ use std::io;
use std::str;
#[start]
fn start(argc: int, argv: **u8) -> int {
fn start(argc: int, argv: *const *const u8) -> int {
green::start(argc, argv, rustuv::event_loop, main)
}

View file

@ -16,7 +16,7 @@ extern crate rustuv;
extern crate native;
#[start]
fn start(argc: int, argv: **u8) -> int {
fn start(argc: int, argv: *const *const u8) -> int {
green::start(argc, argv, rustuv::event_loop, main)
}

View file

@ -25,11 +25,11 @@ impl BarTy {
}
// If these fail, it's necessary to update middle::resolve and the cfail tests.
impl Foo for *BarTy {
impl Foo for *const BarTy {
fn bar(&self) {
self.baz();
BarTy::a();
Foo::bah(None::<*BarTy>);
Foo::bah(None::<*const BarTy>);
}
}
@ -66,10 +66,10 @@ impl Foo for Box<BarTy> {
}
// If these fail, it's necessary to update middle::resolve and the cfail tests.
impl Foo for *int {
impl Foo for *const int {
fn bar(&self) {
self.baz();
Foo::bah(None::<*int>);
Foo::bah(None::<*const int>);
}
}

View file

@ -13,7 +13,7 @@ mod a {
pub mod rustrt {
use super::rust_task;
extern {
pub fn rust_task_is_unwinding(rt: *rust_task) -> bool;
pub fn rust_task_is_unwinding(rt: *const rust_task) -> bool;
}
}
}
@ -23,7 +23,7 @@ mod b {
pub mod rustrt {
use super::rust_task;
extern {
pub fn rust_task_is_unwinding(rt: *rust_task) -> bool;
pub fn rust_task_is_unwinding(rt: *const rust_task) -> bool;
}
}
}

View file

@ -42,9 +42,9 @@ pub mod pipes {
payload: Option<T>
}
pub fn packet<T:Send>() -> *packet<T> {
pub fn packet<T:Send>() -> *const packet<T> {
unsafe {
let p: *packet<T> = mem::transmute(box Stuff{
let p: *const packet<T> = mem::transmute(box Stuff{
state: empty,
blocked_task: None::<Task>,
payload: None::<T>
@ -61,7 +61,7 @@ pub mod pipes {
// We should consider moving this to ::std::unsafe, although I
// suspect graydon would want us to use void pointers instead.
pub unsafe fn uniquify<T>(x: *T) -> Box<T> {
pub unsafe fn uniquify<T>(x: *const T) -> Box<T> {
mem::transmute(x)
}
@ -123,7 +123,7 @@ pub mod pipes {
}
}
pub fn sender_terminate<T:Send>(p: *packet<T>) {
pub fn sender_terminate<T:Send>(p: *const packet<T>) {
let mut p = unsafe { uniquify(p) };
match swap_state_rel(&mut (*p).state, terminated) {
empty | blocked => {
@ -140,7 +140,7 @@ pub mod pipes {
}
}
pub fn receiver_terminate<T:Send>(p: *packet<T>) {
pub fn receiver_terminate<T:Send>(p: *const packet<T>) {
let mut p = unsafe { uniquify(p) };
match swap_state_rel(&mut (*p).state, terminated) {
empty => {
@ -158,7 +158,7 @@ pub mod pipes {
}
pub struct send_packet<T> {
p: Option<*packet<T>>,
p: Option<*const packet<T>>,
}
#[unsafe_destructor]
@ -166,7 +166,7 @@ pub mod pipes {
fn drop(&mut self) {
unsafe {
if self.p != None {
let self_p: &mut Option<*packet<T>> =
let self_p: &mut Option<*const packet<T>> =
mem::transmute(&self.p);
let p = replace(self_p, None);
sender_terminate(p.unwrap())
@ -176,19 +176,19 @@ pub mod pipes {
}
impl<T:Send> send_packet<T> {
pub fn unwrap(&mut self) -> *packet<T> {
pub fn unwrap(&mut self) -> *const packet<T> {
replace(&mut self.p, None).unwrap()
}
}
pub fn send_packet<T:Send>(p: *packet<T>) -> send_packet<T> {
pub fn send_packet<T:Send>(p: *const packet<T>) -> send_packet<T> {
send_packet {
p: Some(p)
}
}
pub struct recv_packet<T> {
p: Option<*packet<T>>,
p: Option<*const packet<T>>,
}
#[unsafe_destructor]
@ -196,7 +196,7 @@ pub mod pipes {
fn drop(&mut self) {
unsafe {
if self.p != None {
let self_p: &mut Option<*packet<T>> =
let self_p: &mut Option<*const packet<T>> =
mem::transmute(&self.p);
let p = replace(self_p, None);
receiver_terminate(p.unwrap())
@ -206,12 +206,12 @@ pub mod pipes {
}
impl<T:Send> recv_packet<T> {
pub fn unwrap(&mut self) -> *packet<T> {
pub fn unwrap(&mut self) -> *const packet<T> {
replace(&mut self.p, None).unwrap()
}
}
pub fn recv_packet<T:Send>(p: *packet<T>) -> recv_packet<T> {
pub fn recv_packet<T:Send>(p: *const packet<T>) -> recv_packet<T> {
recv_packet {
p: Some(p)
}
@ -231,7 +231,7 @@ pub mod pingpong {
pub fn liberate_ping(p: ping) -> ::pipes::send_packet<pong> {
unsafe {
let _addr : *::pipes::send_packet<pong> = match &p {
let _addr : *const ::pipes::send_packet<pong> = match &p {
&ping(ref x) => { mem::transmute(x) }
};
fail!()
@ -240,7 +240,7 @@ pub mod pingpong {
pub fn liberate_pong(p: pong) -> ::pipes::send_packet<ping> {
unsafe {
let _addr : *::pipes::send_packet<ping> = match &p {
let _addr : *const ::pipes::send_packet<ping> = match &p {
&pong(ref x) => { mem::transmute(x) }
};
fail!()

View file

@ -18,7 +18,7 @@ use libc::{c_uint, uint32_t, c_void};
struct KEYGEN {
hash_algorithm: [c_uint, ..2],
count: uint32_t,
salt: *c_void,
salt: *const c_void,
salt_size: uint32_t,
}

View file

@ -15,17 +15,17 @@ extern crate libc;
use std::mem::transmute;
use libc::c_void;
struct NonCopyable(*c_void);
struct NonCopyable(*const c_void);
impl Drop for NonCopyable {
fn drop(&mut self) {
let NonCopyable(p) = *self;
let _v = unsafe { transmute::<*c_void, Box<int>>(p) };
let _v = unsafe { transmute::<*const c_void, Box<int>>(p) };
}
}
pub fn main() {
let t = box 0;
let p = unsafe { transmute::<Box<int>, *c_void>(t) };
let p = unsafe { transmute::<Box<int>, *const c_void>(t) };
let _z = NonCopyable(p);
}

View file

@ -12,9 +12,9 @@ extern crate libc;
extern {
#[link_name = "malloc"]
fn malloc1(len: libc::c_int) -> *libc::c_void;
fn malloc1(len: libc::c_int) -> *const libc::c_void;
#[link_name = "malloc"]
fn malloc2(len: libc::c_int, foo: libc::c_int) -> *libc::c_void;
fn malloc2(len: libc::c_int, foo: libc::c_int) -> *const libc::c_void;
}
pub fn main () {}

View file

@ -14,7 +14,7 @@ pub mod Bar {
}
extern {
pub fn foo(v: *Foo) -> Foo;
pub fn foo(v: *const Foo) -> Foo;
}
}

View file

@ -16,7 +16,7 @@ static mut DROP_S: int = 0i;
static mut DROP_T: int = 0i;
#[start]
fn start(argc: int, argv: **u8) -> int {
fn start(argc: int, argv: *const *const u8) -> int {
let ret = green::start(argc, argv, green::basic::event_loop, main);
unsafe {
assert_eq!(2, DROP);

View file

@ -33,6 +33,6 @@ extern {}
extern {}
#[start]
fn main(_: int, _: **u8) -> int {
fn main(_: int, _: *const *const u8) -> int {
1 % 1
}

View file

@ -19,7 +19,7 @@ extern crate other = "linkage1";
extern {
#[linkage = "extern_weak"]
static foo: *int;
static foo: *const int;
#[linkage = "extern_weak"]
static something_that_should_never_exist: *mut int;
}

View file

@ -15,7 +15,7 @@ extern crate native;
static mut set: bool = false;
#[start]
fn start(argc: int, argv: **u8) -> int {
fn start(argc: int, argv: *const *const u8) -> int {
// make sure that native::start always waits for all children to finish
native::start(argc, argv, proc() {
spawn(proc() {

View file

@ -10,7 +10,7 @@
#[start]
pub fn main(_: int, _: **u8) -> int {
pub fn main(_: int, _: *const *const u8) -> int {
println!("hello");
0
}

View file

@ -28,7 +28,7 @@ use std::io::process::Command;
use std::io::signal::{Listener, Interrupt};
#[start]
fn start(argc: int, argv: **u8) -> int {
fn start(argc: int, argv: *const *const u8) -> int {
green::start(argc, argv, rustuv::event_loop, main)
}

View file

@ -12,7 +12,7 @@ use std::mem::transmute;
mod a {
extern {
pub fn free(x: *u8);
pub fn free(x: *const u8);
}
}

View file

@ -66,44 +66,44 @@ impl TyVisitor for MyVisitor {
_sz: uint, _sz2: uint,
_align: uint) -> bool { true }
fn visit_box(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool { true }
fn visit_uniq(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool { true }
fn visit_ptr(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool { true }
fn visit_rptr(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool { true }
fn visit_box(&mut self, _mtbl: uint, _inner: *const TyDesc) -> bool { true }
fn visit_uniq(&mut self, _mtbl: uint, _inner: *const TyDesc) -> bool { true }
fn visit_ptr(&mut self, _mtbl: uint, _inner: *const TyDesc) -> bool { true }
fn visit_rptr(&mut self, _mtbl: uint, _inner: *const TyDesc) -> bool { true }
fn visit_evec_slice(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool { true }
fn visit_evec_slice(&mut self, _mtbl: uint, _inner: *const TyDesc) -> bool { true }
fn visit_evec_fixed(&mut self, _n: uint, _sz: uint, _align: uint,
_mtbl: uint, _inner: *TyDesc) -> bool { true }
_mtbl: uint, _inner: *const TyDesc) -> bool { true }
fn visit_enter_rec(&mut self, _n_fields: uint,
_sz: uint, _align: uint) -> bool { true }
fn visit_rec_field(&mut self, _i: uint, _name: &str,
_mtbl: uint, _inner: *TyDesc) -> bool { true }
_mtbl: uint, _inner: *const TyDesc) -> bool { true }
fn visit_leave_rec(&mut self, _n_fields: uint,
_sz: uint, _align: uint) -> bool { true }
fn visit_enter_class(&mut self, _name: &str, _named_fields: bool, _n_fields: uint,
_sz: uint, _align: uint) -> bool { true }
fn visit_class_field(&mut self, _i: uint, _name: &str, _named: bool,
_mtbl: uint, _inner: *TyDesc) -> bool { true }
_mtbl: uint, _inner: *const TyDesc) -> bool { true }
fn visit_leave_class(&mut self, _name: &str, _named_fields: bool, _n_fields: uint,
_sz: uint, _align: uint) -> bool { true }
fn visit_enter_tup(&mut self, _n_fields: uint,
_sz: uint, _align: uint) -> bool { true }
fn visit_tup_field(&mut self, _i: uint, _inner: *TyDesc) -> bool { true }
fn visit_tup_field(&mut self, _i: uint, _inner: *const TyDesc) -> bool { true }
fn visit_leave_tup(&mut self, _n_fields: uint,
_sz: uint, _align: uint) -> bool { true }
fn visit_enter_enum(&mut self, _n_variants: uint,
_get_disr: unsafe extern fn(ptr: *Opaque) -> Disr,
_get_disr: unsafe extern fn(ptr: *const Opaque) -> Disr,
_sz: uint, _align: uint) -> bool { true }
fn visit_enter_enum_variant(&mut self,
_variant: uint,
_disr_val: Disr,
_n_fields: uint,
_name: &str) -> bool { true }
fn visit_enum_variant_field(&mut self, _i: uint, _offset: uint, _inner: *TyDesc)
fn visit_enum_variant_field(&mut self, _i: uint, _offset: uint, _inner: *const TyDesc)
-> bool { true }
fn visit_leave_enum_variant(&mut self,
_variant: uint,
@ -112,13 +112,13 @@ impl TyVisitor for MyVisitor {
_name: &str) -> bool { true }
fn visit_leave_enum(&mut self,
_n_variants: uint,
_get_disr: unsafe extern fn(ptr: *Opaque) -> Disr,
_get_disr: unsafe extern fn(ptr: *const Opaque) -> Disr,
_sz: uint, _align: uint) -> bool { true }
fn visit_enter_fn(&mut self, _purity: uint, _proto: uint,
_n_inputs: uint, _retstyle: uint) -> bool { true }
fn visit_fn_input(&mut self, _i: uint, _mode: uint, _inner: *TyDesc) -> bool { true }
fn visit_fn_output(&mut self, _retstyle: uint, _variadic: bool, _inner: *TyDesc)
fn visit_fn_input(&mut self, _i: uint, _mode: uint, _inner: *const TyDesc) -> bool { true }
fn visit_fn_output(&mut self, _retstyle: uint, _variadic: bool, _inner: *const TyDesc)
-> bool { true }
fn visit_leave_fn(&mut self, _purity: uint, _proto: uint,
_n_inputs: uint, _retstyle: uint) -> bool { true }

View file

@ -37,7 +37,7 @@ fn rename_directory() {
assert!((ostream as uint != 0u));
let s = "hello".to_string();
"hello".with_c_str(|buf| {
let write_len = libc::fwrite(buf as *libc::c_void,
let write_len = libc::fwrite(buf as *const libc::c_void,
1u as libc::size_t,
(s.len() + 1u) as libc::size_t,
ostream);

View file

@ -18,7 +18,7 @@ use std::rt::unwind::try;
local_data_key!(foo: int)
#[start]
fn start(argc: int, argv: **u8) -> int {
fn start(argc: int, argv: *const *const u8) -> int {
if argc > 1 {
unsafe {
match **argv.offset(1) {

View file

@ -17,7 +17,7 @@
extern crate libc;
extern { fn puts(s: *u8); }
extern { fn puts(s: *const u8); }
extern "rust-intrinsic" { fn transmute<T, U>(t: T) -> U; }
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
@ -25,9 +25,9 @@ extern "rust-intrinsic" { fn transmute<T, U>(t: T) -> U; }
#[start]
#[no_split_stack]
fn main(_: int, _: **u8) -> int {
fn main(_: int, _: *const *const u8) -> int {
unsafe {
let (ptr, _): (*u8, uint) = transmute("Hello!\0");
let (ptr, _): (*const u8, uint) = transmute("Hello!\0");
puts(ptr);
}
return 0;

View file

@ -12,5 +12,5 @@
pub fn main() {
let foo = 1;
assert_eq!(&foo as *int, &foo as *int);
assert_eq!(&foo as *const int, &foo as *const int);
}

View file

@ -11,7 +11,7 @@
extern crate libc;
pub fn main() {
let f = 1 as *libc::FILE;
let f = 1 as *const libc::FILE;
println!("{}", f as int);
println!("{}", f as uint);
println!("{}", f as i8);
@ -25,7 +25,7 @@ pub fn main() {
println!("{}", 1 as int);
println!("{}", 1 as uint);
println!("{}", 1 as *libc::FILE);
println!("{}", 1 as *const libc::FILE);
println!("{}", 1 as i8);
println!("{}", 1 as i16);
println!("{}", 1 as i32);
@ -39,7 +39,7 @@ pub fn main() {
println!("{}", 1u as int);
println!("{}", 1u as uint);
println!("{}", 1u as *libc::FILE);
println!("{}", 1u as *const libc::FILE);
println!("{}", 1u as i8);
println!("{}", 1u as i16);
println!("{}", 1u as i32);
@ -53,7 +53,7 @@ pub fn main() {
println!("{}", 1i8 as int);
println!("{}", 1i8 as uint);
println!("{}", 1i8 as *libc::FILE);
println!("{}", 1i8 as *const libc::FILE);
println!("{}", 1i8 as i8);
println!("{}", 1i8 as i16);
println!("{}", 1i8 as i32);
@ -67,7 +67,7 @@ pub fn main() {
println!("{}", 1u8 as int);
println!("{}", 1u8 as uint);
println!("{}", 1u8 as *libc::FILE);
println!("{}", 1u8 as *const libc::FILE);
println!("{}", 1u8 as i8);
println!("{}", 1u8 as i16);
println!("{}", 1u8 as i32);
@ -81,7 +81,7 @@ pub fn main() {
println!("{}", 1i16 as int);
println!("{}", 1i16 as uint);
println!("{}", 1i16 as *libc::FILE);
println!("{}", 1i16 as *const libc::FILE);
println!("{}", 1i16 as i8);
println!("{}", 1i16 as i16);
println!("{}", 1i16 as i32);
@ -95,7 +95,7 @@ pub fn main() {
println!("{}", 1u16 as int);
println!("{}", 1u16 as uint);
println!("{}", 1u16 as *libc::FILE);
println!("{}", 1u16 as *const libc::FILE);
println!("{}", 1u16 as i8);
println!("{}", 1u16 as i16);
println!("{}", 1u16 as i32);
@ -109,7 +109,7 @@ pub fn main() {
println!("{}", 1i32 as int);
println!("{}", 1i32 as uint);
println!("{}", 1i32 as *libc::FILE);
println!("{}", 1i32 as *const libc::FILE);
println!("{}", 1i32 as i8);
println!("{}", 1i32 as i16);
println!("{}", 1i32 as i32);
@ -123,7 +123,7 @@ pub fn main() {
println!("{}", 1u32 as int);
println!("{}", 1u32 as uint);
println!("{}", 1u32 as *libc::FILE);
println!("{}", 1u32 as *const libc::FILE);
println!("{}", 1u32 as i8);
println!("{}", 1u32 as i16);
println!("{}", 1u32 as i32);
@ -137,7 +137,7 @@ pub fn main() {
println!("{}", 1i64 as int);
println!("{}", 1i64 as uint);
println!("{}", 1i64 as *libc::FILE);
println!("{}", 1i64 as *const libc::FILE);
println!("{}", 1i64 as i8);
println!("{}", 1i64 as i16);
println!("{}", 1i64 as i32);
@ -151,7 +151,7 @@ pub fn main() {
println!("{}", 1u64 as int);
println!("{}", 1u64 as uint);
println!("{}", 1u64 as *libc::FILE);
println!("{}", 1u64 as *const libc::FILE);
println!("{}", 1u64 as i8);
println!("{}", 1u64 as i16);
println!("{}", 1u64 as i32);
@ -165,7 +165,7 @@ pub fn main() {
println!("{}", 1u64 as int);
println!("{}", 1u64 as uint);
println!("{}", 1u64 as *libc::FILE);
println!("{}", 1u64 as *const libc::FILE);
println!("{}", 1u64 as i8);
println!("{}", 1u64 as i16);
println!("{}", 1u64 as i32);
@ -179,7 +179,7 @@ pub fn main() {
println!("{}", true as int);
println!("{}", true as uint);
println!("{}", true as *libc::FILE);
println!("{}", true as *const libc::FILE);
println!("{}", true as i8);
println!("{}", true as i16);
println!("{}", true as i32);

View file

@ -14,10 +14,10 @@ pub fn main() {
let (tx, rx) = channel::<uint>();
let x = box 1;
let x_in_parent = &(*x) as *int as uint;
let x_in_parent = &(*x) as *const int as uint;
task::spawn(proc() {
let x_in_child = &(*x) as *int as uint;
let x_in_child = &(*x) as *const int as uint;
tx.send(x_in_child);
});

View file

@ -24,7 +24,7 @@ extern crate green;
extern crate rustuv;
#[cfg(test)] #[start]
fn start(argc: int, argv: **u8) -> int {
fn start(argc: int, argv: *const *const u8) -> int {
green::start(argc, argv, rustuv::event_loop, __test::main)
}

View file

@ -25,7 +25,7 @@ use std::io::{Acceptor, Listener};
use std::task::TaskBuilder;
#[start]
fn start(argc: int, argv: **u8) -> int {
fn start(argc: int, argv: *const *const u8) -> int {
green::start(argc, argv, rustuv::event_loop, main)
}

View file

@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn f(a: *int) -> *int { return a; }
fn f(a: *const int) -> *const int { return a; }
fn g(a: *int) -> *int { let b = f(a); return b; }
fn g(a: *const int) -> *const int { let b = f(a); return b; }
pub fn main() { return; }

View file

@ -11,7 +11,7 @@
// This test checks that the `_` type placeholder works
// correctly for enabling type inference.
static CONSTEXPR: *int = &'static 413 as *_;
static CONSTEXPR: *const int = &'static 413 as *const _;
pub fn main() {
let x: Vec<_> = range(0u, 5).collect();
@ -24,7 +24,7 @@ pub fn main() {
assert_eq!(y.len(), 5);
let ptr = &5u;
let ptr2 = ptr as *_;
let ptr2 = ptr as *const _;
assert_eq!(ptr as *uint as uint, ptr2 as uint);
assert_eq!(ptr as *const uint as uint, ptr2 as uint);
}

View file

@ -14,7 +14,7 @@
use std::mem;
fn null<T>() -> *T {
fn null<T>() -> *const T {
unsafe {
mem::transmute(0)
}

View file

@ -26,7 +26,7 @@ struct Pointy {
}
fn make_uniq_closure<A:Send>(a: A) -> proc():Send -> uint {
proc() { &a as *A as uint }
proc() { &a as *const A as uint }
}
fn empty_pointy() -> Gc<RefCell<Pointy>> {

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn f(x: *int) {
fn f(x: *const int) {
unsafe {
assert_eq!(*x, 3);
}

View file

@ -26,4 +26,4 @@ mod baz {
}
#[start]
pub fn start(_: int, _: **u8) -> int { 0 }
pub fn start(_: int, _: *const *const u8) -> int { 0 }

View file

@ -15,7 +15,7 @@ use libc::{c_char, c_int};
// ignore-fast doesn't like extern crate
extern {
fn sprintf(s: *mut c_char, format: *c_char, ...) -> c_int;
fn sprintf(s: *mut c_char, format: *const c_char, ...) -> c_int;
}
unsafe fn check<T>(expected: &str, f: |*mut c_char| -> T) {
@ -41,10 +41,10 @@ pub fn main() {
});
// Make a function pointer
let x: unsafe extern "C" fn(*mut c_char, *c_char, ...) -> c_int = sprintf;
let x: unsafe extern "C" fn(*mut c_char, *const c_char, ...) -> c_int = sprintf;
// A function that takes a function pointer
unsafe fn call(p: unsafe extern "C" fn(*mut c_char, *c_char, ...) -> c_int) {
unsafe fn call(p: unsafe extern "C" fn(*mut c_char, *const c_char, ...) -> c_int) {
// Call with just the named parameter via fn pointer
"Hello World\n".with_c_str(|c| {
check("Hello World\n", |s| p(s, c));

View file

@ -14,7 +14,7 @@
mod libc {
extern {
pub fn malloc(size: int) -> *u8;
pub fn malloc(size: int) -> *const u8;
}
}