de-mode-ify infer and some parts of typeck

also, fix bug in the various lint passes that fn() was considered
not suitable for the default mode
This commit is contained in:
Niko Matsakis
2012-08-08 12:58:22 -07:00
parent fe8c8ad582
commit 1b2d91c79d
6 changed files with 164 additions and 137 deletions

View File

@@ -17,6 +17,7 @@ export capacity;
export len;
export from_fn;
export from_elem;
export from_slice;
export build, build_sized;
export to_mut;
export from_mut;
@@ -211,6 +212,11 @@ pure fn from_elem<T: copy>(n_elts: uint, t: T) -> ~[T] {
return v;
}
/// Creates a new unique vector with the same contents as the slice
pure fn from_slice<T: copy>(t: &[T]) -> ~[T] {
from_fn(t.len(), |i| t[i])
}
/**
* Builds a vector by calling a provided function with an argument
* function that pushes an element to the back of a vector.