// given a new key, initialize it with this new count,
// given an existing key, add more to its count
- fn addMoreToCount(_k: uint, v0: uint, v1: uint) -> uint {
+ fn add_more_to_count(_k: uint, v0: uint, v1: uint) -> uint {
v0 + v1
}
- fn addMoreToCount_simple(v0: uint, v1: uint) -> uint {
+ fn add_more_to_count_simple(v0: uint, v1: uint) -> uint {
v0 + v1
}
// count integers
- map.update(3, 1, addMoreToCount_simple);
- map.update_with_key(9, 1, addMoreToCount);
- map.update(3, 7, addMoreToCount_simple);
- map.update_with_key(5, 3, addMoreToCount);
- map.update_with_key(3, 2, addMoreToCount);
+ map.update(3, 1, add_more_to_count_simple);
+ map.update_with_key(9, 1, add_more_to_count);
+ map.update(3, 7, add_more_to_count_simple);
+ map.update_with_key(5, 3, add_more_to_count);
+ map.update_with_key(3, 2, add_more_to_count);
// check the total counts
assert_eq!(map.find(&3).unwrap(), &10);
-// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
//! however the converse is not always true due to the above range limits
//! and, as such, should be performed via the `from_u32` function..
+#![allow(non_snake_case_functions)]
use mem::transmute;
use option::{None, Option, Some};
// NOTE: The following code was generated by "src/etc/unicode.py", do not edit directly
-#![allow(missing_doc, non_uppercase_statics)]
+#![allow(missing_doc, non_uppercase_statics, non_snake_case_functions)]
fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
pub struct MovePtrAdaptor<V> {
inner: V
}
-pub fn MovePtrAdaptor<V:TyVisitor + MovePtr>(v: V) -> MovePtrAdaptor<V> {
- MovePtrAdaptor { inner: v }
-}
impl<V:TyVisitor + MovePtr> MovePtrAdaptor<V> {
+ pub fn new(v: V) -> MovePtrAdaptor<V> {
+ MovePtrAdaptor { inner: v }
+ }
+
#[inline]
pub fn bump(&mut self, sz: uint) {
self.inner.move_ptr(|p| ((p as uint) + sz) as *u8)
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
last_err: Option<io::IoError>,
}
-pub fn ReprVisitor<'a>(ptr: *u8,
- writer: &'a mut io::Writer) -> ReprVisitor<'a> {
- ReprVisitor {
- ptr: ptr,
- ptr_stk: vec!(),
- var_stk: vec!(),
- writer: writer,
- last_err: None,
- }
-}
-
impl<'a> MovePtr for ReprVisitor<'a> {
#[inline]
fn move_ptr(&mut self, adjustment: |*u8| -> *u8) {
impl<'a> ReprVisitor<'a> {
// Various helpers for the TyVisitor impl
+ pub fn new(ptr: *u8, writer: &'a mut io::Writer) -> ReprVisitor<'a> {
+ ReprVisitor {
+ ptr: ptr,
+ ptr_stk: vec!(),
+ var_stk: vec!(),
+ writer: writer,
+ last_err: None,
+ }
+ }
#[inline]
pub fn get<T>(&mut self, f: |&mut ReprVisitor, &T| -> bool) -> bool {
#[inline]
pub fn visit_ptr_inner(&mut self, ptr: *u8, inner: *TyDesc) -> bool {
unsafe {
- // This should call the constructor up above, but due to limiting
- // issues we have to recreate it here.
- let u = ReprVisitor {
- ptr: ptr,
- ptr_stk: vec!(),
- var_stk: vec!(),
- writer: mem::transmute_copy(&self.writer),
- last_err: None,
- };
- let mut v = reflect::MovePtrAdaptor(u);
+ let u = ReprVisitor::new(ptr, mem::transmute_copy(&self.writer));
+ let mut v = reflect::MovePtrAdaptor::new(u);
// Obviously this should not be a thing, but blame #8401 for now
visit_tydesc(inner, &mut v as &mut TyVisitor);
match v.unwrap().last_err {
unsafe {
let ptr = object as *T as *u8;
let tydesc = get_tydesc::<T>();
- let u = ReprVisitor(ptr, writer);
- let mut v = reflect::MovePtrAdaptor(u);
+ let u = ReprVisitor::new(ptr, writer);
+ let mut v = reflect::MovePtrAdaptor::new(u);
visit_tydesc(tydesc, &mut v as &mut TyVisitor);
match v.unwrap().last_err {
Some(e) => Err(e),
-// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
#[cfg(unix)]
fn translate_status(status: c_int) -> p::ProcessExit {
+ #![allow(non_snake_case_functions)]
#[cfg(target_os = "linux")]
#[cfg(target_os = "android")]
mod imp {
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+#![allow(non_snake_case_functions)]
use std::rand::{Rng, task_rng};
use std::str;
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
/// This function will move tasks to run on their home I/O scheduler. Note
/// that this function does *not* pin the task to the I/O scheduler, but
/// rather it simply moves it to running on the I/O scheduler.
- fn go_to_IO_home(&mut self) -> uint {
+ fn go_to_io_home(&mut self) -> uint {
let _f = ForbidUnwind::new("going home");
let cur_loop_id = local_id();
/// move the local task to its I/O scheduler and then return an RAII wrapper
/// which will return the task home.
fn fire_homing_missile(&mut self) -> HomingMissile {
- HomingMissile { io_home: self.go_to_IO_home() }
+ HomingMissile { io_home: self.go_to_io_home() }
}
}
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
pub struct MovePtrAdaptor<V> {
inner: V
}
-pub fn MovePtrAdaptor<V:TyVisitor + MovePtr>(v: V) -> MovePtrAdaptor<V> {
- MovePtrAdaptor { inner: v }
-}
impl<V:TyVisitor + MovePtr> MovePtrAdaptor<V> {
+ pub fn new(v: V) -> MovePtrAdaptor<V> {
+ MovePtrAdaptor { inner: v }
+ }
+
#[inline]
pub fn bump(&mut self, sz: uint) {
self.inner.move_ptr(|p| ((p as uint) + sz) as *u8)
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
last_err: Option<io::IoError>,
}
-pub fn ReprVisitor<'a>(ptr: *u8,
- writer: &'a mut io::Writer) -> ReprVisitor<'a> {
- ReprVisitor {
- ptr: ptr,
- ptr_stk: vec!(),
- var_stk: vec!(),
- writer: writer,
- last_err: None,
- }
-}
-
impl<'a> MovePtr for ReprVisitor<'a> {
#[inline]
fn move_ptr(&mut self, adjustment: |*u8| -> *u8) {
impl<'a> ReprVisitor<'a> {
// Various helpers for the TyVisitor impl
+ pub fn new(ptr: *u8, writer: &'a mut io::Writer) -> ReprVisitor<'a> {
+ ReprVisitor {
+ ptr: ptr,
+ ptr_stk: vec!(),
+ var_stk: vec!(),
+ writer: writer,
+ last_err: None,
+ }
+ }
#[inline]
pub fn get<T>(&mut self, f: |&mut ReprVisitor, &T| -> bool) -> bool {
#[inline]
pub fn visit_ptr_inner(&mut self, ptr: *u8, inner: *TyDesc) -> bool {
unsafe {
- // This should call the constructor up above, but due to limiting
- // issues we have to recreate it here.
- let u = ReprVisitor {
- ptr: ptr,
- ptr_stk: vec!(),
- var_stk: vec!(),
- writer: ::mem::transmute_copy(&self.writer),
- last_err: None,
- };
- let mut v = reflect::MovePtrAdaptor(u);
+ let u = ReprVisitor::new(ptr, ::mem::transmute_copy(&self.writer));
+ let mut v = reflect::MovePtrAdaptor::new(u);
// Obviously this should not be a thing, but blame #8401 for now
visit_tydesc(inner, &mut v as &mut TyVisitor);
match v.unwrap().last_err {
unsafe {
let ptr = object as *T as *u8;
let tydesc = get_tydesc::<T>();
- let u = ReprVisitor(ptr, writer);
- let mut v = reflect::MovePtrAdaptor(u);
+ let u = ReprVisitor::new(ptr, writer);
+ let mut v = reflect::MovePtrAdaptor::new(u);
visit_tydesc(tydesc, &mut v as &mut TyVisitor);
match v.unwrap().last_err {
Some(e) => Err(e),