]> git.lizzy.rs Git - rust.git/commitdiff
Rename all raw pointers as necessary
authorAlex Crichton <alex@alexcrichton.com>
Wed, 25 Jun 2014 19:47:34 +0000 (12:47 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Sat, 28 Jun 2014 18:53:58 +0000 (11:53 -0700)
223 files changed:
src/compiletest/compiletest.rs
src/doc/guide-ffi.md
src/doc/guide-runtime.md
src/doc/guide-unsafe.md
src/doc/rust.md
src/liballoc/heap.rs
src/liballoc/owned.rs
src/libarena/lib.rs
src/libcollections/dlist.rs
src/libcollections/hash/mod.rs
src/libcollections/slice.rs
src/libcollections/str.rs
src/libcollections/treemap.rs
src/libcollections/trie.rs
src/libcollections/vec.rs
src/libcore/atomics.rs
src/libcore/fmt/mod.rs
src/libcore/intrinsics.rs
src/libcore/kinds.rs
src/libcore/mem.rs
src/libcore/option.rs
src/libcore/ptr.rs
src/libcore/raw.rs
src/libcore/slice.rs
src/libcore/str.rs
src/libcore/ty.rs
src/libdebug/reflect.rs
src/libdebug/repr.rs
src/libflate/lib.rs
src/libgreen/context.rs
src/libgreen/lib.rs
src/libgreen/sched.rs
src/libgreen/simple.rs
src/libgreen/stack.rs
src/libgreen/task.rs
src/liblibc/lib.rs
src/liblog/lib.rs
src/libnative/io/addrinfo.rs
src/libnative/io/c_unix.rs
src/libnative/io/c_win32.rs
src/libnative/io/file_unix.rs
src/libnative/io/file_win32.rs
src/libnative/io/mod.rs
src/libnative/io/net.rs
src/libnative/io/pipe_unix.rs
src/libnative/io/pipe_win32.rs
src/libnative/io/process.rs
src/libnative/io/timer_unix.rs
src/libnative/io/timer_win32.rs
src/libnative/io/util.rs
src/libnative/lib.rs
src/libnative/task.rs
src/librlibc/lib.rs
src/librustc/back/lto.rs
src/librustc/lib/llvm.rs
src/librustc/lint/mod.rs
src/librustc/metadata/encoder.rs
src/librustc/metadata/loader.rs
src/librustc/middle/astencode.rs
src/librustc/middle/liveness.rs
src/librustc/middle/subst.rs
src/librustc/middle/trans/build.rs
src/librustc/middle/trans/builder.rs
src/librustc/middle/trans/common.rs
src/librustc/middle/trans/context.rs
src/librustc/middle/trans/debuginfo.rs
src/librustc/middle/ty.rs
src/librustc/middle/typeck/check/mod.rs
src/librustc/plugin/load.rs
src/librustc/util/ppaux.rs
src/librustc/util/sha2.rs
src/librustdoc/flock.rs
src/librustdoc/html/markdown.rs
src/librustdoc/plugins.rs
src/librustrt/args.rs
src/librustrt/at_exit_imp.rs
src/librustrt/c_str.rs
src/librustrt/lib.rs
src/librustrt/libunwind.rs
src/librustrt/local_data.rs
src/librustrt/local_heap.rs
src/librustrt/local_ptr.rs
src/librustrt/mutex.rs
src/librustrt/stack.rs
src/librustrt/thread.rs
src/librustrt/thread_local_storage.rs
src/librustrt/unwind.rs
src/librustrt/util.rs
src/librustuv/addrinfo.rs
src/librustuv/async.rs
src/librustuv/file.rs
src/librustuv/idle.rs
src/librustuv/lib.rs
src/librustuv/net.rs
src/librustuv/pipe.rs
src/librustuv/process.rs
src/librustuv/queue.rs
src/librustuv/signal.rs
src/librustuv/stream.rs
src/librustuv/timeout.rs
src/librustuv/timer.rs
src/librustuv/tty.rs
src/librustuv/uvio.rs
src/librustuv/uvll.rs
src/libserialize/ebml.rs
src/libstd/c_vec.rs
src/libstd/collections/hashmap.rs
src/libstd/collections/lru_cache.rs
src/libstd/dynamic_lib.rs
src/libstd/gc.rs
src/libstd/io/extensions.rs
src/libstd/io/test.rs
src/libstd/lib.rs
src/libstd/os.rs
src/libstd/rand/os.rs
src/libstd/rt/backtrace.rs
src/libstd/rt/mod.rs
src/libstd/task.rs
src/libsync/deque.rs
src/libsync/mpsc_intrusive.rs
src/libsync/raw.rs
src/libsyntax/owned_slice.rs
src/libsyntax/print/pprust.rs
src/libtime/lib.rs
src/test/auxiliary/issue13507.rs
src/test/auxiliary/xcrate_static_addresses.rs
src/test/bench/rt-spawn-rate.rs
src/test/bench/silly-test-spawn.rs
src/test/compile-fail/borrowck-borrow-overloaded-auto-deref.rs
src/test/compile-fail/borrowck-borrow-overloaded-deref.rs
src/test/compile-fail/borrowck-move-from-unsafe-ptr.rs
src/test/compile-fail/borrowck-preserve-box-in-field.rs
src/test/compile-fail/borrowck-preserve-box-in-uniq.rs
src/test/compile-fail/borrowck-preserve-box.rs
src/test/compile-fail/borrowck-preserve-expl-deref.rs
src/test/compile-fail/const-cast-different-types.rs
src/test/compile-fail/const-cast-wrong-type.rs
src/test/compile-fail/issue-14254.rs
src/test/compile-fail/issue-2995.rs
src/test/compile-fail/issue-3096-2.rs
src/test/compile-fail/issue-9575.rs
src/test/compile-fail/kindck-copy.rs
src/test/compile-fail/kindck-send.rs
src/test/compile-fail/linkage3.rs
src/test/compile-fail/lint-ctypes.rs
src/test/compile-fail/lint-dead-code-1.rs
src/test/compile-fail/lint-dead-code-2.rs
src/test/compile-fail/lint-dead-code-3.rs
src/test/compile-fail/lint-raw-ptr-deriving.rs
src/test/compile-fail/non-copyable-void.rs
src/test/compile-fail/privacy1.rs
src/test/compile-fail/privacy2.rs
src/test/compile-fail/privacy3.rs
src/test/compile-fail/privacy4.rs
src/test/compile-fail/unsafe-fn-assign-deref-ptr.rs
src/test/compile-fail/unsafe-fn-autoderef.rs
src/test/compile-fail/unsafe-fn-deref-ptr.rs
src/test/compile-fail/variadic-ffi.rs
src/test/compile-fail/vector-cast-weirdness.rs
src/test/compile-fail/warn-foreign-int-types.rs
src/test/run-fail/native-failure.rs
src/test/run-fail/unwind-box-res.rs
src/test/run-make/bootstrap-from-c-with-green/lib.rs
src/test/run-make/bootstrap-from-c-with-native/lib.rs
src/test/run-pass/attr-start.rs
src/test/run-pass/backtrace.rs
src/test/run-pass/binops.rs
src/test/run-pass/borrowck-borrow-from-expr-block.rs
src/test/run-pass/c-stack-returning-int64.rs
src/test/run-pass/capturing-logging.rs
src/test/run-pass/cast-region-to-uint.rs
src/test/run-pass/const-block.rs
src/test/run-pass/const-cast-ptr-int.rs
src/test/run-pass/const-cast.rs
src/test/run-pass/const-region-ptrs-noncopy.rs
src/test/run-pass/const-str-ptr.rs
src/test/run-pass/core-run-destroy.rs
src/test/run-pass/enum-alignment.rs
src/test/run-pass/extern-pub.rs
src/test/run-pass/foreign-call-no-runtime.rs
src/test/run-pass/foreign-fn-linkname.rs
src/test/run-pass/foreign2.rs
src/test/run-pass/func-arg-incomplete-pattern.rs
src/test/run-pass/func-arg-ref-pattern.rs
src/test/run-pass/ifmt.rs
src/test/run-pass/instantiable.rs
src/test/run-pass/intrinsic-atomics.rs
src/test/run-pass/intrinsic-move-val.rs
src/test/run-pass/issue-12684.rs
src/test/run-pass/issue-12699.rs
src/test/run-pass/issue-13304.rs
src/test/run-pass/issue-13494.rs
src/test/run-pass/issue-14254.rs
src/test/run-pass/issue-1866.rs
src/test/run-pass/issue-2718.rs
src/test/run-pass/issue-3656.rs
src/test/run-pass/issue-4735.rs
src/test/run-pass/issue-5791.rs
src/test/run-pass/issue-6470.rs
src/test/run-pass/issue-8860.rs
src/test/run-pass/lang-item-public.rs
src/test/run-pass/linkage1.rs
src/test/run-pass/native-always-waits.rs
src/test/run-pass/native-print-no-runtime.rs
src/test/run-pass/process-detach.rs
src/test/run-pass/pub-extern-privacy.rs
src/test/run-pass/reflect-visit-type.rs
src/test/run-pass/rename-directory.rs
src/test/run-pass/running-with-no-runtime.rs
src/test/run-pass/smallest-hello-world.rs
src/test/run-pass/stable-addr-of.rs
src/test/run-pass/supported-cast.rs
src/test/run-pass/task-spawn-move-and-copy.rs
src/test/run-pass/tcp-connect-timeouts.rs
src/test/run-pass/tcp-stress.rs
src/test/run-pass/type-ptr.rs
src/test/run-pass/typeck_type_placeholder_1.rs
src/test/run-pass/unify-return-ty.rs
src/test/run-pass/uniq-cc-generic.rs
src/test/run-pass/unsafe-pointer-assignability.rs
src/test/run-pass/use.rs
src/test/run-pass/variadic-ffi.rs
src/test/run-pass/warn-ctypes-inhibit.rs

index 4de7b89ba6f29a21d3e9a83cb92b5396ef995cba..9eac38e4cd5b7cb77e70cc03e65fde68c64c45db 100644 (file)
@@ -42,7 +42,7 @@
 pub mod errors;
 
 #[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)
 }
 
index 13e44765d59eb3ee88b87f7e98318e321453114f..bba9594afeb6d6bf71f017560ae85f5e1fe48f38 100644 (file)
@@ -50,19 +50,19 @@ use libc::{c_int, size_t};
 
 #[link(name = "snappy")]
 extern {
-    fn snappy_compress(input: *u8,
+    fn snappy_compress(input: *const u8,
                        input_length: size_t,
                        compressed: *mut u8,
                        compressed_length: *mut size_t) -> c_int;
-    fn snappy_uncompress(compressed: *u8,
+    fn snappy_uncompress(compressed: *const u8,
                          compressed_length: size_t,
                          uncompressed: *mut u8,
                          uncompressed_length: *mut size_t) -> c_int;
     fn snappy_max_compressed_length(source_length: size_t) -> size_t;
-    fn snappy_uncompressed_length(compressed: *u8,
+    fn snappy_uncompressed_length(compressed: *const u8,
                                   compressed_length: size_t,
                                   result: *mut size_t) -> c_int;
-    fn snappy_validate_compressed_buffer(compressed: *u8,
+    fn snappy_validate_compressed_buffer(compressed: *const u8,
                                          compressed_length: size_t) -> c_int;
 }
 # fn main() {}
@@ -82,7 +82,7 @@ the allocated memory. The length is less than or equal to the capacity.
 ~~~~
 # extern crate libc;
 # use libc::{c_int, size_t};
-# unsafe fn snappy_validate_compressed_buffer(_: *u8, _: size_t) -> c_int { 0 }
+# unsafe fn snappy_validate_compressed_buffer(_: *const u8, _: size_t) -> c_int { 0 }
 # fn main() {}
 pub fn validate_compressed_buffer(src: &[u8]) -> bool {
     unsafe {
@@ -106,7 +106,7 @@ the true length after compression for setting the length.
 ~~~~
 # extern crate libc;
 # use libc::{size_t, c_int};
-# unsafe fn snappy_compress(a: *u8, b: size_t, c: *mut u8,
+# unsafe fn snappy_compress(a: *const u8, b: size_t, c: *mut u8,
 #                           d: *mut size_t) -> c_int { 0 }
 # unsafe fn snappy_max_compressed_length(a: size_t) -> size_t { a }
 # fn main() {}
@@ -132,11 +132,11 @@ format and `snappy_uncompressed_length` will retrieve the exact buffer size requ
 ~~~~
 # extern crate libc;
 # use libc::{size_t, c_int};
-# unsafe fn snappy_uncompress(compressed: *u8,
+# unsafe fn snappy_uncompress(compressed: *const u8,
 #                             compressed_length: size_t,
 #                             uncompressed: *mut u8,
 #                             uncompressed_length: *mut size_t) -> c_int { 0 }
-# unsafe fn snappy_uncompressed_length(compressed: *u8,
+# unsafe fn snappy_uncompressed_length(compressed: *const u8,
 #                                      compressed_length: size_t,
 #                                      result: *mut size_t) -> c_int { 0 }
 # fn main() {}
@@ -418,7 +418,7 @@ Unsafe functions, on the other hand, advertise it to the world. An unsafe functi
 this:
 
 ~~~~
-unsafe fn kaboom(ptr: *int) -> int { *ptr }
+unsafe fn kaboom(ptr: *const int) -> int { *ptr }
 ~~~~
 
 This function can only be called from an `unsafe` block or another `unsafe` function.
@@ -453,7 +453,7 @@ use std::ptr;
 
 #[link(name = "readline")]
 extern {
-    static mut rl_prompt: *libc::c_char;
+    static mut rl_prompt: *const libc::c_char;
 }
 
 fn main() {
@@ -478,7 +478,7 @@ extern crate libc;
 #[link(name = "kernel32")]
 #[allow(non_snake_case_functions)]
 extern "stdcall" {
-    fn SetEnvironmentVariableA(n: *u8, v: *u8) -> libc::c_int;
+    fn SetEnvironmentVariableA(n: *const u8, v: *const u8) -> libc::c_int;
 }
 # fn main() { }
 ~~~~
index 0050bd2d77f8fc9d4979401562b090d8900124c5..1367bdc07555fb1ee3650e1db560a8d24040861b 100644 (file)
@@ -245,7 +245,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)
 }
 
@@ -261,7 +261,9 @@ inside of an OS thread.
 extern crate native;
 
 #[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)
+}
 
 fn main() {}
 ~~~
index 609d8937c80c5f5dea27d1a29d4dbe924ee39a50..ffaabbb04ab680bbfbae1ebdc34b2cb5a8247eaa 100644 (file)
@@ -79,7 +79,7 @@ let ref_2: &mut u8 = unsafe { mem::transmute(&mut *ref_1) };
 ## Raw pointers
 
 Rust offers two additional pointer types "raw pointers", written as
-`*T` and `*mut T`. They're an approximation of C's `const T*` and `T*`
+`*const T` and `*mut T`. They're an approximation of C's `const T*` and `T*`
 respectively; indeed, one of their most common uses is for FFI,
 interfacing with external C libraries.
 
@@ -100,7 +100,7 @@ offered by the Rust language and libraries. For example, they
 - lack any form of lifetimes, unlike `&`, and so the compiler cannot
   reason about dangling pointers; and
 - have no guarantees about aliasing or mutability other than mutation
-  not being allowed directly through a `*T`.
+  not being allowed directly through a `*const T`.
 
 Fortunately, they come with a redeeming feature: the weaker guarantees
 mean weaker restrictions. The missing restrictions make raw pointers
@@ -131,13 +131,13 @@ unsafe, and neither is converting to an integer.
 
 At runtime, a raw pointer `*` and a reference pointing to the same
 piece of data have an identical representation. In fact, an `&T`
-reference will implicitly coerce to an `*T` raw pointer in safe code
+reference will implicitly coerce to an `*const T` raw pointer in safe code
 and similarly for the `mut` variants (both coercions can be performed
-explicitly with, respectively, `value as *T` and `value as *mut T`).
+explicitly with, respectively, `value as *const T` and `value as *mut T`).
 
-Going the opposite direction, from `*` to a reference `&`, is not
+Going the opposite direction, from `*const` to a reference `&`, is not
 safe. A `&T` is always valid, and so, at a minimum, the raw pointer
-`*T` has to be a valid to a valid instance of type `T`. Furthermore,
+`*const T` has to be a valid to a valid instance of type `T`. Furthermore,
 the resulting pointer must satisfy the aliasing and mutability laws of
 references. The compiler assumes these properties are true for any
 references, no matter how they are created, and so any conversion from
@@ -149,7 +149,7 @@ The recommended method for the conversion is
 ```
 let i: u32 = 1;
 // explicit cast
-let p_imm: *u32 = &i as *u32;
+let p_imm: *const u32 = &i as *const u32;
 let mut m: u32 = 2;
 // implicit coercion
 let p_mut: *mut u32 = &mut m;
@@ -256,7 +256,7 @@ impl<T: Send> Drop for Unique<T> {
             // Copy the object out from the pointer onto the stack,
             // where it is covered by normal Rust destructor semantics
             // and cleans itself up, if necessary
-            ptr::read(self.ptr as *T);
+            ptr::read(self.ptr as *const T);
 
             // clean-up our allocation
             free(self.ptr as *mut c_void)
@@ -457,7 +457,7 @@ extern crate libc;
 
 // Entry point for this program
 #[start]
-fn start(_argc: int, _argv: **u8) -> int {
+fn start(_argc: int, _argv: *const *const u8) -> int {
     0
 }
 
@@ -482,7 +482,7 @@ compiler's name mangling too:
 extern crate libc;
 
 #[no_mangle] // ensure that this symbol is called `main` in the output
-pub extern fn main(argc: int, argv: **u8) -> int {
+pub extern fn main(argc: int, argv: *const *const u8) -> int {
     0
 }
 
@@ -540,8 +540,8 @@ use core::mem;
 use core::raw::Slice;
 
 #[no_mangle]
-pub extern fn dot_product(a: *u32, a_len: u32,
-                          b: *u32, b_len: u32) -> u32 {
+pub extern fn dot_product(a: *const u32, a_len: u32,
+                          b: *const u32, b_len: u32) -> u32 {
     // Convert the provided arrays into Rust slices.
     // The core::raw module guarantees that the Slice
     // structure has the same memory layout as a &[T]
@@ -573,7 +573,7 @@ extern fn begin_unwind(args: &core::fmt::Arguments,
 
 #[lang = "stack_exhausted"] extern fn stack_exhausted() {}
 #[lang = "eh_personality"] extern fn eh_personality() {}
-# #[start] fn start(argc: int, argv: **u8) -> int { 0 }
+# #[start] fn start(argc: int, argv: *const *const u8) -> int { 0 }
 # fn main() {}
 ```
 
@@ -595,7 +595,7 @@ standard library itself.
 > parts of the language may never be full specified and so details may
 > differ wildly between implementations (and even versions of `rustc`
 > itself).
-> 
+>
 > Furthermore, this is just an overview; the best form of
 > documentation for specific instances of these features are their
 > definitions and uses in `std`.
@@ -627,7 +627,7 @@ via a declaration like
 extern "rust-intrinsic" {
     fn transmute<T, U>(x: T) -> U;
 
-    fn offset<T>(dst: *T, offset: int) -> *T;
+    fn offset<T>(dst: *const T, offset: int) -> *const T;
 }
 ```
 
@@ -677,7 +677,7 @@ unsafe fn deallocate(ptr: *mut u8, _size: uint, _align: uint) {
 }
 
 #[start]
-fn main(argc: int, argv: **u8) -> int {
+fn main(argc: int, argv: *const *const u8) -> int {
     let x = box 1;
 
     0
index a9814dccb3f86c033f183f7b00f84426697a1687..8aaae5558a6cc4e3c09875e877e546b329cb1e00 100644 (file)
@@ -1614,7 +1614,7 @@ extern crate libc;
 use libc::{c_char, FILE};
 
 extern {
-    fn fopen(filename: *c_char, mode: *c_char) -> *FILE;
+    fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
 }
 # fn main() {}
 ~~~~
index b4d0057778a1a395255300163a03192be6a6c743..589ff8c1de9fe357c820ae57d58f71727c049c3a 100644 (file)
@@ -99,7 +99,7 @@ pub fn stats_print() {
 #[inline]
 unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
     if size == 0 {
-        &EMPTY as *uint as *mut u8
+        &EMPTY as *const uint as *mut u8
     } else {
         allocate(size, align)
     }
@@ -144,9 +144,10 @@ fn je_xallocx(ptr: *mut c_void, size: size_t, extra: size_t,
                       flags: c_int) -> size_t;
         fn je_dallocx(ptr: *mut c_void, flags: c_int);
         fn je_nallocx(size: size_t, flags: c_int) -> size_t;
-        fn je_malloc_stats_print(write_cb: Option<extern "C" fn(cbopaque: *mut c_void, *c_char)>,
+        fn je_malloc_stats_print(write_cb: Option<extern "C" fn(cbopaque: *mut c_void,
+                                                                *const c_char)>,
                                  cbopaque: *mut c_void,
-                                 opts: *c_char);
+                                 opts: *const c_char);
     }
 
     // -lpthread needs to occur after -ljemalloc, the earlier argument isn't enough
@@ -226,7 +227,7 @@ pub unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
         // a block of memory, so we special case everything under `*uint` to
         // just pass it to malloc, which is guaranteed to align to at least the
         // size of `*uint`.
-        if align < mem::size_of::<*uint>() {
+        if align < mem::size_of::<uint>() {
             libc_heap::malloc_raw(size)
         } else {
             let mut out = 0 as *mut libc::c_void;
@@ -244,7 +245,7 @@ pub unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
     pub unsafe fn reallocate(ptr: *mut u8, size: uint, align: uint,
                              old_size: uint) -> *mut u8 {
         let new_ptr = allocate(size, align);
-        ptr::copy_memory(new_ptr, ptr as *u8, old_size);
+        ptr::copy_memory(new_ptr, ptr as *const u8, old_size);
         deallocate(ptr, old_size, align);
         return new_ptr;
     }
index 6f5d3293556234041095a95ea4025f5b49e0916b..05121903f5f61d0e794b0db18090f0b910d1f432 100644 (file)
@@ -36,7 +36,7 @@
 
 /// A type that represents a uniquely-owned value.
 #[lang="owned_box"]
-pub struct Box<T>(*T);
+pub struct Box<T>(*mut T);
 
 impl<T: Default> Default for Box<T> {
     fn default() -> Box<T> { box Default::default() }
index aacf9936cce3681a544c9b35092220589d7236dd..152967cb4e90841f2cd83b4e62fe4dda0a8a27f6 100644 (file)
@@ -55,7 +55,7 @@ fn capacity(&self) -> uint {
         self.data.borrow().capacity()
     }
 
-    unsafe fn as_ptr(&self) -> *u8 {
+    unsafe fn as_ptr(&self) -> *const u8 {
         self.data.borrow().as_ptr()
     }
 }
@@ -140,22 +140,22 @@ unsafe fn destroy_chunk(chunk: &Chunk) {
     let fill = chunk.fill.get();
 
     while idx < fill {
-        let tydesc_data: *uint = mem::transmute(buf.offset(idx as int));
+        let tydesc_data: *const uint = mem::transmute(buf.offset(idx as int));
         let (tydesc, is_done) = un_bitpack_tydesc_ptr(*tydesc_data);
         let (size, align) = ((*tydesc).size, (*tydesc).align);
 
-        let after_tydesc = idx + mem::size_of::<*TyDesc>();
+        let after_tydesc = idx + mem::size_of::<*const TyDesc>();
 
         let start = round_up(after_tydesc, align);
 
         //debug!("freeing object: idx = {}, size = {}, align = {}, done = {}",
         //       start, size, align, is_done);
         if is_done {
-            ((*tydesc).drop_glue)(buf.offset(start as int) as *i8);
+            ((*tydesc).drop_glue)(buf.offset(start as int) as *const i8);
         }
 
         // Find where the next tydesc lives
-        idx = round_up(start + size, mem::align_of::<*TyDesc>());
+        idx = round_up(start + size, mem::align_of::<*const TyDesc>());
     }
 }
 
@@ -164,12 +164,12 @@ unsafe fn destroy_chunk(chunk: &Chunk) {
 // is necessary in order to properly do cleanup if a failure occurs
 // during an initializer.
 #[inline]
-fn bitpack_tydesc_ptr(p: *TyDesc, is_done: bool) -> uint {
+fn bitpack_tydesc_ptr(p: *const TyDesc, is_done: bool) -> uint {
     p as uint | (is_done as uint)
 }
 #[inline]
-fn un_bitpack_tydesc_ptr(p: uint) -> (*TyDesc, bool) {
-    ((p & !1) as *TyDesc, p & 1 == 1)
+fn un_bitpack_tydesc_ptr(p: uint) -> (*const TyDesc, bool) {
+    ((p & !1) as *const TyDesc, p & 1 == 1)
 }
 
 impl Arena {
@@ -178,7 +178,7 @@ fn chunk_size(&self) -> uint {
     }
 
     // Functions for the POD part of the arena
-    fn alloc_copy_grow(&self, n_bytes: uint, align: uint) -> *u8 {
+    fn alloc_copy_grow(&self, n_bytes: uint, align: uint) -> *const u8 {
         // Allocate a new chunk.
         let new_min_chunk_size = cmp::max(n_bytes, self.chunk_size());
         self.chunks.borrow_mut().push(self.copy_head.borrow().clone());
@@ -190,7 +190,7 @@ fn alloc_copy_grow(&self, n_bytes: uint, align: uint) -> *u8 {
     }
 
     #[inline]
-    fn alloc_copy_inner(&self, n_bytes: uint, align: uint) -> *u8 {
+    fn alloc_copy_inner(&self, n_bytes: uint, align: uint) -> *const u8 {
         let start = round_up(self.copy_head.borrow().fill.get(), align);
 
         let end = start + n_bytes;
@@ -218,7 +218,8 @@ fn alloc_copy<'a, T>(&'a self, op: || -> T) -> &'a T {
     }
 
     // Functions for the non-POD part of the arena
-    fn alloc_noncopy_grow(&self, n_bytes: uint, align: uint) -> (*u8, *u8) {
+    fn alloc_noncopy_grow(&self, n_bytes: uint,
+                          align: uint) -> (*const u8, *const u8) {
         // Allocate a new chunk.
         let new_min_chunk_size = cmp::max(n_bytes, self.chunk_size());
         self.chunks.borrow_mut().push(self.head.borrow().clone());
@@ -230,7 +231,8 @@ fn alloc_noncopy_grow(&self, n_bytes: uint, align: uint) -> (*u8, *u8) {
     }
 
     #[inline]
-    fn alloc_noncopy_inner(&self, n_bytes: uint, align: uint) -> (*u8, *u8) {
+    fn alloc_noncopy_inner(&self, n_bytes: uint,
+                           align: uint) -> (*const u8, *const u8) {
         // Be careful to not maintain any `head` borrows active, because
         // `alloc_noncopy_grow` borrows it mutably.
         let (start, end, tydesc_start, head_capacity) = {
@@ -238,7 +240,7 @@ fn alloc_noncopy_inner(&self, n_bytes: uint, align: uint) -> (*u8, *u8) {
             let fill = head.fill.get();
 
             let tydesc_start = fill;
-            let after_tydesc = fill + mem::size_of::<*TyDesc>();
+            let after_tydesc = fill + mem::size_of::<*const TyDesc>();
             let start = round_up(after_tydesc, align);
             let end = start + n_bytes;
 
@@ -250,7 +252,7 @@ fn alloc_noncopy_inner(&self, n_bytes: uint, align: uint) -> (*u8, *u8) {
         }
 
         let head = self.head.borrow();
-        head.fill.set(round_up(end, mem::align_of::<*TyDesc>()));
+        head.fill.set(round_up(end, mem::align_of::<*const TyDesc>()));
 
         unsafe {
             let buf = head.as_ptr();
@@ -348,11 +350,11 @@ fn test_arena_destructors_fail() {
 /// run again for these objects.
 pub struct TypedArena<T> {
     /// A pointer to the next object to be allocated.
-    ptr: Cell<*T>,
+    ptr: Cell<*const T>,
 
     /// A pointer to the end of the allocated area. When this pointer is
     /// reached, a new chunk is allocated.
-    end: Cell<*T>,
+    end: Cell<*const T>,
 
     /// A pointer to the first arena segment.
     first: RefCell<TypedArenaChunkRef<T>>,
@@ -398,7 +400,7 @@ unsafe fn destroy(&mut self, len: uint) {
         if intrinsics::needs_drop::<T>() {
             let mut start = self.start();
             for _ in range(0, len) {
-                ptr::read(start as *T); // run the destructor on the pointer
+                ptr::read(start as *const T); // run the destructor on the pointer
                 start = start.offset(mem::size_of::<T>() as int)
             }
         }
@@ -417,8 +419,8 @@ unsafe fn destroy(&mut self, len: uint) {
 
     // Returns a pointer to the first allocated object.
     #[inline]
-    fn start(&self) -> *u8 {
-        let this: *TypedArenaChunk<T> = self;
+    fn start(&self) -> *const u8 {
+        let this: *const TypedArenaChunk<T> = self;
         unsafe {
             mem::transmute(round_up(this.offset(1) as uint,
                                     mem::min_align_of::<T>()))
@@ -427,7 +429,7 @@ fn start(&self) -> *u8 {
 
     // Returns a pointer to the end of the allocated space.
     #[inline]
-    fn end(&self) -> *u8 {
+    fn end(&self) -> *const u8 {
         unsafe {
             let size = mem::size_of::<T>().checked_mul(&self.capacity).unwrap();
             self.start().offset(size as int)
@@ -448,8 +450,8 @@ pub fn new() -> TypedArena<T> {
     pub fn with_capacity(capacity: uint) -> TypedArena<T> {
         let chunk = TypedArenaChunk::<T>::new(None, capacity);
         TypedArena {
-            ptr: Cell::new(chunk.start() as *T),
-            end: Cell::new(chunk.end() as *T),
+            ptr: Cell::new(chunk.start() as *const T),
+            end: Cell::new(chunk.end() as *const T),
             first: RefCell::new(Some(chunk)),
         }
     }
@@ -477,8 +479,8 @@ fn grow(&self) {
         let chunk = self.first.borrow_mut().take_unwrap();
         let new_capacity = chunk.capacity.checked_mul(&2).unwrap();
         let chunk = TypedArenaChunk::<T>::new(Some(chunk), new_capacity);
-        self.ptr.set(chunk.start() as *T);
-        self.end.set(chunk.end() as *T);
+        self.ptr.set(chunk.start() as *const T);
+        self.end.set(chunk.end() as *const T);
         *self.first.borrow_mut() = Some(chunk)
     }
 }
index 0e6cbe4e038dcfc959c3698a057e8e03a928a14e..43cc51f9dc3fa817a0f69a0f22ad9c84c60ff1fa 100644 (file)
@@ -652,7 +652,7 @@ pub fn check_links<T>(list: &DList<T>) {
                 (None   , None      ) => {}
                 (None   , _         ) => fail!("prev link for list_head"),
                 (Some(p), Some(pptr)) => {
-                    assert_eq!(p as *Node<T>, pptr as *Node<T>);
+                    assert_eq!(p as *const Node<T>, pptr as *const Node<T>);
                 }
                 _ => fail!("prev link is none, not good"),
             }
index a0c0c9f97357816edc7470a674a78e1fb82ba6fb..976f726244121f527e053a980042fe5b491e078a 100644 (file)
@@ -247,7 +247,7 @@ fn hash(&self, state: &mut S) {
     }
 }
 
-impl<S: Writer, T> Hash<S> for *T {
+impl<S: Writer, T> Hash<S> for *const T {
     #[inline]
     fn hash(&self, state: &mut S) {
         // NB: raw-pointer Hash does _not_ dereference
@@ -342,7 +342,7 @@ fn test_writer_hasher() {
         assert_eq!(hasher.hash(& &[1u8, 2u8, 3u8]), 9);
 
         unsafe {
-            let ptr: *int = mem::transmute(5);
+            let ptr: *const int = mem::transmute(5);
             assert_eq!(hasher.hash(&ptr), 5);
         }
 
index ac8ac6102f323d7452c24e694e495baa5fb7e5e8..ac32d93edbe83710aa4c689e81804c81f1061c60 100644 (file)
@@ -341,7 +341,7 @@ fn insertion_sort<T>(v: &mut [T], compare: |&T, &T| -> Ordering) {
         let mut j = i;
         unsafe {
             // `i` is in bounds.
-            let read_ptr = buf_v.offset(i) as *T;
+            let read_ptr = buf_v.offset(i) as *const T;
 
             // find where to insert, we need to do strict <,
             // rather than <=, to maintain stability.
@@ -365,7 +365,7 @@ fn insertion_sort<T>(v: &mut [T], compare: |&T, &T| -> Ordering) {
                                  &*buf_v.offset(j),
                                  (i - j) as uint);
                 ptr::copy_nonoverlapping_memory(buf_v.offset(j),
-                                                &tmp as *T,
+                                                &tmp as *const T,
                                                 1);
                 mem::forget(tmp);
             }
index 642e7cfc9a36f44be39d5e27ca1177583f6d1df1..72c5aff675bfb4dbf94518f32acab03badc5a0d5 100644 (file)
@@ -661,7 +661,7 @@ pub mod raw {
     pub use core::str::raw::{slice_unchecked};
 
     /// Create a Rust string from a *u8 buffer of the given length
-    pub unsafe fn from_buf_len(buf: *u8, len: uint) -> String {
+    pub unsafe fn from_buf_len(buf: *const u8, len: uint) -> String {
         let mut result = String::new();
         result.push_bytes(mem::transmute(Slice {
             data: buf,
@@ -671,7 +671,7 @@ pub unsafe fn from_buf_len(buf: *u8, len: uint) -> String {
     }
 
     /// Create a Rust string from a null-terminated C string
-    pub unsafe fn from_c_str(c_string: *i8) -> String {
+    pub unsafe fn from_c_str(c_string: *const i8) -> String {
         let mut buf = String::new();
         let mut len = 0;
         while *c_string.offset(len) != 0 {
index 90f08bdd9dd8fdc723b0939a4ff63b2e63b14b8b..ce0c202fdbacc925019911f4b781ccb7b25f4a35 100644 (file)
@@ -287,7 +287,7 @@ pub struct Entries<'a, K, V> {
     // See the comment on MutEntries; this is just to allow
     // code-sharing (for this immutable-values iterator it *could* very
     // well be Option<&'a TreeNode<K,V>>).
-    node: *TreeNode<K, V>,
+    node: *const TreeNode<K, V>,
     remaining_min: uint,
     remaining_max: uint
 }
@@ -468,11 +468,11 @@ fn size_hint(&self) -> (uint, Option<uint>) {
     addr_mut = mut
 }
 
-fn deref<'a, K, V>(node: &'a Option<Box<TreeNode<K, V>>>) -> *TreeNode<K, V> {
+fn deref<'a, K, V>(node: &'a Option<Box<TreeNode<K, V>>>) -> *const TreeNode<K, V> {
     match *node {
         Some(ref n) => {
             let n: &TreeNode<K, V> = *n;
-            n as *TreeNode<K, V>
+            n as *const TreeNode<K, V>
         }
         None => ptr::null()
     }
index 350c284e1d3b44977ae75a980bf50bb0677c345e..9b6355e121bea459af7c7e4336e3e7396256648d 100644 (file)
@@ -189,7 +189,9 @@ macro_rules! bound {
             // We like sharing code so much that even a little unsafe won't
             // stop us.
             let this = $this;
-            let mut node = addr!(& $($mut_)* this.root as * $($mut_)* TrieNode<T>);
+            let mut node = unsafe {
+                mem::transmute::<_, uint>(&this.root) as *mut TrieNode<T>
+            };
 
             let key = $key;
 
@@ -205,7 +207,10 @@ macro_rules! bound {
                     let child_id = chunk(key, it.length);
                     let (slice_idx, ret) = match children[child_id] {
                         Internal(ref $($mut_)* n) => {
-                            node = addr!(& $($mut_)* **n as * $($mut_)* TrieNode<T>);
+                            node = unsafe {
+                                mem::transmute::<_, uint>(&**n)
+                                    as *mut TrieNode<T>
+                            };
                             (child_id + 1, false)
                         }
                         External(stored, _) => {
index 0ee0c5b87aeaafe6990f92f8e2f640296be8a06e..694deb05d88e3b7aa64dd8661dadd9c3e920d4ad 100644 (file)
@@ -615,7 +615,7 @@ pub fn push(&mut self, value: T) {
         }
 
         unsafe {
-            let end = (self.ptr as *T).offset(self.len as int) as *mut T;
+            let end = (self.ptr as *const T).offset(self.len as int) as *mut T;
             ptr::write(&mut *end, value);
             self.len += 1;
         }
@@ -674,7 +674,10 @@ pub fn truncate(&mut self, len: uint) {
     #[inline]
     pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] {
         unsafe {
-            mem::transmute(Slice { data: self.as_mut_ptr() as *T, len: self.len })
+            mem::transmute(Slice {
+                data: self.as_mut_ptr() as *const T,
+                len: self.len,
+            })
         }
     }
 
@@ -1011,7 +1014,7 @@ pub fn remove(&mut self, index: uint) -> Option<T> {
                     let ptr = self.as_mut_ptr().offset(index as int);
                     // copy it out, unsafely having a copy of the value on
                     // the stack and in the vector at the same time.
-                    ret = Some(ptr::read(ptr as *T));
+                    ret = Some(ptr::read(ptr as *const T));
 
                     // Shift everything down to fill in that spot.
                     ptr::copy_memory(ptr, &*ptr.offset(1), len - index - 1);
@@ -1200,15 +1203,15 @@ pub fn init<'a>(&'a self) -> &'a [T] {
     /// Modifying the vector may cause its buffer to be reallocated, which
     /// would also make any pointers to it invalid.
     #[inline]
-    pub fn as_ptr(&self) -> *T {
+    pub fn as_ptr(&self) -> *const T {
         // If we have a 0-sized vector, then the base pointer should not be NULL
         // because an iterator over the slice will attempt to yield the base
         // pointer as the first element in the vector, but this will end up
         // being Some(NULL) which is optimized to None.
         if mem::size_of::<T>() == 0 {
-            1 as *T
+            1 as *const T
         } else {
-            self.ptr as *T
+            self.ptr as *const T
         }
     }
 
@@ -1542,7 +1545,7 @@ pub mod raw {
     /// The elements of the buffer are copied into the vector without cloning,
     /// as if `ptr::read()` were called on them.
     #[inline]
-    pub unsafe fn from_buf<T>(ptr: *T, elts: uint) -> Vec<T> {
+    pub unsafe fn from_buf<T>(ptr: *const T, elts: uint) -> Vec<T> {
         let mut dst = Vec::with_capacity(elts);
         dst.set_len(elts);
         ptr::copy_nonoverlapping_memory(dst.as_mut_ptr(), ptr, elts);
index 65ba11f89adc61f8501541d0480a34b2eca200fb..13979bb648fdaa6702fd6aa655f191c22a8baac2 100644 (file)
@@ -94,7 +94,7 @@ pub fn new(v: bool) -> AtomicBool {
     /// Load the value
     #[inline]
     pub fn load(&self, order: Ordering) -> bool {
-        unsafe { atomic_load(self.v.get() as *uint, order) > 0 }
+        unsafe { atomic_load(self.v.get() as *const uint, order) > 0 }
     }
 
     /// Store the value
@@ -295,7 +295,7 @@ pub fn new(v: int) -> AtomicInt {
     /// Load the value
     #[inline]
     pub fn load(&self, order: Ordering) -> int {
-        unsafe { atomic_load(self.v.get() as *int, order) }
+        unsafe { atomic_load(self.v.get() as *const int, order) }
     }
 
     /// Store the value
@@ -407,7 +407,7 @@ pub fn new(v: uint) -> AtomicUint {
     /// Load the value
     #[inline]
     pub fn load(&self, order: Ordering) -> uint {
-        unsafe { atomic_load(self.v.get() as *uint, order) }
+        unsafe { atomic_load(self.v.get() as *const uint, order) }
     }
 
     /// Store the value
@@ -520,7 +520,7 @@ pub fn new(p: *mut T) -> AtomicPtr<T> {
     #[inline]
     pub fn load(&self, order: Ordering) -> *mut T {
         unsafe {
-            atomic_load(self.p.get() as **mut T, order) as *mut T
+            atomic_load(self.p.get() as *const *mut T, order) as *mut T
         }
     }
 
@@ -560,7 +560,7 @@ unsafe fn atomic_store<T>(dst: *mut T, val: T, order:Ordering) {
 }
 
 #[inline]
-unsafe fn atomic_load<T>(dst: *T, order:Ordering) -> T {
+unsafe fn atomic_load<T>(dst: *const T, order:Ordering) -> T {
     match order {
         Acquire => intrinsics::atomic_load_acq(dst),
         Relaxed => intrinsics::atomic_load_relaxed(dst),
index d778f3b47a17017f2df926b567617ac2c4c510a6..1a66d952e9bc2d52a4c03cf133cf31ea354a8d8a 100644 (file)
@@ -314,11 +314,11 @@ fn getcount(&mut self, cnt: &rt::Count) -> Option<uint> {
             rt::CountImplied => { None }
             rt::CountIsParam(i) => {
                 let v = self.args[i].value;
-                unsafe { Some(*(v as *any::Void as *uint)) }
+                unsafe { Some(*(v as *const _ as *const uint)) }
             }
             rt::CountIsNextParam => {
                 let v = self.curarg.next().unwrap().value;
-                unsafe { Some(*(v as *any::Void as *uint)) }
+                unsafe { Some(*(v as *const _ as *const uint)) }
             }
         }
     }
@@ -565,7 +565,7 @@ fn fmt(&self, f: &mut Formatter) -> Result {
     }
 }
 
-impl<T> Pointer for *T {
+impl<T> Pointer for *const T {
     fn fmt(&self, f: &mut Formatter) -> Result {
         f.flags |= 1 << (rt::FlagAlternate as uint);
         secret_lower_hex::<uint>(&(*self as uint), f)
@@ -573,17 +573,17 @@ fn fmt(&self, f: &mut Formatter) -> Result {
 }
 impl<T> Pointer for *mut T {
     fn fmt(&self, f: &mut Formatter) -> Result {
-        secret_pointer::<*T>(&(*self as *T), f)
+        secret_pointer::<*const T>(&(*self as *const T), f)
     }
 }
 impl<'a, T> Pointer for &'a T {
     fn fmt(&self, f: &mut Formatter) -> Result {
-        secret_pointer::<*T>(&(&**self as *T), f)
+        secret_pointer::<*const T>(&(&**self as *const T), f)
     }
 }
 impl<'a, T> Pointer for &'a mut T {
     fn fmt(&self, f: &mut Formatter) -> Result {
-        secret_pointer::<*T>(&(&**self as *T), f)
+        secret_pointer::<*const T>(&(&**self as *const T), f)
     }
 }
 
@@ -669,7 +669,7 @@ fn fmt(&self, f: &mut Formatter) -> Result {
 delegate!(f32 to float)
 delegate!(f64 to float)
 
-impl<T> Show for *T {
+impl<T> Show for *const T {
     fn fmt(&self, f: &mut Formatter) -> Result { secret_pointer(self, f) }
 }
 impl<T> Show for *mut T {
index 6519d3b749de403913d65cc77519374a73adac4b..fd06ae95f1b7f2bd33c131363bc2739e69ff9bc3 100644 (file)
@@ -48,7 +48,7 @@
 #[cfg(test)]
 pub use realcore::intrinsics::{TyDesc, Opaque, TyVisitor, TypeId};
 
-pub type GlueFn = extern "Rust" fn(*i8);
+pub type GlueFn = extern "Rust" fn(*const i8);
 
 #[lang="ty_desc"]
 #[cfg(not(test))]
@@ -102,55 +102,58 @@ pub trait TyVisitor {
     fn visit_estr_slice(&mut self) -> bool;
     fn visit_estr_fixed(&mut self, n: uint, sz: uint, align: uint) -> bool;
 
-    fn visit_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
-    fn visit_uniq(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
-    fn visit_ptr(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
-    fn visit_rptr(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
+    fn visit_box(&mut self, mtbl: uint, inner: *const TyDesc) -> bool;
+    fn visit_uniq(&mut self, mtbl: uint, inner: *const TyDesc) -> bool;
+    fn visit_ptr(&mut self, mtbl: uint, inner: *const TyDesc) -> bool;
+    fn visit_rptr(&mut self, mtbl: uint, inner: *const TyDesc) -> bool;
 
-    fn visit_evec_slice(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
+    fn visit_evec_slice(&mut self, mtbl: uint, inner: *const TyDesc) -> bool;
     fn visit_evec_fixed(&mut self, n: uint, sz: uint, align: uint,
-                        mtbl: uint, inner: *TyDesc) -> bool;
+                        mtbl: uint, inner: *const TyDesc) -> bool;
 
     fn visit_enter_rec(&mut self, n_fields: uint,
                        sz: uint, align: uint) -> bool;
     fn visit_rec_field(&mut self, i: uint, name: &str,
-                       mtbl: uint, inner: *TyDesc) -> bool;
+                       mtbl: uint, inner: *const TyDesc) -> bool;
     fn visit_leave_rec(&mut self, n_fields: uint,
                        sz: uint, align: uint) -> bool;
 
     fn visit_enter_class(&mut self, name: &str, named_fields: bool, n_fields: uint,
                          sz: uint, align: uint) -> bool;
     fn visit_class_field(&mut self, i: uint, name: &str, named: bool,
-                         mtbl: uint, inner: *TyDesc) -> bool;
+                         mtbl: uint, inner: *const TyDesc) -> bool;
     fn visit_leave_class(&mut self, name: &str, named_fields: bool, n_fields: uint,
                          sz: uint, align: uint) -> bool;
 
     fn visit_enter_tup(&mut self, n_fields: uint,
                        sz: uint, align: uint) -> bool;
-    fn visit_tup_field(&mut self, i: uint, inner: *TyDesc) -> bool;
+    fn visit_tup_field(&mut self, i: uint, inner: *const TyDesc) -> bool;
     fn visit_leave_tup(&mut self, n_fields: uint,
                        sz: uint, align: uint) -> bool;
 
     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;
     fn visit_enter_enum_variant(&mut self, variant: uint,
                                 disr_val: Disr,
                                 n_fields: uint,
                                 name: &str) -> bool;
-    fn visit_enum_variant_field(&mut self, i: uint, offset: uint, inner: *TyDesc) -> bool;
+    fn visit_enum_variant_field(&mut self, i: uint, offset: uint,
+                                inner: *const TyDesc) -> bool;
     fn visit_leave_enum_variant(&mut self, variant: uint,
                                 disr_val: Disr,
                                 n_fields: uint,
                                 name: &str) -> bool;
     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;
 
     fn visit_enter_fn(&mut self, purity: uint, proto: uint,
                       n_inputs: uint, retstyle: uint) -> bool;
-    fn visit_fn_input(&mut self, i: uint, mode: uint, inner: *TyDesc) -> bool;
-    fn visit_fn_output(&mut self, retstyle: uint, variadic: bool, inner: *TyDesc) -> bool;
+    fn visit_fn_input(&mut self, i: uint, mode: uint,
+                      inner: *const TyDesc) -> bool;
+    fn visit_fn_output(&mut self, retstyle: uint, variadic: bool,
+                       inner: *const TyDesc) -> bool;
     fn visit_leave_fn(&mut self, purity: uint, proto: uint,
                       n_inputs: uint, retstyle: uint) -> bool;
 
@@ -170,9 +173,9 @@ fn visit_leave_fn(&mut self, purity: uint, proto: uint,
     pub fn atomic_cxchg_acqrel<T>(dst: *mut T, old: T, src: T) -> T;
     pub fn atomic_cxchg_relaxed<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_relaxed<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_load_relaxed<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);
@@ -276,7 +279,7 @@ fn visit_leave_fn(&mut self, purity: uint, proto: uint,
     pub fn pref_align_of<T>() -> uint;
 
     /// Get a static pointer to a type descriptor.
-    pub fn get_tydesc<T>() -> *TyDesc;
+    pub fn get_tydesc<T>() -> *const TyDesc;
 
     /// Gets an identifier which is globally unique to the specified type. This
     /// function will return the same value for a type regardless of whichever
@@ -320,7 +323,7 @@ fn visit_leave_fn(&mut self, purity: uint, proto: uint,
     /// Returns `true` if a type is managed (will be allocated on the local heap)
     pub fn owns_managed<T>() -> bool;
 
-    pub fn visit_tydesc(td: *TyDesc, tv: &mut TyVisitor);
+    pub fn visit_tydesc(td: *const TyDesc, tv: &mut TyVisitor);
 
     /// Calculates the offset from a pointer. The offset *must* be in-bounds of
     /// the object, or one-byte-past-the-end. An arithmetic overflow is also
@@ -328,17 +331,17 @@ fn visit_leave_fn(&mut self, purity: uint, proto: uint,
     ///
     /// This is implemented as an intrinsic to avoid converting to and from an
     /// integer, since the conversion would throw away aliasing information.
-    pub fn offset<T>(dst: *T, offset: int) -> *T;
+    pub fn offset<T>(dst: *const T, offset: int) -> *const T;
 
     /// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with
     /// a size of `count` * `size_of::<T>()` and an alignment of
     /// `min_align_of::<T>()`
-    pub fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *T, count: uint);
+    pub fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: uint);
 
     /// Equivalent to the appropriate `llvm.memmove.p0i8.0i8.*` intrinsic, with
     /// a size of `count` * `size_of::<T>()` and an alignment of
     /// `min_align_of::<T>()`
-    pub fn copy_memory<T>(dst: *mut T, src: *T, count: uint);
+    pub fn copy_memory<T>(dst: *mut T, src: *const T, count: uint);
 
     /// Equivalent to the appropriate `llvm.memset.p0i8.*` intrinsic, with a
     /// size of `count` * `size_of::<T>()` and an alignment of
@@ -350,13 +353,14 @@ fn visit_leave_fn(&mut self, purity: uint, proto: uint,
     /// `min_align_of::<T>()`
     ///
     /// The volatile parameter parameter is set to `true`, so it will not be optimized out.
-    pub fn volatile_copy_nonoverlapping_memory<T>(dst: *mut T, src: *T, count: uint);
+    pub fn volatile_copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T,
+                                                  count: uint);
     /// Equivalent to the appropriate `llvm.memmove.p0i8.0i8.*` intrinsic, with
     /// a size of `count` * `size_of::<T>()` and an alignment of
     /// `min_align_of::<T>()`
     ///
     /// The volatile parameter parameter is set to `true`, so it will not be optimized out.
-    pub fn volatile_copy_memory<T>(dst: *mut T, src: *T, count: uint);
+    pub fn volatile_copy_memory<T>(dst: *mut T, src: *const T, count: uint);
     /// Equivalent to the appropriate `llvm.memset.p0i8.*` intrinsic, with a
     /// size of `count` * `size_of::<T>()` and an alignment of
     /// `min_align_of::<T>()`.
@@ -365,7 +369,7 @@ fn visit_leave_fn(&mut self, purity: uint, proto: uint,
     pub fn volatile_set_memory<T>(dst: *mut T, val: u8, count: uint);
 
     /// Perform a volatile load from the `src` pointer.
-    pub fn volatile_load<T>(src: *T) -> T;
+    pub fn volatile_load<T>(src: *const T) -> T;
     /// Perform a volatile store to the `dst` pointer.
     pub fn volatile_store<T>(dst: *mut T, val: T);
 
index 40b716181e6fc5ec897a3c829f42c7b91abb5759..9a6cdb1c7697654008d3ce1a4b6294679d764e47 100644 (file)
@@ -155,7 +155,7 @@ pub mod marker {
     /// ```
     /// use std::mem;
     ///
-    /// struct S<T> { x: *() }
+    /// struct S<T> { x: *const () }
     /// fn get<T>(s: &S<T>, v: T) {
     ///    unsafe {
     ///        let x: fn(T) = mem::transmute(s.x);
index a2a3e09a93c07171634385f64180ddd4872cf1de..d1e2084243d413b293d61003b145f656e0350def 100644 (file)
@@ -363,7 +363,7 @@ pub unsafe fn forget<T>(thing: T) { intrinsics::forget(thing) }
 #[inline]
 #[stable]
 pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
-    ptr::read(src as *T as *U)
+    ptr::read(src as *const T as *const U)
 }
 
 /// Transforms lifetime of the second pointer to match the first.
@@ -407,14 +407,14 @@ fn size_of_basic() {
     #[cfg(target_arch = "mipsel")]
     fn size_of_32() {
         assert_eq!(size_of::<uint>(), 4u);
-        assert_eq!(size_of::<*uint>(), 4u);
+        assert_eq!(size_of::<*const uint>(), 4u);
     }
 
     #[test]
     #[cfg(target_arch = "x86_64")]
     fn size_of_64() {
         assert_eq!(size_of::<uint>(), 8u);
-        assert_eq!(size_of::<*uint>(), 8u);
+        assert_eq!(size_of::<*const uint>(), 8u);
     }
 
     #[test]
@@ -439,14 +439,14 @@ fn align_of_basic() {
     #[cfg(target_arch = "mipsel")]
     fn align_of_32() {
         assert_eq!(align_of::<uint>(), 4u);
-        assert_eq!(align_of::<*uint>(), 4u);
+        assert_eq!(align_of::<*const uint>(), 4u);
     }
 
     #[test]
     #[cfg(target_arch = "x86_64")]
     fn align_of_64() {
         assert_eq!(align_of::<uint>(), 8u);
-        assert_eq!(align_of::<*uint>(), 8u);
+        assert_eq!(align_of::<*const uint>(), 8u);
     }
 
     #[test]
@@ -486,7 +486,7 @@ impl Foo for int {}
         let a = box 100i as Box<Foo>;
         unsafe {
             let x: raw::TraitObject = transmute(a);
-            assert!(*(x.data as *int) == 100);
+            assert!(*(x.data as *const int) == 100);
             let _x: Box<Foo> = transmute(x);
         }
 
index e9fb7c3dae3c954f33ea196b9eada930eaa234a8..9748235e94a13478ae0d3d03e9fd968b5d99e208 100644 (file)
@@ -628,10 +628,10 @@ mod tests {
     fn test_get_ptr() {
         unsafe {
             let x = box 0;
-            let addr_x: *int = ::mem::transmute(&*x);
+            let addr_x: *const int = ::mem::transmute(&*x);
             let opt = Some(x);
             let y = opt.unwrap();
-            let addr_y: *int = ::mem::transmute(&*y);
+            let addr_y: *const int = ::mem::transmute(&*y);
             assert_eq!(addr_x, addr_y);
         }
     }
index 59d7bbfe52dc455b2b968dc56738775be389349a..44e68952df29fa40075cbd361020d4d3fb6994df 100644 (file)
@@ -10,7 +10,7 @@
 
 // FIXME: talk about offset, copy_memory, copy_nonoverlapping_memory
 
-//! Operations on unsafe pointers, `*T`, and `*mut T`.
+//! Operations on unsafe pointers, `*const T`, and `*mut T`.
 //!
 //! Working with unsafe pointers in Rust is uncommon,
 //! typically limited to a few patterns.
@@ -29,7 +29,7 @@
 //!
 //! ```
 //! let my_num: int = 10;
-//! let my_num_ptr: *int = &my_num;
+//! let my_num_ptr: *const int = &my_num;
 //! let mut my_speed: int = 88;
 //! let my_speed_ptr: *mut int = &mut my_speed;
 //! ```
@@ -42,7 +42,7 @@
 //!
 //! The `transmute` function takes, by value, whatever it's given
 //! and returns it as whatever type is requested, as long as the
-//! types are the same size. Because `Box<T>` and `*T` have the same
+//! types are the same size. Because `Box<T>` and `*mut T` have the same
 //! representation they can be trivially,
 //! though unsafely, transformed from one type to the other.
 //!
@@ -51,7 +51,7 @@
 //!
 //! unsafe {
 //!     let my_num: Box<int> = box 10;
-//!     let my_num: *int = mem::transmute(my_num);
+//!     let my_num: *const int = mem::transmute(my_num);
 //!     let my_speed: Box<int> = box 88;
 //!     let my_speed: *mut int = mem::transmute(my_speed);
 //!
 /// ```
 /// use std::ptr;
 ///
-/// let p: *int = ptr::null();
+/// let p: *const int = ptr::null();
 /// assert!(p.is_null());
 /// ```
 #[inline]
 #[unstable = "may need a different name after pending changes to pointer types"]
-pub fn null<T>() -> *T { 0 as *T }
+pub fn null<T>() -> *const T { 0 as *const T }
 
 /// Create an unsafe mutable null pointer.
 ///
@@ -137,7 +137,7 @@ pub fn mut_null<T>() -> *mut T { 0 as *mut T }
 /// ```
 /// use std::ptr;
 ///
-/// unsafe fn from_buf_raw<T>(ptr: *T, elts: uint) -> Vec<T> {
+/// unsafe fn from_buf_raw<T>(ptr: *const T, elts: uint) -> Vec<T> {
 ///     let mut dst = Vec::with_capacity(elts);
 ///     dst.set_len(elts);
 ///     ptr::copy_memory(dst.as_mut_ptr(), ptr, elts);
@@ -147,7 +147,7 @@ pub fn mut_null<T>() -> *mut T { 0 as *mut T }
 ///
 #[inline]
 #[unstable]
-pub unsafe fn copy_memory<T>(dst: *mut T, src: *T, count: uint) {
+pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
     intrinsics::copy_memory(dst, src, count)
 }
 
@@ -190,7 +190,7 @@ pub unsafe fn copy_memory<T>(dst: *mut T, src: *T, count: uint) {
 #[inline]
 #[unstable]
 pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T,
-                                            src: *T,
+                                            src: *const T,
                                             count: uint) {
     intrinsics::copy_nonoverlapping_memory(dst, src, count)
 }
@@ -242,7 +242,7 @@ pub unsafe fn replace<T>(dest: *mut T, mut src: T) -> T {
 /// Reads the value from `*src` and returns it.
 #[inline(always)]
 #[unstable]
-pub unsafe fn read<T>(src: *T) -> T {
+pub unsafe fn read<T>(src: *const T) -> T {
     let mut tmp: T = mem::uninitialized();
     copy_nonoverlapping_memory(&mut tmp, src, 1);
     tmp
@@ -275,11 +275,12 @@ pub unsafe fn write<T>(dst: *mut T, src: T) {
     intrinsics::move_val_init(&mut *dst, src)
 }
 
-/// Given a **T (pointer to an array of pointers),
-/// iterate through each *T, up to the provided `len`,
+/// Given a *const *const T (pointer to an array of pointers),
+/// iterate through each *const T, up to the provided `len`,
 /// passing to the provided callback function
 #[deprecated = "old-style iteration. use a loop and RawPtr::offset"]
-pub unsafe fn array_each_with_len<T>(arr: **T, len: uint, cb: |*T|) {
+pub unsafe fn array_each_with_len<T>(arr: *const *const T, len: uint,
+                                     cb: |*const T|) {
     if arr.is_null() {
         fail!("ptr::array_each_with_len failure: arr input is null pointer");
     }
@@ -290,8 +291,8 @@ pub unsafe fn array_each_with_len<T>(arr: **T, len: uint, cb: |*T|) {
     }
 }
 
-/// Given a null-pointer-terminated **T (pointer to
-/// an array of pointers), iterate through each *T,
+/// Given a null-pointer-terminated *const *const T (pointer to
+/// an array of pointers), iterate through each *const T,
 /// passing to the provided callback function
 ///
 /// # Safety Note
@@ -300,7 +301,7 @@ pub unsafe fn array_each_with_len<T>(arr: **T, len: uint, cb: |*T|) {
 /// pointer array.
 #[deprecated = "old-style iteration. use a loop and RawPtr::offset"]
 #[allow(deprecated)]
-pub unsafe fn array_each<T>(arr: **T, cb: |*T|) {
+pub unsafe fn array_each<T>(arr: *const  *const T, cb: |*const T|) {
     if arr.is_null()  {
         fail!("ptr::array_each_with_len failure: arr input is null pointer");
     }
@@ -312,14 +313,14 @@ pub unsafe fn array_each<T>(arr: **T, cb: |*T|) {
 #[inline]
 #[deprecated = "use a loop and RawPtr::offset"]
 #[allow(deprecated)]
-pub unsafe fn buf_len<T>(buf: **T) -> uint {
+pub unsafe fn buf_len<T>(buf: *const *const T) -> uint {
     position(buf, |i| *i == null())
 }
 
 /// Return the first offset `i` such that `f(buf[i]) == true`.
 #[inline]
 #[deprecated = "old-style iteration. use a loop and RawPtr::offset"]
-pub unsafe fn position<T>(buf: *T, f: |&T| -> bool) -> uint {
+pub unsafe fn position<T>(buf: *const T, f: |&T| -> bool) -> uint {
     let mut i = 0;
     loop {
         if f(&(*buf.offset(i as int))) { return i; }
@@ -352,9 +353,9 @@ fn is_not_null(&self) -> bool { !self.is_null() }
     unsafe fn offset(self, count: int) -> Self;
 }
 
-impl<T> RawPtr<T> for *T {
+impl<T> RawPtr<T> for *const T {
     #[inline]
-    fn null() -> *T { null() }
+    fn null() -> *const T { null() }
 
     #[inline]
     fn is_null(&self) -> bool { *self == RawPtr::null() }
@@ -363,7 +364,9 @@ fn is_null(&self) -> bool { *self == RawPtr::null() }
     fn to_uint(&self) -> uint { *self as uint }
 
     #[inline]
-    unsafe fn offset(self, count: int) -> *T { intrinsics::offset(self, count) }
+    unsafe fn offset(self, count: int) -> *const T {
+        intrinsics::offset(self, count)
+    }
 
     #[inline]
     unsafe fn to_option(&self) -> Option<&T> {
@@ -387,7 +390,7 @@ fn to_uint(&self) -> uint { *self as uint }
 
     #[inline]
     unsafe fn offset(self, count: int) -> *mut T {
-        intrinsics::offset(self as *T, count) as *mut T
+        intrinsics::offset(self as *const T, count) as *mut T
     }
 
     #[inline]
@@ -402,17 +405,17 @@ unsafe fn to_option(&self) -> Option<&T> {
 
 // Equality for pointers
 #[cfg(not(test))]
-impl<T> PartialEq for *T {
+impl<T> PartialEq for *const T {
     #[inline]
-    fn eq(&self, other: &*T) -> bool {
+    fn eq(&self, other: &*const T) -> bool {
         *self == *other
     }
     #[inline]
-    fn ne(&self, other: &*T) -> bool { !self.eq(other) }
+    fn ne(&self, other: &*const T) -> bool { !self.eq(other) }
 }
 
 #[cfg(not(test))]
-impl<T> Eq for *T {}
+impl<T> Eq for *const T {}
 
 #[cfg(not(test))]
 impl<T> PartialEq for *mut T {
@@ -429,22 +432,22 @@ impl<T> Eq for *mut T {}
 
 // Equivalence for pointers
 #[cfg(not(test))]
-impl<T> Equiv<*mut T> for *T {
+impl<T> Equiv<*mut T> for *const T {
     fn equiv(&self, other: &*mut T) -> bool {
         self.to_uint() == other.to_uint()
     }
 }
 
 #[cfg(not(test))]
-impl<T> Equiv<*T> for *mut T {
-    fn equiv(&self, other: &*T) -> bool {
+impl<T> Equiv<*const T> for *mut T {
+    fn equiv(&self, other: &*const T) -> bool {
         self.to_uint() == other.to_uint()
     }
 }
 
-impl<T> Clone for *T {
+impl<T> Clone for *const T {
     #[inline]
-    fn clone(&self) -> *T {
+    fn clone(&self) -> *const T {
         *self
     }
 }
@@ -465,8 +468,8 @@ mod externfnpointers {
     impl<_R> PartialEq for extern "C" fn() -> _R {
         #[inline]
         fn eq(&self, other: &extern "C" fn() -> _R) -> bool {
-            let self_: *() = unsafe { mem::transmute(*self) };
-            let other_: *() = unsafe { mem::transmute(*other) };
+            let self_: *const () = unsafe { mem::transmute(*self) };
+            let other_: *const () = unsafe { mem::transmute(*other) };
             self_ == other_
         }
     }
@@ -475,8 +478,9 @@ macro_rules! fnptreq(
             impl<_R,$($p),*> PartialEq for extern "C" fn($($p),*) -> _R {
                 #[inline]
                 fn eq(&self, other: &extern "C" fn($($p),*) -> _R) -> bool {
-                    let self_: *() = unsafe { mem::transmute(*self) };
-                    let other_: *() = unsafe { mem::transmute(*other) };
+                    let self_: *const () = unsafe { mem::transmute(*self) };
+
+                    let other_: *const () = unsafe { mem::transmute(*other) };
                     self_ == other_
                 }
             }
@@ -491,9 +495,9 @@ fn eq(&self, other: &extern "C" fn($($p),*) -> _R) -> bool {
 
 // Comparison for pointers
 #[cfg(not(test))]
-impl<T> PartialOrd for *T {
+impl<T> PartialOrd for *const T {
     #[inline]
-    fn lt(&self, other: &*T) -> bool { *self < *other }
+    fn lt(&self, other: &*const T) -> bool { *self < *other }
 }
 
 #[cfg(not(test))]
@@ -587,7 +591,7 @@ fn test_buf_len() {
 
     #[test]
     fn test_is_null() {
-        let p: *int = null();
+        let p: *const int = null();
         assert!(p.is_null());
         assert!(!p.is_not_null());
 
@@ -607,10 +611,10 @@ fn test_is_null() {
     #[test]
     fn test_to_option() {
         unsafe {
-            let p: *int = null();
+            let p: *const int = null();
             assert_eq!(p.to_option(), None);
 
-            let q: *int = &2;
+            let q: *const int = &2;
             assert_eq!(q.to_option().unwrap(), &2);
 
             let p: *mut int = mut_null();
@@ -738,7 +742,7 @@ fn test_ptr_array_each() {
     #[should_fail]
     fn test_ptr_array_each_with_len_null_ptr() {
         unsafe {
-            array_each_with_len(0 as **libc::c_char, 1, |e| {
+            array_each_with_len(0 as *const *const libc::c_char, 1, |e| {
                 str::raw::from_c_str(e);
             });
         }
@@ -747,7 +751,7 @@ fn test_ptr_array_each_with_len_null_ptr() {
     #[should_fail]
     fn test_ptr_array_each_null_ptr() {
         unsafe {
-            array_each(0 as **libc::c_char, |e| {
+            array_each(0 as *const *const libc::c_char, |e| {
                 str::raw::from_c_str(e);
             });
         }
index 0a2a756c6b1c24739813d3dfdfb3d087617b6547..f32e6bd9c7cc5986361df5277505f47d18f0c38a 100644 (file)
@@ -31,20 +31,20 @@ pub struct Box<T> {
 
 /// The representation of a Rust slice
 pub struct Slice<T> {
-    pub data: *T,
+    pub data: *const T,
     pub len: uint,
 }
 
 /// The representation of a Rust closure
 pub struct Closure {
-    pub code: *(),
-    pub env: *(),
+    pub code: *mut (),
+    pub env: *mut (),
 }
 
 /// The representation of a Rust procedure (`proc()`)
 pub struct Procedure {
-    pub code: *(),
-    pub env: *(),
+    pub code: *mut (),
+    pub env: *mut (),
 }
 
 /// The representation of a Rust trait object.
@@ -52,8 +52,8 @@ pub struct Procedure {
 /// This struct does not have a `Repr` implementation
 /// because there is no way to refer to all trait objects generically.
 pub struct TraitObject {
-    pub vtable: *(),
-    pub data: *(),
+    pub vtable: *mut (),
+    pub data: *mut (),
 }
 
 /// This trait is meant to map equivalences between raw structs and their
index 14b5f7a6d60e29653a16e2e7ccfede64b467bf11..fea7986eee5951793455e2cd8ad52b2522b00c34 100644 (file)
@@ -44,7 +44,7 @@ pub fn ref_slice<'a, A>(s: &'a A) -> &'a [A] {
  */
 pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] {
     unsafe {
-        let ptr: *A = transmute(s);
+        let ptr: *const A = transmute(s);
         transmute(Slice { data: ptr, len: 1 })
     }
 }
@@ -439,7 +439,7 @@ pub trait ImmutableVector<'a, T> {
      * Modifying the vector may cause its buffer to be reallocated, which
      * would also make any pointers to it invalid.
      */
-    fn as_ptr(&self) -> *T;
+    fn as_ptr(&self) -> *const T;
 
     /**
      * Binary search a sorted vector with a comparator function.
@@ -520,7 +520,7 @@ fn iter(self) -> Items<'a, T> {
             let p = self.as_ptr();
             if mem::size_of::<T>() == 0 {
                 Items{ptr: p,
-                      end: (p as uint + self.len()) as *T,
+                      end: (p as uint + self.len()) as *const T,
                       marker: marker::ContravariantLifetime::<'a>}
             } else {
                 Items{ptr: p,
@@ -606,7 +606,7 @@ unsafe fn unsafe_ref(self, index: uint) -> &'a T {
     }
 
     #[inline]
-    fn as_ptr(&self) -> *T {
+    fn as_ptr(&self) -> *const T {
         self.repr().data
     }
 
@@ -936,7 +936,7 @@ fn mut_slice(self, start: uint, end: uint) -> &'a mut [T] {
         assert!(end <= self.len());
         unsafe {
             transmute(Slice {
-                    data: self.as_mut_ptr().offset(start as int) as *T,
+                    data: self.as_mut_ptr().offset(start as int) as *const T,
                     len: (end - start)
                 })
         }
@@ -1115,7 +1115,7 @@ pub mod raw {
      * not bytes).
      */
     #[inline]
-    pub unsafe fn buf_as_slice<T,U>(p: *T, len: uint, f: |v: &[T]| -> U)
+    pub unsafe fn buf_as_slice<T,U>(p: *const T, len: uint, f: |v: &[T]| -> U)
                                -> U {
         f(transmute(Slice {
             data: p,
@@ -1135,7 +1135,7 @@ pub unsafe fn mut_buf_as_slice<T,
                                    f: |v: &mut [T]| -> U)
                                    -> U {
         f(transmute(Slice {
-            data: p as *T,
+            data: p as *const T,
             len: len
         }))
     }
@@ -1146,9 +1146,9 @@ pub unsafe fn mut_buf_as_slice<T,
      * if the slice is empty. O(1).
      */
      #[inline]
-    pub unsafe fn shift_ptr<T>(slice: &mut Slice<T>) -> Option<*T> {
+    pub unsafe fn shift_ptr<T>(slice: &mut Slice<T>) -> Option<*const T> {
         if slice.len == 0 { return None; }
-        let head: *T = slice.data;
+        let head: *const T = slice.data;
         slice.data = slice.data.offset(1);
         slice.len -= 1;
         Some(head)
@@ -1160,9 +1160,9 @@ pub unsafe fn shift_ptr<T>(slice: &mut Slice<T>) -> Option<*T> {
      * if the slice is empty. O(1).
      */
      #[inline]
-    pub unsafe fn pop_ptr<T>(slice: &mut Slice<T>) -> Option<*T> {
+    pub unsafe fn pop_ptr<T>(slice: &mut Slice<T>) -> Option<*const T> {
         if slice.len == 0 { return None; }
-        let tail: *T = slice.data.offset((slice.len - 1) as int);
+        let tail: *const T = slice.data.offset((slice.len - 1) as int);
         slice.len -= 1;
         Some(tail)
     }
@@ -1201,8 +1201,8 @@ pub fn copy_memory(dst: &mut [u8], src: &[u8]) {
 
 /// Immutable slice iterator
 pub struct Items<'a, T> {
-    ptr: *T,
-    end: *T,
+    ptr: *const T,
+    end: *const T,
     marker: marker::ContravariantLifetime<'a>
 }
 
@@ -1289,7 +1289,7 @@ fn idx(&mut self, index: uint) -> Option<&'a T> {
     }
 }
 
-iterator!{struct Items -> *T, &'a T}
+iterator!{struct Items -> *const T, &'a T}
 
 impl<'a, T> ExactSize<&'a T> for Items<'a, T> {}
 impl<'a, T> ExactSize<&'a mut T> for MutItems<'a, T> {}
index 13efeab57d492693c9d65923048c2ca214685d4f..0d4b5f590742be64e0740a223aeb7e4d5f940364 100644 (file)
@@ -568,10 +568,10 @@ fn next(&mut self) -> Option<&'a str> {
 #[inline]
 fn eq_slice_(a: &str, b: &str) -> bool {
     #[allow(ctypes)]
-    extern { fn memcmp(s1: *i8, s2: *i8, n: uint) -> i32; }
+    extern { fn memcmp(s1: *const i8, s2: *const i8, n: uint) -> i32; }
     a.len() == b.len() && unsafe {
-        memcmp(a.as_ptr() as *i8,
-               b.as_ptr() as *i8,
+        memcmp(a.as_ptr() as *const i8,
+               b.as_ptr() as *const i8,
                a.len()) == 0
     }
 }
@@ -888,8 +888,8 @@ pub unsafe fn from_utf8<'a>(v: &'a [u8]) -> &'a str {
     /// Form a slice from a C string. Unsafe because the caller must ensure the
     /// C string has the static lifetime, or else the return value may be
     /// invalidated later.
-    pub unsafe fn c_str_to_static_slice(s: *i8) -> &'static str {
-        let s = s as *u8;
+    pub unsafe fn c_str_to_static_slice(s: *const i8) -> &'static str {
+        let s = s as *const u8;
         let mut curr = s;
         let mut len = 0u;
         while *curr != 0u8 {
@@ -1618,7 +1618,7 @@ pub trait StrSlice<'a> {
     /// The caller must ensure that the string outlives this pointer,
     /// and that it is not reallocated (e.g. by pushing to the
     /// string).
-    fn as_ptr(&self) -> *u8;
+    fn as_ptr(&self) -> *const u8;
 }
 
 impl<'a> StrSlice<'a> for &'a str {
@@ -1964,7 +1964,7 @@ fn subslice_offset(&self, inner: &str) -> uint {
     }
 
     #[inline]
-    fn as_ptr(&self) -> *u8 {
+    fn as_ptr(&self) -> *const u8 {
         self.repr().data
     }
 }
index 47a2005fef1e6e9f9ab979aa4cfcef26cf469aa8..5bdab6a78ca337d207a63394678360475e5db2a4 100644 (file)
@@ -62,7 +62,7 @@ pub fn new(value: T) -> Unsafe<T> {
 
     /// Gets a mutable pointer to the wrapped value
     #[inline]
-    pub unsafe fn get(&self) -> *mut T { &self.value as *T as *mut T }
+    pub unsafe fn get(&self) -> *mut T { &self.value as *const T as *mut T }
 
     /// Unwraps the value
     #[inline]
index 280e8753b34b5f845d12f2d6bb737b0f82158173..0cbae6ee2d3a3910104fd851929655bb0857e713 100644 (file)
@@ -28,7 +28,7 @@
  * as `TyVisitor`; then build a MovePtrAdaptor wrapped around your struct.
  */
 pub trait MovePtr {
-    fn move_ptr(&mut self, adjustment: |*u8| -> *u8);
+    fn move_ptr(&mut self, adjustment: |*const u8| -> *const u8);
     fn push_ptr(&mut self);
     fn pop_ptr(&mut self);
 }
@@ -51,12 +51,12 @@ pub fn new(v: V) -> MovePtrAdaptor<V> {
 
     #[inline]
     pub fn bump(&mut self, sz: uint) {
-        self.inner.move_ptr(|p| ((p as uint) + sz) as *u8)
+        self.inner.move_ptr(|p| ((p as uint) + sz) as *const u8)
     }
 
     #[inline]
     pub fn align(&mut self, a: uint) {
-        self.inner.move_ptr(|p| align(p as uint, a) as *u8)
+        self.inner.move_ptr(|p| align(p as uint, a) as *const u8)
     }
 
     #[inline]
@@ -202,35 +202,35 @@ fn visit_estr_fixed(&mut self, n: uint,
         true
     }
 
-    fn visit_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
+    fn visit_box(&mut self, mtbl: uint, inner: *const TyDesc) -> bool {
         self.align_to::<Gc<u8>>();
         if ! self.inner.visit_box(mtbl, inner) { return false; }
         self.bump_past::<Gc<u8>>();
         true
     }
 
-    fn visit_uniq(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
+    fn visit_uniq(&mut self, mtbl: uint, inner: *const TyDesc) -> bool {
         self.align_to::<Box<u8>>();
         if ! self.inner.visit_uniq(mtbl, inner) { return false; }
         self.bump_past::<Box<u8>>();
         true
     }
 
-    fn visit_ptr(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
-        self.align_to::<*u8>();
+    fn visit_ptr(&mut self, mtbl: uint, inner: *const TyDesc) -> bool {
+        self.align_to::<*const u8>();
         if ! self.inner.visit_ptr(mtbl, inner) { return false; }
-        self.bump_past::<*u8>();
+        self.bump_past::<*const u8>();
         true
     }
 
-    fn visit_rptr(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
+    fn visit_rptr(&mut self, mtbl: uint, inner: *const TyDesc) -> bool {
         self.align_to::<&'static u8>();
         if ! self.inner.visit_rptr(mtbl, inner) { return false; }
         self.bump_past::<&'static u8>();
         true
     }
 
-    fn visit_evec_slice(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
+    fn visit_evec_slice(&mut self, mtbl: uint, inner: *const TyDesc) -> bool {
         self.align_to::<&'static [u8]>();
         if ! self.inner.visit_evec_slice(mtbl, inner) { return false; }
         self.bump_past::<&'static [u8]>();
@@ -238,7 +238,7 @@ fn visit_evec_slice(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
     }
 
     fn visit_evec_fixed(&mut self, n: uint, sz: uint, align: uint,
-                        mtbl: uint, inner: *TyDesc) -> bool {
+                        mtbl: uint, inner: *const TyDesc) -> bool {
         self.align(align);
         if ! self.inner.visit_evec_fixed(n, sz, align, mtbl, inner) {
             return false;
@@ -254,7 +254,7 @@ fn visit_enter_rec(&mut self, n_fields: uint, sz: uint, align: uint) -> bool {
     }
 
     fn visit_rec_field(&mut self, i: uint, name: &str,
-                       mtbl: uint, inner: *TyDesc) -> bool {
+                       mtbl: uint, inner: *const TyDesc) -> bool {
         unsafe { self.align((*inner).align); }
         if ! self.inner.visit_rec_field(i, name, mtbl, inner) {
             return false;
@@ -278,7 +278,7 @@ fn visit_enter_class(&mut self, name: &str, named_fields: bool, n_fields: uint,
     }
 
     fn visit_class_field(&mut self, i: uint, name: &str, named: bool, mtbl: uint,
-                         inner: *TyDesc) -> bool {
+                         inner: *const TyDesc) -> bool {
         unsafe { self.align((*inner).align); }
         if ! self.inner.visit_class_field(i, name, named, mtbl, inner) {
             return false;
@@ -301,7 +301,7 @@ 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 {
+    fn visit_tup_field(&mut self, i: uint, inner: *const TyDesc) -> bool {
         unsafe { self.align((*inner).align); }
         if ! self.inner.visit_tup_field(i, inner) { return false; }
         unsafe { self.bump((*inner).size); }
@@ -321,12 +321,14 @@ fn visit_enter_fn(&mut self, purity: uint, proto: uint,
         true
     }
 
-    fn visit_fn_input(&mut self, i: uint, mode: uint, inner: *TyDesc) -> bool {
+    fn visit_fn_input(&mut self, i: uint, mode: uint,
+                      inner: *const TyDesc) -> bool {
         if ! self.inner.visit_fn_input(i, mode, inner) { return false; }
         true
     }
 
-    fn visit_fn_output(&mut self, retstyle: uint, variadic: bool, inner: *TyDesc) -> bool {
+    fn visit_fn_output(&mut self, retstyle: uint, variadic: bool,
+                       inner: *const TyDesc) -> bool {
         if ! self.inner.visit_fn_output(retstyle, variadic, inner) { return false; }
         true
     }
@@ -340,7 +342,7 @@ fn visit_leave_fn(&mut self, purity: uint, proto: uint,
     }
 
     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 {
         self.align(align);
@@ -361,7 +363,8 @@ fn visit_enter_enum_variant(&mut self, variant: uint,
         true
     }
 
-    fn visit_enum_variant_field(&mut self, i: uint, offset: uint, inner: *TyDesc) -> bool {
+    fn visit_enum_variant_field(&mut self, i: uint, offset: uint,
+                                inner: *const TyDesc) -> bool {
         self.inner.push_ptr();
         self.bump(offset);
         if ! self.inner.visit_enum_variant_field(i, offset, inner) { return false; }
@@ -381,7 +384,7 @@ fn visit_leave_enum_variant(&mut self, variant: uint,
     }
 
     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 {
         if ! self.inner.visit_leave_enum(n_variants, get_disr, sz, align) {
             return false;
index 6562e2fb6e3829d68f94c03bfb561439c4496db3..1494a2defe949934173aab69655ba387704a8449 100644 (file)
@@ -92,8 +92,8 @@ enum VariantState {
 }
 
 pub struct ReprVisitor<'a> {
-    ptr: *u8,
-    ptr_stk: Vec<*u8>,
+    ptr: *const u8,
+    ptr_stk: Vec<*const u8>,
     var_stk: Vec<VariantState>,
     writer: &'a mut io::Writer,
     last_err: Option<io::IoError>,
@@ -101,7 +101,7 @@ pub struct ReprVisitor<'a> {
 
 impl<'a> MovePtr for ReprVisitor<'a> {
     #[inline]
-    fn move_ptr(&mut self, adjustment: |*u8| -> *u8) {
+    fn move_ptr(&mut self, adjustment: |*const u8| -> *const u8) {
         self.ptr = adjustment(self.ptr);
     }
     fn push_ptr(&mut self) {
@@ -114,7 +114,7 @@ fn pop_ptr(&mut self) {
 
 impl<'a> ReprVisitor<'a> {
     // Various helpers for the TyVisitor impl
-    pub fn new(ptr: *u8, writer: &'a mut io::Writer) -> ReprVisitor<'a> {
+    pub fn new(ptr: *const u8, writer: &'a mut io::Writer) -> ReprVisitor<'a> {
         ReprVisitor {
             ptr: ptr,
             ptr_stk: vec!(),
@@ -128,18 +128,19 @@ pub fn new(ptr: *u8, writer: &'a mut io::Writer) -> ReprVisitor<'a> {
     pub fn get<T>(&mut self, f: |&mut ReprVisitor, &T| -> bool) -> bool {
         unsafe {
             let ptr = self.ptr;
-            f(self, mem::transmute::<*u8,&T>(ptr))
+            f(self, mem::transmute::<*const u8,&T>(ptr))
         }
     }
 
     #[inline]
-    pub fn visit_inner(&mut self, inner: *TyDesc) -> bool {
+    pub fn visit_inner(&mut self, inner: *const TyDesc) -> bool {
         let ptr = self.ptr;
         self.visit_ptr_inner(ptr, inner)
     }
 
     #[inline]
-    pub fn visit_ptr_inner(&mut self, ptr: *u8, inner: *TyDesc) -> bool {
+    pub fn visit_ptr_inner(&mut self, ptr: *const u8,
+                           inner: *const TyDesc) -> bool {
         unsafe {
             let u = ReprVisitor::new(ptr, mem::transmute_copy(&self.writer));
             let mut v = reflect::MovePtrAdaptor::new(u);
@@ -183,8 +184,9 @@ pub fn write_mut_qualifier(&mut self, mtbl: uint) -> bool {
         true
     }
 
-    pub fn write_vec_range(&mut self, ptr: *(), len: uint, inner: *TyDesc) -> bool {
-        let mut p = ptr as *u8;
+    pub fn write_vec_range(&mut self, ptr: *const (), len: uint,
+                           inner: *const TyDesc) -> bool {
+        let mut p = ptr as *const u8;
         let (sz, al) = unsafe { ((*inner).size, (*inner).align) };
         try!(self, self.writer.write(['[' as u8]));
         let mut first = true;
@@ -197,8 +199,8 @@ pub fn write_vec_range(&mut self, ptr: *(), len: uint, inner: *TyDesc) -> bool {
             } else {
                 try!(self, self.writer.write(", ".as_bytes()));
             }
-            self.visit_ptr_inner(p as *u8, inner);
-            p = align(unsafe { p.offset(sz as int) as uint }, al) as *u8;
+            self.visit_ptr_inner(p as *const u8, inner);
+            p = align(unsafe { p.offset(sz as int) as uint }, al) as *const u8;
             left -= dec;
         }
         try!(self, self.writer.write([']' as u8]));
@@ -276,40 +278,46 @@ fn visit_estr_slice(&mut self) -> bool {
     fn visit_estr_fixed(&mut self, _n: uint, _sz: uint,
                         _align: uint) -> bool { fail!(); }
 
-    fn visit_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
+    fn visit_box(&mut self, mtbl: uint, inner: *const TyDesc) -> bool {
         try!(self, self.writer.write("box(GC) ".as_bytes()));
         self.write_mut_qualifier(mtbl);
         self.get::<&raw::Box<()>>(|this, b| {
-            let p = &b.data as *() as *u8;
+            let p = &b.data as *const () as *const u8;
             this.visit_ptr_inner(p, inner)
         })
     }
 
-    fn visit_uniq(&mut self, _mtbl: uint, inner: *TyDesc) -> bool {
+    fn visit_uniq(&mut self, _mtbl: uint, inner: *const TyDesc) -> bool {
         try!(self, self.writer.write("box ".as_bytes()));
-        self.get::<*u8>(|this, b| {
+        self.get::<*const u8>(|this, b| {
             this.visit_ptr_inner(*b, inner)
         })
     }
 
-    fn visit_ptr(&mut self, mtbl: uint, _inner: *TyDesc) -> bool {
-        self.get::<*u8>(|this, p| {
+    fn visit_ptr(&mut self, mtbl: uint, _inner: *const TyDesc) -> bool {
+        self.get::<*const u8>(|this, p| {
             try!(this, write!(this.writer, "({} as *", *p));
-            this.write_mut_qualifier(mtbl);
+            if mtbl == 0 {
+                try!(this, this.writer.write("mut ".as_bytes()));
+            } else if mtbl == 1 {
+                try!(this, this.writer.write("const ".as_bytes()));
+            } else {
+                fail!("invalid mutability value");
+            }
             try!(this, this.writer.write("())".as_bytes()));
             true
         })
     }
 
-    fn visit_rptr(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
+    fn visit_rptr(&mut self, mtbl: uint, inner: *const TyDesc) -> bool {
         try!(self, self.writer.write(['&' as u8]));
         self.write_mut_qualifier(mtbl);
-        self.get::<*u8>(|this, p| {
+        self.get::<*const u8>(|this, p| {
             this.visit_ptr_inner(*p, inner)
         })
     }
 
-    fn visit_evec_slice(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
+    fn visit_evec_slice(&mut self, mtbl: uint, inner: *const TyDesc) -> bool {
         self.get::<raw::Slice<()>>(|this, s| {
             try!(this, this.writer.write(['&' as u8]));
             this.write_mut_qualifier(mtbl);
@@ -321,7 +329,7 @@ fn visit_evec_slice(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
     }
 
     fn visit_evec_fixed(&mut self, n: uint, sz: uint, _align: uint,
-                        _: uint, inner: *TyDesc) -> bool {
+                        _: uint, inner: *const TyDesc) -> bool {
         let assumed_size = if sz == 0 { n } else { sz };
         self.get::<()>(|this, b| {
             this.write_vec_range(b, assumed_size, inner)
@@ -335,7 +343,7 @@ fn visit_enter_rec(&mut self, _n_fields: uint,
     }
 
     fn visit_rec_field(&mut self, i: uint, name: &str,
-                       mtbl: uint, inner: *TyDesc) -> bool {
+                       mtbl: uint, inner: *const TyDesc) -> bool {
         if i != 0 {
             try!(self, self.writer.write(", ".as_bytes()));
         }
@@ -366,7 +374,7 @@ fn visit_enter_class(&mut self, name: &str, named_fields: bool, n_fields: uint,
     }
 
     fn visit_class_field(&mut self, i: uint, name: &str, named: bool,
-                         _mtbl: uint, inner: *TyDesc) -> bool {
+                         _mtbl: uint, inner: *const TyDesc) -> bool {
         if i != 0 {
             try!(self, self.writer.write(", ".as_bytes()));
         }
@@ -396,7 +404,7 @@ fn visit_enter_tup(&mut self, _n_fields: uint,
         true
     }
 
-    fn visit_tup_field(&mut self, i: uint, inner: *TyDesc) -> bool {
+    fn visit_tup_field(&mut self, i: uint, inner: *const TyDesc) -> bool {
         if i != 0 {
             try!(self, self.writer.write(", ".as_bytes()));
         }
@@ -415,7 +423,7 @@ fn visit_leave_tup(&mut self, _n_fields: uint,
 
     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 {
         let disr = unsafe {
@@ -456,7 +464,7 @@ fn visit_enter_enum_variant(&mut self, _variant: uint,
     fn visit_enum_variant_field(&mut self,
                                 i: uint,
                                 _offset: uint,
-                                inner: *TyDesc)
+                                inner: *const TyDesc)
                                 -> bool {
         match *self.var_stk.get(self.var_stk.len() - 1) {
             Matched => {
@@ -489,7 +497,7 @@ fn visit_leave_enum_variant(&mut self, _variant: uint,
 
     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 {
@@ -505,7 +513,8 @@ fn visit_enter_fn(&mut self, _purity: uint, _proto: uint,
         true
     }
 
-    fn visit_fn_input(&mut self, i: uint, _mode: uint, inner: *TyDesc) -> bool {
+    fn visit_fn_input(&mut self, i: uint, _mode: uint,
+                      inner: *const TyDesc) -> bool {
         if i != 0 {
             try!(self, self.writer.write(", ".as_bytes()));
         }
@@ -515,7 +524,7 @@ fn visit_fn_input(&mut self, i: uint, _mode: uint, inner: *TyDesc) -> bool {
     }
 
     fn visit_fn_output(&mut self, _retstyle: uint, variadic: bool,
-                       inner: *TyDesc) -> bool {
+                       inner: *const TyDesc) -> bool {
         if variadic {
             try!(self, self.writer.write(", ...".as_bytes()));
         }
@@ -543,7 +552,7 @@ fn visit_self(&mut self) -> bool { true }
 
 pub fn write_repr<T>(writer: &mut io::Writer, object: &T) -> io::IoResult<()> {
     unsafe {
-        let ptr = object as *T as *u8;
+        let ptr = object as *const T as *const u8;
         let tydesc = get_tydesc::<T>();
         let u = ReprVisitor::new(ptr, writer);
         let mut v = reflect::MovePtrAdaptor::new(u);
@@ -591,7 +600,7 @@ fn exact_test<T>(t: &T, e:&str) {
     let mut x = 10;
     exact_test(&(&mut x), "&mut 10");
 
-    exact_test(&(0 as *()), "(0x0 as *())");
+    exact_test(&(0 as *const ()), "(0x0 as *const ())");
     exact_test(&(0 as *mut ()), "(0x0 as *mut ())");
 
     exact_test(&(1,), "(1,)");
index 26e9b2aa372fa0c8d8705517713aecbb9f0526db..06f574f4c88a3a4b275620847e6f4e58e691ae3b 100644 (file)
 #[link(name = "miniz", kind = "static")]
 extern {
     /// Raw miniz compression function.
-    fn tdefl_compress_mem_to_heap(psrc_buf: *c_void,
-                                      src_buf_len: size_t,
-                                      pout_len: *mut size_t,
-                                      flags: c_int)
-                                      -> *mut c_void;
+    fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
+                                  src_buf_len: size_t,
+                                  pout_len: *mut size_t,
+                                  flags: c_int)
+                                  -> *mut c_void;
 
     /// Raw miniz decompression function.
-    fn tinfl_decompress_mem_to_heap(psrc_buf: *c_void,
-                                        src_buf_len: size_t,
-                                        pout_len: *mut size_t,
-                                        flags: c_int)
-                                        -> *mut c_void;
+    fn tinfl_decompress_mem_to_heap(psrc_buf: *const c_void,
+                                    src_buf_len: size_t,
+                                    pout_len: *mut size_t,
+                                    flags: c_int)
+                                    -> *mut c_void;
 }
 
 static LZ_NORM : c_int = 0x80;  // LZ with 128 probes, "normal"
@@ -59,10 +59,10 @@ fn tinfl_decompress_mem_to_heap(psrc_buf: *c_void,
 fn deflate_bytes_internal(bytes: &[u8], flags: c_int) -> Option<CVec<u8>> {
     unsafe {
         let mut outsz : size_t = 0;
-        let res = tdefl_compress_mem_to_heap(bytes.as_ptr() as *c_void,
-                                                     bytes.len() as size_t,
-                                                     &mut outsz,
-                                                     flags);
+        let res = tdefl_compress_mem_to_heap(bytes.as_ptr() as *const _,
+                                             bytes.len() as size_t,
+                                             &mut outsz,
+                                             flags);
         if !res.is_null() {
             Some(CVec::new_with_dtor(res as *mut u8, outsz as uint, proc() libc::free(res)))
         } else {
@@ -84,10 +84,10 @@ pub fn deflate_bytes_zlib(bytes: &[u8]) -> Option<CVec<u8>> {
 fn inflate_bytes_internal(bytes: &[u8], flags: c_int) -> Option<CVec<u8>> {
     unsafe {
         let mut outsz : size_t = 0;
-        let res = tinfl_decompress_mem_to_heap(bytes.as_ptr() as *c_void,
-                                                       bytes.len() as size_t,
-                                                       &mut outsz,
-                                                       flags);
+        let res = tinfl_decompress_mem_to_heap(bytes.as_ptr() as *const _,
+                                               bytes.len() as size_t,
+                                               &mut outsz,
+                                               flags);
         if !res.is_null() {
             Some(CVec::new_with_dtor(res as *mut u8, outsz as uint, proc() libc::free(res)))
         } else {
index f11a1d2c66737e5da1ba546d5b792fd40432262c..8c60f3d9fe1dc19f3b83de676c20ce45f73fa27c 100644 (file)
@@ -27,7 +27,7 @@ pub struct Context {
     stack_bounds: Option<(uint, uint)>,
 }
 
-pub type InitFn = extern "C" fn(uint, *(), *()) -> !;
+pub type InitFn = extern "C" fn(uint, *mut (), *mut ()) -> !;
 
 impl Context {
     pub fn empty() -> Context {
@@ -49,7 +49,7 @@ pub fn empty() -> Context {
     pub fn new(init: InitFn, arg: uint, start: proc():Send,
                stack: &mut Stack) -> Context {
 
-        let sp: *uint = stack.end();
+        let sp: *const uint = stack.end();
         let sp: *mut uint = sp as *mut uint;
         // Save and then immediately load the current context,
         // which we will then modify to call the given function when restored
@@ -66,7 +66,7 @@ pub fn new(init: InitFn, arg: uint, start: proc():Send,
         // them in terms of the code running on them (and hopefully they don't
         // overflow). Additionally, their coroutine stacks are listed as being
         // zero-length, so that's how we detect what's what here.
-        let stack_base: *uint = stack.start();
+        let stack_base: *const uint = stack.start();
         let bounds = if sp as uint == stack_base as uint {
             None
         } else {
@@ -116,7 +116,7 @@ pub fn swap(out_context: &mut Context, in_context: &Context) {
 
 #[link(name = "context_switch", kind = "static")]
 extern {
-    fn rust_swap_registers(out_regs: *mut Registers, in_regs: *Registers);
+    fn rust_swap_registers(out_regs: *mut Registers, in_regs: *const Registers);
 }
 
 // Register contexts used in various architectures
index 007f63383ac1bb79fc790fee5ae8a6fa470ca5d5..38096f568b11fe4649cfef481445c232466637ff 100644 (file)
 //! extern crate green;
 //!
 //! #[start]
-//! fn start(argc: int, argv: **u8) -> int {
+//! fn start(argc: int, argv: *const *const u8) -> int {
 //!     green::start(argc, argv, green::basic::event_loop, main)
 //! }
 //!
 //! 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)
 //! }
 //!
@@ -267,7 +267,7 @@ mod __start {
         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, super::$f)
         }
     }
@@ -291,7 +291,7 @@ fn start(argc: int, argv: **u8) -> int {
 ///
 /// The return value is used as the process return code. 0 on success, 101 on
 /// error.
-pub fn start(argc: int, argv: **u8,
+pub fn start(argc: int, argv: *const *const u8,
              event_loop_factory: fn() -> Box<rtio::EventLoop + Send>,
              main: proc():Send) -> int {
     rt::init(argc, argv);
index 0402a93e468497c1fd8ff1fc9dc21b76b282359b..8d66f4ee962aa24fe3ba3da174a9ab694f83cac0 100644 (file)
@@ -611,13 +611,13 @@ pub fn enqueue_task(&mut self, task: Box<GreenTask>) {
     // old task as inputs.
 
     pub fn change_task_context(mut ~self,
-                               current_task: Box<GreenTask>,
+                               mut current_task: Box<GreenTask>,
                                mut next_task: Box<GreenTask>,
                                f: |&mut Scheduler, Box<GreenTask>|)
                                -> Box<GreenTask> {
         let f_opaque = ClosureConverter::from_fn(f);
 
-        let current_task_dupe = &*current_task as *GreenTask;
+        let current_task_dupe = &mut *current_task as *mut GreenTask;
 
         // The current task is placed inside an enum with the cleanup
         // function. This enum is then placed inside the scheduler.
@@ -871,7 +871,7 @@ pub fn maybe_yield(mut ~self, cur: Box<GreenTask>) {
 
     // * Utility Functions
 
-    pub fn sched_id(&self) -> uint { self as *Scheduler as uint }
+    pub fn sched_id(&self) -> uint { self as *const Scheduler as uint }
 
     pub fn run_cleanup_job(&mut self) {
         let cleanup_job = self.cleanup_job.take_unwrap();
index 7b738ed9c7c158d3ac10f0b107e55ef5f2671adb..874ddbfe7ed0e3137775f4d219b2919834403e4f 100644 (file)
@@ -32,7 +32,7 @@ fn deschedule(mut ~self, times: uint, mut cur_task: Box<Task>,
         assert!(times == 1);
 
         let me = &mut *self as *mut SimpleTask;
-        let cur_dupe = &*cur_task as *Task;
+        let cur_dupe = &mut *cur_task as *mut Task;
         cur_task.put_runtime(self);
         let task = BlockedTask::block(cur_task);
 
index 526ce66b1ead88fb7545158f4e0f2070295d7e60..c4885edb7d3a776f63cb3df282c6c65f6ed36a13 100644 (file)
@@ -78,14 +78,14 @@ pub unsafe fn dummy_stack() -> Stack {
     }
 
     /// Point to the low end of the allocated stack
-    pub fn start(&self) -> *uint {
-        self.buf.data as *uint
+    pub fn start(&self) -> *const uint {
+        self.buf.data as *const uint
     }
 
     /// Point one uint beyond the high end of the allocated stack
-    pub fn end(&self) -> *uint {
+    pub fn end(&self) -> *const uint {
         unsafe {
-            self.buf.data.offset(self.buf.len as int) as *uint
+            self.buf.data.offset(self.buf.len as int) as *const uint
         }
     }
 }
@@ -168,8 +168,8 @@ fn max_cached_stacks() -> uint {
 }
 
 extern {
-    fn rust_valgrind_stack_register(start: *libc::uintptr_t,
-                                    end: *libc::uintptr_t) -> libc::c_uint;
+    fn rust_valgrind_stack_register(start: *const libc::uintptr_t,
+                                    end: *const libc::uintptr_t) -> libc::c_uint;
     fn rust_valgrind_stack_deregister(id: libc::c_uint);
 }
 
index 692b6e14fe7e1622f8c4e8c2a718b5718f4cc08c..88bdfc6089421ca721831f84e6816f0722f5f9b9 100644 (file)
@@ -89,7 +89,7 @@ pub enum Home {
 ///
 /// The goal for having this weird-looking function is to reduce the number of
 /// allocations done on a green-task startup as much as possible.
-extern fn bootstrap_green_task(task: uint, code: *(), env: *()) -> ! {
+extern fn bootstrap_green_task(task: uint, code: *mut (), env: *mut ()) -> ! {
     // Acquire ownership of the `proc()`
     let start: proc() = unsafe {
         mem::transmute(raw::Procedure { code: code, env: env })
@@ -256,7 +256,7 @@ pub fn is_sched(&self) -> bool {
     // context switches
 
     pub fn as_uint(&self) -> uint {
-        self as *GreenTask as uint
+        self as *const GreenTask as uint
     }
 
     pub unsafe fn from_uint(val: uint) -> Box<GreenTask> {
index 0d4f9ad19c6988eca07ae6a83b692b59dbf6ff88..3f7f0437baee4378592fa5b3edc1c0b806adab22 100644 (file)
@@ -365,14 +365,14 @@ pub mod posix01 {
 
                 pub struct glob_t {
                     pub gl_pathc: size_t,
-                    pub gl_pathv: **c_char,
+                    pub gl_pathv: *mut *mut c_char,
                     pub gl_offs:  size_t,
 
-                    pub __unused1: *c_void,
-                    pub __unused2: *c_void,
-                    pub __unused3: *c_void,
-                    pub __unused4: *c_void,
-                    pub __unused5: *c_void,
+                    pub __unused1: *mut c_void,
+                    pub __unused2: *mut c_void,
+                    pub __unused3: *mut c_void,
+                    pub __unused4: *mut c_void,
+                    pub __unused5: *mut c_void,
                 }
 
                 pub struct timeval {
@@ -440,18 +440,18 @@ pub struct addrinfo {
                     pub ai_addrlen: socklen_t,
 
                     #[cfg(target_os = "linux")]
-                    pub ai_addr: *sockaddr,
+                    pub ai_addr: *mut sockaddr,
 
                     #[cfg(target_os = "linux")]
-                    pub ai_canonname: *c_char,
+                    pub ai_canonname: *mut c_char,
 
                     #[cfg(target_os = "android")]
-                    pub ai_canonname: *c_char,
+                    pub ai_canonname: *mut c_char,
 
                     #[cfg(target_os = "android")]
-                    pub ai_addr: *sockaddr,
+                    pub ai_addr: *mut sockaddr,
 
-                    pub ai_next: *addrinfo,
+                    pub ai_next: *mut addrinfo,
                 }
                 pub struct sockaddr_un {
                     pub sun_family: sa_family_t,
@@ -751,15 +751,15 @@ pub struct glob_t {
                     pub __unused1: size_t,
                     pub gl_offs:   size_t,
                     pub __unused2: c_int,
-                    pub gl_pathv:  **c_char,
+                    pub gl_pathv:  *mut *mut c_char,
 
-                    pub __unused3: *c_void,
+                    pub __unused3: *mut c_void,
 
-                    pub __unused4: *c_void,
-                    pub __unused5: *c_void,
-                    pub __unused6: *c_void,
-                    pub __unused7: *c_void,
-                    pub __unused8: *c_void,
+                    pub __unused4: *mut c_void,
+                    pub __unused5: *mut c_void,
+                    pub __unused6: *mut c_void,
+                    pub __unused7: *mut c_void,
+                    pub __unused8: *mut c_void,
                 }
 
                 pub struct timeval {
@@ -830,9 +830,9 @@ pub struct addrinfo {
                     pub ai_socktype: c_int,
                     pub ai_protocol: c_int,
                     pub ai_addrlen: socklen_t,
-                    pub ai_canonname: *c_char,
-                    pub ai_addr: *sockaddr,
-                    pub ai_next: *addrinfo,
+                    pub ai_canonname: *mut c_char,
+                    pub ai_addr: *mut sockaddr,
+                    pub ai_next: *mut addrinfo,
                 }
                 pub struct sockaddr_un {
                     pub sun_len: u8,
@@ -922,7 +922,7 @@ pub struct utimbuf {
                     pub modtime: time_t,
                 }
 
-                pub type pthread_attr_t = *c_void;
+                pub type pthread_attr_t = *mut c_void;
             }
             pub mod posix08 {
             }
@@ -1028,9 +1028,9 @@ pub struct addrinfo {
                     pub ai_socktype: c_int,
                     pub ai_protocol: c_int,
                     pub ai_addrlen: size_t,
-                    pub ai_canonname: *c_char,
-                    pub ai_addr: *sockaddr,
-                    pub ai_next: *addrinfo,
+                    pub ai_canonname: *mut c_char,
+                    pub ai_addr: *mut sockaddr,
+                    pub ai_next: *mut addrinfo,
                 }
                 pub struct sockaddr_un {
                     pub sun_family: sa_family_t,
@@ -1142,8 +1142,8 @@ pub mod extra {
                 pub type LARGE_INTEGER = c_longlong;
                 pub type PLARGE_INTEGER = *mut c_longlong;
 
-                pub type LPCWSTR = *WCHAR;
-                pub type LPCSTR = *CHAR;
+                pub type LPCWSTR = *const WCHAR;
+                pub type LPCSTR = *const CHAR;
 
                 pub type LPWSTR = *mut WCHAR;
                 pub type LPSTR = *mut CHAR;
@@ -1159,7 +1159,7 @@ pub struct SECURITY_ATTRIBUTES {
                 pub type LPSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES;
 
                 pub type LPVOID = *mut c_void;
-                pub type LPCVOID = *c_void;
+                pub type LPCVOID = *const c_void;
                 pub type LPBYTE = *mut BYTE;
                 pub type LPWORD = *mut WORD;
                 pub type LPDWORD = *mut DWORD;
@@ -1231,8 +1231,8 @@ pub struct MEMORY_BASIC_INFORMATION {
                 pub type LPMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION;
 
                 pub struct OVERLAPPED {
-                    pub Internal: *c_ulong,
-                    pub InternalHigh: *c_ulong,
+                    pub Internal: *mut c_ulong,
+                    pub InternalHigh: *mut c_ulong,
                     pub Offset: DWORD,
                     pub OffsetHigh: DWORD,
                     pub hEvent: HANDLE,
@@ -1308,15 +1308,15 @@ pub struct glob_t {
                     pub __unused1: c_int,
                     pub gl_offs:   size_t,
                     pub __unused2: c_int,
-                    pub gl_pathv:  **c_char,
+                    pub gl_pathv:  *mut *mut c_char,
 
-                    pub __unused3: *c_void,
+                    pub __unused3: *mut c_void,
 
-                    pub __unused4: *c_void,
-                    pub __unused5: *c_void,
-                    pub __unused6: *c_void,
-                    pub __unused7: *c_void,
-                    pub __unused8: *c_void,
+                    pub __unused4: *mut c_void,
+                    pub __unused5: *mut c_void,
+                    pub __unused6: *mut c_void,
+                    pub __unused7: *mut c_void,
+                    pub __unused8: *mut c_void,
                 }
 
                 pub struct timeval {
@@ -1388,9 +1388,9 @@ pub struct addrinfo {
                     pub ai_socktype: c_int,
                     pub ai_protocol: c_int,
                     pub ai_addrlen: socklen_t,
-                    pub ai_canonname: *c_char,
-                    pub ai_addr: *sockaddr,
-                    pub ai_next: *addrinfo,
+                    pub ai_canonname: *mut c_char,
+                    pub ai_addr: *mut sockaddr,
+                    pub ai_next: *mut addrinfo,
                 }
                 pub struct sockaddr_un {
                     pub sun_len: u8,
@@ -3539,53 +3539,56 @@ pub mod stdio {
             use types::os::arch::c95::{c_char, c_int, c_long, size_t};
 
             extern {
-                pub fn fopen(filename: *c_char, mode: *c_char) -> *FILE;
-                pub fn freopen(filename: *c_char, mode: *c_char, file: *FILE)
-                               -> *FILE;
-                pub fn fflush(file: *FILE) -> c_int;
-                pub fn fclose(file: *FILE) -> c_int;
-                pub fn remove(filename: *c_char) -> c_int;
-                pub fn rename(oldname: *c_char, newname: *c_char) -> c_int;
-                pub fn tmpfile() -> *FILE;
-                pub fn setvbuf(stream: *FILE,
-                               buffer: *c_char,
+                pub fn fopen(filename: *const c_char,
+                             mode: *const c_char) -> *mut FILE;
+                pub fn freopen(filename: *const c_char, mode: *const c_char,
+                               file: *mut FILE)
+                               -> *mut FILE;
+                pub fn fflush(file: *mut FILE) -> c_int;
+                pub fn fclose(file: *mut FILE) -> c_int;
+                pub fn remove(filename: *const c_char) -> c_int;
+                pub fn rename(oldname: *const c_char,
+                              newname: *const c_char) -> c_int;
+                pub fn tmpfile() -> *mut FILE;
+                pub fn setvbuf(stream: *mut FILE,
+                               buffer: *mut c_char,
                                mode: c_int,
                                size: size_t)
                                -> c_int;
-                pub fn setbuf(stream: *FILE, buf: *c_char);
+                pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
                 // Omitted: printf and scanf variants.
-                pub fn fgetc(stream: *FILE) -> c_int;
-                pub fn fgets(buf: *mut c_char, n: c_int, stream: *FILE)
-                             -> *c_char;
-                pub fn fputc(c: c_int, stream: *FILE) -> c_int;
-                pub fn fputs(s: *c_char, stream: *FILE) -> *c_char;
+                pub fn fgetc(stream: *mut FILE) -> c_int;
+                pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
+                             -> *mut c_char;
+                pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
+                pub fn fputs(s: *const c_char, stream: *mut FILE)-> c_int;
                 // Omitted: getc, getchar (might be macros).
 
                 // Omitted: gets, so ridiculously unsafe that it should not
                 // survive.
 
                 // Omitted: putc, putchar (might be macros).
-                pub fn puts(s: *c_char) -> c_int;
-                pub fn ungetc(c: c_int, stream: *FILE) -> c_int;
+                pub fn puts(s: *const c_char) -> c_int;
+                pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
                 pub fn fread(ptr: *mut c_void,
                              size: size_t,
                              nobj: size_t,
-                             stream: *FILE)
+                             stream: *mut FILE)
                              -> size_t;
-                pub fn fwrite(ptr: *c_void,
+                pub fn fwrite(ptr: *const c_void,
                               size: size_t,
                               nobj: size_t,
-                              stream: *FILE)
+                              stream: *mut FILE)
                               -> size_t;
-                pub fn fseek(stream: *FILE, offset: c_long, whence: c_int)
+                pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int)
                              -> c_int;
-                pub fn ftell(stream: *FILE) -> c_long;
-                pub fn rewind(stream: *FILE);
-                pub fn fgetpos(stream: *FILE, ptr: *fpos_t) -> c_int;
-                pub fn fsetpos(stream: *FILE, ptr: *fpos_t) -> c_int;
-                pub fn feof(stream: *FILE) -> c_int;
-                pub fn ferror(stream: *FILE) -> c_int;
-                pub fn perror(s: *c_char);
+                pub fn ftell(stream: *mut FILE) -> c_long;
+                pub fn rewind(stream: *mut FILE);
+                pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
+                pub fn fsetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
+                pub fn feof(stream: *mut FILE) -> c_int;
+                pub fn ferror(stream: *mut FILE) -> c_int;
+                pub fn perror(s: *const c_char);
             }
         }
 
@@ -3599,22 +3602,23 @@ pub mod stdlib {
                 pub fn abs(i: c_int) -> c_int;
                 pub fn labs(i: c_long) -> c_long;
                 // Omitted: div, ldiv (return pub type incomplete).
-                pub fn atof(s: *c_char) -> c_double;
-                pub fn atoi(s: *c_char) -> c_int;
-                pub fn strtod(s: *c_char, endp: **c_char) -> c_double;
-                pub fn strtol(s: *c_char, endp: **c_char, base: c_int)
-                              -> c_long;
-                pub fn strtoul(s: *c_char, endp: **c_char, base: c_int)
-                               -> c_ulong;
-                pub fn calloc(nobj: size_t, size: size_t) -> *c_void;
+                pub fn atof(s: *const c_char) -> c_double;
+                pub fn atoi(s: *const c_char) -> c_int;
+                pub fn strtod(s: *const c_char,
+                              endp: *mut *mut c_char) -> c_double;
+                pub fn strtol(s: *const c_char,
+                              endp: *mut *mut c_char, base: c_int) -> c_long;
+                pub fn strtoul(s: *const c_char, endp: *mut *mut c_char,
+                               base: c_int) -> c_ulong;
+                pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
                 pub fn malloc(size: size_t) -> *mut c_void;
                 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
                 pub fn free(p: *mut c_void);
                 pub fn exit(status: c_int) -> !;
                 pub fn _exit(status: c_int) -> !;
                 // Omitted: atexit.
-                pub fn system(s: *c_char) -> c_int;
-                pub fn getenv(s: *c_char) -> *c_char;
+                pub fn system(s: *const c_char) -> c_int;
+                pub fn getenv(s: *const c_char) -> *mut c_char;
                 // Omitted: bsearch, qsort
                 pub fn rand() -> c_int;
                 pub fn srand(seed: c_uint);
@@ -3627,32 +3631,40 @@ pub mod string {
             use types::os::arch::c95::{wchar_t};
 
             extern {
-                pub fn strcpy(dst: *c_char, src: *c_char) -> *c_char;
-                pub fn strncpy(dst: *c_char, src: *c_char, n: size_t)
-                               -> *c_char;
-                pub fn strcat(s: *c_char, ct: *c_char) -> *c_char;
-                pub fn strncat(s: *c_char, ct: *c_char, n: size_t) -> *c_char;
-                pub fn strcmp(cs: *c_char, ct: *c_char) -> c_int;
-                pub fn strncmp(cs: *c_char, ct: *c_char, n: size_t) -> c_int;
-                pub fn strcoll(cs: *c_char, ct: *c_char) -> c_int;
-                pub fn strchr(cs: *c_char, c: c_int) -> *c_char;
-                pub fn strrchr(cs: *c_char, c: c_int) -> *c_char;
-                pub fn strspn(cs: *c_char, ct: *c_char) -> size_t;
-                pub fn strcspn(cs: *c_char, ct: *c_char) -> size_t;
-                pub fn strpbrk(cs: *c_char, ct: *c_char) -> *c_char;
-                pub fn strstr(cs: *c_char, ct: *c_char) -> *c_char;
-                pub fn strlen(cs: *c_char) -> size_t;
-                pub fn strerror(n: c_int) -> *c_char;
-                pub fn strtok(s: *c_char, t: *c_char) -> *c_char;
-                pub fn strxfrm(s: *c_char, ct: *c_char, n: size_t) -> size_t;
-                pub fn wcslen(buf: *wchar_t) -> size_t;
+                pub fn strcpy(dst: *mut c_char,
+                              src: *const c_char) -> *mut c_char;
+                pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t)
+                               -> *mut c_char;
+                pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
+                pub fn strncat(s: *mut c_char, ct: *const c_char,
+                               n: size_t) -> *mut c_char;
+                pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
+                pub fn strncmp(cs: *const c_char, ct: *const c_char,
+                               n: size_t) -> c_int;
+                pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
+                pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
+                pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
+                pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
+                pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
+                pub fn strpbrk(cs: *const c_char,
+                               ct: *const c_char) -> *mut c_char;
+                pub fn strstr(cs: *const c_char,
+                              ct: *const c_char) -> *mut c_char;
+                pub fn strlen(cs: *const c_char) -> size_t;
+                pub fn strerror(n: c_int) -> *mut c_char;
+                pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
+                pub fn strxfrm(s: *mut c_char, ct: *const c_char,
+                               n: size_t) -> size_t;
+                pub fn wcslen(buf: *const wchar_t) -> size_t;
 
                 // Omitted: memcpy, memmove, memset (provided by LLVM)
 
                 // These are fine to execute on the Rust stack. They must be,
                 // in fact, because LLVM generates calls to them!
-                pub fn memcmp(cx: *c_void, ct: *c_void, n: size_t) -> c_int;
-                pub fn memchr(cx: *c_void, c: c_int, n: size_t) -> *c_void;
+                pub fn memcmp(cx: *const c_void, ct: *const c_void,
+                              n: size_t) -> c_int;
+                pub fn memchr(cx: *const c_void, c: c_int,
+                              n: size_t) -> *mut c_void;
             }
         }
     }
@@ -3671,21 +3683,21 @@ pub mod stat_ {
 
             extern {
                 #[link_name = "_chmod"]
-                pub fn chmod(path: *c_char, mode: c_int) -> c_int;
+                pub fn chmod(path: *const c_char, mode: c_int) -> c_int;
                 #[link_name = "_wchmod"]
-                pub fn wchmod(path: *wchar_t, mode: c_int) -> c_int;
+                pub fn wchmod(path: *const wchar_t, mode: c_int) -> c_int;
                 #[link_name = "_mkdir"]
-                pub fn mkdir(path: *c_char) -> c_int;
+                pub fn mkdir(path: *const c_char) -> c_int;
                 #[link_name = "_wrmdir"]
-                pub fn wrmdir(path: *wchar_t) -> c_int;
+                pub fn wrmdir(path: *const wchar_t) -> c_int;
                 #[link_name = "_fstat64"]
                 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
                 #[link_name = "_stat64"]
-                pub fn stat(path: *c_char, buf: *mut stat) -> c_int;
+                pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
                 #[link_name = "_wstat64"]
-                pub fn wstat(path: *wchar_t, buf: *mut stat) -> c_int;
+                pub fn wstat(path: *const wchar_t, buf: *mut stat) -> c_int;
                 #[link_name = "_wutime64"]
-                pub fn wutime(file: *wchar_t, buf: *utimbuf) -> c_int;
+                pub fn wutime(file: *const wchar_t, buf: *mut utimbuf) -> c_int;
             }
         }
 
@@ -3695,13 +3707,14 @@ pub mod stdio {
 
             extern {
                 #[link_name = "_popen"]
-                pub fn popen(command: *c_char, mode: *c_char) -> *FILE;
+                pub fn popen(command: *const c_char,
+                             mode: *const c_char) -> *mut FILE;
                 #[link_name = "_pclose"]
-                pub fn pclose(stream: *FILE) -> c_int;
+                pub fn pclose(stream: *mut FILE) -> c_int;
                 #[link_name = "_fdopen"]
-                pub fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
+                pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut FILE;
                 #[link_name = "_fileno"]
-                pub fn fileno(stream: *FILE) -> c_int;
+                pub fn fileno(stream: *mut FILE) -> c_int;
             }
         }
 
@@ -3709,13 +3722,13 @@ pub mod fcntl {
             use types::os::arch::c95::{c_int, c_char, wchar_t};
             extern {
                 #[link_name = "_open"]
-                pub fn open(path: *c_char, oflag: c_int, mode: c_int)
+                pub fn open(path: *const c_char, oflag: c_int, mode: c_int)
                             -> c_int;
                 #[link_name = "_wopen"]
-                pub fn wopen(path: *wchar_t, oflag: c_int, mode: c_int)
+                pub fn wopen(path: *const wchar_t, oflag: c_int, mode: c_int)
                             -> c_int;
                 #[link_name = "_creat"]
-                pub fn creat(path: *c_char, mode: c_int) -> c_int;
+                pub fn creat(path: *const c_char, mode: c_int) -> c_int;
             }
         }
 
@@ -3731,9 +3744,9 @@ pub mod unistd {
 
             extern {
                 #[link_name = "_access"]
-                pub fn access(path: *c_char, amode: c_int) -> c_int;
+                pub fn access(path: *const c_char, amode: c_int) -> c_int;
                 #[link_name = "_chdir"]
-                pub fn chdir(dir: *c_char) -> c_int;
+                pub fn chdir(dir: *const c_char) -> c_int;
                 #[link_name = "_close"]
                 pub fn close(fd: c_int) -> c_int;
                 #[link_name = "_dup"]
@@ -3741,17 +3754,20 @@ pub mod unistd {
                 #[link_name = "_dup2"]
                 pub fn dup2(src: c_int, dst: c_int) -> c_int;
                 #[link_name = "_execv"]
-                pub fn execv(prog: *c_char, argv: **c_char) -> intptr_t;
+                pub fn execv(prog: *const c_char,
+                             argv: *mut *const c_char) -> intptr_t;
                 #[link_name = "_execve"]
-                pub fn execve(prog: *c_char, argv: **c_char, envp: **c_char)
+                pub fn execve(prog: *const c_char, argv: *mut *const c_char,
+                              envp: *mut *const c_char)
                               -> c_int;
                 #[link_name = "_execvp"]
-                pub fn execvp(c: *c_char, argv: **c_char) -> c_int;
+                pub fn execvp(c: *const c_char,
+                              argv: *mut *const c_char) -> c_int;
                 #[link_name = "_execvpe"]
-                pub fn execvpe(c: *c_char, argv: **c_char, envp: **c_char)
-                               -> c_int;
+                pub fn execvpe(c: *const c_char, argv: *mut *const c_char,
+                               envp: *mut *const c_char) -> c_int;
                 #[link_name = "_getcwd"]
-                pub fn getcwd(buf: *mut c_char, size: size_t) -> *c_char;
+                pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
                 #[link_name = "_getpid"]
                 pub fn getpid() -> c_int;
                 #[link_name = "_isatty"]
@@ -3766,11 +3782,12 @@ pub fn pipe(fds: *mut c_int, psize: c_uint, textmode: c_int)
                 pub fn read(fd: c_int, buf: *mut c_void, count: c_uint)
                             -> c_int;
                 #[link_name = "_rmdir"]
-                pub fn rmdir(path: *c_char) -> c_int;
+                pub fn rmdir(path: *const c_char) -> c_int;
                 #[link_name = "_unlink"]
-                pub fn unlink(c: *c_char) -> c_int;
+                pub fn unlink(c: *const c_char) -> c_int;
                 #[link_name = "_write"]
-                pub fn write(fd: c_int, buf: *c_void, count: c_uint) -> c_int;
+                pub fn write(fd: c_int, buf: *const c_void,
+                             count: c_uint) -> c_int;
             }
         }
 
@@ -3791,7 +3808,7 @@ pub mod stat_ {
             use types::os::arch::posix88::mode_t;
 
             extern {
-                pub fn chmod(path: *c_char, mode: mode_t) -> c_int;
+                pub fn chmod(path: *const c_char, mode: mode_t) -> c_int;
                 pub fn fchmod(fd: c_int, mode: mode_t) -> c_int;
 
                 #[cfg(target_os = "linux")]
@@ -3804,18 +3821,18 @@ pub mod stat_ {
                 #[link_name = "fstat64"]
                 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
 
-                pub fn mkdir(path: *c_char, mode: mode_t) -> c_int;
-                pub fn mkfifo(path: *c_char, mode: mode_t) -> c_int;
+                pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int;
+                pub fn mkfifo(path: *const c_char, mode: mode_t) -> c_int;
 
                 #[cfg(target_os = "linux")]
                 #[cfg(target_os = "freebsd")]
                 #[cfg(target_os = "android")]
                 #[cfg(target_os = "ios")]
-                pub fn stat(path: *c_char, buf: *mut stat) -> c_int;
+                pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
 
                 #[cfg(target_os = "macos")]
                 #[link_name = "stat64"]
-                pub fn stat(path: *c_char, buf: *mut stat) -> c_int;
+                pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
             }
         }
 
@@ -3824,10 +3841,11 @@ pub mod stdio {
             use types::os::arch::c95::{c_char, c_int};
 
             extern {
-                pub fn popen(command: *c_char, mode: *c_char) -> *FILE;
-                pub fn pclose(stream: *FILE) -> c_int;
-                pub fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
-                pub fn fileno(stream: *FILE) -> c_int;
+                pub fn popen(command: *const c_char,
+                             mode: *const c_char) -> *mut FILE;
+                pub fn pclose(stream: *mut FILE) -> c_int;
+                pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut FILE;
+                pub fn fileno(stream: *mut FILE) -> c_int;
             }
         }
 
@@ -3836,9 +3854,9 @@ pub mod fcntl {
             use types::os::arch::posix88::mode_t;
 
             extern {
-                pub fn open(path: *c_char, oflag: c_int, mode: c_int)
+                pub fn open(path: *const c_char, oflag: c_int, mode: c_int)
                             -> c_int;
-                pub fn creat(path: *c_char, mode: mode_t) -> c_int;
+                pub fn creat(path: *const c_char, mode: mode_t) -> c_int;
                 pub fn fcntl(fd: c_int, cmd: c_int, ...) -> c_int;
             }
         }
@@ -3856,17 +3874,17 @@ pub mod dirent {
 
             extern {
                 #[link_name="rust_opendir"]
-                pub fn opendir(dirname: *c_char) -> *DIR;
+                pub fn opendir(dirname: *const c_char) -> *mut DIR;
                 #[link_name="rust_readdir_r"]
-                pub fn readdir_r(dirp: *DIR, entry: *mut dirent_t,
+                pub fn readdir_r(dirp: *mut DIR, entry: *mut dirent_t,
                                   result: *mut *mut dirent_t) -> c_int;
             }
 
             extern {
-                pub fn closedir(dirp: *DIR) -> c_int;
-                pub fn rewinddir(dirp: *DIR);
-                pub fn seekdir(dirp: *DIR, loc: c_long);
-                pub fn telldir(dirp: *DIR) -> c_long;
+                pub fn closedir(dirp: *mut DIR) -> c_int;
+                pub fn rewinddir(dirp: *mut DIR);
+                pub fn seekdir(dirp: *mut DIR, loc: c_long);
+                pub fn telldir(dirp: *mut DIR) -> c_long;
             }
         }
 
@@ -3882,60 +3900,65 @@ pub mod unistd {
             pub static _PC_NAME_MAX: c_int = 4;
 
             extern {
-                pub fn access(path: *c_char, amode: c_int) -> c_int;
+                pub fn access(path: *const c_char, amode: c_int) -> c_int;
                 pub fn alarm(seconds: c_uint) -> c_uint;
-                pub fn chdir(dir: *c_char) -> c_int;
-                pub fn chown(path: *c_char, uid: uid_t, gid: gid_t) -> c_int;
+                pub fn chdir(dir: *const c_char) -> c_int;
+                pub fn chown(path: *const c_char, uid: uid_t,
+                             gid: gid_t) -> c_int;
                 pub fn close(fd: c_int) -> c_int;
                 pub fn dup(fd: c_int) -> c_int;
                 pub fn dup2(src: c_int, dst: c_int) -> c_int;
-                pub fn execv(prog: *c_char, argv: **c_char) -> c_int;
-                pub fn execve(prog: *c_char, argv: **c_char, envp: **c_char)
+                pub fn execv(prog: *const c_char,
+                             argv: *mut *const c_char) -> c_int;
+                pub fn execve(prog: *const c_char, argv: *mut *const c_char,
+                              envp: *mut *const c_char)
                               -> c_int;
-                pub fn execvp(c: *c_char, argv: **c_char) -> c_int;
+                pub fn execvp(c: *const c_char,
+                              argv: *mut *const c_char) -> c_int;
                 pub fn fork() -> pid_t;
                 pub fn fpathconf(filedes: c_int, name: c_int) -> c_long;
-                pub fn getcwd(buf: *mut c_char, size: size_t) -> *c_char;
+                pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
                 pub fn getegid() -> gid_t;
                 pub fn geteuid() -> uid_t;
                 pub fn getgid() -> gid_t ;
                 pub fn getgroups(ngroups_max: c_int, groups: *mut gid_t)
                                  -> c_int;
-                pub fn getlogin() -> *c_char;
-                pub fn getopt(argc: c_int, argv: **c_char, optstr: *c_char)
-                              -> c_int;
+                pub fn getlogin() -> *mut c_char;
+                pub fn getopt(argc: c_int, argv: *mut *const c_char,
+                              optstr: *const c_char) -> c_int;
                 pub fn getpgrp() -> pid_t;
                 pub fn getpid() -> pid_t;
                 pub fn getppid() -> pid_t;
                 pub fn getuid() -> uid_t;
                 pub fn isatty(fd: c_int) -> c_int;
-                pub fn link(src: *c_char, dst: *c_char) -> c_int;
+                pub fn link(src: *const c_char, dst: *const c_char) -> c_int;
                 pub fn lseek(fd: c_int, offset: off_t, whence: c_int)
                              -> off_t;
-                pub fn pathconf(path: *c_char, name: c_int) -> c_long;
+                pub fn pathconf(path: *mut c_char, name: c_int) -> c_long;
                 pub fn pause() -> c_int;
                 pub fn pipe(fds: *mut c_int) -> c_int;
                 pub fn read(fd: c_int, buf: *mut c_void, count: size_t)
                             -> ssize_t;
-                pub fn rmdir(path: *c_char) -> c_int;
+                pub fn rmdir(path: *const c_char) -> c_int;
                 pub fn setgid(gid: gid_t) -> c_int;
                 pub fn setpgid(pid: pid_t, pgid: pid_t) -> c_int;
                 pub fn setsid() -> pid_t;
                 pub fn setuid(uid: uid_t) -> c_int;
                 pub fn sleep(secs: c_uint) -> c_uint;
                 pub fn usleep(secs: c_uint) -> c_int;
-                pub fn nanosleep(rqtp: *timespec, rmtp: *mut timespec) -> c_int;
+                pub fn nanosleep(rqtp: *const timespec,
+                                 rmtp: *mut timespec) -> c_int;
                 pub fn sysconf(name: c_int) -> c_long;
                 pub fn tcgetpgrp(fd: c_int) -> pid_t;
-                pub fn ttyname(fd: c_int) -> *c_char;
-                pub fn unlink(c: *c_char) -> c_int;
-                pub fn write(fd: c_int, buf: *c_void, count: size_t)
+                pub fn ttyname(fd: c_int) -> *mut c_char;
+                pub fn unlink(c: *const c_char) -> c_int;
+                pub fn write(fd: c_int, buf: *const c_void, count: size_t)
                              -> ssize_t;
-                pub fn pread(fd: c_int, buf: *c_void, count: size_t,
+                pub fn pread(fd: c_int, buf: *mut c_void, count: size_t,
                              offset: off_t) -> ssize_t;
-                pub fn pwrite(fd: c_int, buf: *c_void, count: size_t,
+                pub fn pwrite(fd: c_int, buf: *const c_void, count: size_t,
                               offset: off_t) -> ssize_t;
-                pub fn utime(file: *c_char, buf: *utimbuf) -> c_int;
+                pub fn utime(file: *const c_char, buf: *const utimbuf) -> c_int;
             }
         }
 
@@ -3954,8 +3977,8 @@ pub mod mman {
             use types::os::arch::posix88::{mode_t, off_t};
 
             extern {
-                pub fn mlock(addr: *c_void, len: size_t) -> c_int;
-                pub fn munlock(addr: *c_void, len: size_t) -> c_int;
+                pub fn mlock(addr: *const c_void, len: size_t) -> c_int;
+                pub fn munlock(addr: *const c_void, len: size_t) -> c_int;
                 pub fn mlockall(flags: c_int) -> c_int;
                 pub fn munlockall() -> c_int;
 
@@ -3973,9 +3996,9 @@ pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int)
 
                 pub fn msync(addr: *mut c_void, len: size_t, flags: c_int)
                              -> c_int;
-                pub fn shm_open(name: *c_char, oflag: c_int, mode: mode_t)
+                pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t)
                                 -> c_int;
-                pub fn shm_unlink(name: *c_char) -> c_int;
+                pub fn shm_unlink(name: *const c_char) -> c_int;
             }
         }
     }
@@ -3995,11 +4018,11 @@ pub mod stat_ {
                 #[cfg(target_os = "freebsd")]
                 #[cfg(target_os = "android")]
                 #[cfg(target_os = "ios")]
-                pub fn lstat(path: *c_char, buf: *mut stat) -> c_int;
+                pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int;
 
                 #[cfg(target_os = "macos")]
                 #[link_name = "lstat64"]
-                pub fn lstat(path: *c_char, buf: *mut stat) -> c_int;
+                pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int;
             }
         }
 
@@ -4008,7 +4031,7 @@ pub mod unistd {
             use types::os::arch::posix88::{ssize_t, off_t};
 
             extern {
-                pub fn readlink(path: *c_char,
+                pub fn readlink(path: *const c_char,
                                 buf: *mut c_char,
                                 bufsz: size_t)
                                 -> ssize_t;
@@ -4019,12 +4042,13 @@ pub fn readlink(path: *c_char,
                 #[cfg(target_os = "android")]
                 pub fn fdatasync(fd: c_int) -> c_int;
 
-                pub fn setenv(name: *c_char, val: *c_char, overwrite: c_int)
-                              -> c_int;
-                pub fn unsetenv(name: *c_char) -> c_int;
-                pub fn putenv(string: *c_char) -> c_int;
+                pub fn setenv(name: *const c_char, val: *const c_char,
+                              overwrite: c_int) -> c_int;
+                pub fn unsetenv(name: *const c_char) -> c_int;
+                pub fn putenv(string: *mut c_char) -> c_int;
 
-                pub fn symlink(path1: *c_char, path2: *c_char) -> c_int;
+                pub fn symlink(path1: *const c_char,
+                               path2: *const c_char) -> c_int;
 
                 pub fn ftruncate(fd: c_int, length: off_t) -> c_int;
             }
@@ -4053,9 +4077,10 @@ pub mod glob {
             use types::os::common::posix01::{glob_t};
 
             extern {
-                pub fn glob(pattern: *c_char,
+                pub fn glob(pattern: *const c_char,
                             flags: c_int,
-                            errfunc: ::Nullable<extern "C" fn(epath: *c_char, errno: int) -> int>,
+                            errfunc: ::Nullable<extern "C" fn(epath: *const c_char,
+                                                              errno: int) -> int>,
                             pglob: *mut glob_t);
                 pub fn globfree(pglob: *mut glob_t);
             }
@@ -4066,7 +4091,7 @@ pub mod mman {
             use types::os::arch::c95::{c_int, size_t};
 
             extern {
-                pub fn posix_madvise(addr: *c_void,
+                pub fn posix_madvise(addr: *mut c_void,
                                      len: size_t,
                                      advice: c_int)
                                      -> c_int;
@@ -4110,9 +4135,9 @@ pub mod bsd43 {
 
         extern "system" {
             pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> c_int;
-            pub fn connect(socket: c_int, address: *sockaddr,
+            pub fn connect(socket: c_int, address: *const sockaddr,
                            len: socklen_t) -> c_int;
-            pub fn bind(socket: c_int, address: *sockaddr,
+            pub fn bind(socket: c_int, address: *const sockaddr,
                         address_len: socklen_t) -> c_int;
             pub fn listen(socket: c_int, backlog: c_int) -> c_int;
             pub fn accept(socket: c_int, address: *mut sockaddr,
@@ -4122,7 +4147,8 @@ pub fn getpeername(socket: c_int, address: *mut sockaddr,
             pub fn getsockname(socket: c_int, address: *mut sockaddr,
                                address_len: *mut socklen_t) -> c_int;
             pub fn setsockopt(socket: c_int, level: c_int, name: c_int,
-                              value: *c_void, option_len: socklen_t) -> c_int;
+                              value: *const c_void,
+                              option_len: socklen_t) -> c_int;
             pub fn recv(socket: c_int, buf: *mut c_void, len: size_t,
                         flags: c_int) -> ssize_t;
             pub fn send(socket: c_int, buf: *mut c_void, len: size_t,
@@ -4130,8 +4156,8 @@ pub fn send(socket: c_int, buf: *mut c_void, len: size_t,
             pub fn recvfrom(socket: c_int, buf: *mut c_void, len: size_t,
                             flags: c_int, addr: *mut sockaddr,
                             addrlen: *mut socklen_t) -> ssize_t;
-            pub fn sendto(socket: c_int, buf: *c_void, len: size_t,
-                          flags: c_int, addr: *sockaddr,
+            pub fn sendto(socket: c_int, buf: *const c_void, len: size_t,
+                          flags: c_int, addr: *const sockaddr,
                           addrlen: socklen_t) -> ssize_t;
             pub fn shutdown(socket: c_int, how: c_int) -> c_int;
         }
@@ -4146,9 +4172,9 @@ pub mod bsd43 {
 
         extern "system" {
             pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> SOCKET;
-            pub fn connect(socket: SOCKET, address: *sockaddr,
+            pub fn connect(socket: SOCKET, address: *const sockaddr,
                            len: socklen_t) -> c_int;
-            pub fn bind(socket: SOCKET, address: *sockaddr,
+            pub fn bind(socket: SOCKET, address: *const sockaddr,
                         address_len: socklen_t) -> c_int;
             pub fn listen(socket: SOCKET, backlog: c_int) -> c_int;
             pub fn accept(socket: SOCKET, address: *mut sockaddr,
@@ -4158,7 +4184,8 @@ pub fn getpeername(socket: SOCKET, address: *mut sockaddr,
             pub fn getsockname(socket: SOCKET, address: *mut sockaddr,
                                address_len: *mut socklen_t) -> c_int;
             pub fn setsockopt(socket: SOCKET, level: c_int, name: c_int,
-                              value: *c_void, option_len: socklen_t) -> c_int;
+                              value: *const c_void,
+                              option_len: socklen_t) -> c_int;
             pub fn closesocket(socket: SOCKET) -> c_int;
             pub fn recv(socket: SOCKET, buf: *mut c_void, len: c_int,
                         flags: c_int) -> c_int;
@@ -4167,8 +4194,8 @@ pub fn send(socket: SOCKET, buf: *mut c_void, len: c_int,
             pub fn recvfrom(socket: SOCKET, buf: *mut c_void, len: c_int,
                             flags: c_int, addr: *mut sockaddr,
                             addrlen: *mut c_int) -> ssize_t;
-            pub fn sendto(socket: SOCKET, buf: *c_void, len: c_int,
-                          flags: c_int, addr: *sockaddr,
+            pub fn sendto(socket: SOCKET, buf: *const c_void, len: c_int,
+                          flags: c_int, addr: *const sockaddr,
                           addrlen: c_int) -> c_int;
             pub fn shutdown(socket: SOCKET, how: c_int) -> c_int;
         }
@@ -4182,27 +4209,27 @@ pub mod bsd44 {
         use types::os::arch::c95::{c_char, c_uchar, c_int, c_uint, size_t};
 
         extern {
-            pub fn sysctl(name: *c_int,
+            pub fn sysctl(name: *mut c_int,
                           namelen: c_uint,
                           oldp: *mut c_void,
                           oldlenp: *mut size_t,
-                          newp: *c_void,
+                          newp: *mut c_void,
                           newlen: size_t)
                           -> c_int;
-            pub fn sysctlbyname(name: *c_char,
+            pub fn sysctlbyname(name: *const c_char,
                                 oldp: *mut c_void,
                                 oldlenp: *mut size_t,
-                                newp: *c_void,
+                                newp: *mut c_void,
                                 newlen: size_t)
                                 -> c_int;
-            pub fn sysctlnametomib(name: *c_char,
+            pub fn sysctlnametomib(name: *const c_char,
                                    mibp: *mut c_int,
                                    sizep: *mut size_t)
                                    -> c_int;
             pub fn getdtablesize() -> c_int;
-            pub fn madvise(addr: *c_void, len: size_t, advice: c_int)
+            pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int)
                            -> c_int;
-            pub fn mincore(addr: *c_void, len: size_t, vec: *c_uchar)
+            pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)
                            -> c_int;
         }
     }
@@ -4294,7 +4321,7 @@ pub fn GetCurrentDirectoryW(nBufferLength: DWORD,
                                             -> DWORD;
                 pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
                 pub fn GetLastError() -> DWORD;
-                pub fn FindFirstFileW(fileName: *u16, findFileData: HANDLE)
+                pub fn FindFirstFileW(fileName: LPCWSTR, findFileData: HANDLE)
                                       -> HANDLE;
                 pub fn FindNextFileW(findFile: HANDLE, findFileData: HANDLE)
                                      -> BOOL;
index 41a741eb1df34e403f21f4e06ffa0bd53ff1d615..ba102a85c1bcb16b6cd3d533274372ba01201302 100644 (file)
@@ -144,8 +144,8 @@ fn main() {
 /// logging statement should be run.
 static mut LOG_LEVEL: u32 = MAX_LOG_LEVEL;
 
-static mut DIRECTIVES: *Vec<directive::LogDirective> =
-    0 as *Vec<directive::LogDirective>;
+static mut DIRECTIVES: *const Vec<directive::LogDirective> =
+    0 as *const Vec<directive::LogDirective>;
 
 /// Debug log level
 pub static DEBUG: u32 = 4;
@@ -351,7 +351,7 @@ fn init() {
             assert!(!DIRECTIVES.is_null());
             let _directives: Box<Vec<directive::LogDirective>> =
                 mem::transmute(DIRECTIVES);
-            DIRECTIVES = 0 as *Vec<directive::LogDirective>;
+            DIRECTIVES = 0 as *const Vec<directive::LogDirective>;
         });
     }
 }
index 255c3f4bd213dd8c510791c6f6adad4dc627bd66..8c3cdf4e9ecaf53859c40b6c65db8d91715202a5 100644 (file)
@@ -37,13 +37,15 @@ pub fn run(host: Option<&str>, servname: Option<&str>,
                 ai_socktype: 0,
                 ai_protocol: 0,
                 ai_addrlen: 0,
-                ai_canonname: null(),
-                ai_addr: null(),
-                ai_next: null()
+                ai_canonname: mut_null(),
+                ai_addr: mut_null(),
+                ai_next: mut_null()
             }
         });
 
-        let hint_ptr = hint.as_ref().map_or(null(), |x| x as *libc::addrinfo);
+        let hint_ptr = hint.as_ref().map_or(null(), |x| {
+            x as *const libc::addrinfo
+        });
         let mut res = mut_null();
 
         // Make the call
@@ -87,11 +89,12 @@ pub fn run(host: Option<&str>, servname: Option<&str>,
 }
 
 extern "system" {
-    fn getaddrinfo(node: *c_char, service: *c_char,
-                   hints: *libc::addrinfo, res: *mut *mut libc::addrinfo) -> c_int;
+    fn getaddrinfo(node: *const c_char, service: *const c_char,
+                   hints: *const libc::addrinfo,
+                   res: *mut *mut libc::addrinfo) -> c_int;
     fn freeaddrinfo(res: *mut libc::addrinfo);
     #[cfg(not(windows))]
-    fn gai_strerror(errcode: c_int) -> *c_char;
+    fn gai_strerror(errcode: c_int) -> *const c_char;
 }
 
 #[cfg(windows)]
index b1bc36e0b05e0273867928745de9e47ccb4ea1d7..9fbf3659d3f6ba900a0883655045394558343304 100644 (file)
 
 extern {
     pub fn gettimeofday(timeval: *mut libc::timeval,
-                        tzp: *libc::c_void) -> libc::c_int;
+                        tzp: *mut libc::c_void) -> libc::c_int;
     pub fn select(nfds: libc::c_int,
-                  readfds: *fd_set,
-                  writefds: *fd_set,
-                  errorfds: *fd_set,
-                  timeout: *libc::timeval) -> libc::c_int;
+                  readfds: *mut fd_set,
+                  writefds: *mut fd_set,
+                  errorfds: *mut fd_set,
+                  timeout: *mut libc::timeval) -> libc::c_int;
     pub fn getsockopt(sockfd: libc::c_int,
                       level: libc::c_int,
                       optname: libc::c_int,
@@ -75,7 +75,7 @@ pub fn waitpid(pid: libc::pid_t, status: *mut libc::c_int,
                    options: libc::c_int) -> libc::pid_t;
 
     pub fn sigaction(signum: libc::c_int,
-                     act: *sigaction,
+                     act: *const sigaction,
                      oldact: *mut sigaction) -> libc::c_int;
 
     pub fn sigaddset(set: *mut sigset_t, signum: libc::c_int) -> libc::c_int;
index 1b6525c6e3877568818a38288a30c8e4480dc9fb..7e58102d2418399b9d314242be84edcfc1d9e332 100644 (file)
@@ -28,7 +28,7 @@ pub struct WSADATA {
     pub szSystemStatus: [u8, ..WSASYS_STATUS_LEN + 1],
     pub iMaxSockets: u16,
     pub iMaxUdpDg: u16,
-    pub lpVendorInfo: *u8,
+    pub lpVendorInfo: *mut u8,
 }
 
 pub type LPWSADATA = *mut WSADATA;
@@ -53,10 +53,10 @@ pub fn WSAStartup(wVersionRequested: libc::WORD,
     pub fn ioctlsocket(s: libc::SOCKET, cmd: libc::c_long,
                        argp: *mut libc::c_ulong) -> libc::c_int;
     pub fn select(nfds: libc::c_int,
-                  readfds: *fd_set,
-                  writefds: *fd_set,
-                  exceptfds: *fd_set,
-                  timeout: *libc::timeval) -> libc::c_int;
+                  readfds: *mut fd_set,
+                  writefds: *mut fd_set,
+                  exceptfds: *mut fd_set,
+                  timeout: *mut libc::timeval) -> libc::c_int;
     pub fn getsockopt(sockfd: libc::SOCKET,
                       level: libc::c_int,
                       optname: libc::c_int,
index edf2becc777608584821035107beb20f7f764454..72dad27c6e761f9a8b74ddaea6d3b93124258f5c 100644 (file)
@@ -68,7 +68,7 @@ pub fn inner_read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
     pub fn inner_write(&mut self, buf: &[u8]) -> IoResult<()> {
         let ret = keep_going(buf, |buf, len| {
             unsafe {
-                libc::write(self.fd(), buf as *libc::c_void,
+                libc::write(self.fd(), buf as *const libc::c_void,
                             len as libc::size_t) as i64
             }
         });
@@ -91,7 +91,7 @@ fn write(&mut self, buf: &[u8]) -> IoResult<()> {
     }
     fn pread(&mut self, buf: &mut [u8], offset: u64) -> IoResult<int> {
         match retry(|| unsafe {
-            libc::pread(self.fd(), buf.as_ptr() as *libc::c_void,
+            libc::pread(self.fd(), buf.as_ptr() as *mut _,
                         buf.len() as libc::size_t,
                         offset as libc::off_t) as libc::c_int
         }) {
@@ -101,7 +101,7 @@ fn pread(&mut self, buf: &mut [u8], offset: u64) -> IoResult<int> {
     }
     fn pwrite(&mut self, buf: &[u8], offset: u64) -> IoResult<()> {
         super::mkerr_libc(retry(|| unsafe {
-            libc::pwrite(self.fd(), buf.as_ptr() as *libc::c_void,
+            libc::pwrite(self.fd(), buf.as_ptr() as *const _,
                          buf.len() as libc::size_t, offset as libc::off_t)
         } as c_int))
     }
@@ -222,7 +222,7 @@ fn drop(&mut self) {
 }
 
 pub struct CFile {
-    file: *libc::FILE,
+    file: *mut libc::FILE,
     fd: FileDesc,
 }
 
@@ -231,7 +231,7 @@ impl CFile {
     ///
     /// The `CFile` takes ownership of the `FILE` pointer and will close it upon
     /// destruction.
-    pub fn new(file: *libc::FILE) -> CFile {
+    pub fn new(file: *mut libc::FILE) -> CFile {
         CFile {
             file: file,
             fd: FileDesc::new(unsafe { libc::fileno(file) }, false)
@@ -263,7 +263,7 @@ fn read(&mut self, buf: &mut [u8]) -> IoResult<int> {
     fn write(&mut self, buf: &[u8]) -> IoResult<()> {
         let ret = keep_going(buf, |buf, len| {
             unsafe {
-                libc::fwrite(buf as *libc::c_void, 1, len as libc::size_t,
+                libc::fwrite(buf as *const libc::c_void, 1, len as libc::size_t,
                             self.file) as i64
             }
         });
@@ -366,7 +366,7 @@ fn prune(root: &CString, dirs: Vec<Path>) -> Vec<CString> {
 
     extern {
         fn rust_dirent_t_size() -> libc::c_int;
-        fn rust_list_dir_val(ptr: *mut dirent_t) -> *libc::c_char;
+        fn rust_list_dir_val(ptr: *mut dirent_t) -> *const libc::c_char;
     }
 
     let size = unsafe { rust_dirent_t_size() };
@@ -423,7 +423,7 @@ pub fn chown(p: &CString, uid: int, gid: int) -> IoResult<()> {
 
 pub fn readlink(p: &CString) -> IoResult<CString> {
     let p = p.with_ref(|p| p);
-    let mut len = unsafe { libc::pathconf(p, libc::_PC_NAME_MAX) };
+    let mut len = unsafe { libc::pathconf(p as *mut _, libc::_PC_NAME_MAX) };
     if len == -1 {
         len = 1024; // FIXME: read PATH_MAX from C ffi?
     }
index cd9abc70a4ee8cd09690be4ff6a45d276021e39a..cdbf762f87d528ba8ad4de9d266ff2845533866b 100644 (file)
@@ -357,7 +357,7 @@ fn prune(root: &CString, dirs: Vec<Path>) -> Vec<CString> {
 
     extern {
         fn rust_list_dir_wfd_size() -> libc::size_t;
-        fn rust_list_dir_wfd_fp_buf(wfd: *libc::c_void) -> *u16;
+        fn rust_list_dir_wfd_fp_buf(wfd: *mut libc::c_void) -> *const u16;
     }
     let star = Path::new(unsafe {
         CString::new(p.with_ref(|p| p), false)
@@ -366,12 +366,13 @@ fn prune(root: &CString, dirs: Vec<Path>) -> Vec<CString> {
 
     unsafe {
         let wfd_ptr = malloc_raw(rust_list_dir_wfd_size() as uint);
-        let find_handle = libc::FindFirstFileW(path.as_ptr(), wfd_ptr as libc::HANDLE);
+        let find_handle = libc::FindFirstFileW(path.as_ptr(),
+                                               wfd_ptr as libc::HANDLE);
         if find_handle as libc::c_int != libc::INVALID_HANDLE_VALUE {
             let mut paths = vec!();
             let mut more_files = 1 as libc::c_int;
             while more_files != 0 {
-                let fp_buf = rust_list_dir_wfd_fp_buf(wfd_ptr as *c_void);
+                let fp_buf = rust_list_dir_wfd_fp_buf(wfd_ptr as *mut c_void);
                 if fp_buf as uint == 0 {
                     fail!("os::list_dir() failure: got null ptr from wfd");
                 } else {
@@ -446,7 +447,7 @@ pub fn readlink(p: &CString) -> IoResult<CString> {
     // without the null pointer
     let ret = fill_utf16_buf_and_decode(|buf, sz| unsafe {
         GetFinalPathNameByHandleW(handle,
-                                  buf as *u16,
+                                  buf as *const u16,
                                   sz - 1,
                                   libc::VOLUME_NAME_DOS)
     });
@@ -514,12 +515,12 @@ pub fn lstat(_p: &CString) -> IoResult<rtio::FileStat> {
 }
 
 pub fn utime(p: &CString, atime: u64, mtime: u64) -> IoResult<()> {
-    let buf = libc::utimbuf {
+    let mut buf = libc::utimbuf {
         actime: (atime / 1000) as libc::time64_t,
         modtime: (mtime / 1000) as libc::time64_t,
     };
     let p = try!(to_utf16(p));
     super::mkerr_libc(unsafe {
-        libc::wutime(p.as_ptr(), &buf)
+        libc::wutime(p.as_ptr(), &mut buf)
     })
 }
index 32775e2cfb58cd8dc89ebee6838c0d3de3c9e6aa..f6764b8f26a790893853e1c88e716bb1bb51341e 100644 (file)
@@ -132,7 +132,7 @@ fn retry(f: || -> libc::c_int) -> libc::c_int {
     }
 }
 
-fn keep_going(data: &[u8], f: |*u8, uint| -> i64) -> i64 {
+fn keep_going(data: &[u8], f: |*const u8, uint| -> i64) -> i64 {
     let origamt = data.len();
     let mut data = data.as_ptr();
     let mut amt = origamt;
index 5dfae8d9efe649b5221b176dad416371c3504952..395c063e706f11d8494d11fa36901ebd2815f9a6 100644 (file)
@@ -105,7 +105,7 @@ fn socket(addr: rtio::SocketAddr, ty: libc::c_int) -> IoResult<sock_t> {
 fn setsockopt<T>(fd: sock_t, opt: libc::c_int, val: libc::c_int,
                  payload: T) -> IoResult<()> {
     unsafe {
-        let payload = &payload as *T as *libc::c_void;
+        let payload = &payload as *const T as *const libc::c_void;
         let ret = libc::setsockopt(fd, opt, val,
                                    payload,
                                    mem::size_of::<T>() as libc::socklen_t);
@@ -278,7 +278,7 @@ pub fn connect(addr: rtio::SocketAddr,
         let ret = TcpStream::new(Inner::new(fd));
 
         let (addr, len) = addr_to_sockaddr(addr);
-        let addrp = &addr as *_ as *libc::sockaddr;
+        let addrp = &addr as *const _ as *const libc::sockaddr;
         let len = len as libc::socklen_t;
 
         match timeout {
@@ -369,7 +369,7 @@ fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
     fn write(&mut self, buf: &[u8]) -> IoResult<()> {
         let fd = self.fd();
         let dolock = || self.lock_nonblocking();
-        let dowrite = |nb: bool, buf: *u8, len: uint| unsafe {
+        let dowrite = |nb: bool, buf: *const u8, len: uint| unsafe {
             let flags = if nb {c::MSG_DONTWAIT} else {0};
             libc::send(fd,
                        buf as *mut libc::c_void,
@@ -456,7 +456,7 @@ pub fn bind(addr: rtio::SocketAddr) -> IoResult<TcpListener> {
         let ret = TcpListener { inner: Inner::new(fd) };
 
         let (addr, len) = addr_to_sockaddr(addr);
-        let addrp = &addr as *_ as *libc::sockaddr;
+        let addrp = &addr as *const _ as *const libc::sockaddr;
         let len = len as libc::socklen_t;
 
         // On platforms with Berkeley-derived sockets, this allows
@@ -564,7 +564,7 @@ pub fn bind(addr: rtio::SocketAddr) -> IoResult<UdpSocket> {
         };
 
         let (addr, len) = addr_to_sockaddr(addr);
-        let addrp = &addr as *_ as *libc::sockaddr;
+        let addrp = &addr as *const _ as *const libc::sockaddr;
         let len = len as libc::socklen_t;
 
         match unsafe { libc::bind(fd, addrp, len) } {
@@ -654,15 +654,15 @@ fn recvfrom(&mut self, buf: &mut [u8]) -> IoResult<(uint, rtio::SocketAddr)> {
 
     fn sendto(&mut self, buf: &[u8], dst: rtio::SocketAddr) -> IoResult<()> {
         let (dst, dstlen) = addr_to_sockaddr(dst);
-        let dstp = &dst as *_ as *libc::sockaddr;
+        let dstp = &dst as *const _ as *const libc::sockaddr;
         let dstlen = dstlen as libc::socklen_t;
 
         let fd = self.fd();
         let dolock = || self.lock_nonblocking();
-        let dowrite = |nb, buf: *u8, len: uint| unsafe {
+        let dowrite = |nb, buf: *const u8, len: uint| unsafe {
             let flags = if nb {c::MSG_DONTWAIT} else {0};
             libc::sendto(fd,
-                         buf as *libc::c_void,
+                         buf as *const libc::c_void,
                          len as msglen_t,
                          flags,
                          dstp,
@@ -842,7 +842,7 @@ pub fn write<T>(fd: sock_t,
                 buf: &[u8],
                 write_everything: bool,
                 lock: || -> T,
-                write: |bool, *u8, uint| -> i64) -> IoResult<uint> {
+                write: |bool, *const u8, uint| -> i64) -> IoResult<uint> {
     let mut ret = -1;
     let mut written = 0;
     if deadline == 0 {
index db0d1743c7279c2222a4b844afbcbbb39737742f..ae08d0ea0a9b75ab447a498aa81a8c7024a58338 100644 (file)
@@ -78,7 +78,7 @@ fn connect(addr: &CString, ty: libc::c_int,
            timeout: Option<u64>) -> IoResult<Inner> {
     let (addr, len) = try!(addr_to_sockaddr_un(addr));
     let inner = Inner::new(try!(unix_socket(ty)));
-    let addrp = &addr as *_ as *libc::sockaddr;
+    let addrp = &addr as *const _ as *const libc::sockaddr;
     let len = len as libc::socklen_t;
 
     match timeout {
@@ -98,9 +98,9 @@ fn connect(addr: &CString, ty: libc::c_int,
 fn bind(addr: &CString, ty: libc::c_int) -> IoResult<Inner> {
     let (addr, len) = try!(addr_to_sockaddr_un(addr));
     let inner = Inner::new(try!(unix_socket(ty)));
-    let addrp = &addr as *libc::sockaddr_storage;
+    let addrp = &addr as *const _;
     match unsafe {
-        libc::bind(inner.fd, addrp as *libc::sockaddr, len as libc::socklen_t)
+        libc::bind(inner.fd, addrp as *const _, len as libc::socklen_t)
     } {
         -1 => Err(super::last_error()),
         _  => Ok(inner)
@@ -166,7 +166,7 @@ fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
     fn write(&mut self, buf: &[u8]) -> IoResult<()> {
         let fd = self.fd();
         let dolock = || self.lock_nonblocking();
-        let dowrite = |nb: bool, buf: *u8, len: uint| unsafe {
+        let dowrite = |nb: bool, buf: *const u8, len: uint| unsafe {
             let flags = if nb {c::MSG_DONTWAIT} else {0};
             libc::send(fd,
                        buf as *mut libc::c_void,
index 5d9ddb1f59c150dd389b0673c50fad7afc607ee2..da713e3f2a931e9394a02f90b5bd3061175d2601 100644 (file)
@@ -152,7 +152,7 @@ fn drop(&mut self) {
     }
 }
 
-unsafe fn pipe(name: *u16, init: bool) -> libc::HANDLE {
+unsafe fn pipe(name: *const u16, init: bool) -> libc::HANDLE {
     libc::CreateNamedPipeW(
         name,
         libc::PIPE_ACCESS_DUPLEX |
@@ -210,7 +210,7 @@ pub struct UnixStream {
 }
 
 impl UnixStream {
-    fn try_connect(p: *u16) -> Option<libc::HANDLE> {
+    fn try_connect(p: *const u16) -> Option<libc::HANDLE> {
         // Note that most of this is lifted from the libuv implementation.
         // The idea is that if we fail to open a pipe in read/write mode
         // that we try afterwards in just read or just write
index c421dada205fc7e9f4886d195df2eda291cba6cc..de0474c488cbe6b7039bba3880b303b7275011ef 100644 (file)
@@ -43,7 +43,7 @@ pub struct Process {
     /// A handle to the process - on unix this will always be NULL, but on
     /// windows it will be a HANDLE to the process, which will prevent the
     /// pid being re-used until the handle is closed.
-    handle: *(),
+    handle: *mut (),
 
     /// None until finish() is called.
     exit_code: Option<rtio::ProcessExit>,
@@ -269,7 +269,7 @@ unsafe fn killpid(pid: pid_t, signal: int) -> IoResult<()> {
 
 struct SpawnProcessResult {
     pid: pid_t,
-    handle: *(),
+    handle: *mut (),
 }
 
 #[cfg(windows)]
@@ -403,7 +403,7 @@ fn spawn_process_os(cfg: ProcessConfig,
 
         Ok(SpawnProcessResult {
             pid: pi.dwProcessId as pid_t,
-            handle: pi.hProcess as *()
+            handle: pi.hProcess as *mut ()
         })
     }
 }
@@ -515,14 +515,14 @@ mod rustrt {
     }
 
     #[cfg(target_os = "macos")]
-    unsafe fn set_environ(envp: *c_void) {
-        extern { fn _NSGetEnviron() -> *mut *c_void; }
+    unsafe fn set_environ(envp: *const c_void) {
+        extern { fn _NSGetEnviron() -> *mut *const c_void; }
 
         *_NSGetEnviron() = envp;
     }
     #[cfg(not(target_os = "macos"))]
-    unsafe fn set_environ(envp: *c_void) {
-        extern { static mut environ: *c_void; }
+    unsafe fn set_environ(envp: *const c_void) {
+        extern { static mut environ: *const c_void; }
         environ = envp;
     }
 
@@ -564,7 +564,7 @@ unsafe fn set_cloexec(fd: c_int) {
                     Err(..) => {
                         Ok(SpawnProcessResult {
                             pid: pid,
-                            handle: ptr::null()
+                            handle: ptr::mut_null()
                         })
                     }
                     Ok(..) => fail!("short read on the cloexec pipe"),
@@ -664,17 +664,18 @@ fn fail(output: &mut file::FileDesc) -> ! {
             }
             match cfg.uid {
                 Some(u) => {
-                    // When dropping privileges from root, the `setgroups` call will
-                    // remove any extraneous groups. If we don't call this, then
-                    // even though our uid has dropped, we may still have groups
-                    // that enable us to do super-user things. This will fail if we
-                    // aren't root, so don't bother checking the return value, this
-                    // is just done as an optimistic privilege dropping function.
+                    // When dropping privileges from root, the `setgroups` call
+                    // will remove any extraneous groups. If we don't call this,
+                    // then even though our uid has dropped, we may still have
+                    // groups that enable us to do super-user things. This will
+                    // fail if we aren't root, so don't bother checking the
+                    // return value, this is just done as an optimistic
+                    // privilege dropping function.
                     extern {
                         fn setgroups(ngroups: libc::c_int,
-                                     ptr: *libc::c_void) -> libc::c_int;
+                                     ptr: *const libc::c_void) -> libc::c_int;
                     }
-                    let _ = setgroups(0, 0 as *libc::c_void);
+                    let _ = setgroups(0, 0 as *const libc::c_void);
 
                     if libc::setuid(u as libc::uid_t) != 0 {
                         fail(&mut output);
@@ -694,15 +695,16 @@ fn setgroups(ngroups: libc::c_int,
             if !envp.is_null() {
                 set_environ(envp);
             }
-            let _ = execvp(*argv, argv);
+            let _ = execvp(*argv, argv as *mut _);
             fail(&mut output);
         })
     })
 }
 
 #[cfg(unix)]
-fn with_argv<T>(prog: &CString, args: &[CString], cb: proc(**libc::c_char) -> T) -> T {
-    let mut ptrs: Vec<*libc::c_char> = Vec::with_capacity(args.len()+1);
+fn with_argv<T>(prog: &CString, args: &[CString],
+                cb: proc(*const *const libc::c_char) -> T) -> T {
+    let mut ptrs: Vec<*const libc::c_char> = Vec::with_capacity(args.len()+1);
 
     // Convert the CStrings into an array of pointers. Note: the
     // lifetime of the various CStrings involved is guaranteed to be
@@ -719,7 +721,8 @@ fn with_argv<T>(prog: &CString, args: &[CString], cb: proc(**libc::c_char) -> T)
 }
 
 #[cfg(unix)]
-fn with_envp<T>(env: Option<&[(CString, CString)]>, cb: proc(*c_void) -> T) -> T {
+fn with_envp<T>(env: Option<&[(CString, CString)]>,
+                cb: proc(*const c_void) -> T) -> T {
     // On posixy systems we can pass a char** for envp, which is a
     // null-terminated array of "k=v\0" strings. Since we must create
     // these strings locally, yet expose a raw pointer to them, we
@@ -738,13 +741,13 @@ fn with_envp<T>(env: Option<&[(CString, CString)]>, cb: proc(*c_void) -> T) -> T
             }
 
             // As with `with_argv`, this is unsafe, since cb could leak the pointers.
-            let mut ptrs: Vec<*libc::c_char> =
+            let mut ptrs: Vec<*const libc::c_char> =
                 tmps.iter()
-                    .map(|tmp| tmp.as_ptr() as *libc::c_char)
+                    .map(|tmp| tmp.as_ptr() as *const libc::c_char)
                     .collect();
             ptrs.push(ptr::null());
 
-            cb(ptrs.as_ptr() as *c_void)
+            cb(ptrs.as_ptr() as *const c_void)
         }
         _ => cb(ptr::null())
     }
@@ -776,7 +779,7 @@ fn with_envp<T>(env: Option<&[(CString, CString)]>, cb: |*mut c_void| -> T) -> T
 }
 
 #[cfg(windows)]
-fn with_dirp<T>(d: Option<&CString>, cb: |*u16| -> T) -> T {
+fn with_dirp<T>(d: Option<&CString>, cb: |*const u16| -> T) -> T {
     match d {
       Some(dir) => {
           let dir_str = dir.as_str()
@@ -789,14 +792,14 @@ fn with_dirp<T>(d: Option<&CString>, cb: |*u16| -> T) -> T {
 }
 
 #[cfg(windows)]
-fn free_handle(handle: *()) {
+fn free_handle(handle: *mut ()) {
     assert!(unsafe {
         libc::CloseHandle(mem::transmute(handle)) != 0
     })
 }
 
 #[cfg(unix)]
-fn free_handle(_handle: *()) {
+fn free_handle(_handle: *mut ()) {
     // unix has no process handle object, just a pid
 }
 
@@ -1010,15 +1013,16 @@ fn waitpid_helper(input: libc::c_int,
                     let now = ::io::timer::now();
                     let ms = if now < deadline {deadline - now} else {0};
                     tv = util::ms_to_timeval(ms);
-                    (&tv as *_, idx)
+                    (&mut tv as *mut _, idx)
                 }
-                None => (ptr::null(), -1),
+                None => (ptr::mut_null(), -1),
             };
 
             // Wait for something to happen
             c::fd_set(&mut set, input);
             c::fd_set(&mut set, read_fd);
-            match unsafe { c::select(max, &set, ptr::null(), ptr::null(), p) } {
+            match unsafe { c::select(max, &mut set, ptr::mut_null(),
+                                     ptr::mut_null(), p) } {
                 // interrupted, retry
                 -1 if os::errno() == libc::EINTR as int => continue,
 
@@ -1128,9 +1132,9 @@ fn drain(fd: libc::c_int) -> bool {
     // which will wake up the other end at some point, so we just allow this
     // signal to be coalesced with the pending signals on the pipe.
     extern fn sigchld_handler(_signum: libc::c_int) {
-        let mut msg = 1;
+        let msg = 1;
         match unsafe {
-            libc::write(WRITE_FD, &mut msg as *mut _ as *libc::c_void, 1)
+            libc::write(WRITE_FD, &msg as *const _ as *const libc::c_void, 1)
         } {
             1 => {}
             -1 if util::wouldblock() => {} // see above comments
index 304ff9738356eddccb2b1f48e713bef3dfb57379..8d6563bafad6365c3ed287bda8a31b81731a3918 100644 (file)
@@ -88,7 +88,7 @@ pub enum Req {
 pub fn now() -> u64 {
     unsafe {
         let mut now: libc::timeval = mem::zeroed();
-        assert_eq!(c::gettimeofday(&mut now, ptr::null()), 0);
+        assert_eq!(c::gettimeofday(&mut now, ptr::mut_null()), 0);
         return (now.tv_sec as u64) * 1000 + (now.tv_usec as u64) / 1000;
     }
 }
@@ -146,7 +146,7 @@ fn signal(active: &mut Vec<Box<Inner>>,
     'outer: loop {
         let timeout = if active.len() == 0 {
             // Empty array? no timeout (wait forever for the next request)
-            ptr::null()
+            ptr::mut_null()
         } else {
             let now = now();
             // If this request has already expired, then signal it and go
@@ -162,12 +162,13 @@ fn signal(active: &mut Vec<Box<Inner>>,
             let tm = active.get(0).target - now;
             timeout.tv_sec = (tm / 1000) as libc::time_t;
             timeout.tv_usec = ((tm % 1000) * 1000) as libc::suseconds_t;
-            &timeout as *libc::timeval
+            &mut timeout as *mut libc::timeval
         };
 
         c::fd_set(&mut set, input);
         match unsafe {
-            c::select(input + 1, &set, ptr::null(), ptr::null(), timeout)
+            c::select(input + 1, &mut set, ptr::mut_null(),
+                      ptr::mut_null(), timeout)
         } {
             // timed out
             0 => signal(&mut active, &mut dead),
index 9be09c6de076284ba5a4233425236e1aa1c4c289..1e5594126b10a9739b606b2cb40d2ce96024d4fb 100644 (file)
@@ -141,7 +141,7 @@ fn sleep(&mut self, msecs: u64) {
         // 100ns intervals, so we multiply by 10^4.
         let due = -(msecs as i64 * 10000) as libc::LARGE_INTEGER;
         assert_eq!(unsafe {
-            imp::SetWaitableTimer(self.obj, &due, 0, ptr::null(),
+            imp::SetWaitableTimer(self.obj, &due, 0, ptr::mut_null(),
                                   ptr::mut_null(), 0)
         }, 1);
 
@@ -154,7 +154,7 @@ fn oneshot(&mut self, msecs: u64, cb: Box<Callback + Send>) {
         // see above for the calculation
         let due = -(msecs as i64 * 10000) as libc::LARGE_INTEGER;
         assert_eq!(unsafe {
-            imp::SetWaitableTimer(self.obj, &due, 0, ptr::null(),
+            imp::SetWaitableTimer(self.obj, &due, 0, ptr::mut_null(),
                                   ptr::mut_null(), 0)
         }, 1);
 
@@ -169,7 +169,7 @@ fn period(&mut self, msecs: u64, cb: Box<Callback + Send>) {
         let due = -(msecs as i64 * 10000) as libc::LARGE_INTEGER;
         assert_eq!(unsafe {
             imp::SetWaitableTimer(self.obj, &due, msecs as libc::LONG,
-                                  ptr::null(), ptr::mut_null(), 0)
+                                  ptr::mut_null(), ptr::mut_null(), 0)
         }, 1);
 
         unsafe { HELPER.send(NewTimer(self.obj, cb, false)) }
@@ -188,20 +188,20 @@ mod imp {
     use libc::{LPSECURITY_ATTRIBUTES, BOOL, LPCSTR, HANDLE, LARGE_INTEGER,
                     LONG, LPVOID, DWORD, c_void};
 
-    pub type PTIMERAPCROUTINE = *c_void;
+    pub type PTIMERAPCROUTINE = *mut c_void;
 
     extern "system" {
         pub fn CreateWaitableTimerA(lpTimerAttributes: LPSECURITY_ATTRIBUTES,
                                     bManualReset: BOOL,
                                     lpTimerName: LPCSTR) -> HANDLE;
         pub fn SetWaitableTimer(hTimer: HANDLE,
-                                pDueTime: *LARGE_INTEGER,
+                                pDueTime: *const LARGE_INTEGER,
                                 lPeriod: LONG,
                                 pfnCompletionRoutine: PTIMERAPCROUTINE,
                                 lpArgToCompletionRoutine: LPVOID,
                                 fResume: BOOL) -> BOOL;
         pub fn WaitForMultipleObjects(nCount: DWORD,
-                                      lpHandles: *HANDLE,
+                                      lpHandles: *const HANDLE,
                                       bWaitAll: BOOL,
                                       dwMilliseconds: DWORD) -> DWORD;
         pub fn WaitForSingleObject(hHandle: HANDLE,
index a3c5349fa4582a47be58176939d9a2304b2e499d..31ba2223082d554325d66814aa8869500c566324 100644 (file)
@@ -90,7 +90,7 @@ pub fn set_nonblocking(fd: net::sock_t, nb: bool) -> IoResult<()> {
 // See http://developerweb.net/viewtopic.php?id=3196 for where this is
 // derived from.
 pub fn connect_timeout(fd: net::sock_t,
-                       addrp: *libc::sockaddr,
+                       addrp: *const libc::sockaddr,
                        len: libc::socklen_t,
                        timeout_ms: u64) -> IoResult<()> {
     use std::os;
@@ -145,16 +145,16 @@ fn await(fd: net::sock_t, set: &mut c::fd_set,
             // Recalculate the timeout each iteration (it is generally
             // undefined what the value of the 'tv' is after select
             // returns EINTR).
-            let tv = ms_to_timeval(timeout - (::io::timer::now() - start));
-            c::select(fd + 1, ptr::null(), set as *mut _ as *_,
-                      ptr::null(), &tv)
+            let mut tv = ms_to_timeval(timeout - (::io::timer::now() - start));
+            c::select(fd + 1, ptr::mut_null(), set as *mut _,
+                      ptr::mut_null(), &mut tv)
         })
     }
     #[cfg(windows)]
     fn await(_fd: net::sock_t, set: &mut c::fd_set,
              timeout: u64) -> libc::c_int {
-        let tv = ms_to_timeval(timeout);
-        unsafe { c::select(1, ptr::null(), &*set, ptr::null(), &tv) }
+        let mut tv = ms_to_timeval(timeout);
+        unsafe { c::select(1, ptr::mut_null(), set, ptr::mut_null(), &mut tv) }
     }
 }
 
@@ -163,25 +163,25 @@ pub fn await(fd: net::sock_t, deadline: Option<u64>,
     let mut set: c::fd_set = unsafe { mem::zeroed() };
     c::fd_set(&mut set, fd);
     let (read, write) = match status {
-        Readable => (&set as *_, ptr::null()),
-        Writable => (ptr::null(), &set as *_),
+        Readable => (&mut set as *mut _, ptr::mut_null()),
+        Writable => (ptr::mut_null(), &mut set as *mut _),
     };
     let mut tv: libc::timeval = unsafe { mem::zeroed() };
 
     match retry(|| {
         let now = ::io::timer::now();
         let tvp = match deadline {
-            None => ptr::null(),
+            None => ptr::mut_null(),
             Some(deadline) => {
                 // If we're past the deadline, then pass a 0 timeout to
                 // select() so we can poll the status
                 let ms = if deadline < now {0} else {deadline - now};
                 tv = ms_to_timeval(ms);
-                &tv as *_
+                &mut tv as *mut _
             }
         };
         let n = if cfg!(windows) {1} else {fd as libc::c_int + 1};
-        let r = unsafe { c::select(n, read, write, ptr::null(), tvp) };
+        let r = unsafe { c::select(n, read, write, ptr::mut_null(), tvp) };
         r
     }) {
         -1 => Err(last_error()),
index 3ed3d5862b9046d6635a0a00ce17195000a0ca4c..8ca3e9846542da3df961c5d592f8cecc7d33a763 100644 (file)
@@ -20,7 +20,9 @@
 //! extern crate native;
 //!
 //! #[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)
+//! }
 //!
 //! fn main() {
 //!     // this code is running on the main OS thread
@@ -83,7 +85,7 @@
 
 #[lang = "start"]
 #[cfg(not(test))]
-pub fn lang_start(main: *u8, argc: int, argv: **u8) -> int {
+pub fn lang_start(main: *const u8, argc: int, argv: *const *const u8) -> int {
     use std::mem;
     start(argc, argv, proc() {
         let main: extern "Rust" fn() = unsafe { mem::transmute(main) };
@@ -100,9 +102,9 @@ pub fn lang_start(main: *u8, argc: int, argv: **u8) -> int {
 ///
 /// This function will only return once *all* native threads in the system have
 /// exited.
-pub fn start(argc: int, argv: **u8, main: proc()) -> int {
+pub fn start(argc: int, argv: *const *const u8, main: proc()) -> int {
     let something_around_the_top_of_the_stack = 1;
-    let addr = &something_around_the_top_of_the_stack as *int;
+    let addr = &something_around_the_top_of_the_stack as *const int;
     let my_stack_top = addr as uint;
 
     // FIXME #11359 we just assume that this thread has a stack of a
index 8b7c8e61bc35bf3733fe97bf87712a570df72ead..45b66aaa5fb67403c51d63e8f45cc635498d3dc5 100644 (file)
@@ -81,7 +81,7 @@ pub fn spawn_opts(opts: TaskOpts, f: proc():Send) {
     // which our stack started).
     Thread::spawn_stack(stack, proc() {
         let something_around_the_top_of_the_stack = 1;
-        let addr = &something_around_the_top_of_the_stack as *int;
+        let addr = &something_around_the_top_of_the_stack as *const int;
         let my_stack = addr as uint;
         unsafe {
             stack::record_stack_bounds(my_stack - stack + 1024, my_stack);
@@ -199,7 +199,7 @@ fn deschedule(mut ~self, times: uint, mut cur_task: Box<Task>,
         cur_task.put_runtime(self);
 
         unsafe {
-            let cur_task_dupe = &*cur_task as *Task;
+            let cur_task_dupe = &mut *cur_task as *mut Task;
             let task = BlockedTask::block(cur_task);
 
             if times == 1 {
index 4c5419185e55a066f9043f351aa9a03ad9a72bca..c85e0099ab832f9012f59c4ece785ac7298e43e4 100644 (file)
 // implementations below. If pointer arithmetic is done through integers the
 // optimizations start to break down.
 extern "rust-intrinsic" {
-    fn offset<T>(dst: *T, offset: int) -> *T;
+    fn offset<T>(dst: *const T, offset: int) -> *const T;
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn memcpy(dest: *mut u8, src: *u8, n: uint) -> *mut u8 {
+pub unsafe extern "C" fn memcpy(dest: *mut u8, src: *const u8,
+                                n: uint) -> *mut u8 {
     let mut i = 0;
     while i < n {
-        *(offset(dest as *u8, i as int) as *mut u8) = *offset(src, i as int);
+        *(offset(dest as *const u8, i as int) as *mut u8) =
+            *offset(src, i as int);
         i += 1;
     }
     return dest;
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn memmove(dest: *mut u8, src: *u8, n: uint) -> *mut u8 {
-    if src < dest as *u8 { // copy from end
+pub unsafe extern "C" fn memmove(dest: *mut u8, src: *const u8,
+                                 n: uint) -> *mut u8 {
+    if src < dest as *const u8 { // copy from end
         let mut i = n;
         while i != 0 {
             i -= 1;
-            *(offset(dest as *u8, i as int) as *mut u8) = *offset(src, i as int);
+            *(offset(dest as *const u8, i as int) as *mut u8) =
+                *offset(src, i as int);
         }
     } else { // copy from beginning
         let mut i = 0;
         while i < n {
-            *(offset(dest as *u8, i as int) as *mut u8) = *offset(src, i as int);
+            *(offset(dest as *const u8, i as int) as *mut u8) =
+                *offset(src, i as int);
             i += 1;
         }
     }
 pub unsafe extern "C" fn memset(s: *mut u8, c: i32, n: uint) -> *mut u8 {
     let mut i = 0;
     while i < n {
-        *(offset(s as *u8, i as int) as *mut u8) = c as u8;
+        *(offset(s as *const u8, i as int) as *mut u8) = c as u8;
         i += 1;
     }
     return s;
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn memcmp(s1: *u8, s2: *u8, n: uint) -> i32 {
+pub unsafe extern "C" fn memcmp(s1: *const u8, s2: *const u8, n: uint) -> i32 {
     let mut i = 0;
     while i < n {
         let a = *offset(s1, i as int);
index 7449622366fc2678f4c7912ef4e05664c2916562..69cc52d68b30b3172a0ffea3d870d5faf7dde49d 100644 (file)
@@ -82,7 +82,7 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
              (),
              |()| unsafe {
             if !llvm::LLVMRustLinkInExternalBitcode(llmod,
-                                                    ptr as *libc::c_char,
+                                                    ptr as *const libc::c_char,
                                                     bc.len() as libc::size_t) {
                 link::llvm_err(sess,
                                format!("failed to load bc of `{}`",
@@ -94,10 +94,11 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
     // Internalize everything but the reachable symbols of the current module
     let cstrs: Vec<::std::c_str::CString> =
         reachable.iter().map(|s| s.as_slice().to_c_str()).collect();
-    let arr: Vec<*i8> = cstrs.iter().map(|c| c.with_ref(|p| p)).collect();
+    let arr: Vec<*const i8> = cstrs.iter().map(|c| c.with_ref(|p| p)).collect();
     let ptr = arr.as_ptr();
     unsafe {
-        llvm::LLVMRustRunRestrictionPass(llmod, ptr as **libc::c_char,
+        llvm::LLVMRustRunRestrictionPass(llmod,
+                                         ptr as *const *const libc::c_char,
                                          arr.len() as libc::size_t);
     }
 
index ac9cec84715264e1f483bedce9a22342f2525054..0c2f07009b867e5085d2b167246ee68fb998e391 100644 (file)
@@ -255,45 +255,45 @@ pub enum CodeGenModel {
 
 // Opaque pointer types
 pub enum Module_opaque {}
-pub type ModuleRef = *Module_opaque;
+pub type ModuleRef = *mut Module_opaque;
 pub enum Context_opaque {}
-pub type ContextRef = *Context_opaque;
+pub type ContextRef = *mut Context_opaque;
 pub enum Type_opaque {}
-pub type TypeRef = *Type_opaque;
+pub type TypeRef = *mut Type_opaque;
 pub enum Value_opaque {}
-pub type ValueRef = *Value_opaque;
+pub type ValueRef = *mut Value_opaque;
 pub enum BasicBlock_opaque {}
-pub type BasicBlockRef = *BasicBlock_opaque;
+pub type BasicBlockRef = *mut BasicBlock_opaque;
 pub enum Builder_opaque {}
-pub type BuilderRef = *Builder_opaque;
+pub type BuilderRef = *mut Builder_opaque;
 pub enum ExecutionEngine_opaque {}
-pub type ExecutionEngineRef = *ExecutionEngine_opaque;
+pub type ExecutionEngineRef = *mut ExecutionEngine_opaque;
 pub enum MemoryBuffer_opaque {}
-pub type MemoryBufferRef = *MemoryBuffer_opaque;
+pub type MemoryBufferRef = *mut MemoryBuffer_opaque;
 pub enum PassManager_opaque {}
-pub type PassManagerRef = *PassManager_opaque;
+pub type PassManagerRef = *mut PassManager_opaque;
 pub enum PassManagerBuilder_opaque {}
-pub type PassManagerBuilderRef = *PassManagerBuilder_opaque;
+pub type PassManagerBuilderRef = *mut PassManagerBuilder_opaque;
 pub enum Use_opaque {}
-pub type UseRef = *Use_opaque;
+pub type UseRef = *mut Use_opaque;
 pub enum TargetData_opaque {}
-pub type TargetDataRef = *TargetData_opaque;
+pub type TargetDataRef = *mut TargetData_opaque;
 pub enum ObjectFile_opaque {}
-pub type ObjectFileRef = *ObjectFile_opaque;
+pub type ObjectFileRef = *mut ObjectFile_opaque;
 pub enum SectionIterator_opaque {}
-pub type SectionIteratorRef = *SectionIterator_opaque;
+pub type SectionIteratorRef = *mut SectionIterator_opaque;
 pub enum Pass_opaque {}
-pub type PassRef = *Pass_opaque;
+pub type PassRef = *mut Pass_opaque;
 pub enum TargetMachine_opaque {}
-pub type TargetMachineRef = *TargetMachine_opaque;
+pub type TargetMachineRef = *mut TargetMachine_opaque;
 pub enum Archive_opaque {}
-pub type ArchiveRef = *Archive_opaque;
+pub type ArchiveRef = *mut Archive_opaque;
 
 pub mod debuginfo {
     use super::{ValueRef};
 
     pub enum DIBuilder_opaque {}
-    pub type DIBuilderRef = *DIBuilder_opaque;
+    pub type DIBuilderRef = *mut DIBuilder_opaque;
 
     pub type DIDescriptor = ValueRef;
     pub type DIScope = DIDescriptor;
@@ -354,30 +354,30 @@ pub mod llvm {
         pub fn LLVMContextCreate() -> ContextRef;
         pub fn LLVMContextDispose(C: ContextRef);
         pub fn LLVMGetMDKindIDInContext(C: ContextRef,
-                                        Name: *c_char,
+                                        Name: *const c_char,
                                         SLen: c_uint)
                                         -> c_uint;
 
         /* Create and destroy modules. */
-        pub fn LLVMModuleCreateWithNameInContext(ModuleID: *c_char,
+        pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char,
                                                  C: ContextRef)
                                                  -> ModuleRef;
         pub fn LLVMGetModuleContext(M: ModuleRef) -> ContextRef;
         pub fn LLVMDisposeModule(M: ModuleRef);
 
         /** Data layout. See Module::getDataLayout. */
-        pub fn LLVMGetDataLayout(M: ModuleRef) -> *c_char;
-        pub fn LLVMSetDataLayout(M: ModuleRef, Triple: *c_char);
+        pub fn LLVMGetDataLayout(M: ModuleRef) -> *const c_char;
+        pub fn LLVMSetDataLayout(M: ModuleRef, Triple: *const c_char);
 
         /** Target triple. See Module::getTargetTriple. */
-        pub fn LLVMGetTarget(M: ModuleRef) -> *c_char;
-        pub fn LLVMSetTarget(M: ModuleRef, Triple: *c_char);
+        pub fn LLVMGetTarget(M: ModuleRef) -> *const c_char;
+        pub fn LLVMSetTarget(M: ModuleRef, Triple: *const c_char);
 
         /** See Module::dump. */
         pub fn LLVMDumpModule(M: ModuleRef);
 
         /** See Module::setModuleInlineAsm. */
-        pub fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: *c_char);
+        pub fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: *const c_char);
 
         /** See llvm::LLVMTypeKind::getTypeID. */
         pub fn LLVMGetTypeKind(Ty: TypeRef) -> TypeKind;
@@ -405,18 +405,18 @@ pub fn LLVMIntTypeInContext(C: ContextRef, NumBits: c_uint)
 
         /* Operations on function types */
         pub fn LLVMFunctionType(ReturnType: TypeRef,
-                                ParamTypes: *TypeRef,
+                                ParamTypes: *const TypeRef,
                                 ParamCount: c_uint,
                                 IsVarArg: Bool)
                                 -> TypeRef;
         pub fn LLVMIsFunctionVarArg(FunctionTy: TypeRef) -> Bool;
         pub fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef;
         pub fn LLVMCountParamTypes(FunctionTy: TypeRef) -> c_uint;
-        pub fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *TypeRef);
+        pub fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *const TypeRef);
 
         /* Operations on struct types */
         pub fn LLVMStructTypeInContext(C: ContextRef,
-                                       ElementTypes: *TypeRef,
+                                       ElementTypes: *const TypeRef,
                                        ElementCount: c_uint,
                                        Packed: Bool)
                                        -> TypeRef;
@@ -436,7 +436,7 @@ pub fn LLVMVectorType(ElementType: TypeRef, ElementCount: c_uint)
         pub fn LLVMGetArrayLength(ArrayTy: TypeRef) -> c_uint;
         pub fn LLVMGetPointerAddressSpace(PointerTy: TypeRef) -> c_uint;
         pub fn LLVMGetPointerToGlobal(EE: ExecutionEngineRef, V: ValueRef)
-                                      -> *();
+                                      -> *const ();
         pub fn LLVMGetVectorSize(VectorTy: TypeRef) -> c_uint;
 
         /* Operations on other types */
@@ -446,8 +446,8 @@ pub fn LLVMGetPointerToGlobal(EE: ExecutionEngineRef, V: ValueRef)
 
         /* Operations on all values */
         pub fn LLVMTypeOf(Val: ValueRef) -> TypeRef;
-        pub fn LLVMGetValueName(Val: ValueRef) -> *c_char;
-        pub fn LLVMSetValueName(Val: ValueRef, Name: *c_char);
+        pub fn LLVMGetValueName(Val: ValueRef) -> *const c_char;
+        pub fn LLVMSetValueName(Val: ValueRef, Name: *const c_char);
         pub fn LLVMDumpValue(Val: ValueRef);
         pub fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef);
         pub fn LLVMHasMetadata(Val: ValueRef) -> c_int;
@@ -482,32 +482,32 @@ pub fn LLVMConstFCmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef)
 
         /* Operations on metadata */
         pub fn LLVMMDStringInContext(C: ContextRef,
-                                     Str: *c_char,
+                                     Str: *const c_char,
                                      SLen: c_uint)
                                      -> ValueRef;
         pub fn LLVMMDNodeInContext(C: ContextRef,
-                                   Vals: *ValueRef,
+                                   Vals: *const ValueRef,
                                    Count: c_uint)
                                    -> ValueRef;
         pub fn LLVMAddNamedMetadataOperand(M: ModuleRef,
-                                           Str: *c_char,
+                                           Str: *const c_char,
                                            Val: ValueRef);
 
         /* Operations on scalar constants */
         pub fn LLVMConstInt(IntTy: TypeRef, N: c_ulonglong, SignExtend: Bool)
                             -> ValueRef;
-        pub fn LLVMConstIntOfString(IntTy: TypeRef, Text: *c_char, Radix: u8)
+        pub fn LLVMConstIntOfString(IntTy: TypeRef, Text: *const c_char, Radix: u8)
                                     -> ValueRef;
         pub fn LLVMConstIntOfStringAndSize(IntTy: TypeRef,
-                                           Text: *c_char,
+                                           Text: *const c_char,
                                            SLen: c_uint,
                                            Radix: u8)
                                            -> ValueRef;
         pub fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
-        pub fn LLVMConstRealOfString(RealTy: TypeRef, Text: *c_char)
+        pub fn LLVMConstRealOfString(RealTy: TypeRef, Text: *const c_char)
                                      -> ValueRef;
         pub fn LLVMConstRealOfStringAndSize(RealTy: TypeRef,
-                                            Text: *c_char,
+                                            Text: *const c_char,
                                             SLen: c_uint)
                                             -> ValueRef;
         pub fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef) -> c_ulonglong;
@@ -516,21 +516,21 @@ pub fn LLVMConstRealOfStringAndSize(RealTy: TypeRef,
 
         /* Operations on composite constants */
         pub fn LLVMConstStringInContext(C: ContextRef,
-                                        Str: *c_char,
+                                        Str: *const c_char,
                                         Length: c_uint,
                                         DontNullTerminate: Bool)
                                         -> ValueRef;
         pub fn LLVMConstStructInContext(C: ContextRef,
-                                        ConstantVals: *ValueRef,
+                                        ConstantVals: *const ValueRef,
                                         Count: c_uint,
                                         Packed: Bool)
                                         -> ValueRef;
 
         pub fn LLVMConstArray(ElementTy: TypeRef,
-                              ConstantVals: *ValueRef,
+                              ConstantVals: *const ValueRef,
                               Length: c_uint)
                               -> ValueRef;
-        pub fn LLVMConstVector(ScalarConstantVals: *ValueRef, Size: c_uint)
+        pub fn LLVMConstVector(ScalarConstantVals: *const ValueRef, Size: c_uint)
                                -> ValueRef;
 
         /* Constant expressions */
@@ -593,11 +593,11 @@ pub fn LLVMConstLShr(LHSConstant: ValueRef, RHSConstant: ValueRef)
         pub fn LLVMConstAShr(LHSConstant: ValueRef, RHSConstant: ValueRef)
                              -> ValueRef;
         pub fn LLVMConstGEP(ConstantVal: ValueRef,
-                            ConstantIndices: *ValueRef,
+                            ConstantIndices: *const ValueRef,
                             NumIndices: c_uint)
                             -> ValueRef;
         pub fn LLVMConstInBoundsGEP(ConstantVal: ValueRef,
-                                    ConstantIndices: *ValueRef,
+                                    ConstantIndices: *const ValueRef,
                                     NumIndices: c_uint)
                                     -> ValueRef;
         pub fn LLVMConstTrunc(ConstantVal: ValueRef, ToType: TypeRef)
@@ -654,17 +654,17 @@ pub fn LLVMConstShuffleVector(VectorAConstant: ValueRef,
                                       MaskConstant: ValueRef)
                                       -> ValueRef;
         pub fn LLVMConstExtractValue(AggConstant: ValueRef,
-                                     IdxList: *c_uint,
+                                     IdxList: *const c_uint,
                                      NumIdx: c_uint)
                                      -> ValueRef;
         pub fn LLVMConstInsertValue(AggConstant: ValueRef,
                                     ElementValueConstant: ValueRef,
-                                    IdxList: *c_uint,
+                                    IdxList: *const c_uint,
                                     NumIdx: c_uint)
                                     -> ValueRef;
         pub fn LLVMConstInlineAsm(Ty: TypeRef,
-                                  AsmString: *c_char,
-                                  Constraints: *c_char,
+                                  AsmString: *const c_char,
+                                  Constraints: *const c_char,
                                   HasSideEffects: Bool,
                                   IsAlignStack: Bool)
                                   -> ValueRef;
@@ -677,8 +677,8 @@ pub fn LLVMConstInlineAsm(Ty: TypeRef,
         pub fn LLVMIsDeclaration(Global: ValueRef) -> Bool;
         pub fn LLVMGetLinkage(Global: ValueRef) -> c_uint;
         pub fn LLVMSetLinkage(Global: ValueRef, Link: c_uint);
-        pub fn LLVMGetSection(Global: ValueRef) -> *c_char;
-        pub fn LLVMSetSection(Global: ValueRef, Section: *c_char);
+        pub fn LLVMGetSection(Global: ValueRef) -> *const c_char;
+        pub fn LLVMSetSection(Global: ValueRef, Section: *const c_char);
         pub fn LLVMGetVisibility(Global: ValueRef) -> c_uint;
         pub fn LLVMSetVisibility(Global: ValueRef, Viz: c_uint);
         pub fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
@@ -686,14 +686,14 @@ pub fn LLVMConstInlineAsm(Ty: TypeRef,
 
 
         /* Operations on global variables */
-        pub fn LLVMAddGlobal(M: ModuleRef, Ty: TypeRef, Name: *c_char)
+        pub fn LLVMAddGlobal(M: ModuleRef, Ty: TypeRef, Name: *const c_char)
                              -> ValueRef;
         pub fn LLVMAddGlobalInAddressSpace(M: ModuleRef,
                                            Ty: TypeRef,
-                                           Name: *c_char,
+                                           Name: *const c_char,
                                            AddressSpace: c_uint)
                                            -> ValueRef;
-        pub fn LLVMGetNamedGlobal(M: ModuleRef, Name: *c_char) -> ValueRef;
+        pub fn LLVMGetNamedGlobal(M: ModuleRef, Name: *const c_char) -> ValueRef;
         pub fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
         pub fn LLVMGetLastGlobal(M: ModuleRef) -> ValueRef;
         pub fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
@@ -711,37 +711,37 @@ pub fn LLVMSetInitializer(GlobalVar: ValueRef,
         pub fn LLVMAddAlias(M: ModuleRef,
                             Ty: TypeRef,
                             Aliasee: ValueRef,
-                            Name: *c_char)
+                            Name: *const c_char)
                             -> ValueRef;
 
         /* Operations on functions */
         pub fn LLVMAddFunction(M: ModuleRef,
-                               Name: *c_char,
+                               Name: *const c_char,
                                FunctionTy: TypeRef)
                                -> ValueRef;
-        pub fn LLVMGetNamedFunction(M: ModuleRef, Name: *c_char) -> ValueRef;
+        pub fn LLVMGetNamedFunction(M: ModuleRef, Name: *const c_char) -> ValueRef;
         pub fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef;
         pub fn LLVMGetLastFunction(M: ModuleRef) -> ValueRef;
         pub fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
         pub fn LLVMGetPreviousFunction(Fn: ValueRef) -> ValueRef;
         pub fn LLVMDeleteFunction(Fn: ValueRef);
         pub fn LLVMGetOrInsertFunction(M: ModuleRef,
-                                       Name: *c_char,
+                                       Name: *const c_char,
                                        FunctionTy: TypeRef)
                                        -> ValueRef;
         pub fn LLVMGetIntrinsicID(Fn: ValueRef) -> c_uint;
         pub fn LLVMGetFunctionCallConv(Fn: ValueRef) -> c_uint;
         pub fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
-        pub fn LLVMGetGC(Fn: ValueRef) -> *c_char;
-        pub fn LLVMSetGC(Fn: ValueRef, Name: *c_char);
+        pub fn LLVMGetGC(Fn: ValueRef) -> *const c_char;
+        pub fn LLVMSetGC(Fn: ValueRef, Name: *const c_char);
         pub fn LLVMAddFunctionAttribute(Fn: ValueRef, index: c_uint, PA: uint64_t);
-        pub fn LLVMAddFunctionAttrString(Fn: ValueRef, index: c_uint, Name: *c_char);
-        pub fn LLVMRemoveFunctionAttrString(Fn: ValueRef, index: c_uint, Name: *c_char);
+        pub fn LLVMAddFunctionAttrString(Fn: ValueRef, index: c_uint, Name: *const c_char);
+        pub fn LLVMRemoveFunctionAttrString(Fn: ValueRef, index: c_uint, Name: *const c_char);
         pub fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_ulonglong;
 
         /* Operations on parameters */
         pub fn LLVMCountParams(Fn: ValueRef) -> c_uint;
-        pub fn LLVMGetParams(Fn: ValueRef, Params: *ValueRef);
+        pub fn LLVMGetParams(Fn: ValueRef, Params: *const ValueRef);
         pub fn LLVMGetParam(Fn: ValueRef, Index: c_uint) -> ValueRef;
         pub fn LLVMGetParamParent(Inst: ValueRef) -> ValueRef;
         pub fn LLVMGetFirstParam(Fn: ValueRef) -> ValueRef;
@@ -759,7 +759,7 @@ pub fn LLVMGetOrInsertFunction(M: ModuleRef,
         pub fn LLVMValueAsBasicBlock(Val: ValueRef) -> BasicBlockRef;
         pub fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
         pub fn LLVMCountBasicBlocks(Fn: ValueRef) -> c_uint;
-        pub fn LLVMGetBasicBlocks(Fn: ValueRef, BasicBlocks: *ValueRef);
+        pub fn LLVMGetBasicBlocks(Fn: ValueRef, BasicBlocks: *const ValueRef);
         pub fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
         pub fn LLVMGetLastBasicBlock(Fn: ValueRef) -> BasicBlockRef;
         pub fn LLVMGetNextBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
@@ -768,11 +768,11 @@ pub fn LLVMGetOrInsertFunction(M: ModuleRef,
 
         pub fn LLVMAppendBasicBlockInContext(C: ContextRef,
                                              Fn: ValueRef,
-                                             Name: *c_char)
+                                             Name: *const c_char)
                                              -> BasicBlockRef;
         pub fn LLVMInsertBasicBlockInContext(C: ContextRef,
                                              BB: BasicBlockRef,
-                                             Name: *c_char)
+                                             Name: *const c_char)
                                              -> BasicBlockRef;
         pub fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
 
@@ -816,8 +816,8 @@ pub fn LLVMAddCallSiteAttribute(Instr: ValueRef,
 
         /* Operations on phi nodes */
         pub fn LLVMAddIncoming(PhiNode: ValueRef,
-                               IncomingValues: *ValueRef,
-                               IncomingBlocks: *BasicBlockRef,
+                               IncomingValues: *const ValueRef,
+                               IncomingBlocks: *const BasicBlockRef,
                                Count: c_uint);
         pub fn LLVMCountIncoming(PhiNode: ValueRef) -> c_uint;
         pub fn LLVMGetIncomingValue(PhiNode: ValueRef, Index: c_uint)
@@ -839,7 +839,7 @@ pub fn LLVMPositionBuilderAtEnd(Builder: BuilderRef,
         pub fn LLVMInsertIntoBuilder(Builder: BuilderRef, Instr: ValueRef);
         pub fn LLVMInsertIntoBuilderWithName(Builder: BuilderRef,
                                              Instr: ValueRef,
-                                             Name: *c_char);
+                                             Name: *const c_char);
         pub fn LLVMDisposeBuilder(Builder: BuilderRef);
         pub fn LLVMDisposeExecutionEngine(EE: ExecutionEngineRef);
 
@@ -852,7 +852,7 @@ pub fn LLVMInsertIntoBuilderWithName(Builder: BuilderRef,
         pub fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef;
         pub fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
         pub fn LLVMBuildAggregateRet(B: BuilderRef,
-                                     RetVals: *ValueRef,
+                                     RetVals: *const ValueRef,
                                      N: c_uint)
                                      -> ValueRef;
         pub fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) -> ValueRef;
@@ -872,17 +872,17 @@ pub fn LLVMBuildIndirectBr(B: BuilderRef,
                                    -> ValueRef;
         pub fn LLVMBuildInvoke(B: BuilderRef,
                                Fn: ValueRef,
-                               Args: *ValueRef,
+                               Args: *const ValueRef,
                                NumArgs: c_uint,
                                Then: BasicBlockRef,
                                Catch: BasicBlockRef,
-                               Name: *c_char)
+                               Name: *const c_char)
                                -> ValueRef;
         pub fn LLVMBuildLandingPad(B: BuilderRef,
                                    Ty: TypeRef,
                                    PersFn: ValueRef,
                                    NumClauses: c_uint,
-                                   Name: *c_char)
+                                   Name: *const c_char)
                                    -> ValueRef;
         pub fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
         pub fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
@@ -905,164 +905,164 @@ pub fn LLVMAddCase(Switch: ValueRef,
         pub fn LLVMBuildAdd(B: BuilderRef,
                             LHS: ValueRef,
                             RHS: ValueRef,
-                            Name: *c_char)
+                            Name: *const c_char)
                             -> ValueRef;
         pub fn LLVMBuildNSWAdd(B: BuilderRef,
                                LHS: ValueRef,
                                RHS: ValueRef,
-                               Name: *c_char)
+                               Name: *const c_char)
                                -> ValueRef;
         pub fn LLVMBuildNUWAdd(B: BuilderRef,
                                LHS: ValueRef,
                                RHS: ValueRef,
-                               Name: *c_char)
+                               Name: *const c_char)
                                -> ValueRef;
         pub fn LLVMBuildFAdd(B: BuilderRef,
                              LHS: ValueRef,
                              RHS: ValueRef,
-                             Name: *c_char)
+                             Name: *const c_char)
                              -> ValueRef;
         pub fn LLVMBuildSub(B: BuilderRef,
                             LHS: ValueRef,
                             RHS: ValueRef,
-                            Name: *c_char)
+                            Name: *const c_char)
                             -> ValueRef;
         pub fn LLVMBuildNSWSub(B: BuilderRef,
                                LHS: ValueRef,
                                RHS: ValueRef,
-                               Name: *c_char)
+                               Name: *const c_char)
                                -> ValueRef;
         pub fn LLVMBuildNUWSub(B: BuilderRef,
                                LHS: ValueRef,
                                RHS: ValueRef,
-                               Name: *c_char)
+                               Name: *const c_char)
                                -> ValueRef;
         pub fn LLVMBuildFSub(B: BuilderRef,
                              LHS: ValueRef,
                              RHS: ValueRef,
-                             Name: *c_char)
+                             Name: *const c_char)
                              -> ValueRef;
         pub fn LLVMBuildMul(B: BuilderRef,
                             LHS: ValueRef,
                             RHS: ValueRef,
-                            Name: *c_char)
+                            Name: *const c_char)
                             -> ValueRef;
         pub fn LLVMBuildNSWMul(B: BuilderRef,
                                LHS: ValueRef,
                                RHS: ValueRef,
-                               Name: *c_char)
+                               Name: *const c_char)
                                -> ValueRef;
         pub fn LLVMBuildNUWMul(B: BuilderRef,
                                LHS: ValueRef,
                                RHS: ValueRef,
-                               Name: *c_char)
+                               Name: *const c_char)
                                -> ValueRef;
         pub fn LLVMBuildFMul(B: BuilderRef,
                              LHS: ValueRef,
                              RHS: ValueRef,
-                             Name: *c_char)
+                             Name: *const c_char)
                              -> ValueRef;
         pub fn LLVMBuildUDiv(B: BuilderRef,
                              LHS: ValueRef,
                              RHS: ValueRef,
-                             Name: *c_char)
+                             Name: *const c_char)
                              -> ValueRef;
         pub fn LLVMBuildSDiv(B: BuilderRef,
                              LHS: ValueRef,
                              RHS: ValueRef,
-                             Name: *c_char)
+                             Name: *const c_char)
                              -> ValueRef;
         pub fn LLVMBuildExactSDiv(B: BuilderRef,
                                   LHS: ValueRef,
                                   RHS: ValueRef,
-                                  Name: *c_char)
+                                  Name: *const c_char)
                                   -> ValueRef;
         pub fn LLVMBuildFDiv(B: BuilderRef,
                              LHS: ValueRef,
                              RHS: ValueRef,
-                             Name: *c_char)
+                             Name: *const c_char)
                              -> ValueRef;
         pub fn LLVMBuildURem(B: BuilderRef,
                              LHS: ValueRef,
                              RHS: ValueRef,
-                             Name: *c_char)
+                             Name: *const c_char)
                              -> ValueRef;
         pub fn LLVMBuildSRem(B: BuilderRef,
                              LHS: ValueRef,
                              RHS: ValueRef,
-                             Name: *c_char)
+                             Name: *const c_char)
                              -> ValueRef;
         pub fn LLVMBuildFRem(B: BuilderRef,
                              LHS: ValueRef,
                              RHS: ValueRef,
-                             Name: *c_char)
+                             Name: *const c_char)
                              -> ValueRef;
         pub fn LLVMBuildShl(B: BuilderRef,
                             LHS: ValueRef,
                             RHS: ValueRef,
-                            Name: *c_char)
+                            Name: *const c_char)
                             -> ValueRef;
         pub fn LLVMBuildLShr(B: BuilderRef,
                              LHS: ValueRef,
                              RHS: ValueRef,
-                             Name: *c_char)
+                             Name: *const c_char)
                              -> ValueRef;
         pub fn LLVMBuildAShr(B: BuilderRef,
                              LHS: ValueRef,
                              RHS: ValueRef,
-                             Name: *c_char)
+                             Name: *const c_char)
                              -> ValueRef;
         pub fn LLVMBuildAnd(B: BuilderRef,
                             LHS: ValueRef,
                             RHS: ValueRef,
-                            Name: *c_char)
+                            Name: *const c_char)
                             -> ValueRef;
         pub fn LLVMBuildOr(B: BuilderRef,
                            LHS: ValueRef,
                            RHS: ValueRef,
-                           Name: *c_char)
+                           Name: *const c_char)
                            -> ValueRef;
         pub fn LLVMBuildXor(B: BuilderRef,
                             LHS: ValueRef,
                             RHS: ValueRef,
-                            Name: *c_char)
+                            Name: *const c_char)
                             -> ValueRef;
         pub fn LLVMBuildBinOp(B: BuilderRef,
                               Op: Opcode,
                               LHS: ValueRef,
                               RHS: ValueRef,
-                              Name: *c_char)
+                              Name: *const c_char)
                               -> ValueRef;
-        pub fn LLVMBuildNeg(B: BuilderRef, V: ValueRef, Name: *c_char)
+        pub fn LLVMBuildNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
                             -> ValueRef;
-        pub fn LLVMBuildNSWNeg(B: BuilderRef, V: ValueRef, Name: *c_char)
+        pub fn LLVMBuildNSWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
                                -> ValueRef;
-        pub fn LLVMBuildNUWNeg(B: BuilderRef, V: ValueRef, Name: *c_char)
+        pub fn LLVMBuildNUWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
                                -> ValueRef;
-        pub fn LLVMBuildFNeg(B: BuilderRef, V: ValueRef, Name: *c_char)
+        pub fn LLVMBuildFNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
                              -> ValueRef;
-        pub fn LLVMBuildNot(B: BuilderRef, V: ValueRef, Name: *c_char)
+        pub fn LLVMBuildNot(B: BuilderRef, V: ValueRef, Name: *const c_char)
                             -> ValueRef;
 
         /* Memory */
-        pub fn LLVMBuildMalloc(B: BuilderRef, Ty: TypeRef, Name: *c_char)
+        pub fn LLVMBuildMalloc(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
                                -> ValueRef;
         pub fn LLVMBuildArrayMalloc(B: BuilderRef,
                                     Ty: TypeRef,
                                     Val: ValueRef,
-                                    Name: *c_char)
+                                    Name: *const c_char)
                                     -> ValueRef;
-        pub fn LLVMBuildAlloca(B: BuilderRef, Ty: TypeRef, Name: *c_char)
+        pub fn LLVMBuildAlloca(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
                                -> ValueRef;
         pub fn LLVMBuildArrayAlloca(B: BuilderRef,
                                     Ty: TypeRef,
                                     Val: ValueRef,
-                                    Name: *c_char)
+                                    Name: *const c_char)
                                     -> ValueRef;
         pub fn LLVMBuildFree(B: BuilderRef, PointerVal: ValueRef) -> ValueRef;
         pub fn LLVMBuildLoad(B: BuilderRef,
                              PointerVal: ValueRef,
-                             Name: *c_char)
+                             Name: *const c_char)
                              -> ValueRef;
 
         pub fn LLVMBuildStore(B: BuilderRef, Val: ValueRef, Ptr: ValueRef)
@@ -1070,125 +1070,125 @@ pub fn LLVMBuildStore(B: BuilderRef, Val: ValueRef, Ptr: ValueRef)
 
         pub fn LLVMBuildGEP(B: BuilderRef,
                             Pointer: ValueRef,
-                            Indices: *ValueRef,
+                            Indices: *const ValueRef,
                             NumIndices: c_uint,
-                            Name: *c_char)
+                            Name: *const c_char)
                             -> ValueRef;
         pub fn LLVMBuildInBoundsGEP(B: BuilderRef,
                                     Pointer: ValueRef,
-                                    Indices: *ValueRef,
+                                    Indices: *const ValueRef,
                                     NumIndices: c_uint,
-                                    Name: *c_char)
+                                    Name: *const c_char)
                                     -> ValueRef;
         pub fn LLVMBuildStructGEP(B: BuilderRef,
                                   Pointer: ValueRef,
                                   Idx: c_uint,
-                                  Name: *c_char)
+                                  Name: *const c_char)
                                   -> ValueRef;
         pub fn LLVMBuildGlobalString(B: BuilderRef,
-                                     Str: *c_char,
-                                     Name: *c_char)
+                                     Str: *const c_char,
+                                     Name: *const c_char)
                                      -> ValueRef;
         pub fn LLVMBuildGlobalStringPtr(B: BuilderRef,
-                                        Str: *c_char,
-                                        Name: *c_char)
+                                        Str: *const c_char,
+                                        Name: *const c_char)
                                         -> ValueRef;
 
         /* Casts */
         pub fn LLVMBuildTrunc(B: BuilderRef,
                               Val: ValueRef,
                               DestTy: TypeRef,
-                              Name: *c_char)
+                              Name: *const c_char)
                               -> ValueRef;
         pub fn LLVMBuildZExt(B: BuilderRef,
                              Val: ValueRef,
                              DestTy: TypeRef,
-                             Name: *c_char)
+                             Name: *const c_char)
                              -> ValueRef;
         pub fn LLVMBuildSExt(B: BuilderRef,
                              Val: ValueRef,
                              DestTy: TypeRef,
-                             Name: *c_char)
+                             Name: *const c_char)
                              -> ValueRef;
         pub fn LLVMBuildFPToUI(B: BuilderRef,
                                Val: ValueRef,
                                DestTy: TypeRef,
-                               Name: *c_char)
+                               Name: *const c_char)
                                -> ValueRef;
         pub fn LLVMBuildFPToSI(B: BuilderRef,
                                Val: ValueRef,
                                DestTy: TypeRef,
-                               Name: *c_char)
+                               Name: *const c_char)
                                -> ValueRef;
         pub fn LLVMBuildUIToFP(B: BuilderRef,
                                Val: ValueRef,
                                DestTy: TypeRef,
-                               Name: *c_char)
+                               Name: *const c_char)
                                -> ValueRef;
         pub fn LLVMBuildSIToFP(B: BuilderRef,
                                Val: ValueRef,
                                DestTy: TypeRef,
-                               Name: *c_char)
+                               Name: *const c_char)
                                -> ValueRef;
         pub fn LLVMBuildFPTrunc(B: BuilderRef,
                                 Val: ValueRef,
                                 DestTy: TypeRef,
-                                Name: *c_char)
+                                Name: *const c_char)
                                 -> ValueRef;
         pub fn LLVMBuildFPExt(B: BuilderRef,
                               Val: ValueRef,
                               DestTy: TypeRef,
-                              Name: *c_char)
+                              Name: *const c_char)
                               -> ValueRef;
         pub fn LLVMBuildPtrToInt(B: BuilderRef,
                                  Val: ValueRef,
                                  DestTy: TypeRef,
-                                 Name: *c_char)
+                                 Name: *const c_char)
                                  -> ValueRef;
         pub fn LLVMBuildIntToPtr(B: BuilderRef,
                                  Val: ValueRef,
                                  DestTy: TypeRef,
-                                 Name: *c_char)
+                                 Name: *const c_char)
                                  -> ValueRef;
         pub fn LLVMBuildBitCast(B: BuilderRef,
                                 Val: ValueRef,
                                 DestTy: TypeRef,
-                                Name: *c_char)
+                                Name: *const c_char)
                                 -> ValueRef;
         pub fn LLVMBuildZExtOrBitCast(B: BuilderRef,
                                       Val: ValueRef,
                                       DestTy: TypeRef,
-                                      Name: *c_char)
+                                      Name: *const c_char)
                                       -> ValueRef;
         pub fn LLVMBuildSExtOrBitCast(B: BuilderRef,
                                       Val: ValueRef,
                                       DestTy: TypeRef,
-                                      Name: *c_char)
+                                      Name: *const c_char)
                                       -> ValueRef;
         pub fn LLVMBuildTruncOrBitCast(B: BuilderRef,
                                        Val: ValueRef,
                                        DestTy: TypeRef,
-                                       Name: *c_char)
+                                       Name: *const c_char)
                                        -> ValueRef;
         pub fn LLVMBuildCast(B: BuilderRef,
                              Op: Opcode,
                              Val: ValueRef,
                              DestTy: TypeRef,
-                             Name: *c_char) -> ValueRef;
+                             Name: *const c_char) -> ValueRef;
         pub fn LLVMBuildPointerCast(B: BuilderRef,
                                     Val: ValueRef,
                                     DestTy: TypeRef,
-                                    Name: *c_char)
+                                    Name: *const c_char)
                                     -> ValueRef;
         pub fn LLVMBuildIntCast(B: BuilderRef,
                                 Val: ValueRef,
                                 DestTy: TypeRef,
-                                Name: *c_char)
+                                Name: *const c_char)
                                 -> ValueRef;
         pub fn LLVMBuildFPCast(B: BuilderRef,
                                Val: ValueRef,
                                DestTy: TypeRef,
-                               Name: *c_char)
+                               Name: *const c_char)
                                -> ValueRef;
 
         /* Comparisons */
@@ -1196,78 +1196,78 @@ pub fn LLVMBuildICmp(B: BuilderRef,
                              Op: c_uint,
                              LHS: ValueRef,
                              RHS: ValueRef,
-                             Name: *c_char)
+                             Name: *const c_char)
                              -> ValueRef;
         pub fn LLVMBuildFCmp(B: BuilderRef,
                              Op: c_uint,
                              LHS: ValueRef,
                              RHS: ValueRef,
-                             Name: *c_char)
+                             Name: *const c_char)
                              -> ValueRef;
 
         /* Miscellaneous instructions */
-        pub fn LLVMBuildPhi(B: BuilderRef, Ty: TypeRef, Name: *c_char)
+        pub fn LLVMBuildPhi(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
                             -> ValueRef;
         pub fn LLVMBuildCall(B: BuilderRef,
                              Fn: ValueRef,
-                             Args: *ValueRef,
+                             Args: *const ValueRef,
                              NumArgs: c_uint,
-                             Name: *c_char)
+                             Name: *const c_char)
                              -> ValueRef;
         pub fn LLVMBuildSelect(B: BuilderRef,
                                If: ValueRef,
                                Then: ValueRef,
                                Else: ValueRef,
-                               Name: *c_char)
+                               Name: *const c_char)
                                -> ValueRef;
         pub fn LLVMBuildVAArg(B: BuilderRef,
                               list: ValueRef,
                               Ty: TypeRef,
-                              Name: *c_char)
+                              Name: *const c_char)
                               -> ValueRef;
         pub fn LLVMBuildExtractElement(B: BuilderRef,
                                        VecVal: ValueRef,
                                        Index: ValueRef,
-                                       Name: *c_char)
+                                       Name: *const c_char)
                                        -> ValueRef;
         pub fn LLVMBuildInsertElement(B: BuilderRef,
                                       VecVal: ValueRef,
                                       EltVal: ValueRef,
                                       Index: ValueRef,
-                                      Name: *c_char)
+                                      Name: *const c_char)
                                       -> ValueRef;
         pub fn LLVMBuildShuffleVector(B: BuilderRef,
                                       V1: ValueRef,
                                       V2: ValueRef,
                                       Mask: ValueRef,
-                                      Name: *c_char)
+                                      Name: *const c_char)
                                       -> ValueRef;
         pub fn LLVMBuildExtractValue(B: BuilderRef,
                                      AggVal: ValueRef,
                                      Index: c_uint,
-                                     Name: *c_char)
+                                     Name: *const c_char)
                                      -> ValueRef;
         pub fn LLVMBuildInsertValue(B: BuilderRef,
                                     AggVal: ValueRef,
                                     EltVal: ValueRef,
                                     Index: c_uint,
-                                    Name: *c_char)
+                                    Name: *const c_char)
                                     -> ValueRef;
 
-        pub fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *c_char)
+        pub fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *const c_char)
                                -> ValueRef;
-        pub fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: *c_char)
+        pub fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: *const c_char)
                                   -> ValueRef;
         pub fn LLVMBuildPtrDiff(B: BuilderRef,
                                 LHS: ValueRef,
                                 RHS: ValueRef,
-                                Name: *c_char)
+                                Name: *const c_char)
                                 -> ValueRef;
 
         /* Atomic Operations */
         pub fn LLVMBuildAtomicLoad(B: BuilderRef,
                                    PointerVal: ValueRef,
-                                   Name: *c_char,
+                                   Name: *const c_char,
                                    Order: AtomicOrdering,
                                    Alignment: c_uint)
                                    -> ValueRef;
@@ -1302,10 +1302,10 @@ pub fn LLVMBuildAtomicRMW(B: BuilderRef,
         pub fn LLVMIsAStoreInst(Inst: ValueRef) -> ValueRef;
 
         /** Writes a module to the specified path. Returns 0 on success. */
-        pub fn LLVMWriteBitcodeToFile(M: ModuleRef, Path: *c_char) -> c_int;
+        pub fn LLVMWriteBitcodeToFile(M: ModuleRef, Path: *const c_char) -> c_int;
 
         /** Creates target data from a target layout string. */
-        pub fn LLVMCreateTargetData(StringRep: *c_char) -> TargetDataRef;
+        pub fn LLVMCreateTargetData(StringRep: *const c_char) -> TargetDataRef;
         /// Adds the target data to the given pass manager. The pass manager
         /// references the target data only weakly.
         pub fn LLVMAddTargetData(TD: TargetDataRef, PM: PassManagerRef);
@@ -1464,21 +1464,21 @@ pub fn LLVMIsSectionIteratorAtEnd(ObjFile: ObjectFileRef,
         /** Returns the current section size. */
         pub fn LLVMGetSectionSize(SI: SectionIteratorRef) -> c_ulonglong;
         /** Returns the current section contents as a string buffer. */
-        pub fn LLVMGetSectionContents(SI: SectionIteratorRef) -> *c_char;
+        pub fn LLVMGetSectionContents(SI: SectionIteratorRef) -> *const c_char;
 
         /** Reads the given file and returns it as a memory buffer. Use
             LLVMDisposeMemoryBuffer() to get rid of it. */
-        pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: *c_char)
+        pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: *const c_char)
             -> MemoryBufferRef;
         /** Borrows the contents of the memory buffer (doesn't copy it) */
-        pub fn LLVMCreateMemoryBufferWithMemoryRange(InputData: *c_char,
+        pub fn LLVMCreateMemoryBufferWithMemoryRange(InputData: *const c_char,
                                                      InputDataLength: size_t,
-                                                     BufferName: *c_char,
+                                                     BufferName: *const c_char,
                                                      RequiresNull: Bool)
             -> MemoryBufferRef;
-        pub fn LLVMCreateMemoryBufferWithMemoryRangeCopy(InputData: *c_char,
+        pub fn LLVMCreateMemoryBufferWithMemoryRangeCopy(InputData: *const c_char,
                                                          InputDataLength: size_t,
-                                                         BufferName: *c_char)
+                                                         BufferName: *const c_char)
             -> MemoryBufferRef;
 
         pub fn LLVMIsMultithreaded() -> Bool;
@@ -1486,20 +1486,20 @@ pub fn LLVMCreateMemoryBufferWithMemoryRangeCopy(InputData: *c_char,
 
         /** Returns a string describing the last error caused by an LLVMRust*
             call. */
-        pub fn LLVMRustGetLastError() -> *c_char;
+        pub fn LLVMRustGetLastError() -> *const c_char;
 
         /// Print the pass timings since static dtors aren't picking them up.
         pub fn LLVMRustPrintPassTimings();
 
-        pub fn LLVMStructCreateNamed(C: ContextRef, Name: *c_char) -> TypeRef;
+        pub fn LLVMStructCreateNamed(C: ContextRef, Name: *const c_char) -> TypeRef;
 
         pub fn LLVMStructSetBody(StructTy: TypeRef,
-                                 ElementTypes: *TypeRef,
+                                 ElementTypes: *const TypeRef,
                                  ElementCount: c_uint,
                                  Packed: Bool);
 
         pub fn LLVMConstNamedStruct(S: TypeRef,
-                                    ConstantVals: *ValueRef,
+                                    ConstantVals: *const ValueRef,
                                     Count: c_uint)
                                     -> ValueRef;
 
@@ -1508,8 +1508,8 @@ pub fn LLVMConstNamedStruct(S: TypeRef,
 
         /** Prepares inline assembly. */
         pub fn LLVMInlineAsm(Ty: TypeRef,
-                             AsmString: *c_char,
-                             Constraints: *c_char,
+                             AsmString: *const c_char,
+                             Constraints: *const c_char,
                              SideEffects: Bool,
                              AlignStack: Bool,
                              Dialect: c_uint)
@@ -1518,7 +1518,7 @@ pub fn LLVMInlineAsm(Ty: TypeRef,
         pub static LLVMRustDebugMetadataVersion: u32;
 
         pub fn LLVMRustAddModuleFlag(M: ModuleRef,
-                                     name: *c_char,
+                                     name: *const c_char,
                                      value: u32);
 
         pub fn LLVMDIBuilderCreate(M: ModuleRef) -> DIBuilderRef;
@@ -1529,17 +1529,17 @@ pub fn LLVMRustAddModuleFlag(M: ModuleRef,
 
         pub fn LLVMDIBuilderCreateCompileUnit(Builder: DIBuilderRef,
                                               Lang: c_uint,
-                                              File: *c_char,
-                                              Dir: *c_char,
-                                              Producer: *c_char,
+                                              File: *const c_char,
+                                              Dir: *const c_char,
+                                              Producer: *const c_char,
                                               isOptimized: bool,
-                                              Flags: *c_char,
+                                              Flags: *const c_char,
                                               RuntimeVer: c_uint,
-                                              SplitName: *c_char);
+                                              SplitName: *const c_char);
 
         pub fn LLVMDIBuilderCreateFile(Builder: DIBuilderRef,
-                                       Filename: *c_char,
-                                       Directory: *c_char)
+                                       Filename: *const c_char,
+                                       Directory: *const c_char)
                                        -> DIFile;
 
         pub fn LLVMDIBuilderCreateSubroutineType(Builder: DIBuilderRef,
@@ -1549,8 +1549,8 @@ pub fn LLVMDIBuilderCreateSubroutineType(Builder: DIBuilderRef,
 
         pub fn LLVMDIBuilderCreateFunction(Builder: DIBuilderRef,
                                            Scope: DIDescriptor,
-                                           Name: *c_char,
-                                           LinkageName: *c_char,
+                                           Name: *const c_char,
+                                           LinkageName: *const c_char,
                                            File: DIFile,
                                            LineNo: c_uint,
                                            Ty: DIType,
@@ -1565,7 +1565,7 @@ pub fn LLVMDIBuilderCreateFunction(Builder: DIBuilderRef,
                                            -> DISubprogram;
 
         pub fn LLVMDIBuilderCreateBasicType(Builder: DIBuilderRef,
-                                            Name: *c_char,
+                                            Name: *const c_char,
                                             SizeInBits: c_ulonglong,
                                             AlignInBits: c_ulonglong,
                                             Encoding: c_uint)
@@ -1575,12 +1575,12 @@ pub fn LLVMDIBuilderCreatePointerType(Builder: DIBuilderRef,
                                               PointeeTy: DIType,
                                               SizeInBits: c_ulonglong,
                                               AlignInBits: c_ulonglong,
-                                              Name: *c_char)
+                                              Name: *const c_char)
                                               -> DIDerivedType;
 
         pub fn LLVMDIBuilderCreateStructType(Builder: DIBuilderRef,
                                              Scope: DIDescriptor,
-                                             Name: *c_char,
+                                             Name: *const c_char,
                                              File: DIFile,
                                              LineNumber: c_uint,
                                              SizeInBits: c_ulonglong,
@@ -1590,12 +1590,12 @@ pub fn LLVMDIBuilderCreateStructType(Builder: DIBuilderRef,
                                              Elements: DIArray,
                                              RunTimeLang: c_uint,
                                              VTableHolder: ValueRef,
-                                             UniqueId: *c_char)
+                                             UniqueId: *const c_char)
                                              -> DICompositeType;
 
         pub fn LLVMDIBuilderCreateMemberType(Builder: DIBuilderRef,
                                              Scope: DIDescriptor,
-                                             Name: *c_char,
+                                             Name: *const c_char,
                                              File: DIFile,
                                              LineNo: c_uint,
                                              SizeInBits: c_ulonglong,
@@ -1615,8 +1615,8 @@ pub fn LLVMDIBuilderCreateLexicalBlock(Builder: DIBuilderRef,
 
         pub fn LLVMDIBuilderCreateStaticVariable(Builder: DIBuilderRef,
                                                  Context: DIDescriptor,
-                                                 Name: *c_char,
-                                                 LinkageName: *c_char,
+                                                 Name: *const c_char,
+                                                 LinkageName: *const c_char,
                                                  File: DIFile,
                                                  LineNo: c_uint,
                                                  Ty: DIType,
@@ -1628,7 +1628,7 @@ pub fn LLVMDIBuilderCreateStaticVariable(Builder: DIBuilderRef,
         pub fn LLVMDIBuilderCreateLocalVariable(Builder: DIBuilderRef,
                                                 Tag: c_uint,
                                                 Scope: DIDescriptor,
-                                                Name: *c_char,
+                                                Name: *const c_char,
                                                 File: DIFile,
                                                 LineNo: c_uint,
                                                 Ty: DIType,
@@ -1657,7 +1657,7 @@ pub fn LLVMDIBuilderGetOrCreateSubrange(Builder: DIBuilderRef,
                                                 -> DISubrange;
 
         pub fn LLVMDIBuilderGetOrCreateArray(Builder: DIBuilderRef,
-                                             Ptr: *DIDescriptor,
+                                             Ptr: *const DIDescriptor,
                                              Count: c_uint)
                                              -> DIArray;
 
@@ -1674,13 +1674,13 @@ pub fn LLVMDIBuilderInsertDeclareBefore(Builder: DIBuilderRef,
                                                 -> ValueRef;
 
         pub fn LLVMDIBuilderCreateEnumerator(Builder: DIBuilderRef,
-                                             Name: *c_char,
+                                             Name: *const c_char,
                                              Val: c_ulonglong)
                                              -> ValueRef;
 
         pub fn LLVMDIBuilderCreateEnumerationType(Builder: DIBuilderRef,
                                                   Scope: ValueRef,
-                                                  Name: *c_char,
+                                                  Name: *const c_char,
                                                   File: ValueRef,
                                                   LineNumber: c_uint,
                                                   SizeInBits: c_ulonglong,
@@ -1691,7 +1691,7 @@ pub fn LLVMDIBuilderCreateEnumerationType(Builder: DIBuilderRef,
 
         pub fn LLVMDIBuilderCreateUnionType(Builder: DIBuilderRef,
                                             Scope: ValueRef,
-                                            Name: *c_char,
+                                            Name: *const c_char,
                                             File: ValueRef,
                                             LineNumber: c_uint,
                                             SizeInBits: c_ulonglong,
@@ -1699,14 +1699,14 @@ pub fn LLVMDIBuilderCreateUnionType(Builder: DIBuilderRef,
                                             Flags: c_uint,
                                             Elements: ValueRef,
                                             RunTimeLang: c_uint,
-                                            UniqueId: *c_char)
+                                            UniqueId: *const c_char)
                                             -> ValueRef;
 
         pub fn LLVMSetUnnamedAddr(GlobalVar: ValueRef, UnnamedAddr: Bool);
 
         pub fn LLVMDIBuilderCreateTemplateTypeParameter(Builder: DIBuilderRef,
                                                         Scope: ValueRef,
-                                                        Name: *c_char,
+                                                        Name: *const c_char,
                                                         Ty: ValueRef,
                                                         File: ValueRef,
                                                         LineNo: c_uint,
@@ -1720,25 +1720,25 @@ pub fn LLVMDIBuilderCreateTemplateTypeParameter(Builder: DIBuilderRef,
         pub fn LLVMDIBuilderCreateComplexVariable(Builder: DIBuilderRef,
             Tag: c_uint,
             Scope: ValueRef,
-            Name: *c_char,
+            Name: *const c_char,
             File: ValueRef,
             LineNo: c_uint,
             Ty: ValueRef,
-            AddrOps: *ValueRef,
+            AddrOps: *const ValueRef,
             AddrOpsCount: c_uint,
             ArgNo: c_uint)
             -> ValueRef;
 
         pub fn LLVMDIBuilderCreateNameSpace(Builder: DIBuilderRef,
                                             Scope: ValueRef,
-                                            Name: *c_char,
+                                            Name: *const c_char,
                                             File: ValueRef,
                                             LineNo: c_uint)
                                             -> ValueRef;
 
         pub fn LLVMDICompositeTypeSetTypeArray(CompositeType: ValueRef, TypeArray: ValueRef);
-        pub fn LLVMTypeToString(Type: TypeRef) -> *c_char;
-        pub fn LLVMValueToString(value_ref: ValueRef) -> *c_char;
+        pub fn LLVMTypeToString(Type: TypeRef) -> *const c_char;
+        pub fn LLVMValueToString(value_ref: ValueRef) -> *const c_char;
 
         pub fn LLVMIsAArgument(value_ref: ValueRef) -> ValueRef;
 
@@ -1760,10 +1760,10 @@ pub fn LLVMDIBuilderCreateNameSpace(Builder: DIBuilderRef,
         pub fn LLVMInitializeMipsAsmPrinter();
         pub fn LLVMInitializeMipsAsmParser();
 
-        pub fn LLVMRustAddPass(PM: PassManagerRef, Pass: *c_char) -> bool;
-        pub fn LLVMRustCreateTargetMachine(Triple: *c_char,
-                                           CPU: *c_char,
-                                           Features: *c_char,
+        pub fn LLVMRustAddPass(PM: PassManagerRef, Pass: *const c_char) -> bool;
+        pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
+                                           CPU: *const c_char,
+                                           Features: *const c_char,
                                            Model: CodeGenModel,
                                            Reloc: RelocMode,
                                            Level: CodeGenOptLevel,
@@ -1785,27 +1785,27 @@ pub fn LLVMRustAddLibraryInfo(PM: PassManagerRef, M: ModuleRef,
         pub fn LLVMRustWriteOutputFile(T: TargetMachineRef,
                                        PM: PassManagerRef,
                                        M: ModuleRef,
-                                       Output: *c_char,
+                                       Output: *const c_char,
                                        FileType: FileType) -> bool;
         pub fn LLVMRustPrintModule(PM: PassManagerRef,
                                    M: ModuleRef,
-                                   Output: *c_char);
-        pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: **c_char);
+                                   Output: *const c_char);
+        pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
         pub fn LLVMRustPrintPasses();
-        pub fn LLVMRustSetNormalizedTarget(M: ModuleRef, triple: *c_char);
+        pub fn LLVMRustSetNormalizedTarget(M: ModuleRef, triple: *const c_char);
         pub fn LLVMRustAddAlwaysInlinePass(P: PassManagerBuilderRef,
                                            AddLifetimes: bool);
         pub fn LLVMRustLinkInExternalBitcode(M: ModuleRef,
-                                             bc: *c_char,
+                                             bc: *const c_char,
                                              len: size_t) -> bool;
         pub fn LLVMRustRunRestrictionPass(M: ModuleRef,
-                                          syms: **c_char,
+                                          syms: *const *const c_char,
                                           len: size_t);
         pub fn LLVMRustMarkAllFunctionsNounwind(M: ModuleRef);
 
-        pub fn LLVMRustOpenArchive(path: *c_char) -> ArchiveRef;
-        pub fn LLVMRustArchiveReadSection(AR: ArchiveRef, name: *c_char,
-                                          out_len: *mut size_t) -> *c_char;
+        pub fn LLVMRustOpenArchive(path: *const c_char) -> ArchiveRef;
+        pub fn LLVMRustArchiveReadSection(AR: ArchiveRef, name: *const c_char,
+                                          out_len: *mut size_t) -> *const c_char;
         pub fn LLVMRustDestroyArchive(AR: ArchiveRef);
 
         pub fn LLVMRustSetDLLExportStorageClass(V: ValueRef);
@@ -1813,7 +1813,7 @@ pub fn LLVMRustArchiveReadSection(AR: ArchiveRef, name: *c_char,
         pub fn LLVMVersionMinor() -> c_int;
 
         pub fn LLVMRustGetSectionName(SI: SectionIteratorRef,
-                                      data: *mut *c_char) -> c_int;
+                                      data: *mut *const c_char) -> c_int;
     }
 }
 
index 5aa10b5ab8e8ac9c91db7890ca68d13d3cc317bb..8896a068baa76b992f80bf708cd8d4ab59371f05 100644 (file)
@@ -176,7 +176,7 @@ pub struct LintId {
 
 impl PartialEq for LintId {
     fn eq(&self, other: &LintId) -> bool {
-        (self.lint as *Lint) == (other.lint as *Lint)
+        (self.lint as *const Lint) == (other.lint as *const Lint)
     }
 }
 
@@ -184,7 +184,7 @@ impl Eq for LintId { }
 
 impl<S: hash::Writer> hash::Hash<S> for LintId {
     fn hash(&self, state: &mut S) {
-        let ptr = self.lint as *Lint;
+        let ptr = self.lint as *const Lint;
         ptr.hash(state);
     }
 }
index b606ba3b87a53e983d14d317d28b3389d497dcdc..c5789e4442a9d20e955af7b784dab36418718019 100644 (file)
@@ -1308,7 +1308,7 @@ fn my_visit_expr(_e: &Expr) { }
 
 fn my_visit_item(i: &Item,
                  ebml_w: &mut Encoder,
-                 ecx_ptr: *int,
+                 ecx_ptr: *const int,
                  index: &mut Vec<entry<i64>>) {
     let mut ebml_w = unsafe { ebml_w.unsafe_clone() };
     // See above
@@ -1320,7 +1320,7 @@ fn my_visit_item(i: &Item,
 
 fn my_visit_foreign_item(ni: &ForeignItem,
                          ebml_w: &mut Encoder,
-                         ecx_ptr:*int,
+                         ecx_ptr:*const int,
                          index: &mut Vec<entry<i64>>) {
     // See above
     let ecx: &EncodeContext = unsafe { mem::transmute(ecx_ptr) };
@@ -1341,7 +1341,7 @@ fn my_visit_foreign_item(ni: &ForeignItem,
 
 struct EncodeVisitor<'a,'b> {
     ebml_w_for_visit_item: &'a mut Encoder<'b>,
-    ecx_ptr:*int,
+    ecx_ptr:*const int,
     index: &'a mut Vec<entry<i64>>,
 }
 
@@ -1386,7 +1386,7 @@ fn encode_info_for_items(ecx: &EncodeContext,
                         Public);
 
     // See comment in `encode_side_tables_for_ii` in astencode
-    let ecx_ptr: *int = unsafe { mem::transmute(ecx) };
+    let ecx_ptr: *const int = unsafe { mem::transmute(ecx) };
     visit::walk_crate(&mut EncodeVisitor {
         index: &mut index,
         ecx_ptr: ecx_ptr,
index eca0432229e2f961087610374a2d5d6e65123857..ccab76ca6f012d641250ceaa8f369e953a793ff1 100644 (file)
@@ -545,14 +545,15 @@ fn get_metadata_section_imp(os: abi::Os, filename: &Path) -> Result<MetadataBlob
         while llvm::LLVMIsSectionIteratorAtEnd(of.llof, si.llsi) == False {
             let mut name_buf = ptr::null();
             let name_len = llvm::LLVMRustGetSectionName(si.llsi, &mut name_buf);
-            let name = str::raw::from_buf_len(name_buf as *u8, name_len as uint);
+            let name = str::raw::from_buf_len(name_buf as *const u8,
+                                              name_len as uint);
             debug!("get_metadata_section: name {}", name);
             if read_meta_section_name(os).as_slice() == name.as_slice() {
                 let cbuf = llvm::LLVMGetSectionContents(si.llsi);
                 let csz = llvm::LLVMGetSectionSize(si.llsi) as uint;
                 let mut found =
                     Err(format!("metadata not found: '{}'", filename.display()));
-                let cvbuf: *u8 = mem::transmute(cbuf);
+                let cvbuf: *const u8 = mem::transmute(cbuf);
                 let vlen = encoder::metadata_encoding_version.len();
                 debug!("checking {} bytes of metadata-version stamp",
                        vlen);
index 31a3057e8a644c37c6896b9e1a830fb3207f5440..19e7b9329b1ff218a9f25627766706e19732b98a 100644 (file)
@@ -943,7 +943,7 @@ fn id(&mut self, id: ast::NodeId) {
 }
 
 struct SideTableEncodingIdVisitor<'a,'b> {
-    ecx_ptr: *libc::c_void,
+    ecx_ptr: *const libc::c_void,
     new_ebml_w: &'a mut Encoder<'b>,
 }
 
index f09af6ea4416e415157168443bdaeb2fa6289763..77cb5f667fd000c9b7fbe57655718d4181ea901c 100644 (file)
@@ -360,7 +360,8 @@ fn visit_fn(ir: &mut IrMaps,
     let mut fn_maps = IrMaps::new(ir.tcx);
 
     unsafe {
-        debug!("creating fn_maps: {}", transmute::<&IrMaps, *IrMaps>(&fn_maps));
+        debug!("creating fn_maps: {}",
+               transmute::<&IrMaps, *const IrMaps>(&fn_maps));
     }
 
     for arg in decl.inputs.iter() {
index 5e7284dbfd1def1a5545c8ac173506d2e153c93c..0cd3b6e7d79184ee8dd9f1f737e278ae0d7cba6e 100644 (file)
@@ -44,7 +44,7 @@ fn len(&self) -> uint {
 
     fn as_slice<'a>(&'a self) -> &'a [T] {
         unsafe {
-            let ptr: *T = mem::transmute(self);
+            let ptr: *const T = mem::transmute(self);
             let slice = raw::Slice { data: ptr, len: 3 };
             mem::transmute(slice)
         }
@@ -52,7 +52,7 @@ fn as_slice<'a>(&'a self) -> &'a [T] {
 
     fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] {
         unsafe {
-            let ptr: *T = mem::transmute(self);
+            let ptr: *const T = mem::transmute(self);
             let slice = raw::Slice { data: ptr, len: 3 };
             mem::transmute(slice)
         }
index e04454d4a68d0233099381dca4f55ff45c8c0659..e1c02f543bf9e7c4ee2046012efeeeb5ce3c69cc 100644 (file)
@@ -453,7 +453,7 @@ pub fn StructGEP(cx: &Block, pointer: ValueRef, idx: uint) -> ValueRef {
     }
 }
 
-pub fn GlobalString(cx: &Block, _str: *c_char) -> ValueRef {
+pub fn GlobalString(cx: &Block, _str: *const c_char) -> ValueRef {
     unsafe {
         if cx.unreachable.get() {
             return llvm::LLVMGetUndef(Type::i8p(cx.ccx()).to_ref());
@@ -462,7 +462,7 @@ pub fn GlobalString(cx: &Block, _str: *c_char) -> ValueRef {
     }
 }
 
-pub fn GlobalStringPtr(cx: &Block, _str: *c_char) -> ValueRef {
+pub fn GlobalStringPtr(cx: &Block, _str: *const c_char) -> ValueRef {
     unsafe {
         if cx.unreachable.get() {
             return llvm::LLVMGetUndef(Type::i8p(cx.ccx()).to_ref());
@@ -577,7 +577,8 @@ pub fn TruncOrBitCast(cx: &Block, val: ValueRef, dest_ty: Type) -> ValueRef {
     }
 }
 
-pub fn Cast(cx: &Block, op: Opcode, val: ValueRef, dest_ty: Type, _: *u8)
+pub fn Cast(cx: &Block, op: Opcode, val: ValueRef, dest_ty: Type,
+            _: *const u8)
      -> ValueRef {
     unsafe {
         if cx.unreachable.get() { return llvm::LLVMGetUndef(dest_ty.to_ref()); }
@@ -636,7 +637,8 @@ pub fn EmptyPhi(cx: &Block, ty: Type) -> ValueRef {
     }
 }
 
-pub fn Phi(cx: &Block, ty: Type, vals: &[ValueRef], bbs: &[BasicBlockRef]) -> ValueRef {
+pub fn Phi(cx: &Block, ty: Type, vals: &[ValueRef],
+           bbs: &[BasicBlockRef]) -> ValueRef {
     unsafe {
         if cx.unreachable.get() { return llvm::LLVMGetUndef(ty.to_ref()); }
         B(cx).phi(ty, vals, bbs)
@@ -672,7 +674,7 @@ pub fn add_comment(cx: &Block, text: &str) {
     B(cx).add_comment(text)
 }
 
-pub fn InlineAsmCall(cx: &Block, asm: *c_char, cons: *c_char,
+pub fn InlineAsmCall(cx: &Block, asm: *const c_char, cons: *const c_char,
                      inputs: &[ValueRef], output: Type,
                      volatile: bool, alignstack: bool,
                      dia: AsmDialect) -> ValueRef {
index 4078268c6a5d8d43b9b88ce809406f511b6ebcce..c64f4cfa8779887d8d341457866027e896379573 100644 (file)
@@ -31,9 +31,9 @@ pub struct Builder<'a> {
 
 // This is a really awful way to get a zero-length c-string, but better (and a
 // lot more efficient) than doing str::as_c_str("", ...) every time.
-pub fn noname() -> *c_char {
+pub fn noname() -> *const c_char {
     static cnull: c_char = 0;
-    &cnull as *c_char
+    &cnull as *const c_char
 }
 
 impl<'a> Builder<'a> {
@@ -564,14 +564,14 @@ pub fn struct_gep(&self, ptr: ValueRef, idx: uint) -> ValueRef {
         }
     }
 
-    pub fn global_string(&self, _str: *c_char) -> ValueRef {
+    pub fn global_string(&self, _str: *const c_char) -> ValueRef {
         self.count_insn("globalstring");
         unsafe {
             llvm::LLVMBuildGlobalString(self.llbuilder, _str, noname())
         }
     }
 
-    pub fn global_string_ptr(&self, _str: *c_char) -> ValueRef {
+    pub fn global_string_ptr(&self, _str: *const c_char) -> ValueRef {
         self.count_insn("globalstringptr");
         unsafe {
             llvm::LLVMBuildGlobalStringPtr(self.llbuilder, _str, noname())
@@ -774,7 +774,7 @@ pub fn add_comment(&self, text: &str) {
         }
     }
 
-    pub fn inline_asm_call(&self, asm: *c_char, cons: *c_char,
+    pub fn inline_asm_call(&self, asm: *const c_char, cons: *const c_char,
                          inputs: &[ValueRef], output: Type,
                          volatile: bool, alignstack: bool,
                          dia: AsmDialect) -> ValueRef {
index a1923022e7b176dad7326b7000356453f8e6b033..b1577a6abfe1452f461a3a59c20ebb388424ad2a 100644 (file)
@@ -471,7 +471,7 @@ pub fn ty_to_str(&self, t: ty::t) -> String {
     }
 
     pub fn to_str(&self) -> String {
-        let blk: *Block = self;
+        let blk: *const Block = self;
         format!("[block {}]", blk)
     }
 }
@@ -568,7 +568,7 @@ pub fn C_cstr(cx: &CrateContext, s: InternedString, null_terminated: bool) -> Va
         }
 
         let sc = llvm::LLVMConstStringInContext(cx.llcx,
-                                                s.get().as_ptr() as *c_char,
+                                                s.get().as_ptr() as *const c_char,
                                                 s.get().len() as c_uint,
                                                 !null_terminated as Bool);
 
@@ -636,7 +636,7 @@ pub fn C_array(ty: Type, elts: &[ValueRef]) -> ValueRef {
 
 pub fn C_bytes(ccx: &CrateContext, bytes: &[u8]) -> ValueRef {
     unsafe {
-        let ptr = bytes.as_ptr() as *c_char;
+        let ptr = bytes.as_ptr() as *const c_char;
         return llvm::LLVMConstStringInContext(ccx.llcx, ptr, bytes.len() as c_uint, True);
     }
 }
index 68c6f1752bdfea033d22f74012feacba9458cc1a..6387ec791bab93d6b5f4c5c9698c718ad2db55b3 100644 (file)
@@ -221,8 +221,8 @@ pub fn new(name: &str,
                     llvm_insns: RefCell::new(HashMap::new()),
                     fn_stats: RefCell::new(Vec::new()),
                 },
-                int_type: Type::from_ref(ptr::null()),
-                opaque_vec_type: Type::from_ref(ptr::null()),
+                int_type: Type::from_ref(ptr::mut_null()),
+                opaque_vec_type: Type::from_ref(ptr::mut_null()),
                 builder: BuilderRef_res(llvm::LLVMCreateBuilderInContext(llcx)),
                 uses_gc: false,
                 dbg_cx: dbg_cx,
index e7895a1bb9a6dbac4932172c4c41af651988dd3e..65f272072c0976611288330da63503de7979394c 100644 (file)
@@ -805,7 +805,7 @@ pub fn create_global_var_metadata(cx: &CrateContext,
                                                         type_metadata,
                                                         is_local_to_unit,
                                                         global,
-                                                        ptr::null());
+                                                        ptr::mut_null());
             }
         })
     });
@@ -980,7 +980,7 @@ pub fn create_argument_metadata(bcx: &Block, arg: &ast::Arg) {
             }
         };
 
-        if unsafe { llvm::LLVMIsAAllocaInst(llarg.val) } == ptr::null() {
+        if unsafe { llvm::LLVMIsAAllocaInst(llarg.val) } == ptr::mut_null() {
             cx.sess().span_bug(span, "debuginfo::create_argument_metadata() - \
                                     Referenced variable location is not an alloca!");
         }
@@ -1221,7 +1221,7 @@ pub fn create_function_debug_context(cx: &CrateContext,
                     cx.sess().opts.optimize != config::No,
                     llfn,
                     template_parameters,
-                    ptr::null())
+                    ptr::mut_null())
             }
         })
     });
@@ -1257,7 +1257,7 @@ fn get_function_signature(cx: &CrateContext,
         // Return type -- llvm::DIBuilder wants this at index 0
         match fn_decl.output.node {
             ast::TyNil => {
-                signature.push(ptr::null());
+                signature.push(ptr::mut_null());
             }
             _ => {
                 assert_type_for_node_id(cx, fn_ast_id, error_span);
@@ -1328,7 +1328,7 @@ fn get_template_parameters(cx: &CrateContext,
                             file_metadata,
                             name,
                             actual_self_type_metadata,
-                            ptr::null(),
+                            ptr::mut_null(),
                             0,
                             0)
                     }
@@ -1361,7 +1361,7 @@ fn get_template_parameters(cx: &CrateContext,
                             file_metadata,
                             name,
                             actual_type_metadata,
-                            ptr::null(),
+                            ptr::mut_null(),
                             0,
                             0)
                     }
@@ -2374,7 +2374,7 @@ fn prepare_enum_metadata(cx: &CrateContext,
                 bytes_to_bits(enum_type_size),
                 bytes_to_bits(enum_type_align),
                 0, // Flags
-                ptr::null(),
+                ptr::mut_null(),
                 0, // RuntimeLang
                 unique_type_id_str)
             }
@@ -2554,10 +2554,10 @@ fn create_struct_stub(cx: &CrateContext,
                     bytes_to_bits(struct_size),
                     bytes_to_bits(struct_align),
                     0,
-                    ptr::null(),
+                    ptr::mut_null(),
                     empty_array,
                     0,
-                    ptr::null(),
+                    ptr::mut_null(),
                     unique_type_id)
             })
         })
@@ -2855,7 +2855,7 @@ fn subroutine_type_metadata(cx: &CrateContext,
 
     // return type
     signature_metadata.push(match ty::get(signature.output).sty {
-        ty::ty_nil => ptr::null(),
+        ty::ty_nil => ptr::mut_null(),
         _ => type_metadata(cx, signature.output, span)
     });
 
@@ -3153,7 +3153,8 @@ fn set_debug_location(cx: &CrateContext, debug_location: DebugLocation) {
         KnownLocation { scope, line, .. } => {
             let col = 0u; // Always set the column to zero like Clang and GCC
             debug!("setting debug location to {} {}", line, col);
-            let elements = [C_i32(cx, line as i32), C_i32(cx, col as i32), scope, ptr::null()];
+            let elements = [C_i32(cx, line as i32), C_i32(cx, col as i32),
+                            scope, ptr::mut_null()];
             unsafe {
                 metadata_node = llvm::LLVMMDNodeInContext(debug_context(cx).llcontext,
                                                           elements.as_ptr(),
@@ -3162,7 +3163,7 @@ fn set_debug_location(cx: &CrateContext, debug_location: DebugLocation) {
         }
         UnknownLocation => {
             debug!("clearing debug location ");
-            metadata_node = ptr::null();
+            metadata_node = ptr::mut_null();
         }
     };
 
@@ -3771,7 +3772,7 @@ fn namespace_for_item(cx: &CrateContext, def_id: ast::DefId) -> Rc<NamespaceTree
                     // create and insert
                     let parent_scope = match parent_node {
                         Some(ref node) => node.scope,
-                        None => ptr::null()
+                        None => ptr::mut_null()
                     };
                     let namespace_name = token::get_name(name);
                     let scope = namespace_name.get().with_c_str(|namespace_name| {
@@ -3781,7 +3782,7 @@ fn namespace_for_item(cx: &CrateContext, def_id: ast::DefId) -> Rc<NamespaceTree
                                 parent_scope,
                                 namespace_name,
                                 // cannot reconstruct file ...
-                                ptr::null(),
+                                ptr::mut_null(),
                                 // ... or line information, but that's not so important.
                                 0)
                         }
index 01e3af8a3d79fc956ed3eab5e5bccd1daaceceb2..8d84d089c01b2adff75514cf313a74df9196d7b6 100644 (file)
@@ -158,7 +158,7 @@ pub struct creader_cache_key {
 pub type creader_cache = RefCell<HashMap<creader_cache_key, t>>;
 
 pub struct intern_key {
-    sty: *sty,
+    sty: *const sty,
 }
 
 // NB: Do not replace this with #[deriving(PartialEq)]. The automatically-derived
@@ -409,7 +409,7 @@ enum t_opaque {}
 
 #[allow(raw_pointer_deriving)]
 #[deriving(Clone, PartialEq, Eq, Hash)]
-pub struct t { inner: *t_opaque }
+pub struct t { inner: *const t_opaque }
 
 impl fmt::Show for t {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -1216,7 +1216,7 @@ fn sflags(substs: &Substs) -> uint {
         flags: flags,
     };
 
-    let sty_ptr = &t.sty as *sty;
+    let sty_ptr = &t.sty as *const sty;
 
     let key = intern_key {
         sty: sty_ptr,
@@ -1227,7 +1227,7 @@ fn sflags(substs: &Substs) -> uint {
     cx.next_id.set(cx.next_id.get() + 1);
 
     unsafe {
-        mem::transmute::<*sty, t>(sty_ptr)
+        mem::transmute::<*const sty, t>(sty_ptr)
     }
 }
 
index 0b35eab5679f02cef52235797d9bf6ae85eaeb5e..bb20c3ce0b4aabbe646e69a4409c74b2cf71a58f 100644 (file)
@@ -1262,7 +1262,7 @@ fn anon_regions(&self, span: Span, count: uint)
 
 impl<'a> FnCtxt<'a> {
     pub fn tag(&self) -> String {
-        format!("{}", self as *FnCtxt)
+        format!("{}", self as *const FnCtxt)
     }
 
     pub fn local_ty(&self, span: Span, nid: ast::NodeId) -> ty::t {
index 7d74b8c7296522f1a5f187173a005235c41f67bd..79d0690653faf9d3a6a99d501bea05f3fb947b72 100644 (file)
@@ -129,7 +129,7 @@ fn dylink_registrar(&mut self, vi: &ast::ViewItem, path: Path, symbol: String) {
             let registrar =
                 match lib.symbol(symbol.as_slice()) {
                     Ok(registrar) => {
-                        mem::transmute::<*u8,PluginRegistrarFun>(registrar)
+                        mem::transmute::<*mut u8,PluginRegistrarFun>(registrar)
                     }
                     // again fatal if we can't register macros
                     Err(err) => self.sess.span_fatal(vi.span, err.as_slice())
index 0c0bba992a033a0927752e9fd07198482b50fe0f..6365d7ab9feb455e1590d299d0b15cd658da3f60 100644 (file)
@@ -355,7 +355,12 @@ fn push_sig_to_str(cx: &ctxt,
       ty_float(t) => ast_util::float_ty_to_str(t).to_string(),
       ty_box(typ) => format!("Gc<{}>", ty_to_str(cx, typ)),
       ty_uniq(typ) => format!("Box<{}>", ty_to_str(cx, typ)),
-      ty_ptr(ref tm) => format!("*{}", mt_to_str(cx, tm)),
+      ty_ptr(ref tm) => {
+          format!("*{} {}", match tm.mutbl {
+              ast::MutMutable => "mut",
+              ast::MutImmutable => "const",
+          }, ty_to_str(cx, tm.ty))
+      }
       ty_rptr(r, ref tm) => {
           let mut buf = region_ptr_to_str(cx, r);
           buf.push_str(mt_to_str(cx, tm).as_slice());
index 47d9e66fbd5a51325e2ad79a28b24db0ccb2d10d..d40557fa7253548003680f95f059ddc0be39df5c 100644 (file)
@@ -34,7 +34,7 @@ fn read_u32v_be(dst: &mut[u32], input: &[u8]) {
     assert!(dst.len() * 4 == input.len());
     unsafe {
         let mut x = dst.unsafe_mut_ref(0) as *mut _ as *mut u32;
-        let mut y = input.unsafe_ref(0) as *_ as *u32;
+        let mut y = input.unsafe_ref(0) as *const _ as *const u32;
         for _ in range(0, dst.len()) {
             *x = to_be32(*y);
             x = x.offset(1);
index 800e7f065f1e604ef7422dd273629c89e93ae321..cb2ebd15b3970ffc21733dc3672571bd1d479ba1 100644 (file)
@@ -104,7 +104,7 @@ pub fn new(p: &Path) -> Lock {
                 l_sysid: 0,
             };
             let ret = unsafe {
-                libc::fcntl(fd, os::F_SETLKW, &flock as *os::flock)
+                libc::fcntl(fd, os::F_SETLKW, &flock as *const os::flock)
             };
             if ret == -1 {
                 unsafe { libc::close(fd); }
@@ -125,7 +125,7 @@ fn drop(&mut self) {
                 l_sysid: 0,
             };
             unsafe {
-                libc::fcntl(self.fd, os::F_SETLK, &flock as *os::flock);
+                libc::fcntl(self.fd, os::F_SETLK, &flock as *const os::flock);
                 libc::close(self.fd);
             }
         }
index ccd11c6761107318318701ee01f0894958ae894a..d45dac2f0601b8704b78c878756b3f728bd4bd3d 100644 (file)
 
 struct hoedown_renderer {
     opaque: *mut hoedown_html_renderer_state,
-    blockcode: Option<extern "C" fn(*mut hoedown_buffer, *hoedown_buffer,
-                                    *hoedown_buffer, *mut libc::c_void)>,
-    blockquote: Option<extern "C" fn(*mut hoedown_buffer, *hoedown_buffer,
+    blockcode: Option<extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
+                                    *const hoedown_buffer, *mut libc::c_void)>,
+    blockquote: Option<extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
                                      *mut libc::c_void)>,
-    blockhtml: Option<extern "C" fn(*mut hoedown_buffer, *hoedown_buffer,
+    blockhtml: Option<extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
                                     *mut libc::c_void)>,
-    header: Option<extern "C" fn(*mut hoedown_buffer, *hoedown_buffer,
+    header: Option<extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
                                  libc::c_int, *mut libc::c_void)>,
     other: [libc::size_t, ..28],
 }
@@ -81,7 +81,8 @@ struct hoedown_html_renderer_state {
     opaque: *mut libc::c_void,
     toc_data: html_toc_data,
     flags: libc::c_uint,
-    link_attributes: Option<extern "C" fn(*mut hoedown_buffer, *hoedown_buffer,
+    link_attributes: Option<extern "C" fn(*mut hoedown_buffer,
+                                          *const hoedown_buffer,
                                           *mut libc::c_void)>,
 }
 
@@ -93,13 +94,13 @@ struct html_toc_data {
 }
 
 struct MyOpaque {
-    dfltblk: extern "C" fn(*mut hoedown_buffer, *hoedown_buffer,
-                           *hoedown_buffer, *mut libc::c_void),
+    dfltblk: extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
+                           *const hoedown_buffer, *mut libc::c_void),
     toc_builder: Option<TocBuilder>,
 }
 
 struct hoedown_buffer {
-    data: *u8,
+    data: *const u8,
     size: libc::size_t,
     asize: libc::size_t,
     unit: libc::size_t,
@@ -118,12 +119,12 @@ fn hoedown_document_new(rndr: *mut hoedown_renderer,
                             max_nesting: libc::size_t) -> *mut hoedown_document;
     fn hoedown_document_render(doc: *mut hoedown_document,
                                ob: *mut hoedown_buffer,
-                               document: *u8,
+                               document: *const u8,
                                doc_size: libc::size_t);
     fn hoedown_document_free(md: *mut hoedown_document);
 
     fn hoedown_buffer_new(unit: libc::size_t) -> *mut hoedown_buffer;
-    fn hoedown_buffer_puts(b: *mut hoedown_buffer, c: *libc::c_char);
+    fn hoedown_buffer_puts(b: *mut hoedown_buffer, c: *const libc::c_char);
     fn hoedown_buffer_free(b: *mut hoedown_buffer);
 
 }
@@ -147,13 +148,13 @@ fn stripped_filtered_line<'a>(s: &'a str) -> Option<&'a str> {
 local_data_key!(pub playground_krate: Option<String>)
 
 pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
-    extern fn block(ob: *mut hoedown_buffer, text: *hoedown_buffer,
-                    lang: *hoedown_buffer, opaque: *mut libc::c_void) {
+    extern fn block(ob: *mut hoedown_buffer, text: *const hoedown_buffer,
+                    lang: *const hoedown_buffer, opaque: *mut libc::c_void) {
         unsafe {
             if text.is_null() { return }
 
             let opaque = opaque as *mut hoedown_html_renderer_state;
-            let my_opaque: &MyOpaque = &*((*opaque).opaque as *MyOpaque);
+            let my_opaque: &MyOpaque = &*((*opaque).opaque as *const MyOpaque);
             slice::raw::buf_as_slice((*text).data, (*text).size as uint, |text| {
                 let origtext = str::from_utf8(text).unwrap();
                 debug!("docblock: ==============\n{}\n=======", text);
@@ -213,7 +214,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
         }
     }
 
-    extern fn header(ob: *mut hoedown_buffer, text: *hoedown_buffer,
+    extern fn header(ob: *mut hoedown_buffer, text: *const hoedown_buffer,
                      level: libc::c_int, opaque: *mut libc::c_void) {
         // hoedown does this, we may as well too
         "\n".with_c_str(|p| unsafe { hoedown_buffer_puts(ob, p) });
@@ -304,8 +305,10 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
 }
 
 pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) {
-    extern fn block(_ob: *mut hoedown_buffer, text: *hoedown_buffer,
-                    lang: *hoedown_buffer, opaque: *mut libc::c_void) {
+    extern fn block(_ob: *mut hoedown_buffer,
+                    text: *const hoedown_buffer,
+                    lang: *const hoedown_buffer,
+                    opaque: *mut libc::c_void) {
         unsafe {
             if text.is_null() { return }
             let block_info = if lang.is_null() {
@@ -333,7 +336,8 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) {
         }
     }
 
-    extern fn header(_ob: *mut hoedown_buffer, text: *hoedown_buffer,
+    extern fn header(_ob: *mut hoedown_buffer,
+                     text: *const hoedown_buffer,
                      level: libc::c_int, opaque: *mut libc::c_void) {
         unsafe {
             let opaque = opaque as *mut hoedown_html_renderer_state;
index e5bced8038baf49f2a325a51497e6c739906d17a..9ac366655636cca447ce9c4a00895cb99e06521b 100644 (file)
@@ -48,7 +48,7 @@ pub fn load_plugin(&mut self, name: String) {
         let lib = lib_result.unwrap();
         unsafe {
             let plugin = lib.symbol("rustdoc_plugin_entrypoint").unwrap();
-            self.callbacks.push(mem::transmute::<*u8,PluginCallback>(plugin));
+            self.callbacks.push(mem::transmute::<*mut u8,PluginCallback>(plugin));
         }
         self.dylibs.push(lib);
     }
index 09ae2b31f6368d2c16d7bdc9d82cb148d98daf4c..3c0a4aae251dbd90506a5af37a829274eec771e1 100644 (file)
@@ -23,7 +23,7 @@
 use collections::vec::Vec;
 
 /// One-time global initialization.
-pub unsafe fn init(argc: int, argv: **u8) { imp::init(argc, argv) }
+pub unsafe fn init(argc: int, argv: *const *const u8) { imp::init(argc, argv) }
 
 /// One-time global cleanup.
 pub unsafe fn cleanup() { imp::cleanup() }
@@ -55,7 +55,7 @@ mod imp {
     static mut global_args_ptr: uint = 0;
     static mut lock: StaticNativeMutex = NATIVE_MUTEX_INIT;
 
-    pub unsafe fn init(argc: int, argv: **u8) {
+    pub unsafe fn init(argc: int, argv: *const *const u8) {
         let args = load_argc_and_argv(argc, argv);
         put(args);
     }
@@ -99,7 +99,7 @@ fn get_global_ptr() -> *mut Option<Box<Vec<Vec<u8>>>> {
         unsafe { mem::transmute(&global_args_ptr) }
     }
 
-    unsafe fn load_argc_and_argv(argc: int, argv: **u8) -> Vec<Vec<u8>> {
+    unsafe fn load_argc_and_argv(argc: int, argv: *const *const u8) -> Vec<Vec<u8>> {
         Vec::from_fn(argc as uint, |i| {
             let base = *argv.offset(i as int);
             let mut len = 0;
@@ -151,7 +151,7 @@ mod imp {
     use core::prelude::*;
     use collections::vec::Vec;
 
-    pub unsafe fn init(_argc: int, _argv: **u8) {
+    pub unsafe fn init(_argc: int, _argv: *const *const u8) {
     }
 
     pub fn cleanup() {
index 2f1c38c5686755b6cb9c37f500b783f3fe99fc49..dcba7fb7cb6a6255d51b295c6c9f2d6d3e2d2d17 100644 (file)
@@ -43,7 +43,7 @@ pub fn push(f: proc():Send) {
         rtassert!(!RUNNING.load(atomics::SeqCst));
         let queue = QUEUE.load(atomics::SeqCst);
         rtassert!(queue != 0);
-        (*(queue as *Queue)).lock().push(f);
+        (*(queue as *const Queue)).lock().push(f);
     }
 }
 
index 10d1594e78e0455393677131a41aa0721e4b51d7..26216f655304e734757d588d8c2d9ef85a35f0a6 100644 (file)
@@ -42,7 +42,7 @@
 extern crate libc;
 
 extern {
-    fn puts(s: *libc::c_char);
+    fn puts(s: *const libc::c_char);
 }
 
 fn main() {
@@ -82,7 +82,7 @@ fn main() {
 /// This structure wraps a `*libc::c_char`, and will automatically free the
 /// memory it is pointing to when it goes out of scope.
 pub struct CString {
-    buf: *libc::c_char,
+    buf: *const libc::c_char,
     owns_buffer_: bool,
 }
 
@@ -97,7 +97,7 @@ fn clone(&self) -> CString {
             let len = self.len() + 1;
             let buf = unsafe { malloc_raw(len) } as *mut libc::c_char;
             unsafe { ptr::copy_nonoverlapping_memory(buf, self.buf, len); }
-            CString { buf: buf as *libc::c_char, owns_buffer_: true }
+            CString { buf: buf as *const libc::c_char, owns_buffer_: true }
         }
     }
 }
@@ -118,7 +118,7 @@ fn eq(&self, other: &CString) -> bool {
 
 impl CString {
     /// Create a C String from a pointer.
-    pub unsafe fn new(buf: *libc::c_char, owns_buffer: bool) -> CString {
+    pub unsafe fn new(buf: *const libc::c_char, owns_buffer: bool) -> CString {
         CString { buf: buf, owns_buffer_: owns_buffer }
     }
 
@@ -127,7 +127,7 @@ pub unsafe fn new(buf: *libc::c_char, owns_buffer: bool) -> CString {
     /// The original object is destructed after this method is called, and if
     /// the underlying pointer was previously allocated, care must be taken to
     /// ensure that it is deallocated properly.
-    pub unsafe fn unwrap(self) -> *libc::c_char {
+    pub unsafe fn unwrap(self) -> *const libc::c_char {
         let mut c_str = self;
         c_str.owns_buffer_ = false;
         c_str.buf
@@ -138,7 +138,7 @@ pub unsafe fn unwrap(self) -> *libc::c_char {
     /// # Failure
     ///
     /// Fails if the CString is null.
-    pub fn with_ref<T>(&self, f: |*libc::c_char| -> T) -> T {
+    pub fn with_ref<T>(&self, f: |*const libc::c_char| -> T) -> T {
         if self.buf.is_null() { fail!("CString is null!"); }
         f(self.buf)
     }
@@ -284,13 +284,13 @@ pub trait ToCStr {
     ///
     /// Fails the task if the receiver has an interior null.
     #[inline]
-    fn with_c_str<T>(&self, f: |*libc::c_char| -> T) -> T {
+    fn with_c_str<T>(&self, f: |*const libc::c_char| -> T) -> T {
         self.to_c_str().with_ref(f)
     }
 
     /// Unsafe variant of `with_c_str()` that doesn't check for nulls.
     #[inline]
-    unsafe fn with_c_str_unchecked<T>(&self, f: |*libc::c_char| -> T) -> T {
+    unsafe fn with_c_str_unchecked<T>(&self, f: |*const libc::c_char| -> T) -> T {
         self.to_c_str_unchecked().with_ref(f)
     }
 }
@@ -315,12 +315,12 @@ unsafe fn to_c_str_unchecked(&self) -> CString {
     }
 
     #[inline]
-    fn with_c_str<T>(&self, f: |*libc::c_char| -> T) -> T {
+    fn with_c_str<T>(&self, f: |*const libc::c_char| -> T) -> T {
         self.as_bytes().with_c_str(f)
     }
 
     #[inline]
-    unsafe fn with_c_str_unchecked<T>(&self, f: |*libc::c_char| -> T) -> T {
+    unsafe fn with_c_str_unchecked<T>(&self, f: |*const libc::c_char| -> T) -> T {
         self.as_bytes().with_c_str_unchecked(f)
     }
 }
@@ -337,12 +337,12 @@ unsafe fn to_c_str_unchecked(&self) -> CString {
     }
 
     #[inline]
-    fn with_c_str<T>(&self, f: |*libc::c_char| -> T) -> T {
+    fn with_c_str<T>(&self, f: |*const libc::c_char| -> T) -> T {
         self.as_bytes().with_c_str(f)
     }
 
     #[inline]
-    unsafe fn with_c_str_unchecked<T>(&self, f: |*libc::c_char| -> T) -> T {
+    unsafe fn with_c_str_unchecked<T>(&self, f: |*const libc::c_char| -> T) -> T {
         self.as_bytes().with_c_str_unchecked(f)
     }
 }
@@ -364,20 +364,21 @@ unsafe fn to_c_str_unchecked(&self) -> CString {
         ptr::copy_memory(buf, self.as_ptr(), self_len);
         *buf.offset(self_len as int) = 0;
 
-        CString::new(buf as *libc::c_char, true)
+        CString::new(buf as *const libc::c_char, true)
     }
 
-    fn with_c_str<T>(&self, f: |*libc::c_char| -> T) -> T {
+    fn with_c_str<T>(&self, f: |*const libc::c_char| -> T) -> T {
         unsafe { with_c_str(*self, true, f) }
     }
 
-    unsafe fn with_c_str_unchecked<T>(&self, f: |*libc::c_char| -> T) -> T {
+    unsafe fn with_c_str_unchecked<T>(&self, f: |*const libc::c_char| -> T) -> T {
         with_c_str(*self, false, f)
     }
 }
 
 // Unsafe function that handles possibly copying the &[u8] into a stack array.
-unsafe fn with_c_str<T>(v: &[u8], checked: bool, f: |*libc::c_char| -> T) -> T {
+unsafe fn with_c_str<T>(v: &[u8], checked: bool,
+                        f: |*const libc::c_char| -> T) -> T {
     if v.len() < BUF_LEN {
         let mut buf: [u8, .. BUF_LEN] = mem::uninitialized();
         slice::bytes::copy_memory(buf, v);
@@ -388,7 +389,7 @@ unsafe fn with_c_str<T>(v: &[u8], checked: bool, f: |*libc::c_char| -> T) -> T {
             check_for_null(v, buf as *mut libc::c_char);
         }
 
-        f(buf as *libc::c_char)
+        f(buf as *const libc::c_char)
     } else if checked {
         v.to_c_str().with_ref(f)
     } else {
@@ -410,7 +411,7 @@ fn check_for_null(v: &[u8], buf: *mut libc::c_char) {
 ///
 /// Use with the `std::iter` module.
 pub struct CChars<'a> {
-    ptr: *libc::c_char,
+    ptr: *const libc::c_char,
     marker: marker::ContravariantLifetime<'a>,
 }
 
@@ -434,7 +435,7 @@ fn next(&mut self) -> Option<libc::c_char> {
 ///
 /// The specified closure is invoked with each string that
 /// is found, and the number of strings found is returned.
-pub unsafe fn from_c_multistring(buf: *libc::c_char,
+pub unsafe fn from_c_multistring(buf: *const libc::c_char,
                                  count: Option<uint>,
                                  f: |&CString|) -> uint {
 
@@ -445,8 +446,8 @@ pub unsafe fn from_c_multistring(buf: *libc::c_char,
         None => (false, 0)
     };
     while ((limited_count && ctr < limit) || !limited_count)
-          && *(curr_ptr as *libc::c_char) != 0 as libc::c_char {
-        let cstr = CString::new(curr_ptr as *libc::c_char, false);
+          && *(curr_ptr as *const libc::c_char) != 0 as libc::c_char {
+        let cstr = CString::new(curr_ptr as *const libc::c_char, false);
         f(&cstr);
         curr_ptr += cstr.len() + 1;
         ctr += 1;
@@ -470,7 +471,7 @@ fn test_str_multistring_parsing() {
             let ptr = input.as_ptr();
             let expected = ["zero", "one"];
             let mut it = expected.iter();
-            let result = from_c_multistring(ptr as *libc::c_char, None, |c| {
+            let result = from_c_multistring(ptr as *const libc::c_char, None, |c| {
                 let cbytes = c.as_bytes_no_nul();
                 assert_eq!(cbytes, it.next().unwrap().as_bytes());
             });
@@ -707,7 +708,7 @@ mod bench {
     use std::prelude::*;
 
     #[inline]
-    fn check(s: &str, c_str: *libc::c_char) {
+    fn check(s: &str, c_str: *const libc::c_char) {
         let s_buf = s.as_ptr();
         for i in range(0, s.len()) {
             unsafe {
index 1c283a4e64789d24343ace42ee83bab274552c70..a040829ebe33ddf5ca7015c2a4f02e3c3ccb8585 100644 (file)
@@ -104,7 +104,7 @@ fn spawn_sibling(~self,
 /// Initializes global state, including frobbing
 /// the crate's logging flags, registering GC
 /// metadata, and storing the process arguments.
-pub fn init(argc: int, argv: **u8) {
+pub fn init(argc: int, argv: *const *const u8) {
     // FIXME: Derefing these pointers is not safe.
     // Need to propagate the unsafety to `start`.
     unsafe {
index faddadb832d90dd6a2d6598975299708363e90d2..6811a62c74f523f7cda3ed8943f2c20accc833e6 100644 (file)
@@ -82,7 +82,7 @@ pub enum _Unwind_Context {}
 
 pub type _Unwind_Exception_Cleanup_Fn =
         extern "C" fn(unwind_code: _Unwind_Reason_Code,
-                      exception: *_Unwind_Exception);
+                      exception: *mut _Unwind_Exception);
 
 #[cfg(target_os = "linux")]
 #[cfg(target_os = "freebsd")]
@@ -99,14 +99,14 @@ pub enum _Unwind_Context {}
     // iOS on armv7 uses SjLj exceptions and requires to link
     // agains corresponding routine (..._SjLj_...)
     #[cfg(not(target_os = "ios", target_arch = "arm"))]
-    pub fn _Unwind_RaiseException(exception: *_Unwind_Exception)
+    pub fn _Unwind_RaiseException(exception: *mut _Unwind_Exception)
                                   -> _Unwind_Reason_Code;
 
     #[cfg(target_os = "ios", target_arch = "arm")]
-    fn _Unwind_SjLj_RaiseException(e: *_Unwind_Exception)
+    fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception)
                                    -> _Unwind_Reason_Code;
 
-    pub fn _Unwind_DeleteException(exception: *_Unwind_Exception);
+    pub fn _Unwind_DeleteException(exception: *mut _Unwind_Exception);
 }
 
 // ... and now we just providing access to SjLj counterspart
@@ -114,7 +114,7 @@ fn _Unwind_SjLj_RaiseException(e: *_Unwind_Exception)
 // (see also comment above regarding _Unwind_RaiseException)
 #[cfg(target_os = "ios", target_arch = "arm")]
 #[inline(always)]
-pub unsafe fn _Unwind_RaiseException(exc: *_Unwind_Exception)
+pub unsafe fn _Unwind_RaiseException(exc: *mut _Unwind_Exception)
                                      -> _Unwind_Reason_Code {
     _Unwind_SjLj_RaiseException(exc)
 }
index 2e7c3ef37b9dc60a063f56359f08d5d974e72cb8..d4c87e9fc05c14e458ff110237360935b2baa28b 100644 (file)
@@ -90,7 +90,7 @@ impl<T: 'static> LocalData for T {}
 // n.b. If TLS is used heavily in future, this could be made more efficient with
 //      a proper map.
 #[doc(hidden)]
-pub type Map = Vec<Option<(*u8, TLSValue, uint)>>;
+pub type Map = Vec<Option<(*const u8, TLSValue, uint)>>;
 type TLSValue = Box<LocalData + Send>;
 
 // Gets the map from the runtime. Lazily initialises if not done so already.
@@ -116,8 +116,8 @@ unsafe fn get_local_map() -> Option<&mut Map> {
     }
 }
 
-fn key_to_key_value<T: 'static>(key: Key<T>) -> *u8 {
-    key as *KeyValue<T> as *u8
+fn key_to_key_value<T: 'static>(key: Key<T>) -> *const u8 {
+    key as *const KeyValue<T> as *const u8
 }
 
 /// An RAII immutable reference to a task-local value.
@@ -236,7 +236,8 @@ pub fn get(&'static self) -> Option<Ref<T>> {
             // pointer part of the trait, (as ~T), and then use
             // compiler coercions to achieve a '&' pointer.
             let ptr = unsafe {
-                let data = data as *Box<LocalData + Send> as *raw::TraitObject;
+                let data = data as *const Box<LocalData + Send>
+                                as *const raw::TraitObject;
                 &mut *((*data).data as *mut T)
             };
             Ref { _ptr: ptr, _index: pos, _nosend: marker::NoSend, _key: self }
index d09033e771cf7d5813e3b93932658cc5c1e6cb57..c19dc536985d9c2a1ce979a67402c90e43233c4e 100644 (file)
@@ -213,8 +213,8 @@ impl MemoryRegion {
     #[inline]
     fn malloc(&mut self, size: uint) -> *mut Box {
         let total_size = size + AllocHeader::size();
-        let alloc: *AllocHeader = unsafe {
-            libc_heap::malloc_raw(total_size) as *AllocHeader
+        let alloc: *mut AllocHeader = unsafe {
+            libc_heap::malloc_raw(total_size) as *mut AllocHeader
         };
 
         let alloc: &mut AllocHeader = unsafe { mem::transmute(alloc) };
@@ -232,14 +232,14 @@ fn realloc(&mut self, alloc: *mut Box, size: uint) -> *mut Box {
         unsafe { (*orig_alloc).assert_sane(); }
 
         let total_size = size + AllocHeader::size();
-        let alloc: *AllocHeader = unsafe {
-            libc_heap::realloc_raw(orig_alloc as *mut u8, total_size) as *AllocHeader
+        let alloc: *mut AllocHeader = unsafe {
+            libc_heap::realloc_raw(orig_alloc as *mut u8, total_size) as *mut AllocHeader
         };
 
         let alloc: &mut AllocHeader = unsafe { mem::transmute(alloc) };
         alloc.assert_sane();
         alloc.update_size(size as u32);
-        self.update(alloc, orig_alloc as *AllocHeader);
+        self.update(alloc, orig_alloc as *mut AllocHeader);
         return alloc.as_box();
     }
 
@@ -261,7 +261,7 @@ fn claim(&mut self, _alloc: &mut AllocHeader) {}
     #[inline]
     fn release(&mut self, _alloc: &AllocHeader) {}
     #[inline]
-    fn update(&mut self, _alloc: &mut AllocHeader, _orig: *AllocHeader) {}
+    fn update(&mut self, _alloc: &mut AllocHeader, _orig: *mut AllocHeader) {}
 }
 
 impl Drop for MemoryRegion {
@@ -275,17 +275,19 @@ fn drop(&mut self) {
 #[cfg(not(test))]
 #[lang="malloc"]
 #[inline]
-pub unsafe fn local_malloc_(drop_glue: fn(*mut u8), size: uint, align: uint) -> *u8 {
+pub unsafe fn local_malloc_(drop_glue: fn(*mut u8), size: uint,
+                            align: uint) -> *mut u8 {
     local_malloc(drop_glue, size, align)
 }
 
 #[inline]
-pub unsafe fn local_malloc(drop_glue: fn(*mut u8), size: uint, align: uint) -> *u8 {
+pub unsafe fn local_malloc(drop_glue: fn(*mut u8), size: uint,
+                           align: uint) -> *mut u8 {
     // FIXME: Unsafe borrow for speed. Lame.
     let task: Option<*mut Task> = Local::try_unsafe_borrow();
     match task {
         Some(task) => {
-            (*task).heap.alloc(drop_glue, size, align) as *u8
+            (*task).heap.alloc(drop_glue, size, align) as *mut u8
         }
         None => rtabort!("local malloc outside of task")
     }
@@ -294,7 +296,7 @@ pub unsafe fn local_malloc(drop_glue: fn(*mut u8), size: uint, align: uint) -> *
 #[cfg(not(test))]
 #[lang="free"]
 #[inline]
-pub unsafe fn local_free_(ptr: *u8) {
+pub unsafe fn local_free_(ptr: *mut u8) {
     local_free(ptr)
 }
 
@@ -302,7 +304,7 @@ pub unsafe fn local_free_(ptr: *u8) {
 // inside a landing pad may corrupt the state of the exception handler. If a
 // problem occurs, call exit instead.
 #[inline]
-pub unsafe fn local_free(ptr: *u8) {
+pub unsafe fn local_free(ptr: *mut u8) {
     // FIXME: Unsafe borrow for speed. Lame.
     let task_ptr: Option<*mut Task> = Local::try_unsafe_borrow();
     match task_ptr {
index b6858be32b7ceb70fc0ee9f4da000dc9d8e18f09..a0140129c0b406d666f0c7c350461ff6429f2543 100644 (file)
@@ -35,7 +35,7 @@
 /// Encapsulates a borrowed value. When this value goes out of scope, the
 /// pointer is returned.
 pub struct Borrowed<T> {
-    val: *(),
+    val: *const (),
 }
 
 #[unsafe_destructor]
@@ -54,7 +54,7 @@ fn drop(&mut self) {
 
 impl<T> Deref<T> for Borrowed<T> {
     fn deref<'a>(&'a self) -> &'a T {
-        unsafe { &*(self.val as *T) }
+        unsafe { &*(self.val as *const T) }
     }
 }
 
@@ -72,7 +72,7 @@ fn deref_mut<'a>(&'a mut self) -> &'a mut T {
 /// Does not validate the pointer type.
 #[inline]
 pub unsafe fn borrow<T>() -> Borrowed<T> {
-    let val: *() = mem::transmute(take::<T>());
+    let val: *const () = mem::transmute(take::<T>());
     Borrowed {
         val: val,
     }
index 2bbfcf73917c96b90aae773fe1beb5222946678a..6950d987d2f270d5339160118492e9d84619968b 100644 (file)
@@ -351,8 +351,8 @@ mod imp {
     mod os {
         use libc;
 
-        pub type pthread_mutex_t = *libc::c_void;
-        pub type pthread_cond_t = *libc::c_void;
+        pub type pthread_mutex_t = *mut libc::c_void;
+        pub type pthread_cond_t = *mut libc::c_void;
 
         pub static PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t =
             0 as pthread_mutex_t;
index 36ddf764d5c7fd914fdceaec2e480083ca539c0b..8e637207d2209c07879c581112e507c33c68296b 100644 (file)
@@ -221,9 +221,9 @@ unsafe fn target_record_sp_limit(limit: uint) {
     #[cfg(target_arch = "arm", not(target_os = "ios"))] #[inline(always)]
     unsafe fn target_record_sp_limit(limit: uint) {
         use libc::c_void;
-        return record_sp_limit(limit as *c_void);
+        return record_sp_limit(limit as *const c_void);
         extern {
-            fn record_sp_limit(limit: *c_void);
+            fn record_sp_limit(limit: *const c_void);
         }
     }
 
@@ -305,7 +305,7 @@ unsafe fn target_get_sp_limit() -> uint {
         use libc::c_void;
         return get_sp_limit() as uint;
         extern {
-            fn get_sp_limit() -> *c_void;
+            fn get_sp_limit() -> *const c_void;
         }
     }
 
index b385f48f33a493a718d96404fc867be8efa2eef0..9908e87e86a4727a0230eba1c77c66265bf8c9fd 100644 (file)
@@ -25,7 +25,7 @@
 
 use stack;
 
-type StartFn = extern "C" fn(*libc::c_void) -> imp::rust_thread_return;
+type StartFn = extern "C" fn(*mut libc::c_void) -> imp::rust_thread_return;
 
 /// This struct represents a native thread's state. This is used to join on an
 /// existing thread created in the join-able state.
@@ -42,7 +42,7 @@ pub struct Thread<T> {
 // no_split_stack annotation), and then we extract the main function
 // and invoke it.
 #[no_split_stack]
-extern fn thread_start(main: *libc::c_void) -> imp::rust_thread_return {
+extern fn thread_start(main: *mut libc::c_void) -> imp::rust_thread_return {
     unsafe {
         stack::record_stack_bounds(0, uint::MAX);
         let f: Box<proc()> = mem::transmute(main);
@@ -82,7 +82,7 @@ pub fn start_stack<T: Send>(stack: uint, main: proc():Send -> T) -> Thread<T> {
         // so.
         let packet = box None;
         let packet2: *mut Option<T> = unsafe {
-            *mem::transmute::<&Box<Option<T>>, **mut Option<T>>(&packet)
+            *mem::transmute::<&Box<Option<T>>, *const *mut Option<T>>(&packet)
         };
         let main = proc() unsafe { *packet2 = Some(main()); };
         let native = unsafe { imp::create(stack, box main) };
@@ -225,7 +225,7 @@ mod imp {
     use stack::RED_ZONE;
 
     pub type rust_thread = libc::pthread_t;
-    pub type rust_thread_return = *u8;
+    pub type rust_thread_return = *mut u8;
 
     pub unsafe fn create(stack: uint, p: Box<proc():Send>) -> rust_thread {
         let mut native: libc::pthread_t = mem::zeroed();
@@ -255,7 +255,7 @@ pub unsafe fn create(stack: uint, p: Box<proc():Send>) -> rust_thread {
             },
         };
 
-        let arg: *libc::c_void = mem::transmute(p);
+        let arg: *mut libc::c_void = mem::transmute(p);
         let ret = pthread_create(&mut native, &attr, super::thread_start, arg);
         assert_eq!(pthread_attr_destroy(&mut attr), 0);
 
@@ -268,7 +268,7 @@ pub unsafe fn create(stack: uint, p: Box<proc():Send>) -> rust_thread {
     }
 
     pub unsafe fn join(native: rust_thread) {
-        assert_eq!(pthread_join(native, ptr::null()), 0);
+        assert_eq!(pthread_join(native, ptr::mut_null()), 0);
     }
 
     pub unsafe fn detach(native: rust_thread) {
@@ -287,33 +287,33 @@ pub unsafe fn detach(native: rust_thread) {
     // currently always the case.  Note that you need to check that the symbol
     // is non-null before calling it!
     #[cfg(target_os = "linux")]
-    fn min_stack_size(attr: *libc::pthread_attr_t) -> libc::size_t {
-        type F = unsafe extern "C" fn(*libc::pthread_attr_t) -> libc::size_t;
+    fn min_stack_size(attr: *const libc::pthread_attr_t) -> libc::size_t {
+        type F = unsafe extern "C" fn(*const libc::pthread_attr_t) -> libc::size_t;
         extern {
             #[linkage = "extern_weak"]
-            static __pthread_get_minstack: *();
+            static __pthread_get_minstack: *const ();
         }
         if __pthread_get_minstack.is_null() {
             PTHREAD_STACK_MIN
         } else {
-            unsafe { mem::transmute::<*(), F>(__pthread_get_minstack)(attr) }
+            unsafe { mem::transmute::<*const (), F>(__pthread_get_minstack)(attr) }
         }
     }
 
     // __pthread_get_minstack() is marked as weak but extern_weak linkage is
     // not supported on OS X, hence this kludge...
     #[cfg(not(target_os = "linux"))]
-    fn min_stack_size(_: *libc::pthread_attr_t) -> libc::size_t {
+    fn min_stack_size(_: *const libc::pthread_attr_t) -> libc::size_t {
         PTHREAD_STACK_MIN
     }
 
     extern {
         fn pthread_create(native: *mut libc::pthread_t,
-                          attr: *libc::pthread_attr_t,
+                          attr: *const libc::pthread_attr_t,
                           f: super::StartFn,
-                          value: *libc::c_void) -> libc::c_int;
+                          value: *mut libc::c_void) -> libc::c_int;
         fn pthread_join(native: libc::pthread_t,
-                        value: **libc::c_void) -> libc::c_int;
+                        value: *mut *mut libc::c_void) -> libc::c_int;
         fn pthread_attr_init(attr: *mut libc::pthread_attr_t) -> libc::c_int;
         fn pthread_attr_destroy(attr: *mut libc::pthread_attr_t) -> libc::c_int;
         fn pthread_attr_setstacksize(attr: *mut libc::pthread_attr_t,
index 4a7be39e6b87a0b7e15891acb87cd58bdc604fbe..e1db67140aad755cbd4d302a27d7a87e49adec74 100644 (file)
@@ -50,7 +50,7 @@ pub unsafe fn destroy(key: Key) {
 
 #[cfg(unix)]
 extern {
-    fn pthread_key_create(key: *mut pthread_key_t, dtor: *u8) -> c_int;
+    fn pthread_key_create(key: *mut pthread_key_t, dtor: *const u8) -> c_int;
     fn pthread_key_delete(key: pthread_key_t) -> c_int;
     fn pthread_getspecific(key: pthread_key_t) -> *mut u8;
     fn pthread_setspecific(key: pthread_key_t, value: *mut u8) -> c_int;
index 1e9e63c211be87e3c5e30d94c62a1a66f47c6b66..309e00668e048b838e2eba14ae03682d94f6cbbf 100644 (file)
@@ -150,8 +150,8 @@ pub fn result(&mut self) -> Result {
 ///   run.
 pub unsafe fn try(f: ||) -> ::core::result::Result<(), Box<Any + Send>> {
     let closure: Closure = mem::transmute(f);
-    let ep = rust_try(try_fn, closure.code as *c_void,
-                      closure.env as *c_void);
+    let ep = rust_try(try_fn, closure.code as *mut c_void,
+                      closure.env as *mut c_void);
     return if ep.is_null() {
         Ok(())
     } else {
@@ -162,11 +162,11 @@ pub unsafe fn try(f: ||) -> ::core::result::Result<(), Box<Any + Send>> {
         Err(cause.unwrap())
     };
 
-    extern fn try_fn(code: *c_void, env: *c_void) {
+    extern fn try_fn(code: *mut c_void, env: *mut c_void) {
         unsafe {
             let closure: || = mem::transmute(Closure {
-                code: code as *(),
-                env: env as *(),
+                code: code as *mut (),
+                env: env as *mut (),
             });
             closure();
         }
@@ -178,9 +178,9 @@ pub unsafe fn try(f: ||) -> ::core::result::Result<(), Box<Any + Send>> {
         // When f(...) returns normally, the return value is null.
         // When f(...) throws, the return value is a pointer to the caught
         // exception object.
-        fn rust_try(f: extern "C" fn(*c_void, *c_void),
-                    code: *c_void,
-                    data: *c_void) -> *uw::_Unwind_Exception;
+        fn rust_try(f: extern "C" fn(*mut c_void, *mut c_void),
+                    code: *mut c_void,
+                    data: *mut c_void) -> *mut uw::_Unwind_Exception;
     }
 }
 
@@ -204,7 +204,7 @@ fn rust_fail(cause: Box<Any + Send>) -> ! {
     }
 
     extern fn exception_cleanup(_unwind_code: uw::_Unwind_Reason_Code,
-                                exception: *uw::_Unwind_Exception) {
+                                exception: *mut uw::_Unwind_Exception) {
         rtdebug!("exception_cleanup()");
         unsafe {
             let _: Box<Exception> = mem::transmute(exception);
@@ -249,8 +249,8 @@ pub mod eabi {
         fn __gcc_personality_v0(version: c_int,
                                 actions: uw::_Unwind_Action,
                                 exception_class: uw::_Unwind_Exception_Class,
-                                ue_header: *uw::_Unwind_Exception,
-                                context: *uw::_Unwind_Context)
+                                ue_header: *mut uw::_Unwind_Exception,
+                                context: *mut uw::_Unwind_Context)
             -> uw::_Unwind_Reason_Code;
     }
 
@@ -259,8 +259,8 @@ fn __gcc_personality_v0(version: c_int,
         version: c_int,
         actions: uw::_Unwind_Action,
         exception_class: uw::_Unwind_Exception_Class,
-        ue_header: *uw::_Unwind_Exception,
-        context: *uw::_Unwind_Context
+        ue_header: *mut uw::_Unwind_Exception,
+        context: *mut uw::_Unwind_Context
     ) -> uw::_Unwind_Reason_Code
     {
         unsafe {
@@ -274,8 +274,8 @@ pub extern "C" fn rust_eh_personality_catch(
         version: c_int,
         actions: uw::_Unwind_Action,
         exception_class: uw::_Unwind_Exception_Class,
-        ue_header: *uw::_Unwind_Exception,
-        context: *uw::_Unwind_Context
+        ue_header: *mut uw::_Unwind_Exception,
+        context: *mut uw::_Unwind_Context
     ) -> uw::_Unwind_Reason_Code
     {
         if (actions as c_int & uw::_UA_SEARCH_PHASE as c_int) != 0 { // search phase
@@ -304,8 +304,8 @@ pub mod eabi {
         fn __gcc_personality_sj0(version: c_int,
                                 actions: uw::_Unwind_Action,
                                 exception_class: uw::_Unwind_Exception_Class,
-                                ue_header: *uw::_Unwind_Exception,
-                                context: *uw::_Unwind_Context)
+                                ue_header: *mut uw::_Unwind_Exception,
+                                context: *mut uw::_Unwind_Context)
             -> uw::_Unwind_Reason_Code;
     }
 
@@ -315,8 +315,8 @@ pub extern "C" fn rust_eh_personality(
         version: c_int,
         actions: uw::_Unwind_Action,
         exception_class: uw::_Unwind_Exception_Class,
-        ue_header: *uw::_Unwind_Exception,
-        context: *uw::_Unwind_Context
+        ue_header: *mut uw::_Unwind_Exception,
+        context: *mut uw::_Unwind_Context
     ) -> uw::_Unwind_Reason_Code
     {
         unsafe {
@@ -330,8 +330,8 @@ pub extern "C" fn rust_eh_personality_catch(
         version: c_int,
         actions: uw::_Unwind_Action,
         exception_class: uw::_Unwind_Exception_Class,
-        ue_header: *uw::_Unwind_Exception,
-        context: *uw::_Unwind_Context
+        ue_header: *mut uw::_Unwind_Exception,
+        context: *mut uw::_Unwind_Context
     ) -> uw::_Unwind_Reason_Code
     {
         if (actions as c_int & uw::_UA_SEARCH_PHASE as c_int) != 0 { // search phase
@@ -357,16 +357,16 @@ pub mod eabi {
 
     extern "C" {
         fn __gcc_personality_v0(state: uw::_Unwind_State,
-                                ue_header: *uw::_Unwind_Exception,
-                                context: *uw::_Unwind_Context)
+                                ue_header: *mut uw::_Unwind_Exception,
+                                context: *mut uw::_Unwind_Context)
             -> uw::_Unwind_Reason_Code;
     }
 
     #[lang="eh_personality"]
     extern "C" fn eh_personality(
         state: uw::_Unwind_State,
-        ue_header: *uw::_Unwind_Exception,
-        context: *uw::_Unwind_Context
+        ue_header: *mut uw::_Unwind_Exception,
+        context: *mut uw::_Unwind_Context
     ) -> uw::_Unwind_Reason_Code
     {
         unsafe {
@@ -377,8 +377,8 @@ extern "C" fn eh_personality(
     #[no_mangle] // referenced from rust_try.ll
     pub extern "C" fn rust_eh_personality_catch(
         state: uw::_Unwind_State,
-        ue_header: *uw::_Unwind_Exception,
-        context: *uw::_Unwind_Context
+        ue_header: *mut uw::_Unwind_Exception,
+        context: *mut uw::_Unwind_Context
     ) -> uw::_Unwind_Reason_Code
     {
         if (state as c_int & uw::_US_ACTION_MASK as c_int)
index c08652cc08c792feb14864b46660875ec289adc7..40c3e19576e4fa304467661d73aa8028da28325e 100644 (file)
@@ -38,7 +38,7 @@ fn write(&mut self, data: &[u8]) -> fmt::Result {
         unsafe {
             let Stdio(fd) = *self;
             libc::write(fd,
-                        data.as_ptr() as *libc::c_void,
+                        data.as_ptr() as *const libc::c_void,
                         data.len() as WriteLen);
         }
         Ok(()) // yes, we're lying
index daca3005f12ffcd099463bc3211988121dba6d44..fa30199109e76ce2554da23076a1f33283b37d57 100644 (file)
@@ -11,7 +11,7 @@
 use libc::c_int;
 use libc;
 use std::mem;
-use std::ptr::null;
+use std::ptr::{null, mut_null};
 use std::rt::task::BlockedTask;
 use std::rt::rtio;
 
@@ -20,7 +20,7 @@
 use uvll;
 
 struct Addrinfo {
-    handle: *libc::addrinfo,
+    handle: *const libc::addrinfo,
 }
 
 struct Ctx {
@@ -62,12 +62,14 @@ pub fn run(loop_: &Loop, node: Option<&str>, service: Option<&str>,
                 ai_socktype: 0,
                 ai_protocol: 0,
                 ai_addrlen: 0,
-                ai_canonname: null(),
-                ai_addr: null(),
-                ai_next: null(),
+                ai_canonname: mut_null(),
+                ai_addr: mut_null(),
+                ai_next: mut_null(),
             }
         });
-        let hint_ptr = hint.as_ref().map_or(null(), |x| x as *libc::addrinfo);
+        let hint_ptr = hint.as_ref().map_or(null(), |x| {
+            x as *const libc::addrinfo
+        });
         let mut req = Request::new(uvll::UV_GETADDRINFO);
 
         return match unsafe {
@@ -80,7 +82,7 @@ pub fn run(loop_: &Loop, node: Option<&str>, service: Option<&str>,
                 let mut cx = Ctx { slot: None, status: 0, addrinfo: None };
 
                 wait_until_woken_after(&mut cx.slot, loop_, || {
-                    req.set_data(&cx);
+                    req.set_data(&mut cx);
                 });
 
                 match cx.status {
@@ -92,9 +94,9 @@ pub fn run(loop_: &Loop, node: Option<&str>, service: Option<&str>,
         };
 
 
-        extern fn getaddrinfo_cb(req: *uvll::uv_getaddrinfo_t,
+        extern fn getaddrinfo_cb(req: *mut uvll::uv_getaddrinfo_t,
                                  status: c_int,
-                                 res: *libc::addrinfo) {
+                                 res: *const libc::addrinfo) {
             let req = Request::wrap(req);
             assert!(status != uvll::ECANCELED);
             let cx: &mut Ctx = unsafe { req.get_data() };
@@ -108,7 +110,7 @@ pub fn run(loop_: &Loop, node: Option<&str>, service: Option<&str>,
 
 impl Drop for Addrinfo {
     fn drop(&mut self) {
-        unsafe { uvll::uv_freeaddrinfo(self.handle) }
+        unsafe { uvll::uv_freeaddrinfo(self.handle as *mut _) }
     }
 }
 
@@ -130,7 +132,7 @@ pub fn accum_addrinfo(addr: &Addrinfo) -> Vec<rtio::AddrinfoInfo> {
                 flags: 0,
             });
             if (*addr).ai_next.is_not_null() {
-                addr = (*addr).ai_next;
+                addr = (*addr).ai_next as *const _;
             } else {
                 break;
             }
index 323bd0fbce2f5f7c3068e93c1e40bc8c4275fc07..97f95145b8992e6be43e19e5f2303c29d92ac577 100644 (file)
@@ -19,7 +19,7 @@
 // The entire point of async is to call into a loop from other threads so it
 // does not need to home.
 pub struct AsyncWatcher {
-    handle: *uvll::uv_async_t,
+    handle: *mut uvll::uv_async_t,
 
     // A flag to tell the callback to exit, set from the dtor. This is
     // almost never contested - only in rare races with the dtor.
@@ -40,7 +40,7 @@ pub fn new(loop_: &mut Loop, cb: Box<Callback + Send>) -> AsyncWatcher {
         let flag = Arc::new(Exclusive::new(false));
         let payload = box Payload { callback: cb, exit_flag: flag.clone() };
         unsafe {
-            let payload: *u8 = mem::transmute(payload);
+            let payload: *mut u8 = mem::transmute(payload);
             uvll::set_data_for_uv_handle(handle, payload);
         }
         return AsyncWatcher { handle: handle, exit_flag: flag, };
@@ -48,13 +48,13 @@ pub fn new(loop_: &mut Loop, cb: Box<Callback + Send>) -> AsyncWatcher {
 }
 
 impl UvHandle<uvll::uv_async_t> for AsyncWatcher {
-    fn uv_handle(&self) -> *uvll::uv_async_t { self.handle }
-    unsafe fn from_uv_handle<'a>(_: &'a *uvll::uv_async_t) -> &'a mut AsyncWatcher {
+    fn uv_handle(&self) -> *mut uvll::uv_async_t { self.handle }
+    unsafe fn from_uv_handle<'a>(_: &'a *mut uvll::uv_async_t) -> &'a mut AsyncWatcher {
         fail!("async watchers can't be built from their handles");
     }
 }
 
-extern fn async_cb(handle: *uvll::uv_async_t) {
+extern fn async_cb(handle: *mut uvll::uv_async_t) {
     let payload: &mut Payload = unsafe {
         mem::transmute(uvll::get_data_for_uv_handle(handle))
     };
@@ -90,7 +90,7 @@ unsafe fn from_uv_handle<'a>(_: &'a *uvll::uv_async_t) -> &'a mut AsyncWatcher {
     }
 }
 
-extern fn close_cb(handle: *uvll::uv_handle_t) {
+extern fn close_cb(handle: *mut uvll::uv_handle_t) {
     // drop the payload
     let _payload: Box<Payload> = unsafe {
         mem::transmute(uvll::get_data_for_uv_handle(handle))
index 4b1343045de376219398b7137b5dc6aa689ca338..85abc45c4302a52c640690aa332fbf4f41e8ea9f 100644 (file)
@@ -24,7 +24,7 @@
 use uvll;
 
 pub struct FsRequest {
-    req: *uvll::uv_fs_t,
+    req: *mut uvll::uv_fs_t,
     fired: bool,
 }
 
@@ -94,7 +94,7 @@ pub fn write(loop_: &Loop, fd: c_int, buf: &[u8], offset: i64)
                 offset + written as i64
             };
             let uvbuf = uvll::uv_buf_t {
-                base: buf.slice_from(written as uint).as_ptr(),
+                base: buf.slice_from(written as uint).as_ptr() as *mut _,
                 len: (buf.len() - written) as uvll::uv_buf_len_t,
             };
             match execute(|req, cb| unsafe {
@@ -111,11 +111,11 @@ pub fn read(loop_: &Loop, fd: c_int, buf: &mut [u8], offset: i64)
         -> Result<int, UvError>
     {
         execute(|req, cb| unsafe {
-            let uvbuf = uvll::uv_buf_t {
-                base: buf.as_ptr(),
+            let mut uvbuf = uvll::uv_buf_t {
+                base: buf.as_mut_ptr(),
                 len: buf.len() as uvll::uv_buf_len_t,
             };
-            uvll::uv_fs_read(loop_.handle, req, fd, &uvbuf, 1, offset, cb)
+            uvll::uv_fs_read(loop_.handle, req, fd, &mut uvbuf, 1, offset, cb)
         }).map(|req| {
             req.get_result() as int
         })
@@ -168,7 +168,7 @@ pub fn readdir(loop_: &Loop, path: &CString, flags: c_int)
             let mut paths = vec!();
             let path = CString::new(path.with_ref(|p| p), false);
             let parent = Path::new(path);
-            let _ = c_str::from_c_multistring(req.get_ptr() as *libc::c_char,
+            let _ = c_str::from_c_multistring(req.get_ptr() as *const libc::c_char,
                                               Some(req.get_result() as uint),
                                               |rel| {
                 let p = rel.as_bytes();
@@ -186,7 +186,7 @@ pub fn readlink(loop_: &Loop, path: &CString) -> Result<CString, UvError> {
             // Be sure to clone the cstring so we get an independently owned
             // allocation to work with and return.
             unsafe {
-                CString::new(req.get_ptr() as *libc::c_char, false).clone()
+                CString::new(req.get_ptr() as *const libc::c_char, false).clone()
             }
         })
     }
@@ -262,12 +262,12 @@ pub fn get_result(&self) -> ssize_t {
     }
 
     pub fn get_stat(&self) -> uvll::uv_stat_t {
-        let stat = uvll::uv_stat_t::new();
-        unsafe { uvll::populate_stat(self.req, &stat); }
+        let mut stat = uvll::uv_stat_t::new();
+        unsafe { uvll::populate_stat(self.req, &mut stat); }
         stat
     }
 
-    pub fn get_ptr(&self) -> *libc::c_void {
+    pub fn get_ptr(&self) -> *mut libc::c_void {
         unsafe { uvll::get_ptr_from_fs_req(self.req) }
     }
 
@@ -310,7 +310,7 @@ fn drop(&mut self) {
     }
 }
 
-fn execute(f: |*uvll::uv_fs_t, uvll::uv_fs_cb| -> c_int)
+fn execute(f: |*mut uvll::uv_fs_t, uvll::uv_fs_cb| -> c_int)
     -> Result<FsRequest, UvError>
 {
     let mut req = FsRequest {
@@ -323,7 +323,7 @@ fn execute(f: |*uvll::uv_fs_t, uvll::uv_fs_cb| -> c_int)
             let mut slot = None;
             let loop_ = unsafe { uvll::get_loop_from_fs_req(req.req) };
             wait_until_woken_after(&mut slot, &Loop::wrap(loop_), || {
-                unsafe { uvll::set_data_for_req(req.req, &slot) }
+                unsafe { uvll::set_data_for_req(req.req, &mut slot) }
             });
             match req.get_result() {
                 n if n < 0 => Err(UvError(n as i32)),
@@ -333,7 +333,7 @@ fn execute(f: |*uvll::uv_fs_t, uvll::uv_fs_cb| -> c_int)
         n => Err(UvError(n))
     };
 
-    extern fn fs_cb(req: *uvll::uv_fs_t) {
+    extern fn fs_cb(req: *mut uvll::uv_fs_t) {
         let slot: &mut Option<BlockedTask> = unsafe {
             mem::transmute(uvll::get_data_for_req(req))
         };
@@ -341,7 +341,7 @@ fn execute(f: |*uvll::uv_fs_t, uvll::uv_fs_cb| -> c_int)
     }
 }
 
-fn execute_nop(f: |*uvll::uv_fs_t, uvll::uv_fs_cb| -> c_int)
+fn execute_nop(f: |*mut uvll::uv_fs_t, uvll::uv_fs_cb| -> c_int)
     -> Result<(), UvError> {
     execute(f).map(|_| {})
 }
@@ -397,7 +397,7 @@ fn drop(&mut self) {
                                                  self.fd, close_cb), 0);
                 }
 
-                extern fn close_cb(req: *uvll::uv_fs_t) {
+                extern fn close_cb(req: *mut uvll::uv_fs_t) {
                     unsafe {
                         uvll::uv_fs_req_cleanup(req);
                         uvll::free_req(req);
index 43ddd2681b3e30b51ffbd869ae8e672aa2cb69f1..7b9a2fcf4446779af43fad88ec92f87217afc9b3 100644 (file)
@@ -16,7 +16,7 @@
 use std::rt::rtio::{Callback, PausableIdleCallback};
 
 pub struct IdleWatcher {
-    handle: *uvll::uv_idle_t,
+    handle: *mut uvll::uv_idle_t,
     idle_flag: bool,
     callback: Box<Callback + Send>,
 }
@@ -39,12 +39,12 @@ pub fn onetime(loop_: &mut Loop, f: proc()) {
         let handle = UvHandle::alloc(None::<IdleWatcher>, uvll::UV_IDLE);
         unsafe {
             assert_eq!(uvll::uv_idle_init(loop_.handle, handle), 0);
-            let data: *c_void = mem::transmute(box f);
+            let data: *mut c_void = mem::transmute(box f);
             uvll::set_data_for_uv_handle(handle, data);
             assert_eq!(uvll::uv_idle_start(handle, onetime_cb), 0)
         }
 
-        extern fn onetime_cb(handle: *uvll::uv_idle_t) {
+        extern fn onetime_cb(handle: *mut uvll::uv_idle_t) {
             unsafe {
                 let data = uvll::get_data_for_uv_handle(handle);
                 let f: Box<proc()> = mem::transmute(data);
@@ -54,7 +54,7 @@ pub fn onetime(loop_: &mut Loop, f: proc()) {
             }
         }
 
-        extern fn close_cb(handle: *uvll::uv_handle_t) {
+        extern fn close_cb(handle: *mut uvll::uv_handle_t) {
             unsafe { uvll::free_handle(handle) }
         }
     }
@@ -76,10 +76,10 @@ fn resume(&mut self) {
 }
 
 impl UvHandle<uvll::uv_idle_t> for IdleWatcher {
-    fn uv_handle(&self) -> *uvll::uv_idle_t { self.handle }
+    fn uv_handle(&self) -> *mut uvll::uv_idle_t { self.handle }
 }
 
-extern fn idle_cb(handle: *uvll::uv_idle_t) {
+extern fn idle_cb(handle: *mut uvll::uv_idle_t) {
     let idle: &mut IdleWatcher = unsafe { UvHandle::from_uv_handle(&handle) };
     idle.callback.call();
 }
index 74caf86a6310242832f360dbb893eb7a61792cc7..968a283995bef2fef78775b9594ac7a9cf47d018 100644 (file)
@@ -53,7 +53,6 @@
 use libc::{c_int, c_void};
 use std::fmt;
 use std::mem;
-use std::ptr::null;
 use std::ptr;
 use std::rt::local::Local;
 use std::rt::rtio;
@@ -78,7 +77,7 @@
 //        threading mode than the default by reaching into the auto-generated
 //        '__test' module.
 #[cfg(test)] #[start]
-fn start(argc: int, argv: **u8) -> int {
+fn start(argc: int, argv: *const *const u8) -> int {
     green::start(argc, argv, event_loop, __test::main)
 }
 
@@ -118,7 +117,7 @@ fn start(argc: int, argv: **u8) -> int {
 /// extern crate green;
 ///
 /// #[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)
 /// }
 ///
@@ -132,28 +131,28 @@ pub fn event_loop() -> Box<rtio::EventLoop + Send> {
 
 /// A type that wraps a uv handle
 pub trait UvHandle<T> {
-    fn uv_handle(&self) -> *T;
+    fn uv_handle(&self) -> *mut T;
 
     fn uv_loop(&self) -> Loop {
         Loop::wrap(unsafe { uvll::get_loop_for_uv_handle(self.uv_handle()) })
     }
 
     // FIXME(#8888) dummy self
-    fn alloc(_: Option<Self>, ty: uvll::uv_handle_type) -> *T {
+    fn alloc(_: Option<Self>, ty: uvll::uv_handle_type) -> *mut T {
         unsafe {
             let handle = uvll::malloc_handle(ty);
             assert!(!handle.is_null());
-            handle as *T
+            handle as *mut T
         }
     }
 
-    unsafe fn from_uv_handle<'a>(h: &'a *T) -> &'a mut Self {
+    unsafe fn from_uv_handle<'a>(h: &'a *mut T) -> &'a mut Self {
         mem::transmute(uvll::get_data_for_uv_handle(*h))
     }
 
     fn install(~self) -> Box<Self> {
         unsafe {
-            let myptr = mem::transmute::<&Box<Self>, &*u8>(&self);
+            let myptr = mem::transmute::<&Box<Self>, &*mut u8>(&self);
             uvll::set_data_for_uv_handle(self.uv_handle(), *myptr);
         }
         self
@@ -162,13 +161,13 @@ fn install(~self) -> Box<Self> {
     fn close_async_(&mut self) {
         // we used malloc to allocate all handles, so we must always have at
         // least a callback to free all the handles we allocated.
-        extern fn close_cb(handle: *uvll::uv_handle_t) {
+        extern fn close_cb(handle: *mut uvll::uv_handle_t) {
             unsafe { uvll::free_handle(handle) }
         }
 
         unsafe {
-            uvll::set_data_for_uv_handle(self.uv_handle(), null::<()>());
-            uvll::uv_close(self.uv_handle() as *uvll::uv_handle_t, close_cb)
+            uvll::set_data_for_uv_handle(self.uv_handle(), ptr::mut_null::<()>());
+            uvll::uv_close(self.uv_handle() as *mut uvll::uv_handle_t, close_cb)
         }
     }
 
@@ -176,19 +175,20 @@ fn close(&mut self) {
         let mut slot = None;
 
         unsafe {
-            uvll::uv_close(self.uv_handle() as *uvll::uv_handle_t, close_cb);
-            uvll::set_data_for_uv_handle(self.uv_handle(), ptr::null::<()>());
+            uvll::uv_close(self.uv_handle() as *mut uvll::uv_handle_t, close_cb);
+            uvll::set_data_for_uv_handle(self.uv_handle(),
+                                         ptr::mut_null::<()>());
 
             wait_until_woken_after(&mut slot, &self.uv_loop(), || {
-                uvll::set_data_for_uv_handle(self.uv_handle(), &slot);
+                uvll::set_data_for_uv_handle(self.uv_handle(), &mut slot);
             })
         }
 
-        extern fn close_cb(handle: *uvll::uv_handle_t) {
+        extern fn close_cb(handle: *mut uvll::uv_handle_t) {
             unsafe {
                 let data = uvll::get_data_for_uv_handle(handle);
                 uvll::free_handle(handle);
-                if data == ptr::null() { return }
+                if data == ptr::mut_null() { return }
                 let slot: &mut Option<BlockedTask> = mem::transmute(data);
                 wakeup(slot);
             }
@@ -261,7 +261,7 @@ fn wakeup(slot: &mut Option<BlockedTask>) {
 }
 
 pub struct Request {
-    pub handle: *uvll::uv_req_t,
+    pub handle: *mut uvll::uv_req_t,
     defused: bool,
 }
 
@@ -269,22 +269,22 @@ impl Request {
     pub fn new(ty: uvll::uv_req_type) -> Request {
         unsafe {
             let handle = uvll::malloc_req(ty);
-            uvll::set_data_for_req(handle, null::<()>());
+            uvll::set_data_for_req(handle, ptr::mut_null::<()>());
             Request::wrap(handle)
         }
     }
 
-    pub fn wrap(handle: *uvll::uv_req_t) -> Request {
+    pub fn wrap(handle: *mut uvll::uv_req_t) -> Request {
         Request { handle: handle, defused: false }
     }
 
-    pub fn set_data<T>(&self, t: *T) {
+    pub fn set_data<T>(&self, t: *mut T) {
         unsafe { uvll::set_data_for_req(self.handle, t) }
     }
 
     pub unsafe fn get_data<T>(&self) -> &'static mut T {
         let data = uvll::get_data_for_req(self.handle);
-        assert!(data != null());
+        assert!(data != ptr::mut_null());
         mem::transmute(data)
     }
 
@@ -313,18 +313,18 @@ fn drop(&mut self) {
 /// with dtors may not be destructured, but tuple structs can,
 /// but the results are not correct.
 pub struct Loop {
-    handle: *uvll::uv_loop_t
+    handle: *mut uvll::uv_loop_t
 }
 
 impl Loop {
     pub fn new() -> Loop {
         let handle = unsafe { uvll::loop_new() };
         assert!(handle.is_not_null());
-        unsafe { uvll::set_data_for_uv_loop(handle, 0 as *c_void) }
+        unsafe { uvll::set_data_for_uv_loop(handle, 0 as *mut c_void) }
         Loop::wrap(handle)
     }
 
-    pub fn wrap(handle: *uvll::uv_loop_t) -> Loop { Loop { handle: handle } }
+    pub fn wrap(handle: *mut uvll::uv_loop_t) -> Loop { Loop { handle: handle } }
 
     pub fn run(&mut self) {
         assert_eq!(unsafe { uvll::uv_run(self.handle, uvll::RUN_DEFAULT) }, 0);
@@ -339,7 +339,7 @@ pub fn close(&mut self) {
     fn modify_blockers(&self, amt: uint) {
         unsafe {
             let cur = uvll::get_data_for_uv_loop(self.handle) as uint;
-            uvll::set_data_for_uv_loop(self.handle, (cur + amt) as *c_void)
+            uvll::set_data_for_uv_loop(self.handle, (cur + amt) as *mut c_void)
         }
     }
 
@@ -445,7 +445,7 @@ pub fn status_to_io_result(status: c_int) -> IoResult<()> {
 
 pub fn empty_buf() -> Buf {
     uvll::uv_buf_t {
-        base: null(),
+        base: ptr::mut_null(),
         len: 0,
     }
 }
@@ -453,7 +453,7 @@ pub fn empty_buf() -> Buf {
 /// Borrow a slice to a Buf
 pub fn slice_to_uv_buf(v: &[u8]) -> Buf {
     let data = v.as_ptr();
-    uvll::uv_buf_t { base: data, len: v.len() as uvll::uv_buf_len_t }
+    uvll::uv_buf_t { base: data as *mut u8, len: v.len() as uvll::uv_buf_len_t }
 }
 
 // This function is full of lies!
@@ -512,7 +512,7 @@ fn test_slice_to_uv_buf() {
         assert_eq!(buf.len, 20);
 
         unsafe {
-            let base = transmute::<*u8, *mut u8>(buf.base);
+            let base = transmute::<*mut u8, *mut u8>(buf.base);
             (*base) = 1;
             (*base.offset(1)) = 2;
         }
index 82693acb1e9dc9573698ad23540aec33b5ec76e1..f1c37762129a3b442d8013e56e41bb47a804982e 100644 (file)
@@ -125,7 +125,7 @@ enum SocketNameKind {
 }
 
 fn socket_name(sk: SocketNameKind,
-               handle: *c_void) -> Result<rtio::SocketAddr, IoError> {
+               handle: *mut c_void) -> Result<rtio::SocketAddr, IoError> {
     let getsockname = match sk {
         TcpPeer => uvll::uv_tcp_getpeername,
         Tcp     => uvll::uv_tcp_getsockname,
@@ -150,7 +150,7 @@ fn socket_name(sk: SocketNameKind,
 ////////////////////////////////////////////////////////////////////////////////
 
 pub struct TcpWatcher {
-    handle: *uvll::uv_tcp_t,
+    handle: *mut uvll::uv_tcp_t,
     stream: StreamWatcher,
     home: HomeHandle,
     refcount: Refcount,
@@ -165,7 +165,7 @@ pub struct TcpWatcher {
 
 pub struct TcpListener {
     home: HomeHandle,
-    handle: *uvll::uv_pipe_t,
+    handle: *mut uvll::uv_pipe_t,
     outgoing: Sender<Result<Box<rtio::RtioTcpStream + Send>, IoError>>,
     incoming: Receiver<Result<Box<rtio::RtioTcpStream + Send>, IoError>>,
 }
@@ -204,7 +204,7 @@ pub fn connect(io: &mut UvIoFactory,
         let tcp = TcpWatcher::new(io);
         let cx = ConnectCtx { status: -1, task: None, timer: None };
         let (addr, _len) = addr_to_sockaddr(address);
-        let addr_p = &addr as *_ as *libc::sockaddr;
+        let addr_p = &addr as *const _ as *const libc::sockaddr;
         cx.connect(tcp, timeout, io, |req, tcp, cb| {
             unsafe { uvll::uv_tcp_connect(req.handle, tcp.handle, addr_p, cb) }
         })
@@ -311,7 +311,7 @@ fn set_read_timeout(&mut self, ms: Option<u64>) {
         let _m = self.fire_homing_missile();
         let loop_ = self.uv_loop();
         self.read_access.set_timeout(ms, &self.home, &loop_, cancel_read,
-                                     &self.stream as *_ as uint);
+                                     &self.stream as *const _ as uint);
 
         fn cancel_read(stream: uint) -> Option<BlockedTask> {
             let stream: &mut StreamWatcher = unsafe { mem::transmute(stream) };
@@ -323,7 +323,7 @@ fn set_write_timeout(&mut self, ms: Option<u64>) {
         let _m = self.fire_homing_missile();
         let loop_ = self.uv_loop();
         self.write_access.set_timeout(ms, &self.home, &loop_, cancel_write,
-                                      &self.stream as *_ as uint);
+                                      &self.stream as *const _ as uint);
 
         fn cancel_write(stream: uint) -> Option<BlockedTask> {
             let stream: &mut StreamWatcher = unsafe { mem::transmute(stream) };
@@ -333,7 +333,7 @@ fn cancel_write(stream: uint) -> Option<BlockedTask> {
 }
 
 impl UvHandle<uvll::uv_tcp_t> for TcpWatcher {
-    fn uv_handle(&self) -> *uvll::uv_tcp_t { self.stream.handle }
+    fn uv_handle(&self) -> *mut uvll::uv_tcp_t { self.stream.handle }
 }
 
 impl Drop for TcpWatcher {
@@ -363,8 +363,8 @@ pub fn bind(io: &mut UvIoFactory, address: rtio::SocketAddr)
         };
         let (addr, _len) = addr_to_sockaddr(address);
         let res = unsafe {
-            let addr_p = &addr as *libc::sockaddr_storage;
-            uvll::uv_tcp_bind(l.handle, addr_p as *libc::sockaddr)
+            let addr_p = &addr as *const libc::sockaddr_storage;
+            uvll::uv_tcp_bind(l.handle, addr_p as *const libc::sockaddr)
         };
         return match res {
             0 => Ok(l.install()),
@@ -378,7 +378,7 @@ fn home<'r>(&'r mut self) -> &'r mut HomeHandle { &mut self.home }
 }
 
 impl UvHandle<uvll::uv_tcp_t> for TcpListener {
-    fn uv_handle(&self) -> *uvll::uv_tcp_t { self.handle }
+    fn uv_handle(&self) -> *mut uvll::uv_tcp_t { self.handle }
 }
 
 impl rtio::RtioSocket for TcpListener {
@@ -405,7 +405,7 @@ fn listen(~self) -> Result<Box<rtio::RtioTcpAcceptor + Send>, IoError> {
     }
 }
 
-extern fn listen_cb(server: *uvll::uv_stream_t, status: c_int) {
+extern fn listen_cb(server: *mut uvll::uv_stream_t, status: c_int) {
     assert!(status != uvll::ECANCELED);
     let tcp: &mut TcpListener = unsafe { UvHandle::from_uv_handle(&server) };
     let msg = match status {
@@ -475,7 +475,7 @@ fn set_timeout(&mut self, ms: Option<u64>) {
 ////////////////////////////////////////////////////////////////////////////////
 
 pub struct UdpWatcher {
-    handle: *uvll::uv_udp_t,
+    handle: *mut uvll::uv_udp_t,
     home: HomeHandle,
 
     // See above for what these fields are
@@ -514,8 +514,8 @@ pub fn bind(io: &mut UvIoFactory, address: rtio::SocketAddr)
         }, 0);
         let (addr, _len) = addr_to_sockaddr(address);
         let result = unsafe {
-            let addr_p = &addr as *libc::sockaddr_storage;
-            uvll::uv_udp_bind(udp.handle, addr_p as *libc::sockaddr, 0u32)
+            let addr_p = &addr as *const libc::sockaddr_storage;
+            uvll::uv_udp_bind(udp.handle, addr_p as *const libc::sockaddr, 0u32)
         };
         return match result {
             0 => Ok(udp),
@@ -525,7 +525,7 @@ pub fn bind(io: &mut UvIoFactory, address: rtio::SocketAddr)
 }
 
 impl UvHandle<uvll::uv_udp_t> for UdpWatcher {
-    fn uv_handle(&self) -> *uvll::uv_udp_t { self.handle }
+    fn uv_handle(&self) -> *mut uvll::uv_udp_t { self.handle }
 }
 
 impl HomingIO for UdpWatcher {
@@ -558,7 +558,7 @@ fn recvfrom(&mut self, buf: &mut [u8])
                 };
                 let handle = self.handle;
                 wait_until_woken_after(&mut cx.task, &loop_, || {
-                    unsafe { uvll::set_data_for_uv_handle(handle, &cx) }
+                    unsafe { uvll::set_data_for_uv_handle(handle, &mut cx) }
                 });
                 match cx.result.take_unwrap() {
                     (n, _) if n < 0 =>
@@ -569,7 +569,7 @@ fn recvfrom(&mut self, buf: &mut [u8])
             n => Err(uv_error_to_io_error(UvError(n)))
         };
 
-        extern fn alloc_cb(handle: *uvll::uv_udp_t,
+        extern fn alloc_cb(handle: *mut uvll::uv_udp_t,
                            _suggested_size: size_t,
                            buf: *mut Buf) {
             unsafe {
@@ -579,8 +579,9 @@ fn recvfrom(&mut self, buf: &mut [u8])
             }
         }
 
-        extern fn recv_cb(handle: *uvll::uv_udp_t, nread: ssize_t, buf: *Buf,
-                          addr: *libc::sockaddr, _flags: c_uint) {
+        extern fn recv_cb(handle: *mut uvll::uv_udp_t, nread: ssize_t,
+                          buf: *const Buf,
+                          addr: *const libc::sockaddr, _flags: c_uint) {
             assert!(nread != uvll::ECANCELED as ssize_t);
             let cx = unsafe {
                 &mut *(uvll::get_data_for_uv_handle(handle) as *mut UdpRecvCtx)
@@ -613,7 +614,7 @@ fn sendto(&mut self, buf: &[u8], dst: rtio::SocketAddr) -> Result<(), IoError> {
 
         let mut req = Request::new(uvll::UV_UDP_SEND);
         let (addr, _len) = addr_to_sockaddr(dst);
-        let addr_p = &addr as *_ as *libc::sockaddr;
+        let addr_p = &addr as *const _ as *const libc::sockaddr;
 
         // see comments in StreamWatcher::write for why we may allocate a buffer
         // here.
@@ -633,7 +634,7 @@ fn sendto(&mut self, buf: &[u8], dst: rtio::SocketAddr) -> Result<(), IoError> {
                     result: uvll::ECANCELED, data: data, udp: self as *mut _
                 };
                 wait_until_woken_after(&mut self.blocked_sender, &loop_, || {
-                    req.set_data(&cx);
+                    req.set_data(&mut cx);
                 });
 
                 if cx.result != uvll::ECANCELED {
@@ -642,13 +643,13 @@ fn sendto(&mut self, buf: &[u8], dst: rtio::SocketAddr) -> Result<(), IoError> {
                         n => Err(uv_error_to_io_error(UvError(n)))
                     }
                 }
-                let new_cx = box UdpSendCtx {
+                let mut new_cx = box UdpSendCtx {
                     result: 0,
                     udp: 0 as *mut UdpWatcher,
                     data: cx.data.take(),
                 };
                 unsafe {
-                    req.set_data(&*new_cx);
+                    req.set_data(&mut *new_cx);
                     mem::forget(new_cx);
                 }
                 Err(uv_error_to_io_error(UvError(cx.result)))
@@ -658,7 +659,7 @@ fn sendto(&mut self, buf: &[u8], dst: rtio::SocketAddr) -> Result<(), IoError> {
 
         // This function is the same as stream::write_cb, but adapted for udp
         // instead of streams.
-        extern fn send_cb(req: *uvll::uv_udp_send_t, status: c_int) {
+        extern fn send_cb(req: *mut uvll::uv_udp_send_t, status: c_int) {
             let req = Request::wrap(req);
             let cx: &mut UdpSendCtx = unsafe { req.get_data() };
             cx.result = status;
@@ -766,12 +767,12 @@ fn set_read_timeout(&mut self, ms: Option<u64>) {
         fn cancel_read(stream: uint) -> Option<BlockedTask> {
             // This method is quite similar to StreamWatcher::cancel_read, see
             // there for more information
-            let handle = stream as *uvll::uv_udp_t;
+            let handle = stream as *mut uvll::uv_udp_t;
             assert_eq!(unsafe { uvll::uv_udp_recv_stop(handle) }, 0);
             let data = unsafe {
                 let data = uvll::get_data_for_uv_handle(handle);
                 if data.is_null() { return None }
-                uvll::set_data_for_uv_handle(handle, 0 as *int);
+                uvll::set_data_for_uv_handle(handle, 0 as *mut int);
                 &mut *(data as *mut UdpRecvCtx)
             };
             data.result = Some((uvll::ECANCELED as ssize_t, None));
@@ -806,7 +807,7 @@ fn drop(&mut self) {
 // Shutdown helper
 ////////////////////////////////////////////////////////////////////////////////
 
-pub fn shutdown(handle: *uvll::uv_stream_t, loop_: &Loop) -> Result<(), IoError> {
+pub fn shutdown(handle: *mut uvll::uv_stream_t, loop_: &Loop) -> Result<(), IoError> {
     struct Ctx {
         slot: Option<BlockedTask>,
         status: c_int,
@@ -819,7 +820,7 @@ struct Ctx {
             let mut cx = Ctx { slot: None, status: 0 };
 
             wait_until_woken_after(&mut cx.slot, loop_, || {
-                req.set_data(&cx);
+                req.set_data(&mut cx);
             });
 
             status_to_io_result(cx.status)
@@ -827,7 +828,7 @@ struct Ctx {
         n => Err(uv_error_to_io_error(UvError(n)))
     };
 
-    extern fn shutdown_cb(req: *uvll::uv_shutdown_t, status: libc::c_int) {
+    extern fn shutdown_cb(req: *mut uvll::uv_shutdown_t, status: libc::c_int) {
         let req = Request::wrap(req);
         assert!(status != uvll::ECANCELED);
         let cx: &mut Ctx = unsafe { req.get_data() };
index 2ac9bfd202b8e8bcd011af3b1c896a41befbeb38..f14f81b0b6072af3c286d3f404cdfef6476c5046 100644 (file)
@@ -37,7 +37,7 @@ pub struct PipeWatcher {
 
 pub struct PipeListener {
     home: HomeHandle,
-    pipe: *uvll::uv_pipe_t,
+    pipe: *mut uvll::uv_pipe_t,
     outgoing: Sender<IoResult<Box<rtio::RtioPipe + Send>>>,
     incoming: Receiver<IoResult<Box<rtio::RtioPipe + Send>>>,
 }
@@ -100,11 +100,11 @@ pub fn connect(io: &mut UvIoFactory, name: &CString, timeout: Option<u64>)
         })
     }
 
-    pub fn handle(&self) -> *uvll::uv_pipe_t { self.stream.handle }
+    pub fn handle(&self) -> *mut uvll::uv_pipe_t { self.stream.handle }
 
     // Unwraps the underlying uv pipe. This cancels destruction of the pipe and
     // allows the pipe to get moved elsewhere
-    fn unwrap(mut self) -> *uvll::uv_pipe_t {
+    fn unwrap(mut self) -> *mut uvll::uv_pipe_t {
         self.defused = true;
         return self.stream.handle;
     }
@@ -181,7 +181,7 @@ fn set_read_timeout(&mut self, ms: Option<u64>) {
         let _m = self.fire_homing_missile();
         let loop_ = self.uv_loop();
         self.read_access.set_timeout(ms, &self.home, &loop_, cancel_read,
-                                     &self.stream as *_ as uint);
+                                     &self.stream as *const _ as uint);
 
         fn cancel_read(stream: uint) -> Option<BlockedTask> {
             let stream: &mut StreamWatcher = unsafe { mem::transmute(stream) };
@@ -193,7 +193,7 @@ fn set_write_timeout(&mut self, ms: Option<u64>) {
         let _m = self.fire_homing_missile();
         let loop_ = self.uv_loop();
         self.write_access.set_timeout(ms, &self.home, &loop_, cancel_write,
-                                      &self.stream as *_ as uint);
+                                      &self.stream as *const _ as uint);
 
         fn cancel_write(stream: uint) -> Option<BlockedTask> {
             let stream: &mut StreamWatcher = unsafe { mem::transmute(stream) };
@@ -207,7 +207,7 @@ fn home<'a>(&'a mut self) -> &'a mut HomeHandle { &mut self.home }
 }
 
 impl UvHandle<uvll::uv_pipe_t> for PipeWatcher {
-    fn uv_handle(&self) -> *uvll::uv_pipe_t { self.stream.handle }
+    fn uv_handle(&self) -> *mut uvll::uv_pipe_t { self.stream.handle }
 }
 
 impl Drop for PipeWatcher {
@@ -269,10 +269,10 @@ fn home<'r>(&'r mut self) -> &'r mut HomeHandle { &mut self.home }
 }
 
 impl UvHandle<uvll::uv_pipe_t> for PipeListener {
-    fn uv_handle(&self) -> *uvll::uv_pipe_t { self.pipe }
+    fn uv_handle(&self) -> *mut uvll::uv_pipe_t { self.pipe }
 }
 
-extern fn listen_cb(server: *uvll::uv_stream_t, status: libc::c_int) {
+extern fn listen_cb(server: *mut uvll::uv_stream_t, status: libc::c_int) {
     assert!(status != uvll::ECANCELED);
 
     let pipe: &mut PipeListener = unsafe { UvHandle::from_uv_handle(&server) };
index aa87582da26d87bca60dd1c7f42b06f935cb06c6..a341f04f567835a8d288dd41198db641d391148c 100644 (file)
@@ -25,7 +25,7 @@
 use uvll;
 
 pub struct Process {
-    handle: *uvll::uv_process_t,
+    handle: *mut uvll::uv_process_t,
     home: HomeHandle,
 
     /// Task to wake up (may be null) for when the process exits
@@ -60,8 +60,8 @@ pub fn spawn(io_loop: &mut UvIoFactory, cfg: rtio::ProcessConfig)
         let mut ret_io = Vec::with_capacity(io.len());
         unsafe {
             stdio.set_len(io.len());
-            for (slot, other) in stdio.iter().zip(io.iter()) {
-                let io = set_stdio(slot as *uvll::uv_stdio_container_t, other,
+            for (slot, other) in stdio.mut_iter().zip(io.iter()) {
+                let io = set_stdio(slot as *mut uvll::uv_stdio_container_t, other,
                                    io_loop);
                 ret_io.push(io);
             }
@@ -79,7 +79,7 @@ pub fn spawn(io_loop: &mut UvIoFactory, cfg: rtio::ProcessConfig)
                 if cfg.detach {
                     flags |= uvll::PROCESS_DETACHED;
                 }
-                let options = uvll::uv_process_options_t {
+                let mut options = uvll::uv_process_options_t {
                     exit_cb: on_exit,
                     file: unsafe { *argv },
                     args: argv,
@@ -90,7 +90,7 @@ pub fn spawn(io_loop: &mut UvIoFactory, cfg: rtio::ProcessConfig)
                     },
                     flags: flags as libc::c_uint,
                     stdio_count: stdio.len() as libc::c_int,
-                    stdio: stdio.as_ptr(),
+                    stdio: stdio.as_mut_ptr(),
                     uid: cfg.uid.unwrap_or(0) as uvll::uv_uid_t,
                     gid: cfg.gid.unwrap_or(0) as uvll::uv_gid_t,
                 };
@@ -105,7 +105,7 @@ pub fn spawn(io_loop: &mut UvIoFactory, cfg: rtio::ProcessConfig)
                     timeout_state: NoTimeout,
                 };
                 match unsafe {
-                    uvll::uv_spawn(io_loop.uv_loop(), handle, &options)
+                    uvll::uv_spawn(io_loop.uv_loop(), handle, &mut options)
                 } {
                     0 => Ok(process.install()),
                     err => Err(UvError(err)),
@@ -129,7 +129,7 @@ pub fn kill(pid: libc::pid_t, signum: int) -> Result<(), UvError> {
     }
 }
 
-extern fn on_exit(handle: *uvll::uv_process_t,
+extern fn on_exit(handle: *mut uvll::uv_process_t,
                   exit_status: i64,
                   term_signal: libc::c_int) {
     let p: &mut Process = unsafe { UvHandle::from_uv_handle(&handle) };
@@ -144,7 +144,7 @@ pub fn kill(pid: libc::pid_t, signum: int) -> Result<(), UvError> {
     wakeup(&mut p.to_wake);
 }
 
-unsafe fn set_stdio(dst: *uvll::uv_stdio_container_t,
+unsafe fn set_stdio(dst: *mut uvll::uv_stdio_container_t,
                     io: &rtio::StdioContainer,
                     io_loop: &mut UvIoFactory) -> Option<PipeWatcher> {
     match *io {
@@ -174,8 +174,9 @@ unsafe fn set_stdio(dst: *uvll::uv_stdio_container_t,
 }
 
 /// Converts the program and arguments to the argv array expected by libuv.
-fn with_argv<T>(prog: &CString, args: &[CString], cb: |**libc::c_char| -> T) -> T {
-    let mut ptrs: Vec<*libc::c_char> = Vec::with_capacity(args.len()+1);
+fn with_argv<T>(prog: &CString, args: &[CString],
+                cb: |*const *const libc::c_char| -> T) -> T {
+    let mut ptrs: Vec<*const libc::c_char> = Vec::with_capacity(args.len()+1);
 
     // Convert the CStrings into an array of pointers. Note: the
     // lifetime of the various CStrings involved is guaranteed to be
@@ -192,7 +193,8 @@ fn with_argv<T>(prog: &CString, args: &[CString], cb: |**libc::c_char| -> T) ->
 }
 
 /// Converts the environment to the env array expected by libuv
-fn with_env<T>(env: Option<&[(CString, CString)]>, cb: |**libc::c_char| -> T) -> T {
+fn with_env<T>(env: Option<&[(CString, CString)]>,
+               cb: |*const *const libc::c_char| -> T) -> T {
     // We can pass a char** for envp, which is a null-terminated array
     // of "k=v\0" strings. Since we must create these strings locally,
     // yet expose a raw pointer to them, we create a temporary vector
@@ -210,9 +212,9 @@ fn with_env<T>(env: Option<&[(CString, CString)]>, cb: |**libc::c_char| -> T) ->
             }
 
             // As with `with_argv`, this is unsafe, since cb could leak the pointers.
-            let mut ptrs: Vec<*libc::c_char> =
+            let mut ptrs: Vec<*const libc::c_char> =
                 tmps.iter()
-                    .map(|tmp| tmp.as_ptr() as *libc::c_char)
+                    .map(|tmp| tmp.as_ptr() as *const libc::c_char)
                     .collect();
             ptrs.push(ptr::null());
 
@@ -227,7 +229,7 @@ fn home<'r>(&'r mut self) -> &'r mut HomeHandle { &mut self.home }
 }
 
 impl UvHandle<uvll::uv_process_t> for Process {
-    fn uv_handle(&self) -> *uvll::uv_process_t { self.handle }
+    fn uv_handle(&self) -> *mut uvll::uv_process_t { self.handle }
 }
 
 impl rtio::RtioProcess for Process {
@@ -290,7 +292,7 @@ fn set_timeout(&mut self, timeout: Option<u64>) {
             });
             let mut timer = box TimerWatcher::new_home(&loop_, self.home().clone());
             unsafe {
-                timer.set_data(self as *mut _ as *Process);
+                timer.set_data(self as *mut _);
             }
             self.timer = Some(timer);
         }
@@ -300,7 +302,7 @@ fn set_timeout(&mut self, timeout: Option<u64>) {
         timer.start(timer_cb, ms, 0);
         self.timeout_state = TimeoutPending;
 
-        extern fn timer_cb(timer: *uvll::uv_timer_t) {
+        extern fn timer_cb(timer: *mut uvll::uv_timer_t) {
             let p: &mut Process = unsafe {
                 &mut *(uvll::get_data_for_uv_handle(timer) as *mut Process)
             };
index a3694bfe9c2beed46199f5a7f825f48fa636b994..902e2b0bd192fec42d3329f8674d01bdece34290 100644 (file)
@@ -38,7 +38,7 @@ enum Message {
 }
 
 struct State {
-    handle: *uvll::uv_async_t,
+    handle: *mut uvll::uv_async_t,
     lock: NativeMutex, // see comments in async_cb for why this is needed
     queue: mpsc::Queue<Message>,
 }
@@ -55,7 +55,7 @@ pub struct Queue {
     queue: Arc<State>,
 }
 
-extern fn async_cb(handle: *uvll::uv_async_t) {
+extern fn async_cb(handle: *mut uvll::uv_async_t) {
     let pool: &mut QueuePool = unsafe {
         mem::transmute(uvll::get_data_for_uv_handle(handle))
     };
@@ -114,7 +114,7 @@ pub fn new(loop_: &mut Loop) -> Box<QueuePool> {
             lock: unsafe {NativeMutex::new()},
             queue: mpsc::Queue::new(),
         });
-        let q = box QueuePool {
+        let mut q = box QueuePool {
             refcnt: 0,
             queue: state,
         };
@@ -122,7 +122,7 @@ pub fn new(loop_: &mut Loop) -> Box<QueuePool> {
         unsafe {
             assert_eq!(uvll::uv_async_init(loop_.handle, handle, async_cb), 0);
             uvll::uv_unref(handle);
-            let data = &*q as *QueuePool as *c_void;
+            let data = &mut *q as *mut QueuePool as *mut c_void;
             uvll::set_data_for_uv_handle(handle, data);
         }
 
@@ -139,7 +139,7 @@ pub fn queue(&mut self) -> Queue {
         Queue { queue: self.queue.clone() }
     }
 
-    pub fn handle(&self) -> *uvll::uv_async_t { self.queue.handle }
+    pub fn handle(&self) -> *mut uvll::uv_async_t { self.queue.handle }
 }
 
 impl Queue {
index b478738ec8e722849b9263d89f2de7feb8e2a546..49ef4e9a24bccad8f1ce42d507539e1c616b386b 100644 (file)
@@ -17,7 +17,7 @@
 use uvio::UvIoFactory;
 
 pub struct SignalWatcher {
-    handle: *uvll::uv_signal_t,
+    handle: *mut uvll::uv_signal_t,
     home: HomeHandle,
 
     cb: Box<Callback + Send>,
@@ -45,7 +45,7 @@ pub fn new(io: &mut UvIoFactory, signum: int, cb: Box<Callback + Send>)
     }
 }
 
-extern fn signal_cb(handle: *uvll::uv_signal_t, _signum: c_int) {
+extern fn signal_cb(handle: *mut uvll::uv_signal_t, _signum: c_int) {
     let s: &mut SignalWatcher = unsafe { UvHandle::from_uv_handle(&handle) };
     let _ = s.cb.call();
 }
@@ -55,7 +55,7 @@ fn home<'r>(&'r mut self) -> &'r mut HomeHandle { &mut self.home }
 }
 
 impl UvHandle<uvll::uv_signal_t> for SignalWatcher {
-    fn uv_handle(&self) -> *uvll::uv_signal_t { self.handle }
+    fn uv_handle(&self) -> *mut uvll::uv_signal_t { self.handle }
 }
 
 impl RtioSignal for SignalWatcher {}
index 742944977622fa96c0132c22210290b92990d0f3..f615e8287b3c7efb3b77daf3b07f3cd4f954c720 100644 (file)
@@ -23,7 +23,7 @@
 // uv_stream_t instance, and all I/O operations assume that it's already located
 // on the appropriate scheduler.
 pub struct StreamWatcher {
-    pub handle: *uvll::uv_stream_t,
+    pub handle: *mut uvll::uv_stream_t,
 
     // Cache the last used uv_write_t so we don't have to allocate a new one on
     // every call to uv_write(). Ideally this would be a stack-allocated
@@ -59,8 +59,8 @@ impl StreamWatcher {
     // will be manipulated on each of the methods called on this watcher.
     // Wrappers should ensure to always reset the field to an appropriate value
     // if they rely on the field to perform an action.
-    pub fn new(stream: *uvll::uv_stream_t) -> StreamWatcher {
-        unsafe { uvll::set_data_for_uv_handle(stream, 0 as *int) }
+    pub fn new(stream: *mut uvll::uv_stream_t) -> StreamWatcher {
+        unsafe { uvll::set_data_for_uv_handle(stream, 0 as *mut int) }
         StreamWatcher {
             handle: stream,
             last_write_req: None,
@@ -85,7 +85,7 @@ pub fn read(&mut self, buf: &mut [u8]) -> Result<uint, UvError> {
         // we must be ready for this to happen (by setting the data in the uv
         // handle). In theory this otherwise doesn't need to happen until after
         // the read is succesfully started.
-        unsafe { uvll::set_data_for_uv_handle(self.handle, &rcx) }
+        unsafe { uvll::set_data_for_uv_handle(self.handle, &mut rcx) }
 
         // Send off the read request, but don't block until we're sure that the
         // read request is queued.
@@ -103,7 +103,7 @@ pub fn read(&mut self, buf: &mut [u8]) -> Result<uint, UvError> {
             n => Err(UvError(n))
         };
         // Make sure a read cancellation sees that there's no pending read
-        unsafe { uvll::set_data_for_uv_handle(self.handle, 0 as *int) }
+        unsafe { uvll::set_data_for_uv_handle(self.handle, 0 as *mut int) }
         return ret;
     }
 
@@ -115,7 +115,7 @@ pub fn cancel_read(&mut self, reason: ssize_t) -> Option<BlockedTask> {
         let data = unsafe {
             let data = uvll::get_data_for_uv_handle(self.handle);
             if data.is_null() { return None }
-            uvll::set_data_for_uv_handle(self.handle, 0 as *int);
+            uvll::set_data_for_uv_handle(self.handle, 0 as *mut int);
             &mut *(data as *mut ReadContext)
         };
         data.result = reason;
@@ -133,7 +133,7 @@ pub fn write(&mut self, buf: &[u8], may_timeout: bool) -> Result<(), UvError> {
         let mut req = match self.last_write_req.take() {
             Some(req) => req, None => Request::new(uvll::UV_WRITE),
         };
-        req.set_data(ptr::null::<()>());
+        req.set_data(ptr::mut_null::<()>());
 
         // And here's where timeouts get a little interesting. Currently, libuv
         // does not support canceling an in-flight write request. Consequently,
@@ -180,7 +180,7 @@ pub fn write(&mut self, buf: &[u8], may_timeout: bool) -> Result<(), UvError> {
                 let loop_ = unsafe { uvll::get_loop_for_uv_handle(self.handle) };
                 wait_until_woken_after(&mut self.blocked_writer,
                                        &Loop::wrap(loop_), || {
-                    req.set_data(&wcx);
+                    req.set_data(&mut wcx);
                 });
 
                 if wcx.result != uvll::ECANCELED {
@@ -205,13 +205,13 @@ pub fn write(&mut self, buf: &[u8], may_timeout: bool) -> Result<(), UvError> {
                 // Note that we don't cache this write request back in the
                 // stream watcher because we no longer have ownership of it, and
                 // we never will.
-                let new_wcx = box WriteContext {
+                let mut new_wcx = box WriteContext {
                     result: 0,
                     stream: 0 as *mut StreamWatcher,
                     data: wcx.data.take(),
                 };
                 unsafe {
-                    req.set_data(&*new_wcx);
+                    req.set_data(&mut *new_wcx);
                     mem::forget(new_wcx);
                 }
                 Err(UvError(wcx.result))
@@ -228,7 +228,7 @@ pub fn cancel_write(&mut self) -> Option<BlockedTask> {
 // This allocation callback expects to be invoked once and only once. It will
 // unwrap the buffer in the ReadContext stored in the stream and return it. This
 // will fail if it is called more than once.
-extern fn alloc_cb(stream: *uvll::uv_stream_t, _hint: size_t, buf: *mut Buf) {
+extern fn alloc_cb(stream: *mut uvll::uv_stream_t, _hint: size_t, buf: *mut Buf) {
     uvdebug!("alloc_cb");
     unsafe {
         let rcx: &mut ReadContext =
@@ -239,7 +239,8 @@ pub fn cancel_write(&mut self) -> Option<BlockedTask> {
 
 // When a stream has read some data, we will always forcibly stop reading and
 // return all the data read (even if it didn't fill the whole buffer).
-extern fn read_cb(handle: *uvll::uv_stream_t, nread: ssize_t, _buf: *Buf) {
+extern fn read_cb(handle: *mut uvll::uv_stream_t, nread: ssize_t,
+                  _buf: *const Buf) {
     uvdebug!("read_cb {}", nread);
     assert!(nread != uvll::ECANCELED as ssize_t);
     let rcx: &mut ReadContext = unsafe {
@@ -258,7 +259,7 @@ pub fn cancel_write(&mut self) -> Option<BlockedTask> {
 // Unlike reading, the WriteContext is stored in the uv_write_t request. Like
 // reading, however, all this does is wake up the blocked task after squirreling
 // away the error code as a result.
-extern fn write_cb(req: *uvll::uv_write_t, status: c_int) {
+extern fn write_cb(req: *mut uvll::uv_write_t, status: c_int) {
     let mut req = Request::wrap(req);
     // Remember to not free the request because it is re-used between writes on
     // the same stream.
index 1c191d476edb9efa27750192bb823d1ea654cc89..1caaf5e0fc75dd04059388e6949be83be6531e22 100644 (file)
@@ -119,13 +119,13 @@ pub fn set_timeout(&mut self, ms: Option<u64>,
         // to fire when the timeout runs out.
         if self.timer.is_none() {
             let mut timer = box TimerWatcher::new_home(loop_, home.clone());
-            let cx = box TimerContext {
+            let mut cx = box TimerContext {
                 timeout: self as *mut _,
                 callback: cb,
                 payload: data,
             };
             unsafe {
-                timer.set_data(&*cx);
+                timer.set_data(&mut *cx);
                 mem::forget(cx);
             }
             self.timer = Some(timer);
@@ -142,9 +142,9 @@ pub fn set_timeout(&mut self, ms: Option<u64>,
         timer.start(timer_cb, ms, 0);
         self.state = TimeoutPending(NoWaiter);
 
-        extern fn timer_cb(timer: *uvll::uv_timer_t) {
+        extern fn timer_cb(timer: *mut uvll::uv_timer_t) {
             let cx: &TimerContext = unsafe {
-                &*(uvll::get_data_for_uv_handle(timer) as *TimerContext)
+                &*(uvll::get_data_for_uv_handle(timer) as *const TimerContext)
             };
             let me = unsafe { &mut *cx.timeout };
 
@@ -240,7 +240,7 @@ pub fn connect<T>(
                     None => {}
                 }
                 wait_until_woken_after(&mut self.task, &io.loop_, || {
-                    let data = &self as *_;
+                    let data = &self as *const _ as *mut ConnectCtx;
                     match self.timer {
                         Some(ref mut timer) => unsafe { timer.set_data(data) },
                         None => {}
@@ -249,7 +249,7 @@ pub fn connect<T>(
                 });
                 // Make sure an erroneously fired callback doesn't have access
                 // to the context any more.
-                req.set_data(0 as *int);
+                req.set_data(0 as *mut int);
 
                 // If we failed because of a timeout, drop the TcpWatcher as
                 // soon as possible because it's data is now set to null and we
@@ -262,7 +262,7 @@ pub fn connect<T>(
             n => Err(UvError(n))
         };
 
-        extern fn timer_cb(handle: *uvll::uv_timer_t) {
+        extern fn timer_cb(handle: *mut uvll::uv_timer_t) {
             // Don't close the corresponding tcp request, just wake up the task
             // and let RAII take care of the pending watcher.
             let cx: &mut ConnectCtx = unsafe {
@@ -272,7 +272,7 @@ pub fn connect<T>(
             wakeup(&mut cx.task);
         }
 
-        extern fn connect_cb(req: *uvll::uv_connect_t, status: c_int) {
+        extern fn connect_cb(req: *mut uvll::uv_connect_t, status: c_int) {
             // This callback can be invoked with ECANCELED if the watcher is
             // closed by the timeout callback. In that case we just want to free
             // the request and be along our merry way.
@@ -367,7 +367,7 @@ pub fn set_timeout<U, T: UvHandle<U> + HomingIO>(
             });
             let mut timer = TimerWatcher::new_home(&loop_, t.home().clone());
             unsafe {
-                timer.set_data(self as *mut _ as *AcceptTimeout);
+                timer.set_data(self as *mut _);
             }
             self.timer = Some(timer);
         }
@@ -381,7 +381,7 @@ pub fn set_timeout<U, T: UvHandle<U> + HomingIO>(
         self.timeout_tx = Some(tx);
         self.timeout_rx = Some(rx);
 
-        extern fn timer_cb(timer: *uvll::uv_timer_t) {
+        extern fn timer_cb(timer: *mut uvll::uv_timer_t) {
             let acceptor: &mut AcceptTimeout = unsafe {
                 &mut *(uvll::get_data_for_uv_handle(timer) as *mut AcceptTimeout)
             };
index 34cd2e489a00cb27e7aa9c844a67da8c15a37b15..9d0a56b3c851d69d82f15e3cdf4ab10a0278739b 100644 (file)
@@ -18,7 +18,7 @@
 use uvll;
 
 pub struct TimerWatcher {
-    pub handle: *uvll::uv_timer_t,
+    pub handle: *mut uvll::uv_timer_t,
     home: HomeHandle,
     action: Option<NextAction>,
     blocker: Option<BlockedTask>,
@@ -60,7 +60,7 @@ pub fn stop(&mut self) {
         assert_eq!(unsafe { uvll::uv_timer_stop(self.handle) }, 0)
     }
 
-    pub unsafe fn set_data<T>(&mut self, data: *T) {
+    pub unsafe fn set_data<T>(&mut self, data: *mut T) {
         uvll::set_data_for_uv_handle(self.handle, data);
     }
 }
@@ -70,7 +70,7 @@ fn home<'r>(&'r mut self) -> &'r mut HomeHandle { &mut self.home }
 }
 
 impl UvHandle<uvll::uv_timer_t> for TimerWatcher {
-    fn uv_handle(&self) -> *uvll::uv_timer_t { self.handle }
+    fn uv_handle(&self) -> *mut uvll::uv_timer_t { self.handle }
 }
 
 impl RtioTimer for TimerWatcher {
@@ -128,7 +128,7 @@ fn period(&mut self, msecs: u64, cb: Box<Callback + Send>) {
     }
 }
 
-extern fn timer_cb(handle: *uvll::uv_timer_t) {
+extern fn timer_cb(handle: *mut uvll::uv_timer_t) {
     let _f = ForbidSwitch::new("timer callback can't switch");
     let timer: &mut TimerWatcher = unsafe { UvHandle::from_uv_handle(&handle) };
 
index 828a3d0c63b0aaea2109647706b625e2723e9cfb..85ec0c75d53c8cd270a0fd9ef63005bbf08894c1 100644 (file)
@@ -19,7 +19,7 @@
 use uvll;
 
 pub struct TtyWatcher{
-    tty: *uvll::uv_tty_t,
+    tty: *mut uvll::uv_tty_t,
     stream: StreamWatcher,
     home: HomeHandle,
     fd: libc::c_int,
@@ -70,7 +70,7 @@ pub fn new(io: &mut UvIoFactory, fd: libc::c_int, readable: bool)
                 // handle, so our only cleanup is to free the handle itself
                 if cfg!(windows) {
                     unsafe { uvll::free_handle(handle); }
-                    watcher.tty = ptr::null();
+                    watcher.tty = ptr::mut_null();
                 }
                 Err(UvError(n))
             }
@@ -102,8 +102,8 @@ fn set_raw(&mut self, raw: bool) -> IoResult<()> {
     fn get_winsize(&mut self) -> IoResult<(int, int)> {
         let mut width: libc::c_int = 0;
         let mut height: libc::c_int = 0;
-        let widthptr: *libc::c_int = &width;
-        let heightptr: *libc::c_int = &width;
+        let widthptr: *mut libc::c_int = &mut width;
+        let heightptr: *mut libc::c_int = &mut width;
 
         let _m = self.fire_homing_missile();
         match unsafe { uvll::uv_tty_get_winsize(self.tty,
@@ -119,7 +119,7 @@ fn isatty(&self) -> bool {
 }
 
 impl UvHandle<uvll::uv_tty_t> for TtyWatcher {
-    fn uv_handle(&self) -> *uvll::uv_tty_t { self.tty }
+    fn uv_handle(&self) -> *mut uvll::uv_tty_t { self.tty }
 }
 
 impl HomingIO for TtyWatcher {
index 8c9d29ee9147b69ec6859640f0cead77aecbde05..61e52a3abd19cc0e11e2ad50d321c1ad5cc63593 100644 (file)
@@ -126,7 +126,7 @@ pub struct UvIoFactory {
 }
 
 impl UvIoFactory {
-    pub fn uv_loop<'a>(&mut self) -> *uvll::uv_loop_t { self.loop_.handle }
+    pub fn uv_loop<'a>(&mut self) -> *mut uvll::uv_loop_t { self.loop_.handle }
 
     pub fn make_handle(&mut self) -> HomeHandle {
         // It's understood by the homing code that the "local id" is just the
index a6193dd9379c1636734f8428338848c8534e0b7a..863536a4111018c2d6919b96b3b8f64dfa058743 100644 (file)
@@ -103,7 +103,7 @@ pub mod errors {
 // see libuv/include/uv-unix.h
 #[cfg(unix)]
 pub struct uv_buf_t {
-    pub base: *u8,
+    pub base: *mut u8,
     pub len: uv_buf_len_t,
 }
 
@@ -111,7 +111,7 @@ pub struct uv_buf_t {
 #[cfg(windows)]
 pub struct uv_buf_t {
     pub len: uv_buf_len_t,
-    pub base: *u8,
+    pub base: *mut u8,
 }
 
 #[repr(C)]
@@ -123,13 +123,13 @@ pub enum uv_run_mode {
 
 pub struct uv_process_options_t {
     pub exit_cb: uv_exit_cb,
-    pub file: *libc::c_char,
-    pub args: **libc::c_char,
-    pub env: **libc::c_char,
-    pub cwd: *libc::c_char,
+    pub file: *const libc::c_char,
+    pub args: *const *const libc::c_char,
+    pub env: *const *const libc::c_char,
+    pub cwd: *const libc::c_char,
     pub flags: libc::c_uint,
     pub stdio_count: libc::c_int,
-    pub stdio: *uv_stdio_container_t,
+    pub stdio: *mut uv_stdio_container_t,
     pub uid: uv_uid_t,
     pub gid: uv_gid_t,
 }
@@ -139,7 +139,7 @@ pub struct uv_process_options_t {
 #[repr(C)]
 pub struct uv_stdio_container_t {
     flags: libc::c_int,
-    stream: *uv_stream_t,
+    stream: *mut uv_stream_t,
 }
 
 pub type uv_handle_t = c_void;
@@ -216,41 +216,41 @@ pub fn is_dir(&self) -> bool {
     }
 }
 
-pub type uv_idle_cb = extern "C" fn(handle: *uv_idle_t);
-pub type uv_alloc_cb = extern "C" fn(stream: *uv_stream_t,
+pub type uv_idle_cb = extern "C" fn(handle: *mut uv_idle_t);
+pub type uv_alloc_cb = extern "C" fn(stream: *mut uv_stream_t,
                                      suggested_size: size_t,
                                      buf: *mut uv_buf_t);
-pub type uv_read_cb = extern "C" fn(stream: *uv_stream_t,
+pub type uv_read_cb = extern "C" fn(stream: *mut uv_stream_t,
                                     nread: ssize_t,
-                                    buf: *uv_buf_t);
-pub type uv_udp_send_cb = extern "C" fn(req: *uv_udp_send_t,
+                                    buf: *const uv_buf_t);
+pub type uv_udp_send_cb = extern "C" fn(req: *mut uv_udp_send_t,
                                         status: c_int);
-pub type uv_udp_recv_cb = extern "C" fn(handle: *uv_udp_t,
+pub type uv_udp_recv_cb = extern "C" fn(handle: *mut uv_udp_t,
                                         nread: ssize_t,
-                                        buf: *uv_buf_t,
-                                        addr: *sockaddr,
+                                        buf: *const uv_buf_t,
+                                        addr: *const sockaddr,
                                         flags: c_uint);
-pub type uv_close_cb = extern "C" fn(handle: *uv_handle_t);
-pub type uv_walk_cb = extern "C" fn(handle: *uv_handle_t,
-                                    arg: *c_void);
-pub type uv_async_cb = extern "C" fn(handle: *uv_async_t);
-pub type uv_connect_cb = extern "C" fn(handle: *uv_connect_t,
+pub type uv_close_cb = extern "C" fn(handle: *mut uv_handle_t);
+pub type uv_walk_cb = extern "C" fn(handle: *mut uv_handle_t,
+                                    arg: *mut c_void);
+pub type uv_async_cb = extern "C" fn(handle: *mut uv_async_t);
+pub type uv_connect_cb = extern "C" fn(handle: *mut uv_connect_t,
                                        status: c_int);
-pub type uv_connection_cb = extern "C" fn(handle: *uv_connection_t,
+pub type uv_connection_cb = extern "C" fn(handle: *mut uv_connection_t,
                                           status: c_int);
-pub type uv_timer_cb = extern "C" fn(handle: *uv_timer_t);
-pub type uv_write_cb = extern "C" fn(handle: *uv_write_t,
+pub type uv_timer_cb = extern "C" fn(handle: *mut uv_timer_t);
+pub type uv_write_cb = extern "C" fn(handle: *mut uv_write_t,
                                      status: c_int);
-pub type uv_getaddrinfo_cb = extern "C" fn(req: *uv_getaddrinfo_t,
+pub type uv_getaddrinfo_cb = extern "C" fn(req: *mut uv_getaddrinfo_t,
                                            status: c_int,
-                                           res: *addrinfo);
-pub type uv_exit_cb = extern "C" fn(handle: *uv_process_t,
+                                           res: *const addrinfo);
+pub type uv_exit_cb = extern "C" fn(handle: *mut uv_process_t,
                                     exit_status: i64,
                                     term_signal: c_int);
-pub type uv_signal_cb = extern "C" fn(handle: *uv_signal_t,
+pub type uv_signal_cb = extern "C" fn(handle: *mut uv_signal_t,
                                       signum: c_int);
-pub type uv_fs_cb = extern "C" fn(req: *uv_fs_t);
-pub type uv_shutdown_cb = extern "C" fn(req: *uv_shutdown_t, status: c_int);
+pub type uv_fs_cb = extern "C" fn(req: *mut uv_fs_t);
+pub type uv_shutdown_cb = extern "C" fn(req: *mut uv_shutdown_t, status: c_int);
 
 #[cfg(unix)] pub type uv_uid_t = libc::types::os::arch::posix88::uid_t;
 #[cfg(unix)] pub type uv_gid_t = libc::types::os::arch::posix88::gid_t;
@@ -330,23 +330,23 @@ pub enum uv_membership {
     UV_JOIN_GROUP
 }
 
-pub unsafe fn malloc_handle(handle: uv_handle_type) -> *c_void {
+pub unsafe fn malloc_handle(handle: uv_handle_type) -> *mut c_void {
     assert!(handle != UV_UNKNOWN_HANDLE && handle != UV_HANDLE_TYPE_MAX);
     let size = uv_handle_size(handle);
-    malloc_raw(size as uint) as *c_void
+    malloc_raw(size as uint) as *mut c_void
 }
 
-pub unsafe fn free_handle(v: *c_void) {
+pub unsafe fn free_handle(v: *mut c_void) {
     free(v as *mut c_void)
 }
 
-pub unsafe fn malloc_req(req: uv_req_type) -> *c_void {
+pub unsafe fn malloc_req(req: uv_req_type) -> *mut c_void {
     assert!(req != UV_UNKNOWN_REQ && req != UV_REQ_TYPE_MAX);
     let size = uv_req_size(req);
-    malloc_raw(size as uint) as *c_void
+    malloc_raw(size as uint) as *mut c_void
 }
 
-pub unsafe fn free_req(v: *c_void) {
+pub unsafe fn free_req(v: *mut c_void) {
     free(v as *mut c_void)
 }
 
@@ -365,17 +365,17 @@ fn request_sanity_check() {
 }
 
 // FIXME Event loops ignore SIGPIPE by default.
-pub unsafe fn loop_new() -> *c_void {
+pub unsafe fn loop_new() -> *mut c_void {
     return rust_uv_loop_new();
 }
 
-pub unsafe fn uv_write(req: *uv_write_t,
-                       stream: *uv_stream_t,
+pub unsafe fn uv_write(req: *mut uv_write_t,
+                       stream: *mut uv_stream_t,
                        buf_in: &[uv_buf_t],
                        cb: uv_write_cb) -> c_int {
     extern {
-        fn uv_write(req: *uv_write_t, stream: *uv_stream_t,
-                    buf_in: *uv_buf_t, buf_cnt: c_int,
+        fn uv_write(req: *mut uv_write_t, stream: *mut uv_stream_t,
+                    buf_in: *const uv_buf_t, buf_cnt: c_int,
                     cb: uv_write_cb) -> c_int;
     }
 
@@ -384,14 +384,15 @@ fn uv_write(req: *uv_write_t, stream: *uv_stream_t,
     return uv_write(req, stream, buf_ptr, buf_cnt, cb);
 }
 
-pub unsafe fn uv_udp_send(req: *uv_udp_send_t,
-                          handle: *uv_udp_t,
+pub unsafe fn uv_udp_send(req: *mut uv_udp_send_t,
+                          handle: *mut uv_udp_t,
                           buf_in: &[uv_buf_t],
-                          addr: *sockaddr,
+                          addr: *const sockaddr,
                           cb: uv_udp_send_cb) -> c_int {
     extern {
-        fn uv_udp_send(req: *uv_write_t, stream: *uv_stream_t,
-                       buf_in: *uv_buf_t, buf_cnt: c_int, addr: *sockaddr,
+        fn uv_udp_send(req: *mut uv_write_t, stream: *mut uv_stream_t,
+                       buf_in: *const uv_buf_t, buf_cnt: c_int,
+                       addr: *const sockaddr,
                        cb: uv_udp_send_cb) -> c_int;
     }
 
@@ -400,76 +401,76 @@ fn uv_udp_send(req: *uv_write_t, stream: *uv_stream_t,
     return uv_udp_send(req, handle, buf_ptr, buf_cnt, addr, cb);
 }
 
-pub unsafe fn get_udp_handle_from_send_req(send_req: *uv_udp_send_t) -> *uv_udp_t {
+pub unsafe fn get_udp_handle_from_send_req(send_req: *mut uv_udp_send_t) -> *mut uv_udp_t {
     return rust_uv_get_udp_handle_from_send_req(send_req);
 }
 
-pub unsafe fn process_pid(p: *uv_process_t) -> c_int {
+pub unsafe fn process_pid(p: *mut uv_process_t) -> c_int {
 
     return rust_uv_process_pid(p);
 }
 
-pub unsafe fn set_stdio_container_flags(c: *uv_stdio_container_t,
+pub unsafe fn set_stdio_container_flags(c: *mut uv_stdio_container_t,
                                         flags: libc::c_int) {
 
     rust_set_stdio_container_flags(c, flags);
 }
 
-pub unsafe fn set_stdio_container_fd(c: *uv_stdio_container_t,
+pub unsafe fn set_stdio_container_fd(c: *mut uv_stdio_container_t,
                                      fd: libc::c_int) {
 
     rust_set_stdio_container_fd(c, fd);
 }
 
-pub unsafe fn set_stdio_container_stream(c: *uv_stdio_container_t,
-                                         stream: *uv_stream_t) {
+pub unsafe fn set_stdio_container_stream(c: *mut uv_stdio_container_t,
+                                         stream: *mut uv_stream_t) {
     rust_set_stdio_container_stream(c, stream);
 }
 
 // data access helpers
-pub unsafe fn get_result_from_fs_req(req: *uv_fs_t) -> ssize_t {
+pub unsafe fn get_result_from_fs_req(req: *mut uv_fs_t) -> ssize_t {
     rust_uv_get_result_from_fs_req(req)
 }
-pub unsafe fn get_ptr_from_fs_req(req: *uv_fs_t) -> *libc::c_void {
+pub unsafe fn get_ptr_from_fs_req(req: *mut uv_fs_t) -> *mut libc::c_void {
     rust_uv_get_ptr_from_fs_req(req)
 }
-pub unsafe fn get_path_from_fs_req(req: *uv_fs_t) -> *c_char {
+pub unsafe fn get_path_from_fs_req(req: *mut uv_fs_t) -> *mut c_char {
     rust_uv_get_path_from_fs_req(req)
 }
-pub unsafe fn get_loop_from_fs_req(req: *uv_fs_t) -> *uv_loop_t {
+pub unsafe fn get_loop_from_fs_req(req: *mut uv_fs_t) -> *mut uv_loop_t {
     rust_uv_get_loop_from_fs_req(req)
 }
-pub unsafe fn get_loop_from_getaddrinfo_req(req: *uv_getaddrinfo_t) -> *uv_loop_t {
+pub unsafe fn get_loop_from_getaddrinfo_req(req: *mut uv_getaddrinfo_t) -> *mut uv_loop_t {
     rust_uv_get_loop_from_getaddrinfo_req(req)
 }
-pub unsafe fn get_loop_for_uv_handle<T>(handle: *T) -> *c_void {
-    return rust_uv_get_loop_for_uv_handle(handle as *c_void);
+pub unsafe fn get_loop_for_uv_handle<T>(handle: *mut T) -> *mut c_void {
+    return rust_uv_get_loop_for_uv_handle(handle as *mut c_void);
 }
-pub unsafe fn get_stream_handle_from_connect_req(connect: *uv_connect_t) -> *uv_stream_t {
+pub unsafe fn get_stream_handle_from_connect_req(connect: *mut uv_connect_t) -> *mut uv_stream_t {
     return rust_uv_get_stream_handle_from_connect_req(connect);
 }
-pub unsafe fn get_stream_handle_from_write_req(write_req: *uv_write_t) -> *uv_stream_t {
+pub unsafe fn get_stream_handle_from_write_req(write_req: *mut uv_write_t) -> *mut uv_stream_t {
     return rust_uv_get_stream_handle_from_write_req(write_req);
 }
-pub unsafe fn get_data_for_uv_loop(loop_ptr: *c_void) -> *c_void {
+pub unsafe fn get_data_for_uv_loop(loop_ptr: *mut c_void) -> *mut c_void {
     rust_uv_get_data_for_uv_loop(loop_ptr)
 }
-pub unsafe fn set_data_for_uv_loop(loop_ptr: *c_void, data: *c_void) {
+pub unsafe fn set_data_for_uv_loop(loop_ptr: *mut c_void, data: *mut c_void) {
     rust_uv_set_data_for_uv_loop(loop_ptr, data);
 }
-pub unsafe fn get_data_for_uv_handle<T>(handle: *T) -> *c_void {
-    return rust_uv_get_data_for_uv_handle(handle as *c_void);
+pub unsafe fn get_data_for_uv_handle<T>(handle: *mut T) -> *mut c_void {
+    return rust_uv_get_data_for_uv_handle(handle as *mut c_void);
 }
-pub unsafe fn set_data_for_uv_handle<T, U>(handle: *T, data: *U) {
-    rust_uv_set_data_for_uv_handle(handle as *c_void, data as *c_void);
+pub unsafe fn set_data_for_uv_handle<T, U>(handle: *mut T, data: *mut U) {
+    rust_uv_set_data_for_uv_handle(handle as *mut c_void, data as *mut c_void);
 }
-pub unsafe fn get_data_for_req<T>(req: *T) -> *c_void {
-    return rust_uv_get_data_for_req(req as *c_void);
+pub unsafe fn get_data_for_req<T>(req: *mut T) -> *mut c_void {
+    return rust_uv_get_data_for_req(req as *mut c_void);
 }
-pub unsafe fn set_data_for_req<T, U>(req: *T, data: *U) {
-    rust_uv_set_data_for_req(req as *c_void, data as *c_void);
+pub unsafe fn set_data_for_req<T, U>(req: *mut T, data: *mut U) {
+    rust_uv_set_data_for_req(req as *mut c_void, data as *mut c_void);
 }
-pub unsafe fn populate_stat(req_in: *uv_fs_t, stat_out: *uv_stat_t) {
+pub unsafe fn populate_stat(req_in: *mut uv_fs_t, stat_out: *mut uv_stat_t) {
     rust_uv_populate_uv_stat(req_in, stat_out)
 }
 pub unsafe fn guess_handle(handle: c_int) -> c_int {
@@ -493,186 +494,196 @@ pub unsafe fn guess_handle(handle: c_int) -> c_int {
 extern {}
 
 extern {
-    fn rust_uv_loop_new() -> *c_void;
+    fn rust_uv_loop_new() -> *mut c_void;
 
     #[cfg(test)]
     fn rust_uv_handle_type_max() -> uintptr_t;
     #[cfg(test)]
     fn rust_uv_req_type_max() -> uintptr_t;
-    fn rust_uv_get_udp_handle_from_send_req(req: *uv_udp_send_t) -> *uv_udp_t;
-
-    fn rust_uv_populate_uv_stat(req_in: *uv_fs_t, stat_out: *uv_stat_t);
-    fn rust_uv_get_result_from_fs_req(req: *uv_fs_t) -> ssize_t;
-    fn rust_uv_get_ptr_from_fs_req(req: *uv_fs_t) -> *libc::c_void;
-    fn rust_uv_get_path_from_fs_req(req: *uv_fs_t) -> *c_char;
-    fn rust_uv_get_loop_from_fs_req(req: *uv_fs_t) -> *uv_loop_t;
-    fn rust_uv_get_loop_from_getaddrinfo_req(req: *uv_fs_t) -> *uv_loop_t;
-    fn rust_uv_get_stream_handle_from_connect_req(req: *uv_connect_t) -> *uv_stream_t;
-    fn rust_uv_get_stream_handle_from_write_req(req: *uv_write_t) -> *uv_stream_t;
-    fn rust_uv_get_loop_for_uv_handle(handle: *c_void) -> *c_void;
-    fn rust_uv_get_data_for_uv_loop(loop_ptr: *c_void) -> *c_void;
-    fn rust_uv_set_data_for_uv_loop(loop_ptr: *c_void, data: *c_void);
-    fn rust_uv_get_data_for_uv_handle(handle: *c_void) -> *c_void;
-    fn rust_uv_set_data_for_uv_handle(handle: *c_void, data: *c_void);
-    fn rust_uv_get_data_for_req(req: *c_void) -> *c_void;
-    fn rust_uv_set_data_for_req(req: *c_void, data: *c_void);
-    fn rust_set_stdio_container_flags(c: *uv_stdio_container_t, flags: c_int);
-    fn rust_set_stdio_container_fd(c: *uv_stdio_container_t, fd: c_int);
-    fn rust_set_stdio_container_stream(c: *uv_stdio_container_t,
-                                       stream: *uv_stream_t);
-    fn rust_uv_process_pid(p: *uv_process_t) -> c_int;
+    fn rust_uv_get_udp_handle_from_send_req(req: *mut uv_udp_send_t) -> *mut uv_udp_t;
+
+    fn rust_uv_populate_uv_stat(req_in: *mut uv_fs_t, stat_out: *mut uv_stat_t);
+    fn rust_uv_get_result_from_fs_req(req: *mut uv_fs_t) -> ssize_t;
+    fn rust_uv_get_ptr_from_fs_req(req: *mut uv_fs_t) -> *mut libc::c_void;
+    fn rust_uv_get_path_from_fs_req(req: *mut uv_fs_t) -> *mut c_char;
+    fn rust_uv_get_loop_from_fs_req(req: *mut uv_fs_t) -> *mut uv_loop_t;
+    fn rust_uv_get_loop_from_getaddrinfo_req(req: *mut uv_fs_t) -> *mut uv_loop_t;
+    fn rust_uv_get_stream_handle_from_connect_req(req: *mut uv_connect_t) -> *mut uv_stream_t;
+    fn rust_uv_get_stream_handle_from_write_req(req: *mut uv_write_t) -> *mut uv_stream_t;
+    fn rust_uv_get_loop_for_uv_handle(handle: *mut c_void) -> *mut c_void;
+    fn rust_uv_get_data_for_uv_loop(loop_ptr: *mut c_void) -> *mut c_void;
+    fn rust_uv_set_data_for_uv_loop(loop_ptr: *mut c_void, data: *mut c_void);
+    fn rust_uv_get_data_for_uv_handle(handle: *mut c_void) -> *mut c_void;
+    fn rust_uv_set_data_for_uv_handle(handle: *mut c_void, data: *mut c_void);
+    fn rust_uv_get_data_for_req(req: *mut c_void) -> *mut c_void;
+    fn rust_uv_set_data_for_req(req: *mut c_void, data: *mut c_void);
+    fn rust_set_stdio_container_flags(c: *mut uv_stdio_container_t, flags: c_int);
+    fn rust_set_stdio_container_fd(c: *mut uv_stdio_container_t, fd: c_int);
+    fn rust_set_stdio_container_stream(c: *mut uv_stdio_container_t,
+                                       stream: *mut uv_stream_t);
+    fn rust_uv_process_pid(p: *mut uv_process_t) -> c_int;
     fn rust_uv_guess_handle(fd: c_int) -> c_int;
 
     // generic uv functions
-    pub fn uv_loop_delete(l: *uv_loop_t);
-    pub fn uv_ref(t: *uv_handle_t);
-    pub fn uv_unref(t: *uv_handle_t);
+    pub fn uv_loop_delete(l: *mut uv_loop_t);
+    pub fn uv_ref(t: *mut uv_handle_t);
+    pub fn uv_unref(t: *mut uv_handle_t);
     pub fn uv_handle_size(ty: uv_handle_type) -> size_t;
     pub fn uv_req_size(ty: uv_req_type) -> size_t;
-    pub fn uv_run(l: *uv_loop_t, mode: uv_run_mode) -> c_int;
-    pub fn uv_close(h: *uv_handle_t, cb: uv_close_cb);
-    pub fn uv_walk(l: *uv_loop_t, cb: uv_walk_cb, arg: *c_void);
-    pub fn uv_buf_init(base: *c_char, len: c_uint) -> uv_buf_t;
-    pub fn uv_strerror(err: c_int) -> *c_char;
-    pub fn uv_err_name(err: c_int) -> *c_char;
-    pub fn uv_listen(s: *uv_stream_t, backlog: c_int,
+    pub fn uv_run(l: *mut uv_loop_t, mode: uv_run_mode) -> c_int;
+    pub fn uv_close(h: *mut uv_handle_t, cb: uv_close_cb);
+    pub fn uv_walk(l: *mut uv_loop_t, cb: uv_walk_cb, arg: *mut c_void);
+    pub fn uv_buf_init(base: *mut c_char, len: c_uint) -> uv_buf_t;
+    pub fn uv_strerror(err: c_int) -> *const c_char;
+    pub fn uv_err_name(err: c_int) -> *const c_char;
+    pub fn uv_listen(s: *mut uv_stream_t, backlog: c_int,
                      cb: uv_connection_cb) -> c_int;
-    pub fn uv_accept(server: *uv_stream_t, client: *uv_stream_t) -> c_int;
-    pub fn uv_read_start(stream: *uv_stream_t,
+    pub fn uv_accept(server: *mut uv_stream_t, client: *mut uv_stream_t) -> c_int;
+    pub fn uv_read_start(stream: *mut uv_stream_t,
                          on_alloc: uv_alloc_cb,
                          on_read: uv_read_cb) -> c_int;
-    pub fn uv_read_stop(stream: *uv_stream_t) -> c_int;
-    pub fn uv_shutdown(req: *uv_shutdown_t, handle: *uv_stream_t,
+    pub fn uv_read_stop(stream: *mut uv_stream_t) -> c_int;
+    pub fn uv_shutdown(req: *mut uv_shutdown_t, handle: *mut uv_stream_t,
                        cb: uv_shutdown_cb) -> c_int;
 
     // idle bindings
-    pub fn uv_idle_init(l: *uv_loop_t, i: *uv_idle_t) -> c_int;
-    pub fn uv_idle_start(i: *uv_idle_t, cb: uv_idle_cb) -> c_int;
-    pub fn uv_idle_stop(i: *uv_idle_t) -> c_int;
+    pub fn uv_idle_init(l: *mut uv_loop_t, i: *mut uv_idle_t) -> c_int;
+    pub fn uv_idle_start(i: *mut uv_idle_t, cb: uv_idle_cb) -> c_int;
+    pub fn uv_idle_stop(i: *mut uv_idle_t) -> c_int;
 
     // async bindings
-    pub fn uv_async_init(l: *uv_loop_t, a: *uv_async_t,
+    pub fn uv_async_init(l: *mut uv_loop_t, a: *mut uv_async_t,
                          cb: uv_async_cb) -> c_int;
-    pub fn uv_async_send(a: *uv_async_t);
+    pub fn uv_async_send(a: *mut uv_async_t);
 
     // tcp bindings
-    pub fn uv_tcp_init(l: *uv_loop_t, h: *uv_tcp_t) -> c_int;
-    pub fn uv_tcp_connect(c: *uv_connect_t, h: *uv_tcp_t,
-                          addr: *sockaddr, cb: uv_connect_cb) -> c_int;
-    pub fn uv_tcp_bind(t: *uv_tcp_t, addr: *sockaddr) -> c_int;
-    pub fn uv_tcp_nodelay(h: *uv_tcp_t, enable: c_int) -> c_int;
-    pub fn uv_tcp_keepalive(h: *uv_tcp_t, enable: c_int,
+    pub fn uv_tcp_init(l: *mut uv_loop_t, h: *mut uv_tcp_t) -> c_int;
+    pub fn uv_tcp_connect(c: *mut uv_connect_t, h: *mut uv_tcp_t,
+                          addr: *const sockaddr, cb: uv_connect_cb) -> c_int;
+    pub fn uv_tcp_bind(t: *mut uv_tcp_t, addr: *const sockaddr) -> c_int;
+    pub fn uv_tcp_nodelay(h: *mut uv_tcp_t, enable: c_int) -> c_int;
+    pub fn uv_tcp_keepalive(h: *mut uv_tcp_t, enable: c_int,
                             delay: c_uint) -> c_int;
-    pub fn uv_tcp_simultaneous_accepts(h: *uv_tcp_t, enable: c_int) -> c_int;
-    pub fn uv_tcp_getsockname(h: *uv_tcp_t, name: *mut sockaddr,
+    pub fn uv_tcp_simultaneous_accepts(h: *mut uv_tcp_t, enable: c_int) -> c_int;
+    pub fn uv_tcp_getsockname(h: *mut uv_tcp_t, name: *mut sockaddr,
                               len: *mut c_int) -> c_int;
-    pub fn uv_tcp_getpeername(h: *uv_tcp_t, name: *mut sockaddr,
+    pub fn uv_tcp_getpeername(h: *mut uv_tcp_t, name: *mut sockaddr,
                               len: *mut c_int) -> c_int;
 
     // udp bindings
-    pub fn uv_udp_init(l: *uv_loop_t, h: *uv_udp_t) -> c_int;
-    pub fn uv_udp_bind(h: *uv_udp_t, addr: *sockaddr, flags: c_uint) -> c_int;
-    pub fn uv_udp_recv_start(server: *uv_udp_t,
+    pub fn uv_udp_init(l: *mut uv_loop_t, h: *mut uv_udp_t) -> c_int;
+    pub fn uv_udp_bind(h: *mut uv_udp_t, addr: *const sockaddr,
+                       flags: c_uint) -> c_int;
+    pub fn uv_udp_recv_start(server: *mut uv_udp_t,
                              on_alloc: uv_alloc_cb,
                              on_recv: uv_udp_recv_cb) -> c_int;
-    pub fn uv_udp_set_membership(handle: *uv_udp_t, multicast_addr: *c_char,
-                                 interface_addr: *c_char,
+    pub fn uv_udp_set_membership(handle: *mut uv_udp_t,
+                                 multicast_addr: *const c_char,
+                                 interface_addr: *const c_char,
                                  membership: uv_membership) -> c_int;
-    pub fn uv_udp_recv_stop(server: *uv_udp_t) -> c_int;
-    pub fn uv_udp_set_multicast_loop(handle: *uv_udp_t, on: c_int) -> c_int;
-    pub fn uv_udp_set_multicast_ttl(handle: *uv_udp_t, ttl: c_int) -> c_int;
-    pub fn uv_udp_set_ttl(handle: *uv_udp_t, ttl: c_int) -> c_int;
-    pub fn uv_udp_set_broadcast(handle: *uv_udp_t, on: c_int) -> c_int;
-    pub fn uv_udp_getsockname(h: *uv_udp_t, name: *mut sockaddr,
+    pub fn uv_udp_recv_stop(server: *mut uv_udp_t) -> c_int;
+    pub fn uv_udp_set_multicast_loop(handle: *mut uv_udp_t, on: c_int) -> c_int;
+    pub fn uv_udp_set_multicast_ttl(handle: *mut uv_udp_t, ttl: c_int) -> c_int;
+    pub fn uv_udp_set_ttl(handle: *mut uv_udp_t, ttl: c_int) -> c_int;
+    pub fn uv_udp_set_broadcast(handle: *mut uv_udp_t, on: c_int) -> c_int;
+    pub fn uv_udp_getsockname(h: *mut uv_udp_t, name: *mut sockaddr,
                               len: *mut c_int) -> c_int;
 
     // timer bindings
-    pub fn uv_timer_init(l: *uv_loop_t, t: *uv_timer_t) -> c_int;
-    pub fn uv_timer_start(t: *uv_timer_t, cb: uv_timer_cb,
+    pub fn uv_timer_init(l: *mut uv_loop_t, t: *mut uv_timer_t) -> c_int;
+    pub fn uv_timer_start(t: *mut uv_timer_t, cb: uv_timer_cb,
                           timeout: libc::uint64_t,
                           repeat: libc::uint64_t) -> c_int;
-    pub fn uv_timer_stop(handle: *uv_timer_t) -> c_int;
+    pub fn uv_timer_stop(handle: *mut uv_timer_t) -> c_int;
 
     // fs operations
-    pub fn uv_fs_open(loop_ptr: *uv_loop_t, req: *uv_fs_t, path: *c_char,
-                      flags: c_int, mode: c_int, cb: uv_fs_cb) -> c_int;
-    pub fn uv_fs_unlink(loop_ptr: *uv_loop_t, req: *uv_fs_t, path: *c_char,
-                        cb: uv_fs_cb) -> c_int;
-    pub fn uv_fs_write(l: *uv_loop_t, req: *uv_fs_t, fd: c_int,
-                       bufs: *uv_buf_t, nbufs: c_uint,
+    pub fn uv_fs_open(loop_ptr: *mut uv_loop_t, req: *mut uv_fs_t,
+                      path: *const c_char, flags: c_int, mode: c_int,
+                      cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_unlink(loop_ptr: *mut uv_loop_t, req: *mut uv_fs_t,
+                        path: *const c_char, cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_write(l: *mut uv_loop_t, req: *mut uv_fs_t, fd: c_int,
+                       bufs: *const uv_buf_t, nbufs: c_uint,
                        offset: i64, cb: uv_fs_cb) -> c_int;
-    pub fn uv_fs_read(l: *uv_loop_t, req: *uv_fs_t, fd: c_int,
-                      bufs: *uv_buf_t, nbufs: c_uint,
+    pub fn uv_fs_read(l: *mut uv_loop_t, req: *mut uv_fs_t, fd: c_int,
+                      bufs: *mut uv_buf_t, nbufs: c_uint,
                       offset: i64, cb: uv_fs_cb) -> c_int;
-    pub fn uv_fs_close(l: *uv_loop_t, req: *uv_fs_t, fd: c_int,
+    pub fn uv_fs_close(l: *mut uv_loop_t, req: *mut uv_fs_t, fd: c_int,
                        cb: uv_fs_cb) -> c_int;
-    pub fn uv_fs_stat(l: *uv_loop_t, req: *uv_fs_t, path: *c_char,
+    pub fn uv_fs_stat(l: *mut uv_loop_t, req: *mut uv_fs_t, path: *const c_char,
                       cb: uv_fs_cb) -> c_int;
-    pub fn uv_fs_fstat(l: *uv_loop_t, req: *uv_fs_t, fd: c_int,
+    pub fn uv_fs_fstat(l: *mut uv_loop_t, req: *mut uv_fs_t, fd: c_int,
                        cb: uv_fs_cb) -> c_int;
-    pub fn uv_fs_mkdir(l: *uv_loop_t, req: *uv_fs_t, path: *c_char,
+    pub fn uv_fs_mkdir(l: *mut uv_loop_t, req: *mut uv_fs_t, path: *const c_char,
                        mode: c_int, cb: uv_fs_cb) -> c_int;
-    pub fn uv_fs_rmdir(l: *uv_loop_t, req: *uv_fs_t, path: *c_char,
+    pub fn uv_fs_rmdir(l: *mut uv_loop_t, req: *mut uv_fs_t, path: *const c_char,
                        cb: uv_fs_cb) -> c_int;
-    pub fn uv_fs_readdir(l: *uv_loop_t, req: *uv_fs_t, path: *c_char,
-                         flags: c_int, cb: uv_fs_cb) -> c_int;
-    pub fn uv_fs_req_cleanup(req: *uv_fs_t);
-    pub fn uv_fs_fsync(handle: *uv_loop_t, req: *uv_fs_t, file: c_int,
+    pub fn uv_fs_readdir(l: *mut uv_loop_t, req: *mut uv_fs_t,
+                         path: *const c_char, flags: c_int,
+                         cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_req_cleanup(req: *mut uv_fs_t);
+    pub fn uv_fs_fsync(handle: *mut uv_loop_t, req: *mut uv_fs_t, file: c_int,
                        cb: uv_fs_cb) -> c_int;
-    pub fn uv_fs_fdatasync(handle: *uv_loop_t, req: *uv_fs_t, file: c_int,
+    pub fn uv_fs_fdatasync(handle: *mut uv_loop_t, req: *mut uv_fs_t, file: c_int,
                            cb: uv_fs_cb) -> c_int;
-    pub fn uv_fs_ftruncate(handle: *uv_loop_t, req: *uv_fs_t, file: c_int,
+    pub fn uv_fs_ftruncate(handle: *mut uv_loop_t, req: *mut uv_fs_t, file: c_int,
                            offset: i64, cb: uv_fs_cb) -> c_int;
-    pub fn uv_fs_readlink(handle: *uv_loop_t, req: *uv_fs_t, file: *c_char,
-                          cb: uv_fs_cb) -> c_int;
-    pub fn uv_fs_symlink(handle: *uv_loop_t, req: *uv_fs_t, src: *c_char,
-                         dst: *c_char, flags: c_int, cb: uv_fs_cb) -> c_int;
-    pub fn uv_fs_rename(handle: *uv_loop_t, req: *uv_fs_t, src: *c_char,
-                        dst: *c_char, cb: uv_fs_cb) -> c_int;
-    pub fn uv_fs_utime(handle: *uv_loop_t, req: *uv_fs_t, path: *c_char,
-                       atime: c_double, mtime: c_double,
+    pub fn uv_fs_readlink(handle: *mut uv_loop_t, req: *mut uv_fs_t,
+                          file: *const c_char, cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_symlink(handle: *mut uv_loop_t, req: *mut uv_fs_t,
+                         src: *const c_char, dst: *const c_char, flags: c_int,
+                         cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_rename(handle: *mut uv_loop_t, req: *mut uv_fs_t,
+                        src: *const c_char, dst: *const c_char,
+                        cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_utime(handle: *mut uv_loop_t, req: *mut uv_fs_t,
+                       path: *const c_char, atime: c_double, mtime: c_double,
                        cb: uv_fs_cb) -> c_int;
-    pub fn uv_fs_link(handle: *uv_loop_t, req: *uv_fs_t, src: *c_char,
-                      dst: *c_char, cb: uv_fs_cb) -> c_int;
-    pub fn uv_fs_chown(handle: *uv_loop_t, req: *uv_fs_t, src: *c_char,
+    pub fn uv_fs_link(handle: *mut uv_loop_t, req: *mut uv_fs_t,
+                      src: *const c_char, dst: *const c_char,
+                      cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_chown(handle: *mut uv_loop_t, req: *mut uv_fs_t, src: *const c_char,
                        uid: uv_uid_t, gid: uv_gid_t, cb: uv_fs_cb) -> c_int;
-    pub fn uv_fs_chmod(handle: *uv_loop_t, req: *uv_fs_t, path: *c_char,
-                       mode: c_int, cb: uv_fs_cb) -> c_int;
-    pub fn uv_fs_lstat(handle: *uv_loop_t, req: *uv_fs_t, file: *c_char,
-                       cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_chmod(handle: *mut uv_loop_t, req: *mut uv_fs_t,
+                       path: *const c_char, mode: c_int, cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_lstat(handle: *mut uv_loop_t, req: *mut uv_fs_t,
+                       file: *const c_char, cb: uv_fs_cb) -> c_int;
 
     // getaddrinfo
-    pub fn uv_getaddrinfo(loop_: *uv_loop_t, req: *uv_getaddrinfo_t,
+    pub fn uv_getaddrinfo(loop_: *mut uv_loop_t, req: *mut uv_getaddrinfo_t,
                           getaddrinfo_cb: uv_getaddrinfo_cb,
-                          node: *c_char, service: *c_char,
-                          hints: *addrinfo) -> c_int;
-    pub fn uv_freeaddrinfo(ai: *addrinfo);
+                          node: *const c_char, service: *const c_char,
+                          hints: *const addrinfo) -> c_int;
+    pub fn uv_freeaddrinfo(ai: *mut addrinfo);
 
     // process spawning
-    pub fn uv_spawn(loop_ptr: *uv_loop_t, outptr: *uv_process_t,
-                    options: *uv_process_options_t) -> c_int;
-    pub fn uv_process_kill(p: *uv_process_t, signum: c_int) -> c_int;
+    pub fn uv_spawn(loop_ptr: *mut uv_loop_t, outptr: *mut uv_process_t,
+                    options: *mut uv_process_options_t) -> c_int;
+    pub fn uv_process_kill(p: *mut uv_process_t, signum: c_int) -> c_int;
     pub fn uv_kill(pid: c_int, signum: c_int) -> c_int;
 
     // pipes
-    pub fn uv_pipe_init(l: *uv_loop_t, p: *uv_pipe_t, ipc: c_int) -> c_int;
-    pub fn uv_pipe_open(pipe: *uv_pipe_t, file: c_int) -> c_int;
-    pub fn uv_pipe_bind(pipe: *uv_pipe_t, name: *c_char) -> c_int;
-    pub fn uv_pipe_connect(req: *uv_connect_t, handle: *uv_pipe_t,
-                           name: *c_char, cb: uv_connect_cb);
+    pub fn uv_pipe_init(l: *mut uv_loop_t, p: *mut uv_pipe_t,
+                        ipc: c_int) -> c_int;
+    pub fn uv_pipe_open(pipe: *mut uv_pipe_t, file: c_int) -> c_int;
+    pub fn uv_pipe_bind(pipe: *mut uv_pipe_t, name: *const c_char) -> c_int;
+    pub fn uv_pipe_connect(req: *mut uv_connect_t, handle: *mut uv_pipe_t,
+                           name: *const c_char, cb: uv_connect_cb);
 
     // tty
-    pub fn uv_tty_init(l: *uv_loop_t, tty: *uv_tty_t, fd: c_int,
+    pub fn uv_tty_init(l: *mut uv_loop_t, tty: *mut uv_tty_t, fd: c_int,
                        readable: c_int) -> c_int;
-    pub fn uv_tty_set_mode(tty: *uv_tty_t, mode: c_int) -> c_int;
-    pub fn uv_tty_get_winsize(tty: *uv_tty_t, width: *c_int,
-                              height: *c_int) -> c_int;
+    pub fn uv_tty_set_mode(tty: *mut uv_tty_t, mode: c_int) -> c_int;
+    pub fn uv_tty_get_winsize(tty: *mut uv_tty_t,
+                              width: *mut c_int,
+                              height: *mut c_int) -> c_int;
 
     // signals
-    pub fn uv_signal_init(loop_: *uv_loop_t, handle: *uv_signal_t) -> c_int;
-    pub fn uv_signal_start(h: *uv_signal_t, cb: uv_signal_cb,
+    pub fn uv_signal_init(loop_: *mut uv_loop_t,
+                          handle: *mut uv_signal_t) -> c_int;
+    pub fn uv_signal_start(h: *mut uv_signal_t, cb: uv_signal_cb,
                            signum: c_int) -> c_int;
-    pub fn uv_signal_stop(handle: *uv_signal_t) -> c_int;
+    pub fn uv_signal_stop(handle: *mut uv_signal_t) -> c_int;
 }
 
 // libuv requires other native libraries on various platforms. These are all
index efee29212e9970dce07c4b56b4d1c78c61fed93c..dfce1eeb832d574a635e4ac8abf8041513470dfd 100644 (file)
@@ -182,7 +182,7 @@ pub fn vuint_at(data: &[u8], start: uint) -> DecodeResult<Res> {
         ];
 
         unsafe {
-            let ptr = data.as_ptr().offset(start as int) as *u32;
+            let ptr = data.as_ptr().offset(start as int) as *const u32;
             let val = Int::from_be(*ptr);
 
             let i = (val >> 28u) as uint;
index e8a158ad230aa40fac8601942b609f1480fde8ee..1926d6b1b960fc4f36bb19bc76c03609c5191e8a 100644 (file)
@@ -102,14 +102,14 @@ pub unsafe fn new_with_dtor(base: *mut T, len: uint,
     /// View the stored data as a slice.
     pub fn as_slice<'a>(&'a self) -> &'a [T] {
         unsafe {
-            mem::transmute(raw::Slice { data: self.base as *T, len: self.len })
+            mem::transmute(raw::Slice { data: self.base as *const T, len: self.len })
         }
     }
 
     /// View the stored data as a mutable slice.
     pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] {
         unsafe {
-            mem::transmute(raw::Slice { data: self.base as *T, len: self.len })
+            mem::transmute(raw::Slice { data: self.base as *const T, len: self.len })
         }
     }
 
index d06d4ea71776afa706fd75e330f8fccb8dcd3099..b94141748d57fe2561cc14a4a20fb43ace1338ca 100644 (file)
@@ -361,8 +361,8 @@ pub fn take(&mut self, index: FullIndex) -> (EmptyIndex, K, V) {
                 *self.hashes.offset(idx) = EMPTY_BUCKET;
 
                 // Drop the mutable constraint.
-                let keys = self.keys as *K;
-                let vals = self.vals as *V;
+                let keys = self.keys as *const K;
+                let vals = self.vals as *const V;
 
                 let k = ptr::read(keys.offset(idx));
                 let v = ptr::read(vals.offset(idx));
index 8ec5146c7b20fd35b39c92c0efc326ecbf5d5383..08f11581e838a17a74f5ee8badd66b350e230066 100644 (file)
@@ -49,7 +49,7 @@
 use ptr;
 use result::{Ok, Err};
 
-struct KeyRef<K> { k: *K }
+struct KeyRef<K> { k: *const K }
 
 struct LruEntry<K, V> {
     next: *mut LruEntry<K, V>,
index 79e01c8b96653ed89a5ab866858e01b01c9d41e9..ec2cc67a60a16a53f92e7fd5c715e72cdf10516a 100644 (file)
@@ -33,7 +33,7 @@
 use string::String;
 use vec::Vec;
 
-pub struct DynamicLibrary { handle: *u8}
+pub struct DynamicLibrary { handle: *mut u8 }
 
 impl Drop for DynamicLibrary {
     fn drop(&mut self) {
@@ -134,7 +134,7 @@ pub fn search_path() -> Vec<Path> {
     }
 
     /// Access the value at the symbol of the dynamic library
-    pub unsafe fn symbol<T>(&self, symbol: &str) -> Result<*T, String> {
+    pub unsafe fn symbol<T>(&self, symbol: &str) -> Result<*mut T, String> {
         // This function should have a lifetime constraint of 'a on
         // T but that feature is still unimplemented
 
@@ -175,7 +175,7 @@ fn test_loading_cosine() {
         let cosine: extern fn(libc::c_double) -> libc::c_double = unsafe {
             match libm.symbol("cos") {
                 Err(error) => fail!("Could not load function cos: {}", error),
-                Ok(cosine) => mem::transmute::<*u8, _>(cosine)
+                Ok(cosine) => mem::transmute::<*mut u8, _>(cosine)
             }
         };
 
@@ -218,14 +218,14 @@ pub mod dl {
     use str::StrAllocating;
     use string::String;
 
-    pub unsafe fn open_external<T: ToCStr>(filename: T) -> *u8 {
+    pub unsafe fn open_external<T: ToCStr>(filename: T) -> *mut u8 {
         filename.with_c_str(|raw_name| {
-            dlopen(raw_name, Lazy as libc::c_int) as *u8
+            dlopen(raw_name, Lazy as libc::c_int) as *mut u8
         })
     }
 
-    pub unsafe fn open_internal() -> *u8 {
-        dlopen(ptr::null(), Lazy as libc::c_int) as *u8
+    pub unsafe fn open_internal() -> *mut u8 {
+        dlopen(ptr::null(), Lazy as libc::c_int) as *mut u8
     }
 
     pub fn check_for_errors_in<T>(f: || -> T) -> Result<T, String> {
@@ -239,7 +239,7 @@ pub fn check_for_errors_in<T>(f: || -> T) -> Result<T, String> {
 
             let result = f();
 
-            let last_error = dlerror();
+            let last_error = dlerror() as *const _;
             let ret = if ptr::null() == last_error {
                 Ok(result)
             } else {
@@ -252,11 +252,12 @@ pub fn check_for_errors_in<T>(f: || -> T) -> Result<T, String> {
         }
     }
 
-    pub unsafe fn symbol(handle: *u8, symbol: *libc::c_char) -> *u8 {
-        dlsym(handle as *libc::c_void, symbol) as *u8
+    pub unsafe fn symbol(handle: *mut u8,
+                         symbol: *const libc::c_char) -> *mut u8 {
+        dlsym(handle as *mut libc::c_void, symbol) as *mut u8
     }
-    pub unsafe fn close(handle: *u8) {
-        dlclose(handle as *libc::c_void); ()
+    pub unsafe fn close(handle: *mut u8) {
+        dlclose(handle as *mut libc::c_void); ()
     }
 
     pub enum RTLD {
@@ -268,10 +269,12 @@ pub enum RTLD {
 
     #[link_name = "dl"]
     extern {
-        fn dlopen(filename: *libc::c_char, flag: libc::c_int) -> *libc::c_void;
-        fn dlerror() -> *libc::c_char;
-        fn dlsym(handle: *libc::c_void, symbol: *libc::c_char) -> *libc::c_void;
-        fn dlclose(handle: *libc::c_void) -> libc::c_int;
+        fn dlopen(filename: *const libc::c_char,
+                  flag: libc::c_int) -> *mut libc::c_void;
+        fn dlerror() -> *mut libc::c_char;
+        fn dlsym(handle: *mut libc::c_void,
+                 symbol: *const libc::c_char) -> *mut libc::c_void;
+        fn dlclose(handle: *mut libc::c_void) -> libc::c_int;
     }
 }
 
@@ -286,18 +289,18 @@ pub mod dl {
     use str;
     use string::String;
 
-    pub unsafe fn open_external<T: ToCStr>(filename: T) -> *u8 {
+    pub unsafe fn open_external<T: ToCStr>(filename: T) -> *mut u8 {
         // Windows expects Unicode data
         let filename_cstr = filename.to_c_str();
         let filename_str = str::from_utf8(filename_cstr.as_bytes_no_nul()).unwrap();
         let filename_str = filename_str.to_utf16().append_one(0);
-        LoadLibraryW(filename_str.as_ptr() as *libc::c_void) as *u8
+        LoadLibraryW(filename_str.as_ptr() as *const libc::c_void) as *mut u8
     }
 
-    pub unsafe fn open_internal() -> *u8 {
-        let handle = ptr::null();
-        GetModuleHandleExW(0 as libc::DWORD, ptr::null(), &handle as **libc::c_void);
-        handle as *u8
+    pub unsafe fn open_internal() -> *mut u8 {
+        let mut handle = ptr::mut_null();
+        GetModuleHandleExW(0 as libc::DWORD, ptr::null(), &mut handle);
+        handle as *mut u8
     }
 
     pub fn check_for_errors_in<T>(f: || -> T) -> Result<T, String> {
@@ -315,20 +318,22 @@ pub fn check_for_errors_in<T>(f: || -> T) -> Result<T, String> {
         }
     }
 
-    pub unsafe fn symbol(handle: *u8, symbol: *libc::c_char) -> *u8 {
-        GetProcAddress(handle as *libc::c_void, symbol) as *u8
+    pub unsafe fn symbol(handle: *mut u8, symbol: *const libc::c_char) -> *mut u8 {
+        GetProcAddress(handle as *mut libc::c_void, symbol) as *mut u8
     }
-    pub unsafe fn close(handle: *u8) {
-        FreeLibrary(handle as *libc::c_void); ()
+    pub unsafe fn close(handle: *mut u8) {
+        FreeLibrary(handle as *mut libc::c_void); ()
     }
 
     #[allow(non_snake_case_functions)]
     extern "system" {
         fn SetLastError(error: libc::size_t);
-        fn LoadLibraryW(name: *libc::c_void) -> *libc::c_void;
-        fn GetModuleHandleExW(dwFlags: libc::DWORD, name: *u16,
-                              handle: **libc::c_void) -> *libc::c_void;
-        fn GetProcAddress(handle: *libc::c_void, name: *libc::c_char) -> *libc::c_void;
-        fn FreeLibrary(handle: *libc::c_void);
+        fn LoadLibraryW(name: *const libc::c_void) -> *mut libc::c_void;
+        fn GetModuleHandleExW(dwFlags: libc::DWORD, name: *const u16,
+                              handle: *mut *mut libc::c_void)
+                              -> *mut libc::c_void;
+        fn GetProcAddress(handle: *mut libc::c_void,
+                          name: *const libc::c_char) -> *mut libc::c_void;
+        fn FreeLibrary(handle: *mut libc::c_void);
     }
 }
index 0f30e7231b12a7cb5f70999d545c637b1402b6d7..363c577563e8c8fad90346ad632cc5395c05c5de 100644 (file)
@@ -33,7 +33,7 @@
                   task annihilation. For now, cycles need to be broken manually by using `Rc<T>` \
                   with a non-owning `Weak<T>` pointer. A tracing garbage collector is planned."]
 pub struct Gc<T> {
-    _ptr: *T,
+    _ptr: *mut T,
     marker: marker::NoSend,
 }
 
@@ -83,7 +83,7 @@ fn default() -> Gc<T> {
     }
 }
 
-impl<T: 'static> raw::Repr<*raw::Box<T>> for Gc<T> {}
+impl<T: 'static> raw::Repr<*const raw::Box<T>> for Gc<T> {}
 
 impl<S: hash::Writer, T: hash::Hash<S> + 'static> hash::Hash<S> for Gc<T> {
     fn hash(&self, s: &mut S) {
index 5d9865fded3e721951e2cb5071658c60c761e934..277aca2332d475cb1b42a9852f0f59b793d2d505 100644 (file)
@@ -166,7 +166,7 @@ pub fn u64_from_be_bytes(data: &[u8], start: uint, size: uint) -> u64 {
         let ptr = data.as_ptr().offset(start as int);
         let out = buf.as_mut_ptr();
         copy_nonoverlapping_memory(out.offset((8 - size) as int), ptr, size);
-        from_be64(*(out as *u64))
+        from_be64(*(out as *const u64))
     }
 }
 
index 4d3dde46b57b57516f71fbc62fe37c8d0e291f76..26e854d9d999fa1b58eae5e061c878a5472a9c70 100644 (file)
@@ -155,7 +155,7 @@ fn sysctl(name: *mut libc::c_int, namelen: libc::c_uint,
                   oldp: *mut libc::c_void, oldlenp: *mut libc::size_t,
                   newp: *mut libc::c_void, newlen: libc::size_t) -> libc::c_int;
         fn getrlimit(resource: libc::c_int, rlp: *mut rlimit) -> libc::c_int;
-        fn setrlimit(resource: libc::c_int, rlp: *rlimit) -> libc::c_int;
+        fn setrlimit(resource: libc::c_int, rlp: *const rlimit) -> libc::c_int;
     }
     static CTL_KERN: libc::c_int = 1;
     static KERN_MAXFILESPERPROC: libc::c_int = 29;
index d1029c7a9baaa040b923d9aec544fef621dd3b4b..f63e69f3cca0a17af6720d38f95608212ccee046 100644 (file)
 //        threading mode than the default by reaching into the auto-generated
 //        '__test' module.
 #[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)
 }
 
index a77242638eb582e7abd69668a8c7a9f8e4e9ec4f..90f4cbb25778dcb1d8e174217249e240cd6fe25d 100644 (file)
@@ -276,7 +276,7 @@ unsafe fn get_env_pairs() -> Vec<Vec<u8>> {
             use c_str::CString;
 
             extern {
-                fn rust_env_pairs() -> **c_char;
+                fn rust_env_pairs() -> *const *const c_char;
             }
             let environ = rust_env_pairs();
             if environ as uint == 0 {
@@ -351,7 +351,7 @@ pub fn getenv_as_bytes(n: &str) -> Option<Vec<u8>> {
             if s.is_null() {
                 None
             } else {
-                Some(Vec::from_slice(CString::new(s,
+                Some(Vec::from_slice(CString::new(s as *const i8,
                                                   false).as_bytes_no_nul()))
             }
         })
@@ -598,19 +598,20 @@ fn load_self() -> Option<Vec<u8>> {
         unsafe {
             use libc::funcs::bsd44::*;
             use libc::consts::os::extra::*;
-            let mib = vec![CTL_KERN as c_int,
-                        KERN_PROC as c_int,
-                        KERN_PROC_PATHNAME as c_int, -1 as c_int];
+            let mut mib = vec![CTL_KERN as c_int,
+                               KERN_PROC as c_int,
+                               KERN_PROC_PATHNAME as c_int,
+                               -1 as c_int];
             let mut sz: libc::size_t = 0;
-            let err = sysctl(mib.as_ptr(), mib.len() as ::libc::c_uint,
-                             ptr::mut_null(), &mut sz, ptr::null(),
+            let err = sysctl(mib.as_mut_ptr(), mib.len() as ::libc::c_uint,
+                             ptr::mut_null(), &mut sz, ptr::mut_null(),
                              0u as libc::size_t);
             if err != 0 { return None; }
             if sz == 0 { return None; }
             let mut v: Vec<u8> = Vec::with_capacity(sz as uint);
-            let err = sysctl(mib.as_ptr(), mib.len() as ::libc::c_uint,
-                             v.as_mut_ptr() as *mut c_void, &mut sz, ptr::null(),
-                             0u as libc::size_t);
+            let err = sysctl(mib.as_mut_ptr(), mib.len() as ::libc::c_uint,
+                             v.as_mut_ptr() as *mut c_void, &mut sz,
+                             ptr::mut_null(), 0u as libc::size_t);
             if err != 0 { return None; }
             if sz == 0 { return None; }
             v.set_len(sz as uint - 1); // chop off trailing NUL
@@ -827,9 +828,9 @@ pub fn errno() -> int {
     #[cfg(target_os = "macos")]
     #[cfg(target_os = "ios")]
     #[cfg(target_os = "freebsd")]
-    fn errno_location() -> *c_int {
+    fn errno_location() -> *const c_int {
         extern {
-            fn __error() -> *c_int;
+            fn __error() -> *const c_int;
         }
         unsafe {
             __error()
@@ -838,9 +839,9 @@ fn errno_location() -> *c_int {
 
     #[cfg(target_os = "linux")]
     #[cfg(target_os = "android")]
-    fn errno_location() -> *c_int {
+    fn errno_location() -> *const c_int {
         extern {
-            fn __errno_location() -> *c_int;
+            fn __errno_location() -> *const c_int;
         }
         unsafe {
             __errno_location()
@@ -913,7 +914,7 @@ fn __xpg_strerror_r(errnum: c_int,
                 fail!("strerror_r failure");
             }
 
-            str::raw::from_c_str(p as *c_char).into_string()
+            str::raw::from_c_str(p as *const c_char).into_string()
         }
     }
 
@@ -932,7 +933,7 @@ fn FormatMessageW(flags: DWORD,
                               langId: DWORD,
                               buf: LPWSTR,
                               nsize: DWORD,
-                              args: *c_void)
+                              args: *const c_void)
                               -> DWORD;
         }
 
@@ -997,7 +998,8 @@ pub fn get_exit_status() -> int {
 }
 
 #[cfg(target_os = "macos")]
-unsafe fn load_argc_and_argv(argc: int, argv: **c_char) -> Vec<Vec<u8>> {
+unsafe fn load_argc_and_argv(argc: int,
+                             argv: *const *const c_char) -> Vec<Vec<u8>> {
     use c_str::CString;
 
     Vec::from_fn(argc as uint, |i| {
@@ -1015,7 +1017,7 @@ unsafe fn load_argc_and_argv(argc: int, argv: **c_char) -> Vec<Vec<u8>> {
 fn real_args_as_bytes() -> Vec<Vec<u8>> {
     unsafe {
         let (argc, argv) = (*_NSGetArgc() as int,
-                            *_NSGetArgv() as **c_char);
+                            *_NSGetArgv() as *const *const c_char);
         load_argc_and_argv(argc, argv)
     }
 }
@@ -1040,16 +1042,16 @@ fn real_args_as_bytes() -> Vec<Vec<u8>> {
 
     #[link(name = "objc")]
     extern {
-        fn sel_registerName(name: *libc::c_uchar) -> Sel;
+        fn sel_registerName(name: *const libc::c_uchar) -> Sel;
         fn objc_msgSend(obj: NsId, sel: Sel, ...) -> NsId;
-        fn objc_getClass(class_name: *libc::c_uchar) -> NsId;
+        fn objc_getClass(class_name: *const libc::c_uchar) -> NsId;
     }
 
     #[link(name = "Foundation", kind = "framework")]
     extern {}
 
-    type Sel = *libc::c_void;
-    type NsId = *libc::c_void;
+    type Sel = *const libc::c_void;
+    type NsId = *const libc::c_void;
 
     let mut res = Vec::new();
 
@@ -1067,7 +1069,8 @@ fn real_args_as_bytes() -> Vec<Vec<u8>> {
         let cnt: int = mem::transmute(objc_msgSend(args, countSel));
         for i in range(0, cnt) {
             let tmp = objc_msgSend(args, objectAtSel, i);
-            let utf_c_str: *libc::c_char = mem::transmute(objc_msgSend(tmp, utf8Sel));
+            let utf_c_str: *const libc::c_char =
+                mem::transmute(objc_msgSend(tmp, utf8Sel));
             let s = CString::new(utf_c_str, false);
             if s.is_not_null() {
                 res.push(Vec::from_slice(s.as_bytes_no_nul()))
@@ -1114,14 +1117,14 @@ fn real_args() -> Vec<String> {
         while *ptr.offset(len as int) != 0 { len += 1; }
 
         // Push it onto the list.
-        let opt_s = slice::raw::buf_as_slice(ptr, len, |buf| {
+        let opt_s = slice::raw::buf_as_slice(ptr as *const _, len, |buf| {
             str::from_utf16(str::truncate_utf16_at_nul(buf))
         });
         opt_s.expect("CommandLineToArgvW returned invalid UTF-16")
     });
 
     unsafe {
-        LocalFree(szArgList as *c_void);
+        LocalFree(szArgList as *mut c_void);
     }
 
     return args
@@ -1132,19 +1135,20 @@ fn real_args_as_bytes() -> Vec<Vec<u8>> {
     real_args().move_iter().map(|s| s.into_bytes()).collect()
 }
 
-type LPCWSTR = *u16;
+type LPCWSTR = *const u16;
 
 #[cfg(windows)]
 #[link_name="kernel32"]
 extern "system" {
     fn GetCommandLineW() -> LPCWSTR;
-    fn LocalFree(ptr: *c_void);
+    fn LocalFree(ptr: *mut c_void);
 }
 
 #[cfg(windows)]
 #[link_name="shell32"]
 extern "system" {
-    fn CommandLineToArgvW(lpCmdLine: LPCWSTR, pNumArgs: *mut c_int) -> **u16;
+    fn CommandLineToArgvW(lpCmdLine: LPCWSTR,
+                          pNumArgs: *mut c_int) -> *mut *mut u16;
 }
 
 /// Returns the arguments which this program was started with (normally passed
@@ -1165,8 +1169,8 @@ pub fn args_as_bytes() -> Vec<Vec<u8>> {
 #[cfg(target_os = "macos")]
 extern {
     // These functions are in crt_externs.h.
-    pub fn _NSGetArgc() -> *c_int;
-    pub fn _NSGetArgv() -> ***c_char;
+    pub fn _NSGetArgc() -> *mut c_int;
+    pub fn _NSGetArgv() -> *mut *mut *mut c_char;
 }
 
 // Round up `from` to be divisible by `to`
@@ -1224,7 +1228,7 @@ pub struct MemoryMap {
 pub enum MemoryMapKind {
     /// Virtual memory map. Usually used to change the permissions of a given
     /// chunk of memory.  Corresponds to `VirtualAlloc` on Windows.
-    MapFile(*u8),
+    MapFile(*const u8),
     /// Virtual memory map. Usually used to change the permissions of a given
     /// chunk of memory, or for allocation. Corresponds to `VirtualAlloc` on
     /// Windows.
@@ -1241,7 +1245,7 @@ pub enum MapOption {
     MapExecutable,
     /// Create a map for a specific address range. Corresponds to `MAP_FIXED` on
     /// POSIX.
-    MapAddr(*u8),
+    MapAddr(*const u8),
     /// Create a memory mapping for a file with a given fd.
     MapFd(c_int),
     /// When using `MapFd`, the start of the map is `uint` bytes from the start
@@ -1342,7 +1346,7 @@ pub fn new(min_len: uint, options: &[MapOption]) -> Result<MemoryMap, MapError>
         if min_len == 0 {
             return Err(ErrZeroLength)
         }
-        let mut addr: *u8 = ptr::null();
+        let mut addr: *const u8 = ptr::null();
         let mut prot = 0;
         let mut flags = libc::MAP_PRIVATE;
         let mut fd = -1;
@@ -1502,7 +1506,7 @@ pub fn new(min_len: uint, options: &[MapOption]) -> Result<MemoryMap, MapError>
                     _ => Ok(MemoryMap {
                        data: r as *mut u8,
                        len: len,
-                       kind: MapFile(mapping as *u8)
+                       kind: MapFile(mapping as *const u8)
                     })
                 }
             }
@@ -1990,7 +1994,7 @@ fn lseek_(fd: c_int, size: uint) {
                 open(path, O_CREAT | O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR)
             });
             lseek_(fd, size);
-            "x".with_c_str(|x| assert!(write(fd, x as *c_void, 1) == 1));
+            "x".with_c_str(|x| assert!(write(fd, x as *const c_void, 1) == 1));
             fd
         };
         let chunk = match MemoryMap::new(size / 2, [
index 1c1aab15361379ec12d3c8b784fb3ecd1cec7e27..60e2c4c894919eb8266b200c958135d9e7c7d70b 100644 (file)
@@ -87,11 +87,12 @@ pub struct OsRng {
 
     struct SecRandom;
 
-    static kSecRandomDefault: *SecRandom = 0 as *SecRandom;
+    static kSecRandomDefault: *const SecRandom = 0 as *const SecRandom;
 
     #[link(name = "Security", kind = "framework")]
     extern "C" {
-        fn SecRandomCopyBytes(rnd: *SecRandom, count: size_t, bytes: *mut u8) -> c_int;
+        fn SecRandomCopyBytes(rnd: *const SecRandom,
+                              count: size_t, bytes: *mut u8) -> c_int;
     }
 
     impl OsRng {
index e3652ffac6e09164606a53ffab3e4a81e9850181..8f51e834c6a024ec0d67b9319908fb0db88cf45d 100644 (file)
@@ -261,7 +261,8 @@ pub fn write(w: &mut Writer) -> IoResult<()> {
         use slice::{MutableVector};
 
         extern {
-            fn backtrace(buf: *mut *libc::c_void, sz: libc::c_int) -> libc::c_int;
+            fn backtrace(buf: *mut *const libc::c_void,
+                         sz: libc::c_int) -> libc::c_int;
         }
 
         // while it doesn't requires lock for work as everything is
@@ -273,7 +274,7 @@ pub fn write(w: &mut Writer) -> IoResult<()> {
         try!(writeln!(w, "stack backtrace:"));
         // 100 lines should be enough
         static SIZE: libc::c_int = 100;
-        let mut buf: [*libc::c_void, ..SIZE] = unsafe {mem::zeroed()};
+        let mut buf: [*const libc::c_void, ..SIZE] = unsafe {mem::zeroed()};
         let cnt = unsafe { backtrace(buf.as_mut_ptr(), SIZE) as uint};
 
         // skipping the first one as it is write itself
@@ -307,7 +308,7 @@ struct Context<'a> {
         let mut cx = Context { writer: w, last_error: None, idx: 0 };
         return match unsafe {
             uw::_Unwind_Backtrace(trace_fn,
-                                  &mut cx as *mut Context as *libc::c_void)
+                                  &mut cx as *mut Context as *mut libc::c_void)
         } {
             uw::_URC_NO_REASON => {
                 match cx.last_error {
@@ -318,10 +319,10 @@ struct Context<'a> {
             _ => Ok(()),
         };
 
-        extern fn trace_fn(ctx: *uw::_Unwind_Context,
-                           arg: *libc::c_void) -> uw::_Unwind_Reason_Code {
+        extern fn trace_fn(ctx: *mut uw::_Unwind_Context,
+                           arg: *mut libc::c_void) -> uw::_Unwind_Reason_Code {
             let cx: &mut Context = unsafe { mem::transmute(arg) };
-            let ip = unsafe { uw::_Unwind_GetIP(ctx) as *libc::c_void };
+            let ip = unsafe { uw::_Unwind_GetIP(ctx) as *mut libc::c_void };
             // dladdr() on osx gets whiny when we use FindEnclosingFunction, and
             // it appears to work fine without it, so we only use
             // FindEnclosingFunction on non-osx platforms. In doing so, we get a
@@ -365,22 +366,22 @@ struct Context<'a> {
 
     #[cfg(target_os = "macos")]
     #[cfg(target_os = "ios")]
-    fn print(w: &mut Writer, idx: int, addr: *libc::c_void) -> IoResult<()> {
+    fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void) -> IoResult<()> {
         use intrinsics;
         #[repr(C)]
         struct Dl_info {
-            dli_fname: *libc::c_char,
-            dli_fbase: *libc::c_void,
-            dli_sname: *libc::c_char,
-            dli_saddr: *libc::c_void,
+            dli_fname: *const libc::c_char,
+            dli_fbase: *mut libc::c_void,
+            dli_sname: *const libc::c_char,
+            dli_saddr: *mut libc::c_void,
         }
         extern {
-            fn dladdr(addr: *libc::c_void,
+            fn dladdr(addr: *const libc::c_void,
                       info: *mut Dl_info) -> libc::c_int;
         }
 
         let mut info: Dl_info = unsafe { intrinsics::init() };
-        if unsafe { dladdr(addr, &mut info) == 0 } {
+        if unsafe { dladdr(addr as *const libc::c_void, &mut info) == 0 } {
             output(w, idx,addr, None)
         } else {
             output(w, idx, addr, Some(unsafe {
@@ -390,7 +391,7 @@ fn dladdr(addr: *libc::c_void,
     }
 
     #[cfg(not(target_os = "macos"), not(target_os = "ios"))]
-    fn print(w: &mut Writer, idx: int, addr: *libc::c_void) -> IoResult<()> {
+    fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void) -> IoResult<()> {
         use collections::Collection;
         use iter::Iterator;
         use os;
@@ -405,17 +406,17 @@ fn print(w: &mut Writer, idx: int, addr: *libc::c_void) -> IoResult<()> {
         type backtrace_syminfo_callback =
             extern "C" fn(data: *mut libc::c_void,
                           pc: libc::uintptr_t,
-                          symname: *libc::c_char,
+                          symname: *const libc::c_char,
                           symval: libc::uintptr_t,
                           symsize: libc::uintptr_t);
         type backtrace_error_callback =
             extern "C" fn(data: *mut libc::c_void,
-                          msg: *libc::c_char,
+                          msg: *const libc::c_char,
                           errnum: libc::c_int);
         enum backtrace_state {}
         #[link(name = "backtrace", kind = "static")]
         extern {
-            fn backtrace_create_state(filename: *libc::c_char,
+            fn backtrace_create_state(filename: *const libc::c_char,
                                       threaded: libc::c_int,
                                       error: backtrace_error_callback,
                                       data: *mut libc::c_void)
@@ -431,16 +432,16 @@ fn backtrace_syminfo(state: *mut backtrace_state,
         // helper callbacks
         ////////////////////////////////////////////////////////////////////////
 
-        extern fn error_cb(_data: *mut libc::c_void, _msg: *libc::c_char,
+        extern fn error_cb(_data: *mut libc::c_void, _msg: *const libc::c_char,
                            _errnum: libc::c_int) {
             // do nothing for now
         }
         extern fn syminfo_cb(data: *mut libc::c_void,
                              _pc: libc::uintptr_t,
-                             symname: *libc::c_char,
+                             symname: *const libc::c_char,
                              _symval: libc::uintptr_t,
                              _symsize: libc::uintptr_t) {
-            let slot = data as *mut *libc::c_char;
+            let slot = data as *mut *const libc::c_char;
             unsafe { *slot = symname; }
         }
 
@@ -502,8 +503,8 @@ unsafe fn init_state() -> *mut backtrace_state {
         if state.is_null() {
             return output(w, idx, addr, None)
         }
-        let mut data = 0 as *libc::c_char;
-        let data_addr = &mut data as *mut *libc::c_char;
+        let mut data = 0 as *const libc::c_char;
+        let data_addr = &mut data as *mut *const libc::c_char;
         let ret = unsafe {
             backtrace_syminfo(state, addr as libc::uintptr_t,
                               syminfo_cb, error_cb,
@@ -517,7 +518,7 @@ unsafe fn init_state() -> *mut backtrace_state {
     }
 
     // Finally, after all that work above, we can emit a symbol.
-    fn output(w: &mut Writer, idx: int, addr: *libc::c_void,
+    fn output(w: &mut Writer, idx: int, addr: *mut libc::c_void,
               s: Option<CString>) -> IoResult<()> {
         try!(write!(w, "  {:2}: {:2$} - ", idx, addr, super::HEX_WIDTH));
         match s.as_ref().and_then(|c| c.as_str()) {
@@ -557,23 +558,23 @@ pub enum _Unwind_Reason_Code {
         pub enum _Unwind_Context {}
 
         pub type _Unwind_Trace_Fn =
-                extern fn(ctx: *_Unwind_Context,
-                          arg: *libc::c_void) -> _Unwind_Reason_Code;
+                extern fn(ctx: *mut _Unwind_Context,
+                          arg: *mut libc::c_void) -> _Unwind_Reason_Code;
 
         extern {
             // No native _Unwind_Backtrace on iOS
             #[cfg(not(target_os = "ios", target_arch = "arm"))]
             pub fn _Unwind_Backtrace(trace: _Unwind_Trace_Fn,
-                                     trace_argument: *libc::c_void)
+                                     trace_argument: *mut libc::c_void)
                         -> _Unwind_Reason_Code;
 
             #[cfg(not(target_os = "android"),
                   not(target_os = "linux", target_arch = "arm"))]
-            pub fn _Unwind_GetIP(ctx: *_Unwind_Context) -> libc::uintptr_t;
+            pub fn _Unwind_GetIP(ctx: *mut _Unwind_Context) -> libc::uintptr_t;
             #[cfg(not(target_os = "android"),
                   not(target_os = "linux", target_arch = "arm"))]
-            pub fn _Unwind_FindEnclosingFunction(pc: *libc::c_void)
-                -> *libc::c_void;
+            pub fn _Unwind_FindEnclosingFunction(pc: *mut libc::c_void)
+                -> *mut libc::c_void;
         }
 
         // On android, the function _Unwind_GetIP is a macro, and this is the
@@ -581,7 +582,7 @@ pub fn _Unwind_FindEnclosingFunction(pc: *libc::c_void)
         // header file with the definition of _Unwind_GetIP.
         #[cfg(target_os = "android")]
         #[cfg(target_os = "linux", target_arch = "arm")]
-        pub unsafe fn _Unwind_GetIP(ctx: *_Unwind_Context) -> libc::uintptr_t {
+        pub unsafe fn _Unwind_GetIP(ctx: *mut _Unwind_Context) -> libc::uintptr_t {
             #[repr(C)]
             enum _Unwind_VRS_Result {
                 _UVRSR_OK = 0,
@@ -608,7 +609,7 @@ enum _Unwind_VRS_DataRepresentation {
 
             type _Unwind_Word = libc::c_uint;
             extern {
-                fn _Unwind_VRS_Get(ctx: *_Unwind_Context,
+                fn _Unwind_VRS_Get(ctx: *mut _Unwind_Context,
                                    klass: _Unwind_VRS_RegClass,
                                    word: _Unwind_Word,
                                    repr: _Unwind_VRS_DataRepresentation,
@@ -627,8 +628,8 @@ fn _Unwind_VRS_Get(ctx: *_Unwind_Context,
         // a no-op
         #[cfg(target_os = "android")]
         #[cfg(target_os = "linux", target_arch = "arm")]
-        pub unsafe fn _Unwind_FindEnclosingFunction(pc: *libc::c_void)
-            -> *libc::c_void
+        pub unsafe fn _Unwind_FindEnclosingFunction(pc: *mut libc::c_void)
+            -> *mut libc::c_void
         {
             pc
         }
@@ -677,7 +678,7 @@ mod imp {
         extern "system" fn(libc::HANDLE, u64, *mut u64,
                            *mut SYMBOL_INFO) -> libc::BOOL;
     type SymInitializeFn =
-        extern "system" fn(libc::HANDLE, *libc::c_void,
+        extern "system" fn(libc::HANDLE, *mut libc::c_void,
                            libc::BOOL) -> libc::BOOL;
     type SymCleanupFn =
         extern "system" fn(libc::HANDLE) -> libc::BOOL;
@@ -685,8 +686,8 @@ mod imp {
     type StackWalk64Fn =
         extern "system" fn(libc::DWORD, libc::HANDLE, libc::HANDLE,
                            *mut STACKFRAME64, *mut arch::CONTEXT,
-                           *libc::c_void, *libc::c_void,
-                           *libc::c_void, *libc::c_void) -> libc::BOOL;
+                           *mut libc::c_void, *mut libc::c_void,
+                           *mut libc::c_void, *mut libc::c_void) -> libc::BOOL;
 
     static MAX_SYM_NAME: uint = 2000;
     static IMAGE_FILE_MACHINE_I386: libc::DWORD = 0x014c;
@@ -735,7 +736,7 @@ struct STACKFRAME64 {
         AddrFrame: ADDRESS64,
         AddrStack: ADDRESS64,
         AddrBStore: ADDRESS64,
-        FuncTableEntry: *libc::c_void,
+        FuncTableEntry: *mut libc::c_void,
         Params: [u64, ..4],
         Far: libc::BOOL,
         Virtual: libc::BOOL,
@@ -924,7 +925,7 @@ pub fn write(w: &mut Writer) -> IoResult<()> {
 
         macro_rules! sym( ($e:expr, $t:ident) => (unsafe {
             match lib.symbol($e) {
-                Ok(f) => mem::transmute::<*u8, $t>(f),
+                Ok(f) => mem::transmute::<*mut u8, $t>(f),
                 Err(..) => return Ok(())
             }
         }) )
@@ -944,7 +945,7 @@ macro_rules! sym( ($e:expr, $t:ident) => (unsafe {
         let image = arch::init_frame(&mut frame, &context);
 
         // Initialize this process's symbols
-        let ret = SymInitialize(process, 0 as *libc::c_void, libc::TRUE);
+        let ret = SymInitialize(process, 0 as *mut libc::c_void, libc::TRUE);
         if ret != libc::TRUE { return Ok(()) }
         let _c = Cleanup { handle: process, SymCleanup: SymCleanup };
 
@@ -952,8 +953,10 @@ macro_rules! sym( ($e:expr, $t:ident) => (unsafe {
         let mut i = 0i;
         try!(write!(w, "stack backtrace:\n"));
         while StackWalk64(image, process, thread, &mut frame, &mut context,
-                          0 as *libc::c_void, 0 as *libc::c_void,
-                          0 as *libc::c_void, 0 as *libc::c_void) == libc::TRUE{
+                          0 as *mut libc::c_void,
+                          0 as *mut libc::c_void,
+                          0 as *mut libc::c_void,
+                          0 as *mut libc::c_void) == libc::TRUE{
             let addr = frame.AddrPC.Offset;
             if addr == frame.AddrReturn.Offset || addr == 0 ||
                frame.AddrReturn.Offset == 0 { break }
index 66e7059422b36f69cb786ceb33a5518e44cfd2eb..19853138afd547ce5f44295429a4444486ac89d8 100644 (file)
@@ -79,7 +79,7 @@
 /// the crate's logging flags, registering GC
 /// metadata, and storing the process arguments.
 #[allow(experimental)]
-pub fn init(argc: int, argv: **u8) {
+pub fn init(argc: int, argv: *const *const u8) {
     rustrt::init(argc, argv);
     unsafe { unwind::register(failure::on_fail); }
 }
index e2d04a30a54bbff93aa76d0f181981643430210e..ad4edfdd15323ae986c8dd9a3963e04386c555c4 100644 (file)
@@ -511,10 +511,10 @@ fn avoid_copying_the_body(spawnfn: |v: proc():Send|) {
         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;
 
         spawnfn(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);
         });
 
index 18608a0a370e0aa31da7681c0477402ce8f924e4..cdd030ac34adcde2a09ddc3b9a722d88bf087283 100644 (file)
@@ -137,7 +137,7 @@ pub struct BufferPool<T> {
 ///   2. We can certainly avoid bounds checks using *T instead of Vec<T>, although
 ///      LLVM is probably pretty good at doing this already.
 struct Buffer<T> {
-    storage: *T,
+    storage: *const T,
     log_size: uint,
 }
 
@@ -354,7 +354,7 @@ unsafe fn new(log_size: uint) -> Buffer<T> {
         let size = buffer_alloc_size::<T>(log_size);
         let buffer = allocate(size, min_align_of::<T>());
         Buffer {
-            storage: buffer as *T,
+            storage: buffer as *const T,
             log_size: log_size,
         }
     }
@@ -364,7 +364,9 @@ fn size(&self) -> int { 1 << self.log_size }
     // Apparently LLVM cannot optimize (foo % (1 << bar)) into this implicitly
     fn mask(&self) -> int { (1 << self.log_size) - 1 }
 
-    unsafe fn elem(&self, i: int) -> *T { self.storage.offset(i & self.mask()) }
+    unsafe fn elem(&self, i: int) -> *const T {
+        self.storage.offset(i & self.mask())
+    }
 
     // This does not protect against loading duplicate values of the same cell,
     // nor does this clear out the contents contained within. Hence, this is a
@@ -610,7 +612,8 @@ fn no_starvation() {
             let s = s.clone();
             let unique_box = box AtomicUint::new(0);
             let thread_box = unsafe {
-                *mem::transmute::<&Box<AtomicUint>, **mut AtomicUint>(&unique_box)
+                *mem::transmute::<&Box<AtomicUint>,
+                                  *const *mut AtomicUint>(&unique_box)
             };
             (Thread::start(proc() {
                 unsafe {
index 6af733ddb4b44628c991a247bcc21d5732ce37f5..2b6886ab7f434f25f72cf89ac950b7f4b91383c2 100644 (file)
@@ -104,7 +104,7 @@ pub unsafe fn pop(&self) -> Option<*mut Node<T>> {
             mem::transmute(&self.stub)
         };
         let mut next = (*tail).next(atomics::Relaxed);
-        if tail as uint == &self.stub as *DummyNode as uint {
+        if tail as uint == &self.stub as *const DummyNode as uint {
             if next.is_null() {
                 return None;
             }
index 28a08a7fef298446083cf36a6274500183d7acef..ed6b2ee2e45afd4fdc3b912ebdee3fe659718904 100644 (file)
@@ -890,7 +890,7 @@ fn test_rwlock_exclusion(x: Arc<RWLock>,
         let x2 = x.clone();
         let mut sharedstate = box 0;
         {
-            let ptr: *int = &*sharedstate;
+            let ptr: *const int = &*sharedstate;
             task::spawn(proc() {
                 let sharedstate: &mut int =
                     unsafe { mem::transmute(ptr) };
index 016dd879dcd838c3ee2f915a29fe269b6117daf6..530ea013112386f1203d00135452273cc9ad4008 100644 (file)
@@ -69,9 +69,9 @@ pub fn as_slice<'a>(&'a self) -> &'a [T] {
         static PTR_MARKER: u8 = 0;
         let ptr = if self.data.is_null() {
             // length zero, i.e. this will never be read as a T.
-            &PTR_MARKER as *u8 as *T
+            &PTR_MARKER as *const u8 as *const T
         } else {
-            self.data as *T
+            self.data as *const T
         };
 
         let slice: &[T] = unsafe {mem::transmute(raw::Slice {
index 97e99ca692d1abc41fc2d77c168c5e1575f952b8..e23378a592b1ccde748bb0a3092d8da3ef7fe9ba 100644 (file)
@@ -479,7 +479,11 @@ pub fn print_type(&mut self, ty: &ast::Ty) -> IoResult<()> {
             }
             ast::TyPtr(ref mt) => {
                 try!(word(&mut self.s, "*"));
-                try!(self.print_mt(mt));
+                match mt.mutbl {
+                    ast::MutMutable => try!(self.word_nbsp("mut")),
+                    ast::MutImmutable => try!(self.word_nbsp("const")),
+                }
+                try!(self.print_type(&*mt.ty));
             }
             ast::TyRptr(ref lifetime, ref mt) => {
                 try!(word(&mut self.s, "&"));
index 94a7acaf0765ab6c065105e5f5530ae84996d17f..3ed7fccb933e667908d204c2199886dd690eec06 100644 (file)
@@ -1091,7 +1091,7 @@ fn set_time_zone() {
         // `SetEnvironmentVariable`, which `os::setenv` internally uses.
         // It is why we use `putenv` here.
         extern {
-            fn _putenv(envstring: *libc::c_char) -> libc::c_int;
+            fn _putenv(envstring: *const libc::c_char) -> libc::c_int;
         }
 
         unsafe {
index 918ba0a2dcedf608fe73b9e658fc30d50bbc8086..ee7787d6fccf56bb02d7f7f6a5b2a1fb3830353a 100644 (file)
@@ -64,7 +64,7 @@ pub enum FooEnum {
     // 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
 
index 13705107cfe8ec6a3c3fa9b14beb9f30ceb1d9a3..8065533dd738269766733fe45ec908a17c1deefc 100644 (file)
 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);
 }
index a091c6be9f8c6aa676aa0ddec2324270ac692ff0..2737c6df533fec71f3b77fe47b0120c06f34fa36 100644 (file)
@@ -21,7 +21,7 @@
 // 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)
 }
 
index fbd35c57adc7998985ea1cafdf4b5ee2cbf94a28..1e5eedfa8a9eae6668cc046f900e51d8ff89924b 100644 (file)
@@ -17,7 +17,7 @@
 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)
 }
 
index de68dd311c6578872aefc4a354381aa70393000b..30aed76a4ebdb04dadf032fc071f08d635a7189b 100644 (file)
@@ -14,7 +14,7 @@
 use std::ops::Deref;
 
 struct Rc<T> {
-    value: *T
+    value: *const T
 }
 
 impl<T> Deref<T> for Rc<T> {
index 7aac9458e3c9ad58df0184115b7c09474414f733..5397c5b8a569fe92a58148ddd2d2621c4ed8d8f5 100644 (file)
@@ -14,7 +14,7 @@
 use std::ops::Deref;
 
 struct Rc<T> {
-    value: *T
+    value: *const T
 }
 
 impl<T> Deref<T> for Rc<T> {
index c507b636f15cf652eb1fba386a6cb23a976b61d2..87bb8ef7a588221d03a4d068a57490583aa07294 100644 (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;
 }
index 416c272b8ce1bb8ad5f7eb791fcee403aef6c3ff..1ea4a98c45beeefaf196787c5501b30931af1261 100644 (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);
     })
 }
index dcfead3a1c20571327e53d7e80ea359e45b430ea..979791ad763f56b33cfa09e4be5d0435e6d18aab 100644 (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);
     })
 }
index ccf0fb3711a91467d6fc091a325a029e812987e1..9eadb62c3a059b0dd911ec5d45b68749562ff1a8 100644 (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);
     })
 }
index 4a7a7b0f265954bd334184192268ef8e0f647d43..066bb53cdc4d3ffc2cab5923e6c590b7fa0c561a 100644 (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);
     })
 }
index 77c26d9e6de5c1d4a143460397c18c2706dbce39..f7d5ddb314557eeea18ae59ab5bb0c5d3a3fdbbb 100644 (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() {
 }
index 875358ea1420131e2b0e8d30a3d31e8ca4636a1d..223426dc7c6896c4f3f7621a346acc584a1013ce 100644 (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() {
 }
index 8b7267ab7766438d4611cdbf01e622e6eab36664..dc19b9d51c8c435446d444b075fb360757bb0455 100644 (file)
@@ -24,7 +24,7 @@ fn a() {}
     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 @@ fn bar(&self) {
     }
 }
 
-impl Foo for *int {
+impl Foo for *const int {
     fn bar(&self) {
         baz();
         //~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?
index ea8ee8699e4821742811fb39dd7a20efcc1d2acc..920897e6828a04770c438d7fcd4b03856a915f8b 100644 (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
 }
 
index 799f5b4d5320cb5777dfcc6c0edaf641c873db7f..2d1ad9a2692ece90250e3075faf493649c60e4aa 100644 (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
 }
index cc03361ee27e1e1c794c587990a672ba57f88e6a..aa3d9d9fef080691385ff4cf10650d1c12c035b0 100644 (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
 }
index 06232580198f0e6544a8d8569a0b5915ec0ca5e4..f2a3d86ef0fd803e7ffd303a7fc56e8131b148c7 100644 (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>();
index 313b6eeb347234851e44e7a10379d62d58e8900b..424c7a4e4303f3d2bb3fc8b3fb65585263606a79 100644 (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() {
index 11ae2fcf9409a355a6e0b131192b110c9c9ed1f7..6c1b3ef67cc831e92c17ee81838bd1948ed8a4f7 100644 (file)
@@ -11,7 +11,7 @@
 #![feature(linkage)]
 
 extern {
-    #[linkage = "foo"] static foo: *i32;
+    #[linkage = "foo"] static foo: *const i32;
     //~^ ERROR: invalid linkage specified
 }
 
index 3de0a0446d80d545e0a3f028f827794376e68e5b..9e609814c8b3c2236d8b396f205bde670be5085e 100644 (file)
 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() {
index b68a2241e1a39a9dc63d6d1fea0e4f86e386b729..f8e59ad13ad7a127bb84bdb95f7910433e91382b 100644 (file)
@@ -37,7 +37,7 @@ mod foo2 {
 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 @@ fn la_la_la() {}
 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 {} }
index 1563850c64135667a6abaf4d3648f4ac32563d11..4ad56ce915431deaf2f99abfef9df2708405d8f0 100644 (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();
index b0d517d18f7eeff30055df9c690981955479965a..4687d66ca5391cd6087b8b7082535610877346ef 100644 (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 @@ pub fn baz() {
 
 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
index d3fdd508f4559de165fc4d8e21545368249f42cd..da43324d494a53db9858b0e65d5a2584d60e8e69 100644 (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 Foo {
 
 #[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() {}
index 5025e2e509b116878c9e74472761b9b8c3b6520a..cd134ccf71d7e20c73e7b02943101f53461a714b 100644 (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
index 6df52c394fc0ed7b7dc3eb0bfdd7af2d3a0e969a..015d221e7efe78b37a1f429d0aa3a296254ced8a 100644 (file)
@@ -184,4 +184,4 @@ mod i {
     }
 }
 
-#[start] fn main(_: int, _: **u8) -> int { 3 }
+#[start] fn main(_: int, _: *const *const u8) -> int { 3 }
index 5a5b6eb8436d71d62a9d83e240930248d3bac1d4..1a94751b46bfe9d01ab2c672b51ec9e52cf95f98 100644 (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 }
 
index 6898a0cde17f569854427ddfc1bf16357dd5c135..4c67a9910cfe9ebf2dd83ec15f97e90e88b8fd9a 100644 (file)
@@ -30,4 +30,4 @@ fn test1() {
     gpriv();
 }
 
-#[start] fn main(_: int, _: **u8) -> int { 3 }
+#[start] fn main(_: int, _: *const *const u8) -> int { 3 }
index 18a94cb86c84781554208feef04e6d92781aac2b..65f4a0e950ff6a32ff9f03743dd27c86518eacee 100644 (file)
@@ -29,4 +29,4 @@ fn test2() {
     gpriv();
 }
 
-#[start] fn main(_: int, _: **u8) -> int { 3 }
+#[start] fn main(_: int, _: *const *const u8) -> int { 3 }
index a9480c60886e6a9d0cfc33d0c490d15bd78c09ee..97908118e3518fa82ba54d64a8f2c076b7ce8fa9 100644 (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;
 }
index 4572e084f66d1041a8454a8d853f4300a4433719..464abd57872bcd56c50a3154e9c1eed2263e308a 100644 (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() {
index fb631e02b6fb110a90e08318fc1c2fddbfd80578..bdf079e24d2a1e40af13796ba5ad172038152a7c 100644 (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
 }
 
index aa58d2e08e94c1c2c3d348f643c83b779c192570..2110d4c80095a79f0dc5cd67eb2382e296caf2cb 100644 (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 {
index da0f0f5f7c94bef708f8c783b6ec2956e9389cfc..e096e5eb436298556ab7a0ceb2bf6c7958b2f799 100644 (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] };
 
index 8a5881d3797677bbcc1f738a9e0f1c34a0fb1681..cfa6623176ca3a199f0a2d1d2cf191309b902413 100644 (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`
     }
index 377057a75ff1f2a6baa3d4b52a8aacf67abc4a39..ae3924ba9356cbd7525c7b72a82b9eb8cd518a33 100644 (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!();
     })
index ce24d265504c75fbebe193da84082ebfa5f3e52e..c370846c673db5240610f89512664d48eb228cab 100644 (file)
@@ -22,7 +22,7 @@ fn failfn() {
 }
 
 struct r {
-  v: *int,
+  v: *const int,
 }
 
 impl Drop for r {
@@ -33,7 +33,7 @@ fn drop(&mut self) {
     }
 }
 
-fn r(v: *int) -> r {
+fn r(v: *const int) -> r {
     r {
         v: v
     }
index bb68ba4916888478b2614275361ce256a3dff7b0..69c65ef8b037a2869ee00682bf449942c742565d 100644 (file)
@@ -15,7 +15,7 @@
 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");
index 7a78ec29a82b85acd9a4fd819878a47a9abad048..d211167626d77fd3eecd460c4e8f95073c972b49 100644 (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");
index 35a0da4dcf3cc66bae9936c88c6be353abf4de99..3bea7e84807cea3e632e8bcdbc44f3238741092f 100644 (file)
@@ -10,6 +10,6 @@
 
 
 #[start]
-fn start(_argc: int, _argv: **u8) -> int {
+fn start(_argc: int, _argv: *const *const u8) -> int {
     return 0;
 }
index 616b247bbb77c28e6c65e5bc8b6fb501bf98ba34..2e559e894fb49f9a2832d92cffc1e4b400a40dfb 100644 (file)
@@ -17,7 +17,9 @@
 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() {
index ff4dcc18bb495245b04b928a645d2124c62cfc5c..218247008601d3469837a678716fe16356e91b62 100644 (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;
index dd1224929c7f316fe272f8177d00c91baafb6736..c9e1c2c8d42c6450b67bcc1173d7b71a6da7fe2f 100644 (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);
     })
 }
index 540a00d3a3122b5b4c767a58de2916ba8d42a05a..597e067b8b6ae22932dc63046b95403c5a39bfb6 100644 (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;
     }
 }
 
index 23607e16795edba637dce9a9a5de02de8200a3af..19186f4b46bcef9fb0fd50168477d58c822715f3 100644 (file)
@@ -31,7 +31,7 @@ fn log(&mut self, record: &LogRecord) {
 }
 
 #[start]
-fn start(argc: int, argv: **u8) -> int {
+fn start(argc: int, argv: *const *const u8) -> int {
     native::start(argc, argv, proc() {
         main();
     })
index eacdd8f3978f6c80947c0cb507d7cef4ba462d31..a298a08a1b7a099bcce4a7e20e38168a0269a735 100644 (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));
 }
index feac6e68e48ad0ca6b6eed4e342bf57a1a8c195f..01eccc53427877de3d82edc8856788e0ed7ca605 100644 (file)
@@ -13,7 +13,7 @@
 
 struct Foo {
     a: uint,
-    b: *()
+    b: *const ()
 }
 
 fn foo<T>(a: T) -> T {
@@ -25,7 +25,7 @@ fn foo<T>(a: T) -> T {
 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);
 
index 88ab70f596adf60c46fee3925e952ac54bbd37b5..e4734fc3e55aa9bec0923940f882995f0c2adee2 100644 (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());
index 7b17b578b82b793040201e8fc7acabd40ffcc5af..87a4fd1153f8229496501df8cca84487e063ef9e 100644 (file)
 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);
 }
index 87363c0e55e869ae3dbb366a88aef639366d7184..36fe021b97e1447628df28cb252b78724a76eafa 100644 (file)
@@ -14,5 +14,5 @@ struct Pair<'a> { a: int, b: &'a Big }
 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);
 }
index 77c7a08f4ca1761db87023b3ffa9ab2ec1cfed03..51f5855bb92a08f12c991428077fe3d95041b52b 100644 (file)
 
 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());
index a0d4785d8d2be420b79ff024251575dfe953815e..8e84278c10e02ab235ba2fd039df06dbb6a99766 100644 (file)
@@ -54,7 +54,7 @@ fn f() $b
 )
 
 #[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)
 }
 
index 2a8293fcba8d0ec5e2e15790209c9d4b148cfe43..a1ef12a7657fe50deaab40a2b319979f3e1dca0f 100644 (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 {
index 2802572847211088bacfe1d613812940710ec96e..cefc266b5c764019ccda14b0211a607964d88eb2 100644 (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() {
index bd4c89eb8ab39edfc48cefb953635d30e08175d5..21238e68b3143f59cd64362a59a2428cfd3a95b3 100644 (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);
     }
 }
index 890f5158a65ffb0663753c09f826d93576ede7a2..750c0c8ed682ab63cf71643d6f35fc308f3c1541 100644 (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;
     }
 }
 
index 3c7e878c3189041ac7b3103ddde7978fbc3befc3..ce2f895566439433143810603ae1b87984796622 100644 (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;
     }
 }
 
index 5ab3930e7a39a20a34922538880029442cd49f21..6d06c12c4507e033326b59cde040482228165a06 100644 (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);
index bb4be948a5ee02449e8b4739c3407a287f496a44..5eeace65054009bf70913acf6121a9a5572f9067 100644 (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);
 
index 4b678d78834d17508f3c4b9c5fe0dd59008c7dd4..1258a498dacb4e4368918588176ebc2bfbf7be29 100644 (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");
index 41ddce7a96ee27a13bddee63499c7351d05c2f18..35897d5b823f1e9dcc628dabb704fad5eb58a0f8 100644 (file)
@@ -14,7 +14,7 @@
 // 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()});
index f28ba7b8bc03b89834c8103f461a1de653b297b4..3b81943000bf83192490d71bd5861a6ef90f188c 100644 (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);
index 4375c63a1b8c03e368fcf74c93c76afc8c5216cc..f1bbf353f717d23ca8bf0bf6329481fd46a96744 100644 (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
index 009a0783b589f22fa712413be8f7f376f6a0d461..37e675b52ebd886d342c73f6a6f9b1e77960fad2 100644 (file)
@@ -14,7 +14,7 @@
 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)
 }
 
index 02790dab7b9976d0af9c6abeeba100ecfa6f243e..c24128f97e372a47954b24ce7b98182e3ad2a6df 100644 (file)
@@ -14,7 +14,7 @@
 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)
 }
 
index 37df74031acf3e99c3d57d15db3638b68aef4fca..6ca605742efa9fe799b8fb01354e784e68528c4d 100644 (file)
@@ -19,7 +19,7 @@
 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)
 }
 
index a4f88d7c04c6e38093150b7e2627b8b98feb5d76..528e6d43cef730e3b41ac0865f0015d9c8bb8321 100644 (file)
@@ -16,7 +16,7 @@
 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)
 }
 
index a3ead0a66858169724e4232ba5b9caaa3e499f9d..160828d42fc54a768bc8c0ad4c3bffedc86b0517 100644 (file)
@@ -25,11 +25,11 @@ fn b(&self) {}
 }
 
 // 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 @@ fn bar(&self) {
 }
 
 // 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>);
     }
 }
 
index 037c7b80cc8c41719ee6bcf305cd58b3ab04ae21..10ae2749a090202073e148129e2c2bc1e86ffbb3 100644 (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;
         }
     }
 }
index 5eb9453134dea74705ea791c013ebe818377ffeb..b4807964d46dd4d8abeac5bacb13f3bb9e457ec4 100644 (file)
@@ -42,9 +42,9 @@ pub struct packet<T> {
         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 @@ mod rusti {
 
     // 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 fn recv<T:Send>(mut p: recv_packet<T>) -> Option<T> {
         }
     }
 
-    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 fn sender_terminate<T:Send>(p: *packet<T>) {
         }
     }
 
-    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 fn receiver_terminate<T:Send>(p: *packet<T>) {
     }
 
     pub struct send_packet<T> {
-        p: Option<*packet<T>>,
+        p: Option<*const packet<T>>,
     }
 
     #[unsafe_destructor]
@@ -166,7 +166,7 @@ impl<T:Send> Drop for send_packet<T> {
         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 @@ fn drop(&mut self) {
     }
 
     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 @@ impl<T:Send> Drop for recv_packet<T> {
         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 @@ fn drop(&mut self) {
     }
 
     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 fn liberate_ping(p: ping) -> ::pipes::send_packet<pong> {
 
     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!()
index 6d70b15c62164906ffeef0889f69518f0faa21f6..8fd603781ba61e76de0f8e9cab3658054398116c 100644 (file)
@@ -18,7 +18,7 @@
 struct KEYGEN {
     hash_algorithm: [c_uint, ..2],
     count: uint32_t,
-    salt: *c_void,
+    salt: *const c_void,
     salt_size: uint32_t,
 }
 
index d96568df63a4dd57293ad9d85de76fac2a86ac10..7730d75a3a9c21bb6535a4e8ffb15e1c22eb64cc 100644 (file)
 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);
 }
index 1bda73a16c9eb5c2bd75d469badac657bcd3a6f1..468f420624a5f8f44ede4e90b5b023fdca5c31ad 100644 (file)
@@ -12,9 +12,9 @@
 
 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 () {}
index 860b23849c6ffcd203be9f094bb3ac9de31f3b57..ef164150804b99a98b4bff37a04e39b8473e3a59 100644 (file)
@@ -14,7 +14,7 @@ pub struct Foo {
     }
 
     extern {
-        pub fn foo(v: *Foo) -> Foo;
+        pub fn foo(v: *const Foo) -> Foo;
     }
 }
 
index c665c1da3fc13552561855abdb429d6252df8df0..d775f23bab4ac3ca39adbc3cdc82bea02796a93b 100644 (file)
@@ -16,7 +16,7 @@
 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);
index 23e48b97427c59e59fa77eb042b1ceb2bf491fb1..6330e1bf3c16e60f62b3c4e84d2f6c05a8811fee 100644 (file)
@@ -33,6 +33,6 @@
 extern {}
 
 #[start]
-fn main(_: int, _: **u8) -> int {
+fn main(_: int, _: *const *const u8) -> int {
     1 % 1
 }
index 2eafd34afcace3c688564e67380d00cbbc662994..2ab1e911180f0d3775093b30bf9273daa2e82f95 100644 (file)
@@ -19,7 +19,7 @@
 
 extern {
     #[linkage = "extern_weak"]
-    static foo: *int;
+    static foo: *const int;
     #[linkage = "extern_weak"]
     static something_that_should_never_exist: *mut int;
 }
index 94a4308ab0822526416901a6a429f43c7803f64a..ea3eb29964883520cdfe2eefc82f84d0a9177517 100644 (file)
@@ -15,7 +15,7 @@
 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() {
index bf1a97f84b631838ae2eb24ae00c8ac53ec232a7..a7937efd66fceeab040afd334f0876a8e5af751b 100644 (file)
@@ -10,7 +10,7 @@
 
 
 #[start]
-pub fn main(_: int, _: **u8) -> int {
+pub fn main(_: int, _: *const *const u8) -> int {
     println!("hello");
     0
 }
index 44ff58c151ed6a4c89184b01f1316ab0e978795c..69ff9fca6ceb935b0d0167b0c5d6ab2df825133c 100644 (file)
@@ -28,7 +28,7 @@
 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)
 }
 
index 26bf06794ca0c215f4a67d5b30af8ac3a73c0fcc..d48f9dccaafc9561f79c2adf061820857e404c6c 100644 (file)
@@ -12,7 +12,7 @@
 
 mod a {
     extern {
-        pub fn free(x: *u8);
+        pub fn free(x: *const u8);
     }
 }
 
index 9757db9df4cfd1df7b021881cfce629c3f49fec7..a8a9afc61561128cc9da105dc6769e613f1c3a49 100644 (file)
@@ -66,44 +66,44 @@ fn visit_estr_fixed(&mut self,
                         _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 @@ fn visit_leave_enum_variant(&mut self,
                                 _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 }
index bf7a8fabff33b4025a68ad70d6a8bc31b11e829c..e0609782a0aa9820c3789e27addb013064631ed9 100644 (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);
index 0ef48c9978251e09cbde006d0ab789fe1e0fc35c..44435dc2398dc7489c59961fd603b063b751b1e7 100644 (file)
@@ -18,7 +18,7 @@
 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) {
index bdba5aa9cfe153d7384d1b72b1e4a94cd60688d9..4f1a3817fabd781a9e3c0bfe9bbf2700faa85107 100644 (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 @@
 
 #[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;
index 083d2e167a0757e54beb71f4cfa07b06831ee7ee..515198f7a71eb0faa4bdaffc4301c93346fda479 100644 (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);
 }
index b87535713a76d54903d758c606fbd3143630a499..a3ab4637412fc0266b4d5637d89cee9987c6c241 100644 (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);
index cf6c2754829324f0403296adb94a234a0370d176..fafb9412c01e5b279eff37900022012ea4df6d15 100644 (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);
     });
 
index b066d8a8ae09169436e9dd2a6dbea271fc9c5f3a..ebc720aa0c888d60f2bc5c675709c38d863f564a 100644 (file)
@@ -24,7 +24,7 @@
 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)
 }
 
index efad0cecbde96289442c8c32cdc41b25b5b7f42c..de3366708c5a0a0e3ebcef92c1279577bfdf3a4a 100644 (file)
@@ -25,7 +25,7 @@
 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)
 }
 
index a00b6b8153e08d13c8089186a5886b09bcb628fc..410e3df9e2ac9fa28321e0b0bd25b65e1c024665 100644 (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; }
index 0316311993ab7779de859987cc905456ba397e5e..1a79edb30c9c640a36ac2d4e509ef51f623faf95 100644 (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);
 }
index 7f46b0ff6e797983bf5afa172c40523d48cda5a0..bf74dedebc4fbffc0731c91b1401576b9695c8bc 100644 (file)
@@ -14,7 +14,7 @@
 
 use std::mem;
 
-fn null<T>() -> *T {
+fn null<T>() -> *const T {
     unsafe {
         mem::transmute(0)
     }
index 77a8009c97593b4c8994a1a68e61068db4515005..eb0a3c0eda816d1cb498235ef09bf3aaad077998 100644 (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>> {
index 3385c6f6fef53534deda9e690c87a503b467dfec..7a624109a5507a72defdb859f0f53699737829a3 100644 (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);
     }
index c42f392d2bce0ced0698d2561b33cca9798b4b5c..de22f428713f71be7e15441b422dc729b7415502 100644 (file)
@@ -26,4 +26,4 @@ mod baz {
 }
 
 #[start]
-pub fn start(_: int, _: **u8) -> int { 0 }
+pub fn start(_: int, _: *const *const u8) -> int { 0 }
index c6a1654bfe4e4c7e5d3ea9cc2c2fc7836623ad71..570b881650ae89a1f844a87507359c4742eff9ff 100644 (file)
@@ -15,7 +15,7 @@
 // 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));
index 9b0a23401565631654d9316a537330c38c0320b1..93112e3e7ec9ddfed34f4029acdadc6d03ded8b5 100644 (file)
@@ -14,7 +14,7 @@
 
 mod libc {
     extern {
-        pub fn malloc(size: int) -> *u8;
+        pub fn malloc(size: int) -> *const u8;
     }
 }