librustc: Remove all uses of static from functions. rs=destatic

This commit is contained in:
Patrick Walton 2013-03-21 19:07:54 -07:00
parent 1616ffd0c2
commit 4634f7edae
79 changed files with 281 additions and 286 deletions

View file

@ -49,7 +49,7 @@ pub pure fn is_false(v: bool) -> bool { !v }
/// Parse logic value from `s`
impl FromStr for bool {
static pure fn from_str(s: &str) -> Option<bool> {
pure fn from_str(s: &str) -> Option<bool> {
if s == "true" {
Some(true)
} else if s == "false" {

View file

@ -126,7 +126,7 @@ pub fn concat<T>(lists: @mut DList<@mut DList<T>>) -> @mut DList<T> {
}
priv impl<T> DList<T> {
static pure fn new_link(data: T) -> DListLink<T> {
pure fn new_link(data: T) -> DListLink<T> {
Some(@mut DListNode {
data: data,
linked: true,

View file

@ -13,5 +13,5 @@
use option::Option;
pub trait FromStr {
static pure fn from_str(s: &str) -> Option<Self>;
pure fn from_str(s: &str) -> Option<Self>;
}

View file

@ -373,7 +373,7 @@ pub mod linear {
pub impl<K:Hash + IterBytes + Eq,V> LinearMap<K, V> {
/// Create an empty LinearMap
static fn new() -> LinearMap<K, V> {
fn new() -> LinearMap<K, V> {
linear_map_with_capacity(INITIAL_CAPACITY)
}
@ -639,7 +639,7 @@ pub mod linear {
pub impl <T:Hash + IterBytes + Eq> LinearSet<T> {
/// Create an empty LinearSet
static fn new() -> LinearSet<T> { LinearSet{map: LinearMap::new()} }
fn new() -> LinearSet<T> { LinearSet{map: LinearMap::new()} }
/// Reserve space for at least `n` elements in the hash table.
fn reserve_at_least(&mut self, n: uint) {

View file

@ -89,7 +89,7 @@ pub trait Buildable<A> {
* as an argument a function that will push an element
* onto the sequence being constructed.
*/
static pure fn build_sized(size: uint,
pure fn build_sized(size: uint,
builder: &fn(push: &pure fn(A))) -> Self;
}

View file

@ -277,12 +277,12 @@ impl cmp::Ord for f32 {
impl num::Zero for f32 {
#[inline(always)]
static pure fn zero() -> f32 { 0.0 }
pure fn zero() -> f32 { 0.0 }
}
impl num::One for f32 {
#[inline(always)]
static pure fn one() -> f32 { 1.0 }
pure fn one() -> f32 { 1.0 }
}
impl NumCast for f32 {
@ -290,7 +290,7 @@ impl NumCast for f32 {
* Cast `n` to an `f32`
*/
#[inline(always)]
static pure fn from<N:NumCast>(n: N) -> f32 { n.to_f32() }
pure fn from<N:NumCast>(n: N) -> f32 { n.to_f32() }
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }
@ -568,12 +568,12 @@ pub pure fn from_str_radix(num: &str, rdx: uint) -> Option<f32> {
impl from_str::FromStr for f32 {
#[inline(always)]
static pure fn from_str(val: &str) -> Option<f32> { from_str(val) }
pure fn from_str(val: &str) -> Option<f32> { from_str(val) }
}
impl num::FromStrRadix for f32 {
#[inline(always)]
static pure fn from_str_radix(val: &str, rdx: uint) -> Option<f32> {
pure fn from_str_radix(val: &str, rdx: uint) -> Option<f32> {
from_str_radix(val, rdx)
}
}

View file

@ -304,7 +304,7 @@ impl NumCast for f64 {
* Cast `n` to an `f64`
*/
#[inline(always)]
static pure fn from<N:NumCast>(n: N) -> f64 { n.to_f64() }
pure fn from<N:NumCast>(n: N) -> f64 { n.to_f64() }
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }
@ -325,12 +325,12 @@ impl NumCast for f64 {
impl num::Zero for f64 {
#[inline(always)]
static pure fn zero() -> f64 { 0.0 }
pure fn zero() -> f64 { 0.0 }
}
impl num::One for f64 {
#[inline(always)]
static pure fn one() -> f64 { 1.0 }
pure fn one() -> f64 { 1.0 }
}
#[cfg(notest)]
@ -592,12 +592,12 @@ pub pure fn from_str_radix(num: &str, rdx: uint) -> Option<f64> {
impl from_str::FromStr for f64 {
#[inline(always)]
static pure fn from_str(val: &str) -> Option<f64> { from_str(val) }
pure fn from_str(val: &str) -> Option<f64> { from_str(val) }
}
impl num::FromStrRadix for f64 {
#[inline(always)]
static pure fn from_str_radix(val: &str, rdx: uint) -> Option<f64> {
pure fn from_str_radix(val: &str, rdx: uint) -> Option<f64> {
from_str_radix(val, rdx)
}
}

View file

@ -304,12 +304,12 @@ pub pure fn from_str_radix(num: &str, radix: uint) -> Option<float> {
impl from_str::FromStr for float {
#[inline(always)]
static pure fn from_str(val: &str) -> Option<float> { from_str(val) }
pure fn from_str(val: &str) -> Option<float> { from_str(val) }
}
impl num::FromStrRadix for float {
#[inline(always)]
static pure fn from_str_radix(val: &str, radix: uint) -> Option<float> {
pure fn from_str_radix(val: &str, radix: uint) -> Option<float> {
from_str_radix(val, radix)
}
}
@ -408,12 +408,12 @@ impl Ord for float {
impl num::Zero for float {
#[inline(always)]
static pure fn zero() -> float { 0.0 }
pure fn zero() -> float { 0.0 }
}
impl num::One for float {
#[inline(always)]
static pure fn one() -> float { 1.0 }
pure fn one() -> float { 1.0 }
}
impl NumCast for float {
@ -421,7 +421,7 @@ impl NumCast for float {
* Cast `n` to a `float`
*/
#[inline(always)]
static pure fn from<N:NumCast>(n: N) -> float { n.to_float() }
pure fn from<N:NumCast>(n: N) -> float { n.to_float() }
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }

View file

@ -163,12 +163,12 @@ impl Eq for T {
impl num::Zero for T {
#[inline(always)]
static pure fn zero() -> T { 0 }
pure fn zero() -> T { 0 }
}
impl num::One for T {
#[inline(always)]
static pure fn one() -> T { 1 }
pure fn one() -> T { 1 }
}
#[cfg(notest)]
@ -221,14 +221,14 @@ pub pure fn parse_bytes(buf: &[u8], radix: uint) -> Option<T> {
impl FromStr for T {
#[inline(always)]
static pure fn from_str(s: &str) -> Option<T> {
pure fn from_str(s: &str) -> Option<T> {
from_str(s)
}
}
impl FromStrRadix for T {
#[inline(always)]
static pure fn from_str_radix(&self, s: &str, radix: uint) -> Option<T> {
pure fn from_str_radix(s: &str, radix: uint) -> Option<T> {
from_str_radix(s, radix)
}
}

View file

@ -22,7 +22,7 @@ impl NumCast for i16 {
* Cast `n` to a `i16`
*/
#[inline(always)]
static pure fn from<N:NumCast>(n: N) -> i16 { n.to_i16() }
pure fn from<N:NumCast>(n: N) -> i16 { n.to_i16() }
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }

View file

@ -22,7 +22,7 @@ impl NumCast for i32 {
* Cast `n` to a `i32`
*/
#[inline(always)]
static pure fn from<N:NumCast>(n: N) -> i32 { n.to_i32() }
pure fn from<N:NumCast>(n: N) -> i32 { n.to_i32() }
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }

View file

@ -22,7 +22,7 @@ impl NumCast for i64 {
* Cast `n` to a `i64`
*/
#[inline(always)]
static pure fn from<N:NumCast>(n: N) -> i64 { n.to_i64() }
pure fn from<N:NumCast>(n: N) -> i64 { n.to_i64() }
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }

View file

@ -22,7 +22,7 @@ impl NumCast for i8 {
* Cast `n` to a `i8`
*/
#[inline(always)]
static pure fn from<N:NumCast>(n: N) -> i8 { n.to_i8() }
pure fn from<N:NumCast>(n: N) -> i8 { n.to_i8() }
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }

View file

@ -63,7 +63,7 @@ impl NumCast for int {
* Cast `n` to a `int`
*/
#[inline(always)]
static pure fn from<N:NumCast>(n: N) -> int { n.to_int() }
pure fn from<N:NumCast>(n: N) -> int { n.to_int() }
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }

View file

@ -18,15 +18,15 @@ pub mod strconv;
pub trait IntConvertible {
pure fn to_int(&self) -> int;
static pure fn from_int(n: int) -> Self;
pure fn from_int(n: int) -> Self;
}
pub trait Zero {
static pure fn zero() -> Self;
pure fn zero() -> Self;
}
pub trait One {
static pure fn one() -> Self;
pure fn one() -> Self;
}
pub pure fn abs<T:Ord + Zero + Neg<T>>(v: T) -> T {
@ -67,7 +67,7 @@ pub pure fn cast<T:NumCast,U:NumCast>(n: T) -> U {
* An interface for generic numeric type casts
*/
pub trait NumCast {
static pure fn from<T:NumCast>(n: T) -> Self;
pure fn from<T:NumCast>(n: T) -> Self;
pure fn to_u8(&self) -> u8;
pure fn to_u16(&self) -> u16;
@ -91,7 +91,7 @@ pub trait ToStrRadix {
}
pub trait FromStrRadix {
static pub pure fn from_str_radix(str: &str, radix: uint) -> Option<Self>;
pub pure fn from_str_radix(str: &str, radix: uint) -> Option<Self>;
}
// Generic math functions:

View file

@ -66,10 +66,10 @@ pure fn is_neg_zero<T:Eq+One+Zero+NumStrConv+Div<T,T>>(num: &T) -> bool {
}
pub trait NumStrConv {
static pure fn NaN() -> Option<Self>;
static pure fn inf() -> Option<Self>;
static pure fn neg_inf() -> Option<Self>;
static pure fn neg_zero() -> Option<Self>;
pure fn NaN() -> Option<Self>;
pure fn inf() -> Option<Self>;
pure fn neg_inf() -> Option<Self>;
pure fn neg_zero() -> Option<Self>;
pure fn round_to_zero(&self) -> Self;
pure fn fractional_part(&self) -> Self;
@ -78,13 +78,13 @@ pub trait NumStrConv {
macro_rules! impl_NumStrConv_Floating (($t:ty) => (
impl NumStrConv for $t {
#[inline(always)]
static pure fn NaN() -> Option<$t> { Some( 0.0 / 0.0) }
pure fn NaN() -> Option<$t> { Some( 0.0 / 0.0) }
#[inline(always)]
static pure fn inf() -> Option<$t> { Some( 1.0 / 0.0) }
pure fn inf() -> Option<$t> { Some( 1.0 / 0.0) }
#[inline(always)]
static pure fn neg_inf() -> Option<$t> { Some(-1.0 / 0.0) }
pure fn neg_inf() -> Option<$t> { Some(-1.0 / 0.0) }
#[inline(always)]
static pure fn neg_zero() -> Option<$t> { Some(-0.0 ) }
pure fn neg_zero() -> Option<$t> { Some(-0.0 ) }
#[inline(always)]
pure fn round_to_zero(&self) -> $t {
@ -102,10 +102,10 @@ macro_rules! impl_NumStrConv_Floating (($t:ty) => (
macro_rules! impl_NumStrConv_Integer (($t:ty) => (
impl NumStrConv for $t {
#[inline(always)] static pure fn NaN() -> Option<$t> { None }
#[inline(always)] static pure fn inf() -> Option<$t> { None }
#[inline(always)] static pure fn neg_inf() -> Option<$t> { None }
#[inline(always)] static pure fn neg_zero() -> Option<$t> { None }
#[inline(always)] pure fn NaN() -> Option<$t> { None }
#[inline(always)] pure fn inf() -> Option<$t> { None }
#[inline(always)] pure fn neg_inf() -> Option<$t> { None }
#[inline(always)] pure fn neg_zero() -> Option<$t> { None }
#[inline(always)] pure fn round_to_zero(&self) -> $t { *self }
#[inline(always)] pure fn fractional_part(&self) -> $t { 0 }

View file

@ -129,12 +129,12 @@ impl Eq for T {
impl num::Zero for T {
#[inline(always)]
static pure fn zero() -> T { 0 }
pure fn zero() -> T { 0 }
}
impl num::One for T {
#[inline(always)]
static pure fn one() -> T { 1 }
pure fn one() -> T { 1 }
}
#[cfg(notest)]
@ -187,14 +187,14 @@ pub pure fn parse_bytes(buf: &[u8], radix: uint) -> Option<T> {
impl FromStr for T {
#[inline(always)]
static pure fn from_str(s: &str) -> Option<T> {
pure fn from_str(s: &str) -> Option<T> {
from_str(s)
}
}
impl FromStrRadix for T {
#[inline(always)]
static pure fn from_str_radix(&self, s: &str, radix: uint) -> Option<T> {
pure fn from_str_radix(s: &str, radix: uint) -> Option<T> {
from_str_radix(s, radix)
}
}

View file

@ -24,7 +24,7 @@ impl NumCast for u16 {
* Cast `n` to a `u16`
*/
#[inline(always)]
static pure fn from<N:NumCast>(n: N) -> u16 { n.to_u16() }
pure fn from<N:NumCast>(n: N) -> u16 { n.to_u16() }
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
#[inline(always)] pure fn to_u16(&self) -> u16 { *self }

View file

@ -24,7 +24,7 @@ impl NumCast for u32 {
* Cast `n` to a `u32`
*/
#[inline(always)]
static pure fn from<N:NumCast>(n: N) -> u32 { n.to_u32() }
pure fn from<N:NumCast>(n: N) -> u32 { n.to_u32() }
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }

View file

@ -24,7 +24,7 @@ impl NumCast for u64 {
* Cast `n` to a `u64`
*/
#[inline(always)]
static pure fn from<N:NumCast>(n: N) -> u64 { n.to_u64() }
pure fn from<N:NumCast>(n: N) -> u64 { n.to_u64() }
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }

View file

@ -31,7 +31,7 @@ impl NumCast for u8 {
* Cast `n` to a `u8`
*/
#[inline(always)]
static pure fn from<N:NumCast>(n: N) -> u8 { n.to_u8() }
pure fn from<N:NumCast>(n: N) -> u8 { n.to_u8() }
#[inline(always)] pure fn to_u8(&self) -> u8 { *self }
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }

View file

@ -215,7 +215,7 @@ impl NumCast for uint {
* Cast `n` to a `uint`
*/
#[inline(always)]
static pure fn from<N:NumCast>(n: N) -> uint { n.to_uint() }
pure fn from<N:NumCast>(n: N) -> uint { n.to_uint() }
#[inline(always)] pure fn to_u8(&self) -> u8 { *self as u8 }
#[inline(always)] pure fn to_u16(&self) -> u16 { *self as u16 }

View file

@ -43,7 +43,7 @@ pub pure fn PosixPath(s: &str) -> PosixPath {
}
pub trait GenericPath {
static pure fn from_str(&str) -> Self;
pure fn from_str(&str) -> Self;
pure fn dirname(&self) -> ~str;
pure fn filename(&self) -> Option<~str>;
@ -380,7 +380,7 @@ impl ToStr for PosixPath {
// PosixPath and WindowsPath, most of their methods are common.
impl GenericPath for PosixPath {
static pure fn from_str(s: &str) -> PosixPath {
pure fn from_str(s: &str) -> PosixPath {
let mut components = str::split_nonempty(s, |c| c == '/');
let is_absolute = (s.len() != 0 && s[0] == '/' as u8);
return PosixPath { is_absolute: is_absolute,
@ -563,7 +563,7 @@ impl ToStr for WindowsPath {
impl GenericPath for WindowsPath {
static pure fn from_str(s: &str) -> WindowsPath {
pure fn from_str(s: &str) -> WindowsPath {
let host;
let device;
let rest;

View file

@ -22,95 +22,95 @@ use libc::size_t;
/// A type that can be randomly generated using an RNG
pub trait Rand {
static fn rand(rng: @rand::Rng) -> Self;
fn rand(rng: @rand::Rng) -> Self;
}
impl Rand for int {
static fn rand(rng: @rand::Rng) -> int {
fn rand(rng: @rand::Rng) -> int {
rng.gen_int()
}
}
impl Rand for i8 {
static fn rand(rng: @rand::Rng) -> i8 {
fn rand(rng: @rand::Rng) -> i8 {
rng.gen_i8()
}
}
impl Rand for i16 {
static fn rand(rng: @rand::Rng) -> i16 {
fn rand(rng: @rand::Rng) -> i16 {
rng.gen_i16()
}
}
impl Rand for i32 {
static fn rand(rng: @rand::Rng) -> i32 {
fn rand(rng: @rand::Rng) -> i32 {
rng.gen_i32()
}
}
impl Rand for i64 {
static fn rand(rng: @rand::Rng) -> i64 {
fn rand(rng: @rand::Rng) -> i64 {
rng.gen_i64()
}
}
impl Rand for u8 {
static fn rand(rng: @rand::Rng) -> u8 {
fn rand(rng: @rand::Rng) -> u8 {
rng.gen_u8()
}
}
impl Rand for u16 {
static fn rand(rng: @rand::Rng) -> u16 {
fn rand(rng: @rand::Rng) -> u16 {
rng.gen_u16()
}
}
impl Rand for u32 {
static fn rand(rng: @rand::Rng) -> u32 {
fn rand(rng: @rand::Rng) -> u32 {
rng.gen_u32()
}
}
impl Rand for u64 {
static fn rand(rng: @rand::Rng) -> u64 {
fn rand(rng: @rand::Rng) -> u64 {
rng.gen_u64()
}
}
impl Rand for float {
static fn rand(rng: @rand::Rng) -> float {
fn rand(rng: @rand::Rng) -> float {
rng.gen_float()
}
}
impl Rand for f32 {
static fn rand(rng: @rand::Rng) -> f32 {
fn rand(rng: @rand::Rng) -> f32 {
rng.gen_f32()
}
}
impl Rand for f64 {
static fn rand(rng: @rand::Rng) -> f64 {
fn rand(rng: @rand::Rng) -> f64 {
rng.gen_f64()
}
}
impl Rand for char {
static fn rand(rng: @rand::Rng) -> char {
fn rand(rng: @rand::Rng) -> char {
rng.gen_char()
}
}
impl Rand for bool {
static fn rand(rng: @rand::Rng) -> bool {
fn rand(rng: @rand::Rng) -> bool {
rng.gen_bool()
}
}
impl<T:Rand> Rand for Option<T> {
static fn rand(rng: @rand::Rng) -> Option<T> {
fn rand(rng: @rand::Rng) -> Option<T> {
if rng.gen_bool() {
Some(Rand::rand(rng))
} else {

View file

@ -19,14 +19,14 @@ use cast::{transmute, transmute_mut_unsafe,
pub struct Context(~Registers);
pub impl Context {
static fn empty() -> Context {
fn empty() -> Context {
Context(new_regs())
}
/// Create a new context that will resume execution by running ~fn()
/// # Safety Note
/// The `start` closure must remain valid for the life of the Task
static fn new(start: &~fn(), stack: &mut StackSegment) -> Context {
fn new(start: &~fn(), stack: &mut StackSegment) -> Context {
// The C-ABI function that is the task entry point
extern fn task_start_wrapper(f: &~fn()) { (*f)() }
@ -49,7 +49,7 @@ pub impl Context {
return Context(regs);
}
static fn swap(out_context: &mut Context, in_context: &Context) {
fn swap(out_context: &mut Context, in_context: &Context) {
let out_regs: &mut Registers = match out_context {
&Context(~ref mut r) => r
};

View file

@ -50,11 +50,11 @@ pub struct Scheduler {
// complaining
type UnsafeTaskReceiver = sys::Closure;
trait HackAroundBorrowCk {
static fn from_fn(&fn(&mut Scheduler, ~Task)) -> Self;
fn from_fn(&fn(&mut Scheduler, ~Task)) -> Self;
fn to_fn(self) -> &fn(&mut Scheduler, ~Task);
}
impl HackAroundBorrowCk for UnsafeTaskReceiver {
static fn from_fn(f: &fn(&mut Scheduler, ~Task)) -> UnsafeTaskReceiver {
fn from_fn(f: &fn(&mut Scheduler, ~Task)) -> UnsafeTaskReceiver {
unsafe { transmute(f) }
}
fn to_fn(self) -> &fn(&mut Scheduler, ~Task) {
@ -70,7 +70,7 @@ enum CleanupJob {
pub impl Scheduler {
static pub fn new(event_loop: ~EventLoopObject) -> Scheduler {
pub fn new(event_loop: ~EventLoopObject) -> Scheduler {
Scheduler {
event_loop: event_loop,
task_queue: WorkQueue::new(),
@ -114,7 +114,7 @@ pub impl Scheduler {
return tlsched.take_scheduler();
}
static fn local(f: &fn(&mut Scheduler)) {
fn local(f: &fn(&mut Scheduler)) {
let mut tlsched = ThreadLocalScheduler::new();
f(tlsched.get_scheduler());
}
@ -296,7 +296,7 @@ pub struct Task {
}
impl Task {
static pub fn new(stack_pool: &mut StackPool, start: ~fn()) -> Task {
pub fn new(stack_pool: &mut StackPool, start: ~fn()) -> Task {
// XXX: Putting main into a ~ so it's a thin pointer and can
// be passed to the spawn function. Another unfortunate
// allocation
@ -337,7 +337,7 @@ impl Task {
struct ThreadLocalScheduler(tls::Key);
impl ThreadLocalScheduler {
static fn new() -> ThreadLocalScheduler {
fn new() -> ThreadLocalScheduler {
unsafe {
// NB: This assumes that the TLS key has been created prior.
// Currently done in rust_start.

View file

@ -15,7 +15,7 @@ pub struct StackSegment {
}
pub impl StackSegment {
static fn new(size: uint) -> StackSegment {
fn new(size: uint) -> StackSegment {
// Crate a block of uninitialized values
let mut stack = vec::with_capacity(size);
unsafe {
@ -37,7 +37,7 @@ pub impl StackSegment {
pub struct StackPool(());
impl StackPool {
static pub fn new() -> StackPool { StackPool(()) }
pub fn new() -> StackPool { StackPool(()) }
fn take_segment(&self, min_size: uint) -> StackSegment {
StackSegment::new(min_size)

View file

@ -20,7 +20,7 @@ struct Thread {
}
impl Thread {
static pub fn start(main: ~fn()) -> Thread {
pub fn start(main: ~fn()) -> Thread {
fn substart(main: &fn()) -> *raw_thread {
unsafe { rust_raw_thread_start(&main) }
}

View file

@ -74,7 +74,7 @@ impl Callback for NullCallback { }
/// A type that wraps a native handle
trait NativeHandle<T> {
static pub fn from_native_handle(T) -> Self;
pub fn from_native_handle(T) -> Self;
pub fn native_handle(&self) -> T;
}
@ -86,7 +86,7 @@ pub struct Loop {
}
pub impl Loop {
static fn new() -> Loop {
fn new() -> Loop {
let handle = unsafe { uvll::loop_new() };
fail_unless!(handle.is_not_null());
NativeHandle::from_native_handle(handle)
@ -102,7 +102,7 @@ pub impl Loop {
}
impl NativeHandle<*uvll::uv_loop_t> for Loop {
static fn from_native_handle(handle: *uvll::uv_loop_t) -> Loop {
fn from_native_handle(handle: *uvll::uv_loop_t) -> Loop {
Loop { handle: handle }
}
fn native_handle(&self) -> *uvll::uv_loop_t {
@ -132,7 +132,7 @@ type IdleCallback = ~fn(IdleWatcher, Option<UvError>);
impl Callback for IdleCallback { }
pub impl IdleWatcher {
static fn new(loop_: &mut Loop) -> IdleWatcher {
fn new(loop_: &mut Loop) -> IdleWatcher {
unsafe {
let handle = uvll::idle_new();
fail_unless!(handle.is_not_null());
@ -177,7 +177,7 @@ pub impl IdleWatcher {
}
impl NativeHandle<*uvll::uv_idle_t> for IdleWatcher {
static fn from_native_handle(handle: *uvll::uv_idle_t) -> IdleWatcher {
fn from_native_handle(handle: *uvll::uv_idle_t) -> IdleWatcher {
IdleWatcher(handle)
}
fn native_handle(&self) -> *uvll::uv_idle_t {
@ -307,7 +307,7 @@ pub impl StreamWatcher {
}
impl NativeHandle<*uvll::uv_stream_t> for StreamWatcher {
static fn from_native_handle(
fn from_native_handle(
handle: *uvll::uv_stream_t) -> StreamWatcher {
StreamWatcher(handle)
}
@ -328,7 +328,7 @@ type ConnectionCallback = ~fn(StreamWatcher, Option<UvError>);
impl Callback for ConnectionCallback { }
pub impl TcpWatcher {
static fn new(loop_: &mut Loop) -> TcpWatcher {
fn new(loop_: &mut Loop) -> TcpWatcher {
unsafe {
let size = size_of::<uvll::uv_tcp_t>() as size_t;
let handle = malloc(size) as *uvll::uv_tcp_t;
@ -421,7 +421,7 @@ pub impl TcpWatcher {
}
impl NativeHandle<*uvll::uv_tcp_t> for TcpWatcher {
static fn from_native_handle(handle: *uvll::uv_tcp_t) -> TcpWatcher {
fn from_native_handle(handle: *uvll::uv_tcp_t) -> TcpWatcher {
TcpWatcher(handle)
}
fn native_handle(&self) -> *uvll::uv_tcp_t {
@ -441,7 +441,7 @@ impl Request for ConnectRequest { }
impl ConnectRequest {
static fn new() -> ConnectRequest {
fn new() -> ConnectRequest {
let connect_handle = unsafe {
malloc(size_of::<uvll::uv_connect_t>() as size_t)
};
@ -465,7 +465,7 @@ impl ConnectRequest {
}
impl NativeHandle<*uvll::uv_connect_t> for ConnectRequest {
static fn from_native_handle(
fn from_native_handle(
handle: *uvll:: uv_connect_t) -> ConnectRequest {
ConnectRequest(handle)
}
@ -480,7 +480,7 @@ impl Request for WriteRequest { }
impl WriteRequest {
static fn new() -> WriteRequest {
fn new() -> WriteRequest {
let write_handle = unsafe {
malloc(size_of::<uvll::uv_write_t>() as size_t)
};
@ -503,7 +503,7 @@ impl WriteRequest {
}
impl NativeHandle<*uvll::uv_write_t> for WriteRequest {
static fn from_native_handle(handle: *uvll:: uv_write_t) -> WriteRequest {
fn from_native_handle(handle: *uvll:: uv_write_t) -> WriteRequest {
WriteRequest(handle)
}
fn native_handle(&self) -> *uvll::uv_write_t {

View file

@ -29,14 +29,14 @@ pub struct UvEventLoop {
}
pub impl UvEventLoop {
static fn new() -> UvEventLoop {
fn new() -> UvEventLoop {
UvEventLoop {
uvio: UvIoFactory(Loop::new())
}
}
/// A convenience constructor
static fn new_scheduler() -> Scheduler {
fn new_scheduler() -> Scheduler {
Scheduler::new(~UvEventLoop::new())
}
}
@ -221,7 +221,7 @@ impl TcpListener for UvTcpListener {
pub struct UvStream(StreamWatcher);
impl UvStream {
static fn new(watcher: StreamWatcher) -> UvStream {
fn new(watcher: StreamWatcher) -> UvStream {
UvStream(watcher)
}

View file

@ -15,7 +15,7 @@ pub struct WorkQueue<T> {
}
pub impl<T> WorkQueue<T> {
static fn new() -> WorkQueue<T> {
fn new() -> WorkQueue<T> {
WorkQueue {
queue: ~[]
}

View file

@ -139,7 +139,7 @@ impl<T> Map<uint, T> for TrieMap<T> {
pub impl<T> TrieMap<T> {
/// Create an empty TrieMap
#[inline(always)]
static pure fn new() -> TrieMap<T> {
pure fn new() -> TrieMap<T> {
TrieMap{root: TrieNode::new(), length: 0}
}
@ -192,7 +192,7 @@ impl Mutable for TrieSet {
impl TrieSet {
/// Create an empty TrieSet
#[inline(always)]
static pure fn new() -> TrieSet {
pure fn new() -> TrieSet {
TrieSet{map: TrieMap::new()}
}
@ -220,7 +220,7 @@ struct TrieNode<T> {
impl<T> TrieNode<T> {
#[inline(always)]
static pure fn new() -> TrieNode<T> {
pure fn new() -> TrieNode<T> {
// FIXME: #5244: [Nothing, ..SIZE] should be possible without Copy
TrieNode{count: 0,
children: [Nothing, Nothing, Nothing, Nothing,

View file

@ -140,7 +140,7 @@ pub mod ct {
}
pub impl<T> Parsed<T> {
static pure fn new(&self, val: T, next: uint) -> Parsed<T> {
pure fn new(val: T, next: uint) -> Parsed<T> {
Parsed {val: val, next: next}
}
}

View file

@ -82,7 +82,7 @@ pub struct LanguageItems {
}
pub impl LanguageItems {
static pub fn new(&self) -> LanguageItems {
pub fn new() -> LanguageItems {
LanguageItems {
items: [ None, ..35 ]
}
@ -96,7 +96,7 @@ pub impl LanguageItems {
}
}
static pub fn item_name(&self, index: uint) -> &'static str {
pub fn item_name(index: uint) -> &'static str {
match index {
0 => "const",
1 => "copy",

View file

@ -311,7 +311,7 @@ impl ToStr for MutabilityCategory {
}
pub impl MutabilityCategory {
static fn from_mutbl(&self, m: ast::mutability) -> MutabilityCategory {
fn from_mutbl(m: ast::mutability) -> MutabilityCategory {
match m {
m_imm => McImmutable,
m_const => McReadOnly,

View file

@ -282,7 +282,7 @@ pub fn trans_static_method_callee(bcx: block,
// When we translate a static fn defined in a trait like:
//
// trait<T1...Tn> Trait {
// static fn foo<M1...Mn>(...) {...}
// fn foo<M1...Mn>(...) {...}
// }
//
// this winds up being translated as something like:

View file

@ -1720,7 +1720,7 @@ pub impl TypeContents {
!self.intersects(TypeContents::noncopyable(cx))
}
static fn noncopyable(_cx: ctxt) -> TypeContents {
fn noncopyable(_cx: ctxt) -> TypeContents {
TC_DTOR + TC_BORROWED_MUT + TC_ONCE_CLOSURE + TC_OWNED_CLOSURE +
TC_EMPTY_ENUM
}
@ -1729,7 +1729,7 @@ pub impl TypeContents {
!self.intersects(TypeContents::nondurable(cx))
}
static fn nondurable(_cx: ctxt) -> TypeContents {
fn nondurable(_cx: ctxt) -> TypeContents {
TC_BORROWED_POINTER
}
@ -1737,7 +1737,7 @@ pub impl TypeContents {
!self.intersects(TypeContents::nonowned(cx))
}
static fn nonowned(_cx: ctxt) -> TypeContents {
fn nonowned(_cx: ctxt) -> TypeContents {
TC_MANAGED + TC_BORROWED_POINTER
}
@ -1749,7 +1749,7 @@ pub impl TypeContents {
!self.intersects(TypeContents::nonconst(cx))
}
static fn nonconst(_cx: ctxt) -> TypeContents {
fn nonconst(_cx: ctxt) -> TypeContents {
TC_MUTABLE
}
@ -1757,7 +1757,7 @@ pub impl TypeContents {
self.intersects(TypeContents::nonimplicitly_copyable(cx))
}
static fn nonimplicitly_copyable(cx: ctxt) -> TypeContents {
fn nonimplicitly_copyable(cx: ctxt) -> TypeContents {
let base = TypeContents::noncopyable(cx) + TC_OWNED_POINTER;
if cx.vecs_implicitly_copyable {base} else {base + TC_OWNED_VEC}
}
@ -1766,7 +1766,7 @@ pub impl TypeContents {
!self.intersects(TypeContents::nondefault_mode(cx))
}
static fn nondefault_mode(cx: ctxt) -> TypeContents {
fn nondefault_mode(cx: ctxt) -> TypeContents {
let tc = TypeContents::nonimplicitly_copyable(cx);
tc + TC_BIG + TC_OWNED_VEC // disregard cx.vecs_implicitly_copyable
}
@ -1776,7 +1776,7 @@ pub impl TypeContents {
self.intersects(tc)
}
static fn owned(&self, _cx: ctxt) -> TypeContents {
fn owned(_cx: ctxt) -> TypeContents {
//! Any kind of owned contents.
TC_OWNED_CLOSURE + TC_OWNED_POINTER + TC_OWNED_VEC
}

View file

@ -51,27 +51,23 @@ use util::common::indenter;
use std::list;
pub trait LatticeValue {
static fn sub(&self, cf: &CombineFields, a: &Self, b: &Self) -> ures;
static fn lub(&self, cf: &CombineFields, a: &Self, b: &Self)
-> cres<Self>;
static fn glb(&self, cf: &CombineFields, a: &Self, b: &Self)
-> cres<Self>;
fn sub(cf: &CombineFields, a: &Self, b: &Self) -> ures;
fn lub(cf: &CombineFields, a: &Self, b: &Self) -> cres<Self>;
fn glb(cf: &CombineFields, a: &Self, b: &Self) -> cres<Self>;
}
pub type LatticeOp<T> = &'self fn(cf: &CombineFields, a: &T, b: &T) -> cres<T>;
impl LatticeValue for ty::t {
static fn sub(&self, cf: &CombineFields, a: &ty::t, b: &ty::t) -> ures {
fn sub(cf: &CombineFields, a: &ty::t, b: &ty::t) -> ures {
Sub(*cf).tys(*a, *b).to_ures()
}
static fn lub(&self, cf: &CombineFields, a: &ty::t, b: &ty::t)
-> cres<ty::t> {
fn lub(cf: &CombineFields, a: &ty::t, b: &ty::t) -> cres<ty::t> {
Lub(*cf).tys(*a, *b)
}
static fn glb(&self, cf: &CombineFields, a: &ty::t, b: &ty::t)
-> cres<ty::t> {
fn glb(cf: &CombineFields, a: &ty::t, b: &ty::t) -> cres<ty::t> {
Glb(*cf).tys(*a, *b)
}
}

View file

@ -35,7 +35,7 @@ pub struct Node<V, T> {
}
pub trait UnifyVid<T> {
static fn appropriate_vals_and_bindings(&self, infcx: &'v mut InferCtxt)
fn appropriate_vals_and_bindings(infcx: &'v mut InferCtxt)
-> &'v mut ValsAndBindings<Self, T>;
}
@ -144,7 +144,7 @@ pub impl InferCtxt {
// doesn't have a subtyping relationship we need to worry about.
pub trait SimplyUnifiable {
static fn to_type_err(&self, expected_found<Self>) -> ty::type_err;
fn to_type_err(expected_found<Self>) -> ty::type_err;
}
pub fn mk_err<T:SimplyUnifiable>(+a_is_expected: bool,
@ -235,36 +235,34 @@ pub impl InferCtxt {
// ______________________________________________________________________
impl UnifyVid<Bounds<ty::t>> for ty::TyVid {
static fn appropriate_vals_and_bindings(&self, infcx: &'v mut InferCtxt)
fn appropriate_vals_and_bindings(infcx: &'v mut InferCtxt)
-> &'v mut ValsAndBindings<ty::TyVid, Bounds<ty::t>> {
return &mut infcx.ty_var_bindings;
}
}
impl UnifyVid<Option<IntVarValue>> for ty::IntVid {
static fn appropriate_vals_and_bindings(&self, infcx: &'v mut InferCtxt)
fn appropriate_vals_and_bindings(infcx: &'v mut InferCtxt)
-> &'v mut ValsAndBindings<ty::IntVid, Option<IntVarValue>> {
return &mut infcx.int_var_bindings;
}
}
impl SimplyUnifiable for IntVarValue {
static fn to_type_err(&self, err: expected_found<IntVarValue>)
-> ty::type_err {
fn to_type_err(err: expected_found<IntVarValue>) -> ty::type_err {
return ty::terr_int_mismatch(err);
}
}
impl UnifyVid<Option<ast::float_ty>> for ty::FloatVid {
static fn appropriate_vals_and_bindings(&self, infcx: &'v mut InferCtxt)
fn appropriate_vals_and_bindings(infcx: &'v mut InferCtxt)
-> &'v mut ValsAndBindings<ty::FloatVid, Option<ast::float_ty>> {
return &mut infcx.float_var_bindings;
}
}
impl SimplyUnifiable for ast::float_ty {
static fn to_type_err(&self, err: expected_found<ast::float_ty>)
-> ty::type_err {
fn to_type_err(err: expected_found<ast::float_ty>) -> ty::type_err {
return ty::terr_float_mismatch(err);
}
}

View file

@ -94,7 +94,7 @@ impl ToStr for BigUint {
}
impl from_str::FromStr for BigUint {
static pure fn from_str(s: &str) -> Option<BigUint> {
pure fn from_str(s: &str) -> Option<BigUint> {
BigUint::from_str_radix(s, 10)
}
}
@ -116,11 +116,11 @@ impl Shr<uint, BigUint> for BigUint {
}
impl Zero for BigUint {
static pure fn zero() -> BigUint { BigUint::new(~[]) }
pure fn zero() -> BigUint { BigUint::new(~[]) }
}
impl One for BigUint {
static pub pure fn one() -> BigUint { BigUint::new(~[1]) }
pub pure fn one() -> BigUint { BigUint::new(~[1]) }
}
impl Add<BigUint, BigUint> for BigUint {
@ -256,14 +256,14 @@ impl IntConvertible for BigUint {
uint::min(self.to_uint(), int::max_value as uint) as int
}
static pure fn from_int(n: int) -> BigUint {
pure fn from_int(n: int) -> BigUint {
if (n < 0) { Zero::zero() } else { BigUint::from_uint(n as uint) }
}
}
pub impl BigUint {
/// Creates and initializes an BigUint.
static pub pure fn new(v: ~[BigDigit]) -> BigUint {
pub pure fn new(v: ~[BigDigit]) -> BigUint {
// omit trailing zeros
let new_len = v.rposition(|n| *n != 0).map_default(0, |p| *p + 1);
@ -274,7 +274,7 @@ pub impl BigUint {
}
/// Creates and initializes an BigUint.
static pub pure fn from_uint(n: uint) -> BigUint {
pub pure fn from_uint(n: uint) -> BigUint {
match BigDigit::from_uint(n) {
(0, 0) => Zero::zero(),
(0, n0) => BigUint::new(~[n0]),
@ -283,18 +283,18 @@ pub impl BigUint {
}
/// Creates and initializes an BigUint.
static pub pure fn from_slice(slice: &[BigDigit]) -> BigUint {
pub pure fn from_slice(slice: &[BigDigit]) -> BigUint {
return BigUint::new(vec::from_slice(slice));
}
/// Creates and initializes an BigUint.
static pub pure fn from_str_radix(s: &str, radix: uint)
pub pure fn from_str_radix(s: &str, radix: uint)
-> Option<BigUint> {
BigUint::parse_bytes(str::to_bytes(s), radix)
}
/// Creates and initializes an BigUint.
static pub pure fn parse_bytes(buf: &[u8], radix: uint)
pub pure fn parse_bytes(buf: &[u8], radix: uint)
-> Option<BigUint> {
let (base, unit_len) = get_radix_base(radix);
let base_num: BigUint = BigUint::from_uint(base);
@ -614,7 +614,7 @@ impl ToStr for BigInt {
}
impl from_str::FromStr for BigInt {
static pure fn from_str(s: &str) -> Option<BigInt> {
pure fn from_str(s: &str) -> Option<BigInt> {
BigInt::from_str_radix(s, 10)
}
}
@ -632,13 +632,13 @@ impl Shr<uint, BigInt> for BigInt {
}
impl Zero for BigInt {
static pub pure fn zero() -> BigInt {
pub pure fn zero() -> BigInt {
BigInt::from_biguint(Zero, Zero::zero())
}
}
impl One for BigInt {
static pub pure fn one() -> BigInt {
pub pure fn one() -> BigInt {
BigInt::from_biguint(Plus, One::one())
}
}
@ -721,7 +721,7 @@ impl IntConvertible for BigInt {
}
}
static pure fn from_int(n: int) -> BigInt {
pure fn from_int(n: int) -> BigInt {
if n > 0 {
return BigInt::from_biguint(Plus, BigUint::from_uint(n as uint));
}
@ -736,12 +736,12 @@ impl IntConvertible for BigInt {
pub impl BigInt {
/// Creates and initializes an BigInt.
static pub pure fn new(sign: Sign, v: ~[BigDigit]) -> BigInt {
pub pure fn new(sign: Sign, v: ~[BigDigit]) -> BigInt {
BigInt::from_biguint(sign, BigUint::new(v))
}
/// Creates and initializes an BigInt.
static pub pure fn from_biguint(sign: Sign, data: BigUint) -> BigInt {
pub pure fn from_biguint(sign: Sign, data: BigUint) -> BigInt {
if sign == Zero || data.is_zero() {
return BigInt { sign: Zero, data: Zero::zero() };
}
@ -749,24 +749,24 @@ pub impl BigInt {
}
/// Creates and initializes an BigInt.
static pub pure fn from_uint(n: uint) -> BigInt {
pub pure fn from_uint(n: uint) -> BigInt {
if n == 0 { return Zero::zero(); }
return BigInt::from_biguint(Plus, BigUint::from_uint(n));
}
/// Creates and initializes an BigInt.
static pub pure fn from_slice(sign: Sign, slice: &[BigDigit]) -> BigInt {
pub pure fn from_slice(sign: Sign, slice: &[BigDigit]) -> BigInt {
BigInt::from_biguint(sign, BigUint::from_slice(slice))
}
/// Creates and initializes an BigInt.
static pub pure fn from_str_radix(s: &str, radix: uint)
pub pure fn from_str_radix(s: &str, radix: uint)
-> Option<BigInt> {
BigInt::parse_bytes(str::to_bytes(s), radix)
}
/// Creates and initializes an BigInt.
static pub pure fn parse_bytes(buf: &[u8], radix: uint)
pub pure fn parse_bytes(buf: &[u8], radix: uint)
-> Option<BigInt> {
if buf.is_empty() { return None; }
let mut sign = Plus;

View file

@ -27,7 +27,7 @@ fn small_mask(nbits: uint) -> uint {
}
pub impl SmallBitv {
static fn new(bits: uint) -> SmallBitv {
fn new(bits: uint) -> SmallBitv {
SmallBitv {bits: bits}
}
@ -124,7 +124,7 @@ fn big_mask(nbits: uint, elem: uint) -> uint {
}
pub impl BigBitv {
static fn new(storage: ~[uint]) -> BigBitv {
fn new(storage: ~[uint]) -> BigBitv {
BigBitv {storage: storage}
}
@ -256,7 +256,7 @@ priv impl Bitv {
}
pub impl Bitv {
static fn new(nbits: uint, init: bool) -> Bitv {
fn new(nbits: uint, init: bool) -> Bitv {
let rep = if nbits <= uint::bits {
Small(~SmallBitv::new(if init {!0} else {0}))
}
@ -592,12 +592,12 @@ pub struct BitvSet {
pub impl BitvSet {
/// Creates a new bit vector set with initially no contents
static fn new() -> BitvSet {
fn new() -> BitvSet {
BitvSet{ size: 0, bitv: BigBitv::new(~[0]) }
}
/// Creates a new bit vector set from the given bit vector
static fn from_bitv(bitv: Bitv) -> BitvSet {
fn from_bitv(bitv: Bitv) -> BitvSet {
let mut size = 0;
for bitv.ones |_| {
size += 1;

View file

@ -43,7 +43,7 @@ impl<T> Mutable for Deque<T> {
pub impl<T> Deque<T> {
/// Create an empty Deque
static pure fn new() -> Deque<T> {
pure fn new() -> Deque<T> {
Deque{nelts: 0, lo: 0, hi: 0,
elts: vec::from_fn(initial_capacity, |_| None)}
}

View file

@ -314,7 +314,7 @@ impl<T,F:Flattener<T>,C:ByteChan> GenericChan<T> for FlatChan<T, F, C> {
}
pub impl<T,U:Unflattener<T>,P:BytePort> FlatPort<T, U, P> {
static fn new(u: U, p: P) -> FlatPort<T, U, P> {
fn new(u: U, p: P) -> FlatPort<T, U, P> {
FlatPort {
unflattener: u,
byte_port: p
@ -323,7 +323,7 @@ pub impl<T,U:Unflattener<T>,P:BytePort> FlatPort<T, U, P> {
}
pub impl<T,F:Flattener<T>,C:ByteChan> FlatChan<T, F, C> {
static fn new(f: F, c: C) -> FlatChan<T, F, C> {
fn new(f: F, c: C) -> FlatChan<T, F, C> {
FlatChan {
flattener: f,
byte_chan: c
@ -376,7 +376,7 @@ pub mod flatteners {
}
pub impl<T:Copy + Owned> PodUnflattener<T> {
static fn new() -> PodUnflattener<T> {
fn new() -> PodUnflattener<T> {
PodUnflattener {
bogus: ()
}
@ -384,7 +384,7 @@ pub mod flatteners {
}
pub impl<T:Copy + Owned> PodFlattener<T> {
static fn new() -> PodFlattener<T> {
fn new() -> PodFlattener<T> {
PodFlattener {
bogus: ()
}
@ -419,7 +419,7 @@ pub mod flatteners {
}
pub impl<D:Decoder,T:Decodable<D>> DeserializingUnflattener<D, T> {
static fn new(deserialize_buffer: DeserializeBuffer<T>)
fn new(deserialize_buffer: DeserializeBuffer<T>)
-> DeserializingUnflattener<D, T> {
DeserializingUnflattener {
deserialize_buffer: deserialize_buffer
@ -428,7 +428,7 @@ pub mod flatteners {
}
pub impl<S:Encoder,T:Encodable<S>> SerializingFlattener<S, T> {
static fn new(serialize_value: SerializeValue<T>)
fn new(serialize_value: SerializeValue<T>)
-> SerializingFlattener<S, T> {
SerializingFlattener {
serialize_value: serialize_value
@ -459,15 +459,15 @@ pub mod flatteners {
}
pub trait FromReader {
static fn from_reader(r: @Reader) -> Self;
fn from_reader(r: @Reader) -> Self;
}
pub trait FromWriter {
static fn from_writer(w: @Writer) -> Self;
fn from_writer(w: @Writer) -> Self;
}
impl FromReader for json::Decoder/&self {
static fn from_reader(r: @Reader) -> json::Decoder/&self {
fn from_reader(r: @Reader) -> json::Decoder/&self {
match json::from_reader(r) {
Ok(json) => {
json::Decoder(json)
@ -478,13 +478,13 @@ pub mod flatteners {
}
impl FromWriter for json::Encoder {
static fn from_writer(w: @Writer) -> json::Encoder {
fn from_writer(w: @Writer) -> json::Encoder {
json::Encoder(w)
}
}
impl FromReader for ebml::reader::Decoder {
static fn from_reader(r: @Reader) -> ebml::reader::Decoder {
fn from_reader(r: @Reader) -> ebml::reader::Decoder {
let buf = @r.read_whole_stream();
let doc = ebml::reader::Doc(buf);
ebml::reader::Decoder(doc)
@ -492,7 +492,7 @@ pub mod flatteners {
}
impl FromWriter for ebml::writer::Encoder {
static fn from_writer(w: @Writer) -> ebml::writer::Encoder {
fn from_writer(w: @Writer) -> ebml::writer::Encoder {
ebml::writer::Encoder(w)
}
}
@ -543,7 +543,7 @@ pub mod bytepipes {
}
pub impl<R:Reader> ReaderBytePort<R> {
static fn new(r: R) -> ReaderBytePort<R> {
fn new(r: R) -> ReaderBytePort<R> {
ReaderBytePort {
reader: r
}
@ -551,7 +551,7 @@ pub mod bytepipes {
}
pub impl<W:Writer> WriterByteChan<W> {
static fn new(w: W) -> WriterByteChan<W> {
fn new(w: W) -> WriterByteChan<W> {
WriterByteChan {
writer: w
}
@ -606,7 +606,7 @@ pub mod bytepipes {
}
pub impl PipeBytePort {
static fn new(p: Port<~[u8]>) -> PipeBytePort {
fn new(p: Port<~[u8]>) -> PipeBytePort {
PipeBytePort {
port: p,
buf: ~[]
@ -615,7 +615,7 @@ pub mod bytepipes {
}
pub impl PipeByteChan {
static fn new(c: Chan<~[u8]>) -> PipeByteChan {
fn new(c: Chan<~[u8]>) -> PipeByteChan {
PipeByteChan {
chan: c
}

View file

@ -17,7 +17,7 @@ pub struct BufReader {
}
pub impl BufReader {
static pub fn new(v: ~[u8]) -> BufReader {
pub fn new(v: ~[u8]) -> BufReader {
BufReader {
buf: v,
pos: 0

View file

@ -45,7 +45,7 @@ struct UserInfo {
pub type Query = ~[(~str, ~str)];
pub impl Url {
static pure fn new(
pure fn new(
scheme: ~str,
user: Option<UserInfo>,
host: ~str,
@ -67,7 +67,7 @@ pub impl Url {
}
pub impl UserInfo {
static pure fn new(user: ~str, pass: Option<~str>) -> UserInfo {
pure fn new(user: ~str, pass: Option<~str>) -> UserInfo {
UserInfo { user: user, pass: pass }
}
}
@ -666,7 +666,7 @@ pub pure fn from_str(rawurl: &str) -> Result<Url, ~str> {
}
impl FromStr for Url {
static pure fn from_str(s: &str) -> Option<Url> {
pure fn from_str(s: &str) -> Option<Url> {
match from_str(s) {
Ok(url) => Some(url),
Err(_) => None

View file

@ -118,10 +118,10 @@ pub impl <T:Ord> PriorityQueue<T> {
}
/// Create an empty PriorityQueue
static pure fn new() -> PriorityQueue<T> { PriorityQueue{data: ~[],} }
pure fn new() -> PriorityQueue<T> { PriorityQueue{data: ~[],} }
/// Create a PriorityQueue from a vector (heapify)
static pure fn from_vec(xs: ~[T]) -> PriorityQueue<T> {
pure fn from_vec(xs: ~[T]) -> PriorityQueue<T> {
let mut q = PriorityQueue{data: xs,};
let mut n = q.len() / 2;
while n > 0 {

View file

@ -110,7 +110,7 @@ pub trait Encodable<S:Encoder> {
}
pub trait Decodable<D:Decoder> {
static fn decode(&self, d: &D) -> Self;
fn decode(d: &D) -> Self;
}
impl<S:Encoder> Encodable<S> for uint {
@ -118,7 +118,7 @@ impl<S:Encoder> Encodable<S> for uint {
}
impl<D:Decoder> Decodable<D> for uint {
static fn decode(&self, d: &D) -> uint {
fn decode(d: &D) -> uint {
d.read_uint()
}
}
@ -128,7 +128,7 @@ impl<S:Encoder> Encodable<S> for u8 {
}
impl<D:Decoder> Decodable<D> for u8 {
static fn decode(&self, d: &D) -> u8 {
fn decode(d: &D) -> u8 {
d.read_u8()
}
}
@ -138,7 +138,7 @@ impl<S:Encoder> Encodable<S> for u16 {
}
impl<D:Decoder> Decodable<D> for u16 {
static fn decode(&self, d: &D) -> u16 {
fn decode(d: &D) -> u16 {
d.read_u16()
}
}
@ -148,7 +148,7 @@ impl<S:Encoder> Encodable<S> for u32 {
}
impl<D:Decoder> Decodable<D> for u32 {
static fn decode(&self, d: &D) -> u32 {
fn decode(d: &D) -> u32 {
d.read_u32()
}
}
@ -158,7 +158,7 @@ impl<S:Encoder> Encodable<S> for u64 {
}
impl<D:Decoder> Decodable<D> for u64 {
static fn decode(&self, d: &D) -> u64 {
fn decode(d: &D) -> u64 {
d.read_u64()
}
}
@ -168,7 +168,7 @@ impl<S:Encoder> Encodable<S> for int {
}
impl<D:Decoder> Decodable<D> for int {
static fn decode(&self, d: &D) -> int {
fn decode(d: &D) -> int {
d.read_int()
}
}
@ -178,7 +178,7 @@ impl<S:Encoder> Encodable<S> for i8 {
}
impl<D:Decoder> Decodable<D> for i8 {
static fn decode(&self, d: &D) -> i8 {
fn decode(d: &D) -> i8 {
d.read_i8()
}
}
@ -188,7 +188,7 @@ impl<S:Encoder> Encodable<S> for i16 {
}
impl<D:Decoder> Decodable<D> for i16 {
static fn decode(&self, d: &D) -> i16 {
fn decode(d: &D) -> i16 {
d.read_i16()
}
}
@ -198,7 +198,7 @@ impl<S:Encoder> Encodable<S> for i32 {
}
impl<D:Decoder> Decodable<D> for i32 {
static fn decode(&self, d: &D) -> i32 {
fn decode(d: &D) -> i32 {
d.read_i32()
}
}
@ -208,7 +208,7 @@ impl<S:Encoder> Encodable<S> for i64 {
}
impl<D:Decoder> Decodable<D> for i64 {
static fn decode(&self, d: &D) -> i64 {
fn decode(d: &D) -> i64 {
d.read_i64()
}
}
@ -222,7 +222,7 @@ impl<S:Encoder> Encodable<S> for ~str {
}
impl<D:Decoder> Decodable<D> for ~str {
static fn decode(&self, d: &D) -> ~str {
fn decode(d: &D) -> ~str {
d.read_owned_str()
}
}
@ -232,7 +232,7 @@ impl<S:Encoder> Encodable<S> for @str {
}
impl<D:Decoder> Decodable<D> for @str {
static fn decode(&self, d: &D) -> @str {
fn decode(d: &D) -> @str {
d.read_managed_str()
}
}
@ -242,7 +242,7 @@ impl<S:Encoder> Encodable<S> for float {
}
impl<D:Decoder> Decodable<D> for float {
static fn decode(&self, d: &D) -> float {
fn decode(d: &D) -> float {
d.read_float()
}
}
@ -252,7 +252,7 @@ impl<S:Encoder> Encodable<S> for f32 {
}
impl<D:Decoder> Decodable<D> for f32 {
static fn decode(&self, d: &D) -> f32 {
fn decode(d: &D) -> f32 {
d.read_f32() }
}
@ -261,7 +261,7 @@ impl<S:Encoder> Encodable<S> for f64 {
}
impl<D:Decoder> Decodable<D> for f64 {
static fn decode(&self, d: &D) -> f64 {
fn decode(d: &D) -> f64 {
d.read_f64()
}
}
@ -271,7 +271,7 @@ impl<S:Encoder> Encodable<S> for bool {
}
impl<D:Decoder> Decodable<D> for bool {
static fn decode(&self, d: &D) -> bool {
fn decode(d: &D) -> bool {
d.read_bool()
}
}
@ -281,7 +281,7 @@ impl<S:Encoder> Encodable<S> for () {
}
impl<D:Decoder> Decodable<D> for () {
static fn decode(&self, d: &D) -> () {
fn decode(d: &D) -> () {
d.read_nil()
}
}
@ -299,7 +299,7 @@ impl<S:Encoder,T:Encodable<S>> Encodable<S> for ~T {
}
impl<D:Decoder,T:Decodable<D>> Decodable<D> for ~T {
static fn decode(&self, d: &D) -> ~T {
fn decode(d: &D) -> ~T {
d.read_owned(|| ~Decodable::decode(d))
}
}
@ -311,7 +311,7 @@ impl<S:Encoder,T:Encodable<S>> Encodable<S> for @T {
}
impl<D:Decoder,T:Decodable<D>> Decodable<D> for @T {
static fn decode(&self, d: &D) -> @T {
fn decode(d: &D) -> @T {
d.read_managed(|| @Decodable::decode(d))
}
}
@ -337,7 +337,7 @@ impl<S:Encoder,T:Encodable<S>> Encodable<S> for ~[T] {
}
impl<D:Decoder,T:Decodable<D>> Decodable<D> for ~[T] {
static fn decode(&self, d: &D) -> ~[T] {
fn decode(d: &D) -> ~[T] {
do d.read_owned_vec |len| {
do vec::from_fn(len) |i| {
d.read_vec_elt(i, || Decodable::decode(d))
@ -357,7 +357,7 @@ impl<S:Encoder,T:Encodable<S>> Encodable<S> for @[T] {
}
impl<D:Decoder,T:Decodable<D>> Decodable<D> for @[T] {
static fn decode(&self, d: &D) -> @[T] {
fn decode(d: &D) -> @[T] {
do d.read_managed_vec |len| {
do at_vec::from_fn(len) |i| {
d.read_vec_elt(i, || Decodable::decode(d))
@ -382,7 +382,7 @@ impl<S:Encoder,T:Encodable<S>> Encodable<S> for Option<T> {
}
impl<D:Decoder,T:Decodable<D>> Decodable<D> for Option<T> {
static fn decode(&self, d: &D) -> Option<T> {
fn decode(d: &D) -> Option<T> {
do d.read_enum(~"option") {
do d.read_enum_variant |i| {
match i {
@ -410,7 +410,7 @@ impl<S:Encoder,T0:Encodable<S>,T1:Encodable<S>> Encodable<S> for (T0, T1) {
}
impl<D:Decoder,T0:Decodable<D>,T1:Decodable<D>> Decodable<D> for (T0, T1) {
static fn decode(&self, d: &D) -> (T0, T1) {
fn decode(d: &D) -> (T0, T1) {
do d.read_tup(2) {
(
d.read_tup_elt(0, || Decodable::decode(d)),
@ -445,7 +445,7 @@ impl<
T1: Decodable<D>,
T2: Decodable<D>
> Decodable<D> for (T0, T1, T2) {
static fn decode(&self, d: &D) -> (T0, T1, T2) {
fn decode(d: &D) -> (T0, T1, T2) {
do d.read_tup(3) {
(
d.read_tup_elt(0, || Decodable::decode(d)),
@ -484,7 +484,7 @@ impl<
T2: Decodable<D>,
T3: Decodable<D>
> Decodable<D> for (T0, T1, T2, T3) {
static fn decode(&self, d: &D) -> (T0, T1, T2, T3) {
fn decode(d: &D) -> (T0, T1, T2, T3) {
do d.read_tup(4) {
(
d.read_tup_elt(0, || Decodable::decode(d)),
@ -527,7 +527,7 @@ impl<
T3: Decodable<D>,
T4: Decodable<D>
> Decodable<D> for (T0, T1, T2, T3, T4) {
static fn decode(&self, d: &D)
fn decode(d: &D)
-> (T0, T1, T2, T3, T4) {
do d.read_tup(5) {
(

View file

@ -135,7 +135,7 @@ impl<V> Map<uint, V> for SmallIntMap<V> {
pub impl<V> SmallIntMap<V> {
/// Create an empty SmallIntMap
static pure fn new() -> SmallIntMap<V> { SmallIntMap{v: ~[]} }
pure fn new() -> SmallIntMap<V> { SmallIntMap{v: ~[]} }
pure fn get(&self, key: &uint) -> &'self V {
self.find(key).expect("key not present")

View file

@ -43,9 +43,10 @@ pub impl<T> TaskPool<T> {
/// new scheduler with the given mode. The provided `init_fn_factory`
/// returns a function which, given the index of the task, should return
/// local data to be kept around in that task.
static fn new(n_tasks: uint,
fn new(n_tasks: uint,
opt_sched_mode: Option<SchedMode>,
init_fn_factory: ~fn() -> ~fn(uint) -> T) -> TaskPool<T> {
init_fn_factory: ~fn() -> ~fn(uint) -> T)
-> TaskPool<T> {
fail_unless!(n_tasks >= 1);
let channels = do vec::from_fn(n_tasks) |i| {

View file

@ -51,7 +51,7 @@ pub struct Timespec { sec: i64, nsec: i32 }
* nsec: 800_000_000_i32 }`.
*/
pub impl Timespec {
static pure fn new(sec: i64, nsec: i32) -> Timespec {
pure fn new(sec: i64, nsec: i32) -> Timespec {
fail_unless!(nsec >= 0 && nsec < NSEC_PER_SEC);
Timespec { sec: sec, nsec: nsec }
}

View file

@ -176,7 +176,7 @@ impl<K: TotalOrd, V> Map<K, V> for TreeMap<K, V> {
pub impl<K: TotalOrd, V> TreeMap<K, V> {
/// Create an empty TreeMap
static pure fn new() -> TreeMap<K, V> { TreeMap{root: None, length: 0} }
pure fn new() -> TreeMap<K, V> { TreeMap{root: None, length: 0} }
/// Visit all keys in reverse order
pure fn each_key_reverse(&self, f: &fn(&K) -> bool) {
@ -501,7 +501,7 @@ impl<T: TotalOrd> Set<T> for TreeSet<T> {
pub impl <T: TotalOrd> TreeSet<T> {
/// Create an empty TreeSet
#[inline(always)]
static pure fn new() -> TreeSet<T> { TreeSet{map: TreeMap::new()} }
pure fn new() -> TreeSet<T> { TreeSet{map: TreeMap::new()} }
/// Get a lazy iterator over the values in the set.
/// Requires that it be frozen (immutable).
@ -542,7 +542,7 @@ struct TreeNode<K, V> {
pub impl<K: TotalOrd, V> TreeNode<K, V> {
#[inline(always)]
static pure fn new(key: K, value: V) -> TreeNode<K, V> {
pure fn new(key: K, value: V) -> TreeNode<K, V> {
TreeNode{key: key, value: value, left: None, right: None, level: 1}
}
}

View file

@ -132,7 +132,7 @@ impl cmp::Ord for WorkKey {
}
pub impl WorkKey {
static fn new(kind: &str, name: &str) -> WorkKey {
fn new(kind: &str, name: &str) -> WorkKey {
WorkKey { kind: kind.to_owned(), name: name.to_owned() }
}
}
@ -151,7 +151,7 @@ impl<S:Encoder> Encodable<S> for WorkMap {
}
impl<D:Decoder> Decodable<D> for WorkMap {
static fn decode(&self, d: &D) -> WorkMap {
fn decode(d: &D) -> WorkMap {
let v : ~[(WorkKey,~str)] = Decodable::decode(d);
let mut w = LinearMap::new();
for v.each |&(k, v)| {
@ -258,7 +258,7 @@ fn digest_file(path: &Path) -> ~str {
pub impl Context {
static fn new(db: @Mut<Database>,
fn new(db: @Mut<Database>,
lg: @Mut<Logger>,
cfg: @json::Object) -> Context {
Context{db: db, logger: lg, cfg: cfg, freshness: LinearMap::new()}
@ -367,7 +367,7 @@ impl TPrep for @Mut<Prep> {
pub impl<T:Owned +
Encodable<json::Encoder> +
Decodable<json::Decoder/&static>> Work<T> { // FIXME(#5121)
static fn new(p: @Mut<Prep>, e: Either<T,PortOne<(Exec,T)>>) -> Work<T> {
fn new(p: @Mut<Prep>, e: Either<T,PortOne<(Exec,T)>>) -> Work<T> {
Work { prep: p, res: Some(e) }
}
}

View file

@ -75,7 +75,7 @@ impl<S:Encoder> Encodable<S> for ident {
}
impl<D:Decoder> Decodable<D> for ident {
static fn decode(d: &D) -> ident {
fn decode(d: &D) -> ident {
let intr = match unsafe {
task::local_data::local_data_get(interner_key!())
} {

View file

@ -30,7 +30,7 @@ use core::uint;
use std::serialize::{Encodable, Decodable, Encoder, Decoder};
pub trait Pos {
static pure fn from_uint(n: uint) -> Self;
pure fn from_uint(n: uint) -> Self;
pure fn to_uint(&self) -> uint;
}
@ -45,7 +45,7 @@ pub struct CharPos(uint);
// have been unsuccessful
impl Pos for BytePos {
static pure fn from_uint(n: uint) -> BytePos { BytePos(n) }
pure fn from_uint(n: uint) -> BytePos { BytePos(n) }
pure fn to_uint(&self) -> uint { **self }
}
@ -80,7 +80,7 @@ impl to_bytes::IterBytes for BytePos {
}
impl Pos for CharPos {
static pure fn from_uint(n: uint) -> CharPos { CharPos(n) }
pure fn from_uint(n: uint) -> CharPos { CharPos(n) }
pure fn to_uint(&self) -> uint { **self }
}
@ -144,7 +144,7 @@ impl<S:Encoder> Encodable<S> for span {
}
impl<D:Decoder> Decodable<D> for span {
static fn decode(_d: &D) -> span {
fn decode(_d: &D) -> span {
dummy_sp()
}
}
@ -286,7 +286,7 @@ pub struct CodeMap {
}
pub impl CodeMap {
static pub fn new() -> CodeMap {
pub fn new() -> CodeMap {
CodeMap {
files: @mut ~[],
}

View file

@ -32,7 +32,7 @@ impl<S:std::serialize::Encoder> Encodable<S> for Node {
}
impl<D:Decoder> Decodable for node_id {
static fn decode(d: &D) -> Node {
fn decode(d: &D) -> Node {
do d.read_struct("Node", 1) {
Node {
id: d.read_field(~"x", 0, || decode(d))
@ -66,7 +66,7 @@ would yield functions like:
D: Decoder,
T: Decodable<D>
> spanned<T>: Decodable<D> {
static fn decode(d: &D) -> spanned<T> {
fn decode(d: &D) -> spanned<T> {
do d.read_rec {
{
node: d.read_field(~"node", 0, || decode(d)),

View file

@ -439,7 +439,7 @@ pub enum MapChain<K,V> {
impl <K: Eq + Hash + IterBytes ,V: Copy> MapChain<K,V>{
// Constructor. I don't think we need a zero-arg one.
static fn new(+init: ~LinearMap<K,@V>) -> @mut MapChain<K,V> {
fn new(+init: ~LinearMap<K,@V>) -> @mut MapChain<K,V> {
@mut BaseMapChain(init)
}

View file

@ -22,14 +22,14 @@ pub struct Interner<T> {
// when traits can extend traits, we should extend index<uint,T> to get []
pub impl<T:Eq + IterBytes + Hash + Const + Copy> Interner<T> {
static fn new() -> Interner<T> {
fn new() -> Interner<T> {
Interner {
map: @mut LinearMap::new(),
vect: @mut ~[],
}
}
static fn prefill(init: &[T]) -> Interner<T> {
fn prefill(init: &[T]) -> Interner<T> {
let rv = Interner::new();
for init.each() |v| { rv.intern(*v); }
rv

View file

@ -13,7 +13,7 @@ pub struct Foo {
}
pub impl Foo {
static fn new() -> Foo {
fn new() -> Foo {
Foo { x: 3 }
}
}

View file

@ -14,17 +14,17 @@
#[crate_type = "lib"];
pub trait read {
static fn readMaybe(s: ~str) -> Option<Self>;
fn readMaybe(s: ~str) -> Option<Self>;
}
impl read for int {
static fn readMaybe(s: ~str) -> Option<int> {
fn readMaybe(s: ~str) -> Option<int> {
int::from_str(s)
}
}
impl read for bool {
static fn readMaybe(s: ~str) -> Option<bool> {
fn readMaybe(s: ~str) -> Option<bool> {
match s {
~"true" => Some(true),
~"false" => Some(false),

View file

@ -11,14 +11,14 @@
pub mod num {
pub trait Num2 {
static pure fn from_int2(n: int) -> Self;
static fn from_int2(n: int) -> Self;
}
}
pub mod float {
impl ::num::Num2 for float {
#[inline]
static pure fn from_int2(n: int) -> float { return n as float; }
static fn from_int2(n: int) -> float { return n as float; }
}
}

View file

@ -1,11 +1,11 @@
pub mod num {
pub trait Num2 {
static pure fn from_int2(n: int) -> Self;
pure fn from_int2(n: int) -> Self;
}
}
pub mod float {
impl ::num::Num2 for float {
static pure fn from_int2(n: int) -> float { return n as float; }
pure fn from_int2(n: int) -> float { return n as float; }
}
}

View file

@ -40,11 +40,11 @@ struct Sudoku {
}
pub impl Sudoku {
static pub fn new(g: grid) -> Sudoku {
pub fn new(g: grid) -> Sudoku {
return Sudoku { grid: g }
}
static pub fn from_vec(vec: &[[u8 * 9] * 9]) -> Sudoku {
pub fn from_vec(vec: &[[u8 * 9] * 9]) -> Sudoku {
let mut g = do vec::from_fn(9u) |i| {
do vec::from_fn(9u) |j| { vec[i][j] }
};
@ -62,7 +62,7 @@ pub impl Sudoku {
return true;
}
static pub fn read(reader: @io::Reader) -> Sudoku {
pub fn read(reader: @io::Reader) -> Sudoku {
fail_unless!(reader.read_line() == ~"9,9"); /* assert first line is exactly "9,9" */
let mut g = vec::from_fn(10u, { |_i| ~[0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8] });
@ -156,7 +156,7 @@ struct Colors(u16);
const heads: u16 = (1u16 << 10) - 1; /* bits 9..0 */
impl Colors {
static fn new(start_color: u8) -> Colors {
fn new(start_color: u8) -> Colors {
// Sets bits 9..start_color
let tails = !0u16 << start_color;
return Colors(heads & tails);

View file

@ -14,7 +14,7 @@ struct Obj {
}
pub impl Obj {
static pure fn boom() -> bool {
pure fn boom() -> bool {
return 1+1 == 2
}
pure fn chirp() {

View file

@ -17,7 +17,7 @@ trait BikeMethods {
}
impl BikeMethods for Bike {
static fn woops(&const self) -> ~str { ~"foo" }
fn woops(&const self) -> ~str { ~"foo" }
//~^ ERROR method `woops` is declared as static in its impl, but not in its trait
}

View file

@ -16,7 +16,7 @@ struct Point {
}
impl ToStr for Point { //~ ERROR implements a method not defined in the trait
static fn new(x: float, y: float) -> Point {
fn new(x: float, y: float) -> Point {
Point { x: x, y: y }
}

View file

@ -1,7 +1,7 @@
mod a {
pub struct S;
impl S {
static fn new() -> S { S }
fn new() -> S { S }
}
}

View file

@ -10,7 +10,7 @@
trait foo {
static fn bar();
fn bar();
}
impl foo for int {

View file

@ -13,7 +13,7 @@ struct Foo {
}
pub impl Foo {
static fn new() -> Foo {
fn new() -> Foo {
Foo { x: 3 }
}
}

View file

@ -115,7 +115,7 @@ pub impl<T> cat<T> {
}
}
static pure fn new(in_x: int, in_y: int, in_name: T) -> cat<T> {
pure fn new(in_x: int, in_y: int, in_name: T) -> cat<T> {
cat{meows: in_x, how_hungry: in_y, name: in_name }
}
}

View file

@ -130,9 +130,9 @@ mod test_methods {
impl Fooable for Foo {
#[cfg(bogus)]
static fn what(&self) { }
fn what(&self) { }
static fn what(&self) { }
fn what(&self) { }
#[cfg(bogus)]
fn the(&self) { }
@ -142,9 +142,9 @@ mod test_methods {
trait Fooable {
#[cfg(bogus)]
static fn what(&self);
fn what(&self);
static fn what(&self);
fn what(&self);
#[cfg(bogus)]
fn the(&self);

View file

@ -13,11 +13,11 @@ trait Deserializer {
}
trait Deserializable<D:Deserializer> {
static fn deserialize(&self, d: &D) -> Self;
fn deserialize(d: &D) -> Self;
}
impl<D:Deserializer> Deserializable<D> for int {
static fn deserialize(&self, d: &D) -> int {
fn deserialize(d: &D) -> int {
return d.read_int();
}
}

View file

@ -14,7 +14,7 @@
// A trait for objects that can be used to do an if-then-else
// (No actual need for this to be static, but it is a simple test.)
trait bool_like {
static fn select<A>(b: Self, +x1: A, +x2: A) -> A;
fn select<A>(b: Self, +x1: A, +x2: A) -> A;
}
fn andand<T:bool_like + Copy>(x1: T, x2: T) -> T {
@ -22,34 +22,34 @@ fn andand<T:bool_like + Copy>(x1: T, x2: T) -> T {
}
impl bool_like for bool {
static fn select<A>(&&b: bool, +x1: A, +x2: A) -> A {
fn select<A>(&&b: bool, +x1: A, +x2: A) -> A {
if b { x1 } else { x2 }
}
}
impl bool_like for int {
static fn select<A>(&&b: int, +x1: A, +x2: A) -> A {
fn select<A>(&&b: int, +x1: A, +x2: A) -> A {
if b != 0 { x1 } else { x2 }
}
}
// A trait for sequences that can be constructed imperatively.
trait buildable<A> {
static pure fn build_sized(size: uint,
pure fn build_sized(size: uint,
builder: &fn(push: &pure fn(+v: A))) -> Self;
}
impl<A> buildable<A> for @[A] {
#[inline(always)]
static pure fn build_sized(size: uint,
pure fn build_sized(size: uint,
builder: &fn(push: &pure fn(+v: A))) -> @[A] {
at_vec::build_sized(size, builder)
}
}
impl<A> buildable<A> for ~[A] {
#[inline(always)]
static pure fn build_sized(size: uint,
pure fn build_sized(size: uint,
builder: &fn(push: &pure fn(+v: A))) -> ~[A] {
vec::build_sized(size, builder)
}

View file

@ -10,17 +10,17 @@
mod a {
pub trait Foo {
static pub fn foo() -> Self;
pub fn foo() -> Self;
}
impl Foo for int {
static pub fn foo() -> int {
pub fn foo() -> int {
3
}
}
impl Foo for uint {
static pub fn foo() -> uint {
pub fn foo() -> uint {
5u
}
}

View file

@ -1,9 +1,9 @@
pub trait Number: NumConv {
static pure fn from<T:Number>(n: T) -> Self;
pure fn from<T:Number>(n: T) -> Self;
}
impl Number for float {
static pure fn from<T:Number>(n: T) -> float { n.to_float() }
pure fn from<T:Number>(n: T) -> float { n.to_float() }
}
pub trait NumConv {

View file

@ -15,7 +15,7 @@
use core::num::NumCast::from;
trait Num {
static fn from_int(i: int) -> Self;
fn from_int(i: int) -> Self;
fn gt(&self, other: &Self) -> bool;
}

View file

@ -9,7 +9,7 @@
// except according to those terms.
trait MyNum {
static fn from_int(int) -> Self;
fn from_int(int) -> Self;
}
pub trait NumExt: MyNum { }
@ -17,7 +17,7 @@ pub trait NumExt: MyNum { }
struct S { v: int }
impl MyNum for S {
static fn from_int(i: int) -> S {
fn from_int(i: int) -> S {
S {
v: i
}

View file

@ -11,7 +11,7 @@
trait MyEq { }
trait MyNum {
static fn from_int(int) -> Self;
fn from_int(int) -> Self;
}
pub trait NumExt: MyEq + MyNum { }
@ -21,7 +21,7 @@ struct S { v: int }
impl MyEq for S { }
impl MyNum for S {
static fn from_int(i: int) -> S {
fn from_int(i: int) -> S {
S {
v: i
}

View file

@ -12,7 +12,7 @@
mod base {
pub trait HasNew<T> {
static pure fn new() -> T;
pure fn new() -> T;
}
pub struct Foo {
@ -20,7 +20,7 @@ mod base {
}
impl ::base::HasNew<Foo> for Foo {
static pure fn new() -> Foo {
pure fn new() -> Foo {
unsafe { io::println("Foo"); }
Foo { dummy: () }
}
@ -31,7 +31,7 @@ mod base {
}
impl ::base::HasNew<Bar> for Bar {
static pure fn new() -> Bar {
pure fn new() -> Bar {
unsafe { io::println("Bar"); }
Bar { dummy: () }
}

View file

@ -12,13 +12,13 @@
// methods!
trait Equal {
static fn isEq(a: Self, b: Self) -> bool;
fn isEq(a: Self, b: Self) -> bool;
}
enum Color { cyan, magenta, yellow, black }
impl Equal for Color {
static fn isEq(a: Color, b: Color) -> bool {
fn isEq(a: Color, b: Color) -> bool {
match (a, b) {
(cyan, cyan) => { true }
(magenta, magenta) => { true }
@ -35,7 +35,7 @@ enum ColorTree {
}
impl Equal for ColorTree {
static fn isEq(a: ColorTree, b: ColorTree) -> bool {
fn isEq(a: ColorTree, b: ColorTree) -> bool {
match (a, b) {
(leaf(x), leaf(y)) => { Equal::isEq(x, y) }
(branch(l1, r1), branch(l2, r2)) => {