allow fn exprs to omit arg types

also, avoid using type variables for fn args with omitted types
unless necessary.  This will be important for bound regions in
fn types.

fixes #2093
This commit is contained in:
Niko Matsakis
2012-05-03 09:09:55 -07:00
parent 6e5c8a7fb8
commit 1ba4ca4c4a
10 changed files with 178 additions and 103 deletions

View File

@@ -1096,6 +1096,14 @@ impl extensions<T> for [T] {
#[inline]
fn map<U>(f: fn(T) -> U) -> [U] { map(self, f) }
#[doc = "
Apply a function to the index and value of each element in the vector
and return the results
"]
fn mapi<U>(f: fn(uint, T) -> U) -> [U] {
let mut i = 0u;
self.map { |e| i += 1u; f(i - 1u, e) }
}
#[doc = "
Apply a function to each element of a vector and return a concatenation
of each result vector
"]