mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
remove all kind annotations from closures
This commit is contained in:
parent
ba2f13ef06
commit
571cc7f8e9
@ -359,7 +359,7 @@ pub fn make_metrics_test_closure(config: &Config, testfile: &Path) -> test::Test
|
|||||||
let config = (*config).clone();
|
let config = (*config).clone();
|
||||||
// FIXME (#9639): This needs to handle non-utf8 paths
|
// FIXME (#9639): This needs to handle non-utf8 paths
|
||||||
let testfile = testfile.as_str().unwrap().to_string();
|
let testfile = testfile.as_str().unwrap().to_string();
|
||||||
test::DynMetricFn(box move |: mm: &mut test::MetricMap| {
|
test::DynMetricFn(box move |mm: &mut test::MetricMap| {
|
||||||
runtest::run_metrics(config, testfile, mm)
|
runtest::run_metrics(config, testfile, mm)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ impl<'a> Iterator for Decompositions<'a> {
|
|||||||
let buffer = &mut self.buffer;
|
let buffer = &mut self.buffer;
|
||||||
let sorted = &mut self.sorted;
|
let sorted = &mut self.sorted;
|
||||||
{
|
{
|
||||||
let callback = |&mut: d| {
|
let callback = |d| {
|
||||||
let class =
|
let class =
|
||||||
unicode::char::canonical_combining_class(d);
|
unicode::char::canonical_combining_class(d);
|
||||||
if class == 0 && !*sorted {
|
if class == 0 && !*sorted {
|
||||||
@ -592,7 +592,7 @@ pub trait StrExt: Index<RangeFull, Output = str> {
|
|||||||
/// let v: Vec<&str> = "Mary had a little lamb".split(' ').collect();
|
/// let v: Vec<&str> = "Mary had a little lamb".split(' ').collect();
|
||||||
/// assert_eq!(v, vec!["Mary", "had", "a", "little", "lamb"]);
|
/// assert_eq!(v, vec!["Mary", "had", "a", "little", "lamb"]);
|
||||||
///
|
///
|
||||||
/// let v: Vec<&str> = "abc1def2ghi".split(|&: c: char| c.is_numeric()).collect();
|
/// let v: Vec<&str> = "abc1def2ghi".split(|c: char| c.is_numeric()).collect();
|
||||||
/// assert_eq!(v, vec!["abc", "def", "ghi"]);
|
/// assert_eq!(v, vec!["abc", "def", "ghi"]);
|
||||||
///
|
///
|
||||||
/// let v: Vec<&str> = "lionXXtigerXleopard".split('X').collect();
|
/// let v: Vec<&str> = "lionXXtigerXleopard".split('X').collect();
|
||||||
@ -616,7 +616,7 @@ pub trait StrExt: Index<RangeFull, Output = str> {
|
|||||||
/// let v: Vec<&str> = "Mary had a little lambda".splitn(2, ' ').collect();
|
/// let v: Vec<&str> = "Mary had a little lambda".splitn(2, ' ').collect();
|
||||||
/// assert_eq!(v, vec!["Mary", "had", "a little lambda"]);
|
/// assert_eq!(v, vec!["Mary", "had", "a little lambda"]);
|
||||||
///
|
///
|
||||||
/// let v: Vec<&str> = "abc1def2ghi".splitn(1, |&: c: char| c.is_numeric()).collect();
|
/// let v: Vec<&str> = "abc1def2ghi".splitn(1, |c: char| c.is_numeric()).collect();
|
||||||
/// assert_eq!(v, vec!["abc", "def2ghi"]);
|
/// assert_eq!(v, vec!["abc", "def2ghi"]);
|
||||||
///
|
///
|
||||||
/// let v: Vec<&str> = "lionXXtigerXleopard".splitn(2, 'X').collect();
|
/// let v: Vec<&str> = "lionXXtigerXleopard".splitn(2, 'X').collect();
|
||||||
@ -651,7 +651,7 @@ pub trait StrExt: Index<RangeFull, Output = str> {
|
|||||||
/// let v: Vec<&str> = "Mary had a little lamb".split(' ').rev().collect();
|
/// let v: Vec<&str> = "Mary had a little lamb".split(' ').rev().collect();
|
||||||
/// assert_eq!(v, vec!["lamb", "little", "a", "had", "Mary"]);
|
/// assert_eq!(v, vec!["lamb", "little", "a", "had", "Mary"]);
|
||||||
///
|
///
|
||||||
/// let v: Vec<&str> = "abc1def2ghi".split(|&: c: char| c.is_numeric()).rev().collect();
|
/// let v: Vec<&str> = "abc1def2ghi".split(|c: char| c.is_numeric()).rev().collect();
|
||||||
/// assert_eq!(v, vec!["ghi", "def", "abc"]);
|
/// assert_eq!(v, vec!["ghi", "def", "abc"]);
|
||||||
///
|
///
|
||||||
/// let v: Vec<&str> = "lionXXtigerXleopard".split('X').rev().collect();
|
/// let v: Vec<&str> = "lionXXtigerXleopard".split('X').rev().collect();
|
||||||
@ -672,7 +672,7 @@ pub trait StrExt: Index<RangeFull, Output = str> {
|
|||||||
/// let v: Vec<&str> = "Mary had a little lamb".rsplitn(2, ' ').collect();
|
/// let v: Vec<&str> = "Mary had a little lamb".rsplitn(2, ' ').collect();
|
||||||
/// assert_eq!(v, vec!["lamb", "little", "Mary had a"]);
|
/// assert_eq!(v, vec!["lamb", "little", "Mary had a"]);
|
||||||
///
|
///
|
||||||
/// let v: Vec<&str> = "abc1def2ghi".rsplitn(1, |&: c: char| c.is_numeric()).collect();
|
/// let v: Vec<&str> = "abc1def2ghi".rsplitn(1, |c: char| c.is_numeric()).collect();
|
||||||
/// assert_eq!(v, vec!["ghi", "abc1def"]);
|
/// assert_eq!(v, vec!["ghi", "abc1def"]);
|
||||||
///
|
///
|
||||||
/// let v: Vec<&str> = "lionXXtigerXleopard".rsplitn(2, 'X').collect();
|
/// let v: Vec<&str> = "lionXXtigerXleopard".rsplitn(2, 'X').collect();
|
||||||
@ -853,7 +853,7 @@ pub trait StrExt: Index<RangeFull, Output = str> {
|
|||||||
/// assert_eq!("11foo1bar11".trim_matches('1'), "foo1bar");
|
/// assert_eq!("11foo1bar11".trim_matches('1'), "foo1bar");
|
||||||
/// let x: &[_] = &['1', '2'];
|
/// let x: &[_] = &['1', '2'];
|
||||||
/// assert_eq!("12foo1bar12".trim_matches(x), "foo1bar");
|
/// assert_eq!("12foo1bar12".trim_matches(x), "foo1bar");
|
||||||
/// assert_eq!("123foo1bar123".trim_matches(|&: c: char| c.is_numeric()), "foo1bar");
|
/// assert_eq!("123foo1bar123".trim_matches(|c: char| c.is_numeric()), "foo1bar");
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
fn trim_matches<P: CharEq>(&self, pat: P) -> &str {
|
fn trim_matches<P: CharEq>(&self, pat: P) -> &str {
|
||||||
@ -873,7 +873,7 @@ pub trait StrExt: Index<RangeFull, Output = str> {
|
|||||||
/// assert_eq!("11foo1bar11".trim_left_matches('1'), "foo1bar11");
|
/// assert_eq!("11foo1bar11".trim_left_matches('1'), "foo1bar11");
|
||||||
/// let x: &[_] = &['1', '2'];
|
/// let x: &[_] = &['1', '2'];
|
||||||
/// assert_eq!("12foo1bar12".trim_left_matches(x), "foo1bar12");
|
/// assert_eq!("12foo1bar12".trim_left_matches(x), "foo1bar12");
|
||||||
/// assert_eq!("123foo1bar123".trim_left_matches(|&: c: char| c.is_numeric()), "foo1bar123");
|
/// assert_eq!("123foo1bar123".trim_left_matches(|c: char| c.is_numeric()), "foo1bar123");
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
fn trim_left_matches<P: CharEq>(&self, pat: P) -> &str {
|
fn trim_left_matches<P: CharEq>(&self, pat: P) -> &str {
|
||||||
@ -893,7 +893,7 @@ pub trait StrExt: Index<RangeFull, Output = str> {
|
|||||||
/// assert_eq!("11foo1bar11".trim_right_matches('1'), "11foo1bar");
|
/// assert_eq!("11foo1bar11".trim_right_matches('1'), "11foo1bar");
|
||||||
/// let x: &[_] = &['1', '2'];
|
/// let x: &[_] = &['1', '2'];
|
||||||
/// assert_eq!("12foo1bar12".trim_right_matches(x), "12foo1bar");
|
/// assert_eq!("12foo1bar12".trim_right_matches(x), "12foo1bar");
|
||||||
/// assert_eq!("123foo1bar123".trim_right_matches(|&: c: char| c.is_numeric()), "123foo1bar");
|
/// assert_eq!("123foo1bar123".trim_right_matches(|c: char| c.is_numeric()), "123foo1bar");
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
fn trim_right_matches<P: CharEq>(&self, pat: P) -> &str {
|
fn trim_right_matches<P: CharEq>(&self, pat: P) -> &str {
|
||||||
@ -1066,7 +1066,7 @@ pub trait StrExt: Index<RangeFull, Output = str> {
|
|||||||
/// assert_eq!(s.find('é'), Some(14));
|
/// assert_eq!(s.find('é'), Some(14));
|
||||||
///
|
///
|
||||||
/// // the first space
|
/// // the first space
|
||||||
/// assert_eq!(s.find(|&: c: char| c.is_whitespace()), Some(5));
|
/// assert_eq!(s.find(|c: char| c.is_whitespace()), Some(5));
|
||||||
///
|
///
|
||||||
/// // neither are found
|
/// // neither are found
|
||||||
/// let x: &[_] = &['1', '2'];
|
/// let x: &[_] = &['1', '2'];
|
||||||
@ -1094,7 +1094,7 @@ pub trait StrExt: Index<RangeFull, Output = str> {
|
|||||||
/// assert_eq!(s.rfind('é'), Some(14));
|
/// assert_eq!(s.rfind('é'), Some(14));
|
||||||
///
|
///
|
||||||
/// // the second space
|
/// // the second space
|
||||||
/// assert_eq!(s.rfind(|&: c: char| c.is_whitespace()), Some(12));
|
/// assert_eq!(s.rfind(|c: char| c.is_whitespace()), Some(12));
|
||||||
///
|
///
|
||||||
/// // searches for an occurrence of either `1` or `2`, but neither are found
|
/// // searches for an occurrence of either `1` or `2`, but neither are found
|
||||||
/// let x: &[_] = &['1', '2'];
|
/// let x: &[_] = &['1', '2'];
|
||||||
@ -1387,21 +1387,21 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_find() {
|
fn test_find() {
|
||||||
assert_eq!("hello".find('l'), Some(2u));
|
assert_eq!("hello".find('l'), Some(2u));
|
||||||
assert_eq!("hello".find(|&: c:char| c == 'o'), Some(4u));
|
assert_eq!("hello".find(|c:char| c == 'o'), Some(4u));
|
||||||
assert!("hello".find('x').is_none());
|
assert!("hello".find('x').is_none());
|
||||||
assert!("hello".find(|&: c:char| c == 'x').is_none());
|
assert!("hello".find(|c:char| c == 'x').is_none());
|
||||||
assert_eq!("ประเทศไทย中华Việt Nam".find('华'), Some(30u));
|
assert_eq!("ประเทศไทย中华Việt Nam".find('华'), Some(30u));
|
||||||
assert_eq!("ประเทศไทย中华Việt Nam".find(|&: c: char| c == '华'), Some(30u));
|
assert_eq!("ประเทศไทย中华Việt Nam".find(|c: char| c == '华'), Some(30u));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_rfind() {
|
fn test_rfind() {
|
||||||
assert_eq!("hello".rfind('l'), Some(3u));
|
assert_eq!("hello".rfind('l'), Some(3u));
|
||||||
assert_eq!("hello".rfind(|&: c:char| c == 'o'), Some(4u));
|
assert_eq!("hello".rfind(|c:char| c == 'o'), Some(4u));
|
||||||
assert!("hello".rfind('x').is_none());
|
assert!("hello".rfind('x').is_none());
|
||||||
assert!("hello".rfind(|&: c:char| c == 'x').is_none());
|
assert!("hello".rfind(|c:char| c == 'x').is_none());
|
||||||
assert_eq!("ประเทศไทย中华Việt Nam".rfind('华'), Some(30u));
|
assert_eq!("ประเทศไทย中华Việt Nam".rfind('华'), Some(30u));
|
||||||
assert_eq!("ประเทศไทย中华Việt Nam".rfind(|&: c: char| c == '华'), Some(30u));
|
assert_eq!("ประเทศไทย中华Việt Nam".rfind(|c: char| c == '华'), Some(30u));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1723,7 +1723,7 @@ mod tests {
|
|||||||
assert_eq!("11foo1bar11".trim_left_matches('1'), "foo1bar11");
|
assert_eq!("11foo1bar11".trim_left_matches('1'), "foo1bar11");
|
||||||
let chars: &[char] = &['1', '2'];
|
let chars: &[char] = &['1', '2'];
|
||||||
assert_eq!("12foo1bar12".trim_left_matches(chars), "foo1bar12");
|
assert_eq!("12foo1bar12".trim_left_matches(chars), "foo1bar12");
|
||||||
assert_eq!("123foo1bar123".trim_left_matches(|&: c: char| c.is_numeric()), "foo1bar123");
|
assert_eq!("123foo1bar123".trim_left_matches(|c: char| c.is_numeric()), "foo1bar123");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1738,7 +1738,7 @@ mod tests {
|
|||||||
assert_eq!("11foo1bar11".trim_right_matches('1'), "11foo1bar");
|
assert_eq!("11foo1bar11".trim_right_matches('1'), "11foo1bar");
|
||||||
let chars: &[char] = &['1', '2'];
|
let chars: &[char] = &['1', '2'];
|
||||||
assert_eq!("12foo1bar12".trim_right_matches(chars), "12foo1bar");
|
assert_eq!("12foo1bar12".trim_right_matches(chars), "12foo1bar");
|
||||||
assert_eq!("123foo1bar123".trim_right_matches(|&: c: char| c.is_numeric()), "123foo1bar");
|
assert_eq!("123foo1bar123".trim_right_matches(|c: char| c.is_numeric()), "123foo1bar");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1753,7 +1753,7 @@ mod tests {
|
|||||||
assert_eq!("11foo1bar11".trim_matches('1'), "foo1bar");
|
assert_eq!("11foo1bar11".trim_matches('1'), "foo1bar");
|
||||||
let chars: &[char] = &['1', '2'];
|
let chars: &[char] = &['1', '2'];
|
||||||
assert_eq!("12foo1bar12".trim_matches(chars), "foo1bar");
|
assert_eq!("12foo1bar12".trim_matches(chars), "foo1bar");
|
||||||
assert_eq!("123foo1bar123".trim_matches(|&: c: char| c.is_numeric()), "foo1bar");
|
assert_eq!("123foo1bar123".trim_matches(|c: char| c.is_numeric()), "foo1bar");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -2222,14 +2222,14 @@ mod tests {
|
|||||||
let split: Vec<&str> = data.splitn(3, ' ').collect();
|
let split: Vec<&str> = data.splitn(3, ' ').collect();
|
||||||
assert_eq!(split, vec!["\nMäry", "häd", "ä", "little lämb\nLittle lämb\n"]);
|
assert_eq!(split, vec!["\nMäry", "häd", "ä", "little lämb\nLittle lämb\n"]);
|
||||||
|
|
||||||
let split: Vec<&str> = data.splitn(3, |&: c: char| c == ' ').collect();
|
let split: Vec<&str> = data.splitn(3, |c: char| c == ' ').collect();
|
||||||
assert_eq!(split, vec!["\nMäry", "häd", "ä", "little lämb\nLittle lämb\n"]);
|
assert_eq!(split, vec!["\nMäry", "häd", "ä", "little lämb\nLittle lämb\n"]);
|
||||||
|
|
||||||
// Unicode
|
// Unicode
|
||||||
let split: Vec<&str> = data.splitn(3, 'ä').collect();
|
let split: Vec<&str> = data.splitn(3, 'ä').collect();
|
||||||
assert_eq!(split, vec!["\nM", "ry h", "d ", " little lämb\nLittle lämb\n"]);
|
assert_eq!(split, vec!["\nM", "ry h", "d ", " little lämb\nLittle lämb\n"]);
|
||||||
|
|
||||||
let split: Vec<&str> = data.splitn(3, |&: c: char| c == 'ä').collect();
|
let split: Vec<&str> = data.splitn(3, |c: char| c == 'ä').collect();
|
||||||
assert_eq!(split, vec!["\nM", "ry h", "d ", " little lämb\nLittle lämb\n"]);
|
assert_eq!(split, vec!["\nM", "ry h", "d ", " little lämb\nLittle lämb\n"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2940,7 +2940,7 @@ mod bench {
|
|||||||
let s = "Mary had a little lamb, Little lamb, little-lamb.";
|
let s = "Mary had a little lamb, Little lamb, little-lamb.";
|
||||||
let len = s.split(' ').count();
|
let len = s.split(' ').count();
|
||||||
|
|
||||||
b.iter(|| assert_eq!(s.split(|&: c: char| c == ' ').count(), len));
|
b.iter(|| assert_eq!(s.split(|c: char| c == ' ').count(), len));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
//!
|
//!
|
||||||
//! use std::finally::Finally;
|
//! use std::finally::Finally;
|
||||||
//!
|
//!
|
||||||
//! (|&mut:| {
|
//! (|| {
|
||||||
//! // ...
|
//! // ...
|
||||||
//! }).finally(|| {
|
//! }).finally(|| {
|
||||||
//! // this code is always run
|
//! // this code is always run
|
||||||
|
@ -225,10 +225,10 @@ pub fn float_to_str_bytes_common<T: Float, U, F>(
|
|||||||
// cut off the one extra digit, and depending on its value
|
// cut off the one extra digit, and depending on its value
|
||||||
// round the remaining ones.
|
// round the remaining ones.
|
||||||
if limit_digits && dig == digit_count {
|
if limit_digits && dig == digit_count {
|
||||||
let ascii2value = |&: chr: u8| {
|
let ascii2value = |chr: u8| {
|
||||||
(chr as char).to_digit(radix).unwrap()
|
(chr as char).to_digit(radix).unwrap()
|
||||||
};
|
};
|
||||||
let value2ascii = |&: val: uint| {
|
let value2ascii = |val: uint| {
|
||||||
char::from_digit(val, radix).unwrap() as u8
|
char::from_digit(val, radix).unwrap() as u8
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -483,7 +483,7 @@ impl<'a> Formatter<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Writes the sign if it exists, and then the prefix if it was requested
|
// Writes the sign if it exists, and then the prefix if it was requested
|
||||||
let write_prefix = |&: f: &mut Formatter| {
|
let write_prefix = |f: &mut Formatter| {
|
||||||
if let Some(c) = sign {
|
if let Some(c) = sign {
|
||||||
let mut b = [0; 4];
|
let mut b = [0; 4];
|
||||||
let n = c.encode_utf8(&mut b).unwrap_or(0);
|
let n = c.encode_utf8(&mut b).unwrap_or(0);
|
||||||
|
@ -1518,11 +1518,11 @@ impl StrExt for str {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn trim_matches<P: CharEq>(&self, mut pat: P) -> &str {
|
fn trim_matches<P: CharEq>(&self, mut pat: P) -> &str {
|
||||||
let cur = match self.find(|&mut: c: char| !pat.matches(c)) {
|
let cur = match self.find(|c: char| !pat.matches(c)) {
|
||||||
None => "",
|
None => "",
|
||||||
Some(i) => unsafe { self.slice_unchecked(i, self.len()) }
|
Some(i) => unsafe { self.slice_unchecked(i, self.len()) }
|
||||||
};
|
};
|
||||||
match cur.rfind(|&mut: c: char| !pat.matches(c)) {
|
match cur.rfind(|c: char| !pat.matches(c)) {
|
||||||
None => "",
|
None => "",
|
||||||
Some(i) => {
|
Some(i) => {
|
||||||
let right = cur.char_range_at(i).next;
|
let right = cur.char_range_at(i).next;
|
||||||
@ -1533,7 +1533,7 @@ impl StrExt for str {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn trim_left_matches<P: CharEq>(&self, mut pat: P) -> &str {
|
fn trim_left_matches<P: CharEq>(&self, mut pat: P) -> &str {
|
||||||
match self.find(|&mut: c: char| !pat.matches(c)) {
|
match self.find(|c: char| !pat.matches(c)) {
|
||||||
None => "",
|
None => "",
|
||||||
Some(first) => unsafe { self.slice_unchecked(first, self.len()) }
|
Some(first) => unsafe { self.slice_unchecked(first, self.len()) }
|
||||||
}
|
}
|
||||||
@ -1541,7 +1541,7 @@ impl StrExt for str {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn trim_right_matches<P: CharEq>(&self, mut pat: P) -> &str {
|
fn trim_right_matches<P: CharEq>(&self, mut pat: P) -> &str {
|
||||||
match self.rfind(|&mut: c: char| !pat.matches(c)) {
|
match self.rfind(|c: char| !pat.matches(c)) {
|
||||||
None => "",
|
None => "",
|
||||||
Some(last) => {
|
Some(last) => {
|
||||||
let next = self.char_range_at(last).next;
|
let next = self.char_range_at(last).next;
|
||||||
|
@ -47,8 +47,9 @@ fn test_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_retval() {
|
fn test_retval() {
|
||||||
let mut closure = |&mut:| 10;
|
let mut closure = || 10;
|
||||||
let i = closure.finally(|| { });
|
// FIXME(#16640) `: i32` annotation shouldn't be necessary
|
||||||
|
let i: i32 = closure.finally(|| { });
|
||||||
assert_eq!(i, 10);
|
assert_eq!(i, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ fn test_rsplitn_char_iterator() {
|
|||||||
split.reverse();
|
split.reverse();
|
||||||
assert_eq!(split, vec!["\nMäry häd ä", "little", "lämb\nLittle", "lämb\n"]);
|
assert_eq!(split, vec!["\nMäry häd ä", "little", "lämb\nLittle", "lämb\n"]);
|
||||||
|
|
||||||
let mut split: Vec<&str> = data.rsplitn(3, |&: c: char| c == ' ').collect();
|
let mut split: Vec<&str> = data.rsplitn(3, |c: char| c == ' ').collect();
|
||||||
split.reverse();
|
split.reverse();
|
||||||
assert_eq!(split, vec!["\nMäry häd ä", "little", "lämb\nLittle", "lämb\n"]);
|
assert_eq!(split, vec!["\nMäry häd ä", "little", "lämb\nLittle", "lämb\n"]);
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ fn test_rsplitn_char_iterator() {
|
|||||||
split.reverse();
|
split.reverse();
|
||||||
assert_eq!(split, vec!["\nMäry häd ", " little l", "mb\nLittle l", "mb\n"]);
|
assert_eq!(split, vec!["\nMäry häd ", " little l", "mb\nLittle l", "mb\n"]);
|
||||||
|
|
||||||
let mut split: Vec<&str> = data.rsplitn(3, |&: c: char| c == 'ä').collect();
|
let mut split: Vec<&str> = data.rsplitn(3, |c: char| c == 'ä').collect();
|
||||||
split.reverse();
|
split.reverse();
|
||||||
assert_eq!(split, vec!["\nMäry häd ", " little l", "mb\nLittle l", "mb\n"]);
|
assert_eq!(split, vec!["\nMäry häd ", " little l", "mb\nLittle l", "mb\n"]);
|
||||||
}
|
}
|
||||||
@ -79,10 +79,10 @@ fn test_split_char_iterator() {
|
|||||||
rsplit.reverse();
|
rsplit.reverse();
|
||||||
assert_eq!(rsplit, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]);
|
assert_eq!(rsplit, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]);
|
||||||
|
|
||||||
let split: Vec<&str> = data.split(|&: c: char| c == ' ').collect();
|
let split: Vec<&str> = data.split(|c: char| c == ' ').collect();
|
||||||
assert_eq!( split, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]);
|
assert_eq!( split, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]);
|
||||||
|
|
||||||
let mut rsplit: Vec<&str> = data.split(|&: c: char| c == ' ').rev().collect();
|
let mut rsplit: Vec<&str> = data.split(|c: char| c == ' ').rev().collect();
|
||||||
rsplit.reverse();
|
rsplit.reverse();
|
||||||
assert_eq!(rsplit, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]);
|
assert_eq!(rsplit, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]);
|
||||||
|
|
||||||
@ -94,10 +94,10 @@ fn test_split_char_iterator() {
|
|||||||
rsplit.reverse();
|
rsplit.reverse();
|
||||||
assert_eq!(rsplit, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]);
|
assert_eq!(rsplit, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]);
|
||||||
|
|
||||||
let split: Vec<&str> = data.split(|&: c: char| c == 'ä').collect();
|
let split: Vec<&str> = data.split(|c: char| c == 'ä').collect();
|
||||||
assert_eq!( split, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]);
|
assert_eq!( split, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]);
|
||||||
|
|
||||||
let mut rsplit: Vec<&str> = data.split(|&: c: char| c == 'ä').rev().collect();
|
let mut rsplit: Vec<&str> = data.split(|c: char| c == 'ä').rev().collect();
|
||||||
rsplit.reverse();
|
rsplit.reverse();
|
||||||
assert_eq!(rsplit, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]);
|
assert_eq!(rsplit, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]);
|
||||||
}
|
}
|
||||||
|
@ -889,7 +889,7 @@ fn each_split_within<F>(ss: &str, lim: uint, mut it: F) -> bool where
|
|||||||
lim = fake_i;
|
lim = fake_i;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut machine = |&mut: cont: &mut bool, (i, c): (uint, char)| -> bool {
|
let mut machine = |cont: &mut bool, (i, c): (uint, char)| -> bool {
|
||||||
let whitespace = if c.is_whitespace() { Ws } else { Cr };
|
let whitespace = if c.is_whitespace() { Ws } else { Cr };
|
||||||
let limit = if (i - slice_start + 1) <= lim { UnderLim } else { OverLim };
|
let limit = if (i - slice_start + 1) <= lim { UnderLim } else { OverLim };
|
||||||
|
|
||||||
|
@ -428,7 +428,7 @@ fn init() {
|
|||||||
DIRECTIVES = mem::transmute(box directives);
|
DIRECTIVES = mem::transmute(box directives);
|
||||||
|
|
||||||
// Schedule the cleanup for the globals for when the runtime exits.
|
// Schedule the cleanup for the globals for when the runtime exits.
|
||||||
rt::at_exit(move |:| {
|
rt::at_exit(move || {
|
||||||
assert!(!DIRECTIVES.is_null());
|
assert!(!DIRECTIVES.is_null());
|
||||||
let _directives: Box<Vec<directive::LogDirective>> =
|
let _directives: Box<Vec<directive::LogDirective>> =
|
||||||
mem::transmute(DIRECTIVES);
|
mem::transmute(DIRECTIVES);
|
||||||
|
@ -949,7 +949,7 @@ impl NonSnakeCase {
|
|||||||
fn to_snake_case(mut str: &str) -> String {
|
fn to_snake_case(mut str: &str) -> String {
|
||||||
let mut words = vec![];
|
let mut words = vec![];
|
||||||
// Preserve leading underscores
|
// Preserve leading underscores
|
||||||
str = str.trim_left_matches(|&mut: c: char| {
|
str = str.trim_left_matches(|c: char| {
|
||||||
if c == '_' {
|
if c == '_' {
|
||||||
words.push(String::new());
|
words.push(String::new());
|
||||||
true
|
true
|
||||||
|
@ -72,7 +72,7 @@ struct CrateInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option<Span>) {
|
pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option<Span>) {
|
||||||
let err = |&: s: &str| {
|
let err = |s: &str| {
|
||||||
match (sp, sess) {
|
match (sp, sess) {
|
||||||
(_, None) => panic!("{}", s),
|
(_, None) => panic!("{}", s),
|
||||||
(Some(sp), Some(sess)) => sess.span_err(sp, s),
|
(Some(sp), Some(sess)) => sess.span_err(sp, s),
|
||||||
|
@ -59,7 +59,7 @@ pub fn each_child_of_item<F>(cstore: &cstore::CStore,
|
|||||||
F: FnMut(decoder::DefLike, ast::Name, ast::Visibility),
|
F: FnMut(decoder::DefLike, ast::Name, ast::Visibility),
|
||||||
{
|
{
|
||||||
let crate_data = cstore.get_crate_data(def_id.krate);
|
let crate_data = cstore.get_crate_data(def_id.krate);
|
||||||
let get_crate_data = |&mut: cnum| {
|
let get_crate_data = |cnum| {
|
||||||
cstore.get_crate_data(cnum)
|
cstore.get_crate_data(cnum)
|
||||||
};
|
};
|
||||||
decoder::each_child_of_item(cstore.intr.clone(),
|
decoder::each_child_of_item(cstore.intr.clone(),
|
||||||
@ -76,7 +76,7 @@ pub fn each_top_level_item_of_crate<F>(cstore: &cstore::CStore,
|
|||||||
F: FnMut(decoder::DefLike, ast::Name, ast::Visibility),
|
F: FnMut(decoder::DefLike, ast::Name, ast::Visibility),
|
||||||
{
|
{
|
||||||
let crate_data = cstore.get_crate_data(cnum);
|
let crate_data = cstore.get_crate_data(cnum);
|
||||||
let get_crate_data = |&mut: cnum| {
|
let get_crate_data = |cnum| {
|
||||||
cstore.get_crate_data(cnum)
|
cstore.get_crate_data(cnum)
|
||||||
};
|
};
|
||||||
decoder::each_top_level_item_of_crate(cstore.intr.clone(),
|
decoder::each_top_level_item_of_crate(cstore.intr.clone(),
|
||||||
|
@ -1409,7 +1409,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
|
|||||||
encode_parent_sort(rbml_w, 't');
|
encode_parent_sort(rbml_w, 't');
|
||||||
|
|
||||||
let trait_item = &ms[i];
|
let trait_item = &ms[i];
|
||||||
let encode_trait_item = |&: rbml_w: &mut Encoder| {
|
let encode_trait_item = |rbml_w: &mut Encoder| {
|
||||||
// If this is a static method, we've already
|
// If this is a static method, we've already
|
||||||
// encoded this.
|
// encoded this.
|
||||||
if is_nonstatic_method {
|
if is_nonstatic_method {
|
||||||
|
@ -138,7 +138,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &ast::Expr) {
|
|||||||
ast::ExprBlock(ref block) => {
|
ast::ExprBlock(ref block) => {
|
||||||
// Check all statements in the block
|
// Check all statements in the block
|
||||||
for stmt in &block.stmts {
|
for stmt in &block.stmts {
|
||||||
let block_span_err = |&: span|
|
let block_span_err = |span|
|
||||||
span_err!(v.tcx.sess, span, E0016,
|
span_err!(v.tcx.sess, span, E0016,
|
||||||
"blocks in constants are limited to items and \
|
"blocks in constants are limited to items and \
|
||||||
tail expressions");
|
tail expressions");
|
||||||
|
@ -1024,7 +1024,7 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
let check_move = |&: p: &Pat, sub: Option<&Pat>| {
|
let check_move = |p: &Pat, sub: Option<&Pat>| {
|
||||||
// check legality of moving out of the enum
|
// check legality of moving out of the enum
|
||||||
|
|
||||||
// x @ Foo(..) is legal, but x @ Foo(y) isn't.
|
// x @ Foo(..) is legal, but x @ Foo(y) isn't.
|
||||||
|
@ -135,7 +135,7 @@ impl<'a, 'tcx> ConstraintGraph<'a, 'tcx> {
|
|||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
let mut node_ids = FnvHashMap();
|
let mut node_ids = FnvHashMap();
|
||||||
{
|
{
|
||||||
let mut add_node = |&mut : node| {
|
let mut add_node = |node| {
|
||||||
if let Vacant(e) = node_ids.entry(node) {
|
if let Vacant(e) = node_ids.entry(node) {
|
||||||
e.insert(i);
|
e.insert(i);
|
||||||
i += 1;
|
i += 1;
|
||||||
|
@ -666,7 +666,7 @@ fn resolve_expr(visitor: &mut RegionResolutionVisitor, expr: &ast::Expr) {
|
|||||||
|
|
||||||
{
|
{
|
||||||
let region_maps = &mut visitor.region_maps;
|
let region_maps = &mut visitor.region_maps;
|
||||||
let terminating = |&: id| {
|
let terminating = |id| {
|
||||||
let scope = CodeExtent::from_node_id(id);
|
let scope = CodeExtent::from_node_id(id);
|
||||||
region_maps.mark_as_terminating_scope(scope)
|
region_maps.mark_as_terminating_scope(scope)
|
||||||
};
|
};
|
||||||
|
@ -6087,7 +6087,7 @@ pub fn hash_crate_independent<'tcx>(tcx: &ctxt<'tcx>, ty: Ty<'tcx>, svh: &Svh) -
|
|||||||
macro_rules! byte { ($b:expr) => { ($b as u8).hash(state) } }
|
macro_rules! byte { ($b:expr) => { ($b as u8).hash(state) } }
|
||||||
macro_rules! hash { ($e:expr) => { $e.hash(state) } }
|
macro_rules! hash { ($e:expr) => { $e.hash(state) } }
|
||||||
|
|
||||||
let region = |&: state: &mut SipHasher, r: Region| {
|
let region = |state: &mut SipHasher, r: Region| {
|
||||||
match r {
|
match r {
|
||||||
ReStatic => {}
|
ReStatic => {}
|
||||||
ReLateBound(db, BrAnon(i)) => {
|
ReLateBound(db, BrAnon(i)) => {
|
||||||
@ -6104,7 +6104,7 @@ pub fn hash_crate_independent<'tcx>(tcx: &ctxt<'tcx>, ty: Ty<'tcx>, svh: &Svh) -
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let did = |&: state: &mut SipHasher, did: DefId| {
|
let did = |state: &mut SipHasher, did: DefId| {
|
||||||
let h = if ast_util::is_local(did) {
|
let h = if ast_util::is_local(did) {
|
||||||
svh.clone()
|
svh.clone()
|
||||||
} else {
|
} else {
|
||||||
@ -6113,10 +6113,10 @@ pub fn hash_crate_independent<'tcx>(tcx: &ctxt<'tcx>, ty: Ty<'tcx>, svh: &Svh) -
|
|||||||
h.as_str().hash(state);
|
h.as_str().hash(state);
|
||||||
did.node.hash(state);
|
did.node.hash(state);
|
||||||
};
|
};
|
||||||
let mt = |&: state: &mut SipHasher, mt: mt| {
|
let mt = |state: &mut SipHasher, mt: mt| {
|
||||||
mt.mutbl.hash(state);
|
mt.mutbl.hash(state);
|
||||||
};
|
};
|
||||||
let fn_sig = |&: state: &mut SipHasher, sig: &Binder<FnSig<'tcx>>| {
|
let fn_sig = |state: &mut SipHasher, sig: &Binder<FnSig<'tcx>>| {
|
||||||
let sig = anonymize_late_bound_regions(tcx, sig).0;
|
let sig = anonymize_late_bound_regions(tcx, sig).0;
|
||||||
for a in &sig.inputs { helper(tcx, *a, svh, state); }
|
for a in &sig.inputs { helper(tcx, *a, svh, state); }
|
||||||
if let ty::FnConverging(output) = sig.output {
|
if let ty::FnConverging(output) = sig.output {
|
||||||
|
@ -187,8 +187,8 @@ pub fn can_reach<T, S>(edges_map: &HashMap<T, Vec<T>, S>, source: T,
|
|||||||
/// ```
|
/// ```
|
||||||
/// pub fn memoized<T: Clone, U: Clone, M: MutableMap<T, U>>(
|
/// pub fn memoized<T: Clone, U: Clone, M: MutableMap<T, U>>(
|
||||||
/// cache: &RefCell<M>,
|
/// cache: &RefCell<M>,
|
||||||
/// f: &|&: T| -> U
|
/// f: &|T| -> U
|
||||||
/// ) -> impl |&: T| -> U {
|
/// ) -> impl |T| -> U {
|
||||||
/// ```
|
/// ```
|
||||||
/// but currently it is not possible.
|
/// but currently it is not possible.
|
||||||
///
|
///
|
||||||
|
@ -86,7 +86,7 @@ pub fn explain_region_and_span(cx: &ctxt, region: ty::Region)
|
|||||||
return match region {
|
return match region {
|
||||||
ReScope(scope) => {
|
ReScope(scope) => {
|
||||||
let new_string;
|
let new_string;
|
||||||
let on_unknown_scope = |&:| {
|
let on_unknown_scope = || {
|
||||||
(format!("unknown scope: {:?}. Please report a bug.", scope), None)
|
(format!("unknown scope: {:?}. Please report a bug.", scope), None)
|
||||||
};
|
};
|
||||||
let span = match scope.span(&cx.map) {
|
let span = match scope.span(&cx.map) {
|
||||||
|
@ -227,7 +227,7 @@ impl Target {
|
|||||||
|
|
||||||
let handler = diagnostic::default_handler(diagnostic::Auto, None, true);
|
let handler = diagnostic::default_handler(diagnostic::Auto, None, true);
|
||||||
|
|
||||||
let get_req_field = |&: name: &str| {
|
let get_req_field = |name: &str| {
|
||||||
match obj.find(name)
|
match obj.find(name)
|
||||||
.map(|s| s.as_string())
|
.map(|s| s.as_string())
|
||||||
.and_then(|os| os.map(|s| s.to_string())) {
|
.and_then(|os| os.map(|s| s.to_string())) {
|
||||||
|
@ -43,7 +43,7 @@ enum Fragment {
|
|||||||
|
|
||||||
impl Fragment {
|
impl Fragment {
|
||||||
fn loan_path_repr<'tcx>(&self, move_data: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) -> String {
|
fn loan_path_repr<'tcx>(&self, move_data: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) -> String {
|
||||||
let repr = |&: mpi| move_data.path_loan_path(mpi).repr(tcx);
|
let repr = |mpi| move_data.path_loan_path(mpi).repr(tcx);
|
||||||
match *self {
|
match *self {
|
||||||
Just(mpi) => repr(mpi),
|
Just(mpi) => repr(mpi),
|
||||||
AllButOneFrom(mpi) => format!("$(allbutone {})", repr(mpi)),
|
AllButOneFrom(mpi) => format!("$(allbutone {})", repr(mpi)),
|
||||||
@ -53,7 +53,7 @@ impl Fragment {
|
|||||||
fn loan_path_user_string<'tcx>(&self,
|
fn loan_path_user_string<'tcx>(&self,
|
||||||
move_data: &MoveData<'tcx>,
|
move_data: &MoveData<'tcx>,
|
||||||
tcx: &ty::ctxt<'tcx>) -> String {
|
tcx: &ty::ctxt<'tcx>) -> String {
|
||||||
let user_string = |&: mpi| move_data.path_loan_path(mpi).user_string(tcx);
|
let user_string = |mpi| move_data.path_loan_path(mpi).user_string(tcx);
|
||||||
match *self {
|
match *self {
|
||||||
Just(mpi) => user_string(mpi),
|
Just(mpi) => user_string(mpi),
|
||||||
AllButOneFrom(mpi) => format!("$(allbutone {})", user_string(mpi)),
|
AllButOneFrom(mpi) => format!("$(allbutone {})", user_string(mpi)),
|
||||||
@ -139,9 +139,9 @@ pub fn instrument_move_fragments<'tcx>(this: &MoveData<'tcx>,
|
|||||||
|
|
||||||
if !span_err && !print { return; }
|
if !span_err && !print { return; }
|
||||||
|
|
||||||
let instrument_all_paths = |&: kind, vec_rc: &Vec<MovePathIndex>| {
|
let instrument_all_paths = |kind, vec_rc: &Vec<MovePathIndex>| {
|
||||||
for (i, mpi) in vec_rc.iter().enumerate() {
|
for (i, mpi) in vec_rc.iter().enumerate() {
|
||||||
let render = |&:| this.path_loan_path(*mpi).user_string(tcx);
|
let render = || this.path_loan_path(*mpi).user_string(tcx);
|
||||||
if span_err {
|
if span_err {
|
||||||
tcx.sess.span_err(sp, &format!("{}: `{}`", kind, render())[]);
|
tcx.sess.span_err(sp, &format!("{}: `{}`", kind, render())[]);
|
||||||
}
|
}
|
||||||
@ -151,9 +151,9 @@ pub fn instrument_move_fragments<'tcx>(this: &MoveData<'tcx>,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let instrument_all_fragments = |&: kind, vec_rc: &Vec<Fragment>| {
|
let instrument_all_fragments = |kind, vec_rc: &Vec<Fragment>| {
|
||||||
for (i, f) in vec_rc.iter().enumerate() {
|
for (i, f) in vec_rc.iter().enumerate() {
|
||||||
let render = |&:| f.loan_path_user_string(this, tcx);
|
let render = || f.loan_path_user_string(this, tcx);
|
||||||
if span_err {
|
if span_err {
|
||||||
tcx.sess.span_err(sp, &format!("{}: `{}`", kind, render())[]);
|
tcx.sess.span_err(sp, &format!("{}: `{}`", kind, render())[]);
|
||||||
}
|
}
|
||||||
@ -186,11 +186,11 @@ pub fn fixup_fragment_sets<'tcx>(this: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) {
|
|||||||
let mut moved = mem::replace(&mut fragments.moved_leaf_paths, vec![]);
|
let mut moved = mem::replace(&mut fragments.moved_leaf_paths, vec![]);
|
||||||
let mut assigned = mem::replace(&mut fragments.assigned_leaf_paths, vec![]);
|
let mut assigned = mem::replace(&mut fragments.assigned_leaf_paths, vec![]);
|
||||||
|
|
||||||
let path_lps = |&: mpis: &[MovePathIndex]| -> Vec<String> {
|
let path_lps = |mpis: &[MovePathIndex]| -> Vec<String> {
|
||||||
mpis.iter().map(|mpi| this.path_loan_path(*mpi).repr(tcx)).collect()
|
mpis.iter().map(|mpi| this.path_loan_path(*mpi).repr(tcx)).collect()
|
||||||
};
|
};
|
||||||
|
|
||||||
let frag_lps = |&: fs: &[Fragment]| -> Vec<String> {
|
let frag_lps = |fs: &[Fragment]| -> Vec<String> {
|
||||||
fs.iter().map(|f| f.loan_path_repr(this, tcx)).collect()
|
fs.iter().map(|f| f.loan_path_repr(this, tcx)).collect()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -343,7 +343,7 @@ fn add_fragment_siblings_for_extension<'tcx>(this: &MoveData<'tcx>,
|
|||||||
Rc<LoanPath<'tcx>>)>) {
|
Rc<LoanPath<'tcx>>)>) {
|
||||||
let parent_ty = parent_lp.to_type();
|
let parent_ty = parent_lp.to_type();
|
||||||
|
|
||||||
let mut add_fragment_sibling_local = |&mut : field_name, variant_did| {
|
let mut add_fragment_sibling_local = |field_name, variant_did| {
|
||||||
add_fragment_sibling_core(
|
add_fragment_sibling_core(
|
||||||
this, tcx, gathered_fragments, parent_lp.clone(), mc, field_name, origin_lp,
|
this, tcx, gathered_fragments, parent_lp.clone(), mc, field_name, origin_lp,
|
||||||
variant_did);
|
variant_did);
|
||||||
|
@ -58,7 +58,7 @@ impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> {
|
|||||||
cmt: mc::cmt<'tcx>) -> RestrictionResult<'tcx> {
|
cmt: mc::cmt<'tcx>) -> RestrictionResult<'tcx> {
|
||||||
debug!("restrict(cmt={})", cmt.repr(self.bccx.tcx));
|
debug!("restrict(cmt={})", cmt.repr(self.bccx.tcx));
|
||||||
|
|
||||||
let new_lp = |&: v: LoanPathKind<'tcx>| Rc::new(LoanPath::new(v, cmt.ty));
|
let new_lp = |v: LoanPathKind<'tcx>| Rc::new(LoanPath::new(v, cmt.ty));
|
||||||
|
|
||||||
match cmt.cat.clone() {
|
match cmt.cat.clone() {
|
||||||
mc::cat_rvalue(..) => {
|
mc::cat_rvalue(..) => {
|
||||||
|
@ -422,7 +422,7 @@ pub fn opt_loan_path<'tcx>(cmt: &mc::cmt<'tcx>) -> Option<Rc<LoanPath<'tcx>>> {
|
|||||||
//! which allows it to share common loan path pieces as it
|
//! which allows it to share common loan path pieces as it
|
||||||
//! traverses the CMT.
|
//! traverses the CMT.
|
||||||
|
|
||||||
let new_lp = |&: v: LoanPathKind<'tcx>| Rc::new(LoanPath::new(v, cmt.ty));
|
let new_lp = |v: LoanPathKind<'tcx>| Rc::new(LoanPath::new(v, cmt.ty));
|
||||||
|
|
||||||
match cmt.cat {
|
match cmt.cat {
|
||||||
mc::cat_rvalue(..) |
|
mc::cat_rvalue(..) |
|
||||||
|
@ -99,7 +99,7 @@ impl<'a, 'tcx> DataflowLabeller<'a, 'tcx> {
|
|||||||
|
|
||||||
fn dataflow_loans_for(&self, e: EntryOrExit, cfgidx: CFGIndex) -> String {
|
fn dataflow_loans_for(&self, e: EntryOrExit, cfgidx: CFGIndex) -> String {
|
||||||
let dfcx = &self.analysis_data.loans;
|
let dfcx = &self.analysis_data.loans;
|
||||||
let loan_index_to_path = |&mut: loan_index| {
|
let loan_index_to_path = |loan_index| {
|
||||||
let all_loans = &self.analysis_data.all_loans;
|
let all_loans = &self.analysis_data.all_loans;
|
||||||
let l: &borrowck::Loan = &all_loans[loan_index];
|
let l: &borrowck::Loan = &all_loans[loan_index];
|
||||||
l.loan_path()
|
l.loan_path()
|
||||||
@ -109,7 +109,7 @@ impl<'a, 'tcx> DataflowLabeller<'a, 'tcx> {
|
|||||||
|
|
||||||
fn dataflow_moves_for(&self, e: EntryOrExit, cfgidx: CFGIndex) -> String {
|
fn dataflow_moves_for(&self, e: EntryOrExit, cfgidx: CFGIndex) -> String {
|
||||||
let dfcx = &self.analysis_data.move_data.dfcx_moves;
|
let dfcx = &self.analysis_data.move_data.dfcx_moves;
|
||||||
let move_index_to_path = |&mut: move_index| {
|
let move_index_to_path = |move_index| {
|
||||||
let move_data = &self.analysis_data.move_data.move_data;
|
let move_data = &self.analysis_data.move_data.move_data;
|
||||||
let moves = move_data.moves.borrow();
|
let moves = move_data.moves.borrow();
|
||||||
let the_move: &borrowck::move_data::Move = &(*moves)[move_index];
|
let the_move: &borrowck::move_data::Move = &(*moves)[move_index];
|
||||||
@ -120,7 +120,7 @@ impl<'a, 'tcx> DataflowLabeller<'a, 'tcx> {
|
|||||||
|
|
||||||
fn dataflow_assigns_for(&self, e: EntryOrExit, cfgidx: CFGIndex) -> String {
|
fn dataflow_assigns_for(&self, e: EntryOrExit, cfgidx: CFGIndex) -> String {
|
||||||
let dfcx = &self.analysis_data.move_data.dfcx_assign;
|
let dfcx = &self.analysis_data.move_data.dfcx_assign;
|
||||||
let assign_index_to_path = |&mut: assign_index| {
|
let assign_index_to_path = |assign_index| {
|
||||||
let move_data = &self.analysis_data.move_data.move_data;
|
let move_data = &self.analysis_data.move_data.move_data;
|
||||||
let assignments = move_data.var_assignments.borrow();
|
let assignments = move_data.var_assignments.borrow();
|
||||||
let assignment: &borrowck::move_data::Assignment = &(*assignments)[assign_index];
|
let assignment: &borrowck::move_data::Assignment = &(*assignments)[assign_index];
|
||||||
|
@ -214,7 +214,7 @@ impl<'a> PhaseController<'a> {
|
|||||||
pub fn basic() -> PhaseController<'a> {
|
pub fn basic() -> PhaseController<'a> {
|
||||||
PhaseController {
|
PhaseController {
|
||||||
stop: false,
|
stop: false,
|
||||||
callback: box |&: _| {},
|
callback: box |_| {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -794,7 +794,7 @@ fn write_out_deps(sess: &Session,
|
|||||||
_ => return,
|
_ => return,
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = (|&:| -> old_io::IoResult<()> {
|
let result = (|| -> old_io::IoResult<()> {
|
||||||
// Build a list of files used to compile the output and
|
// Build a list of files used to compile the output and
|
||||||
// write Makefile-compatible dependency rules
|
// write Makefile-compatible dependency rules
|
||||||
let files: Vec<String> = sess.codemap().files.borrow()
|
let files: Vec<String> = sess.codemap().files.borrow()
|
||||||
|
@ -93,7 +93,7 @@ pub mod driver;
|
|||||||
pub mod pretty;
|
pub mod pretty;
|
||||||
|
|
||||||
pub fn run(args: Vec<String>) -> int {
|
pub fn run(args: Vec<String>) -> int {
|
||||||
monitor(move |:| run_compiler(args.as_slice()));
|
monitor(move || run_compiler(args.as_slice()));
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,7 +362,7 @@ Available lint options:
|
|||||||
let max_name_len = plugin.iter().chain(builtin.iter())
|
let max_name_len = plugin.iter().chain(builtin.iter())
|
||||||
.map(|&s| s.name.width(true))
|
.map(|&s| s.name.width(true))
|
||||||
.max().unwrap_or(0);
|
.max().unwrap_or(0);
|
||||||
let padded = |&: x: &str| {
|
let padded = |x: &str| {
|
||||||
let mut s = repeat(" ").take(max_name_len - x.chars().count())
|
let mut s = repeat(" ").take(max_name_len - x.chars().count())
|
||||||
.collect::<String>();
|
.collect::<String>();
|
||||||
s.push_str(x);
|
s.push_str(x);
|
||||||
@ -373,7 +373,7 @@ Available lint options:
|
|||||||
println!(" {} {:7.7} {}", padded("name"), "default", "meaning");
|
println!(" {} {:7.7} {}", padded("name"), "default", "meaning");
|
||||||
println!(" {} {:7.7} {}", padded("----"), "-------", "-------");
|
println!(" {} {:7.7} {}", padded("----"), "-------", "-------");
|
||||||
|
|
||||||
let print_lints = |&: lints: Vec<&Lint>| {
|
let print_lints = |lints: Vec<&Lint>| {
|
||||||
for lint in lints {
|
for lint in lints {
|
||||||
let name = lint.name_lower().replace("_", "-");
|
let name = lint.name_lower().replace("_", "-");
|
||||||
println!(" {} {:7.7} {}",
|
println!(" {} {:7.7} {}",
|
||||||
@ -389,7 +389,7 @@ Available lint options:
|
|||||||
let max_name_len = plugin_groups.iter().chain(builtin_groups.iter())
|
let max_name_len = plugin_groups.iter().chain(builtin_groups.iter())
|
||||||
.map(|&(s, _)| s.width(true))
|
.map(|&(s, _)| s.width(true))
|
||||||
.max().unwrap_or(0);
|
.max().unwrap_or(0);
|
||||||
let padded = |&: x: &str| {
|
let padded = |x: &str| {
|
||||||
let mut s = repeat(" ").take(max_name_len - x.chars().count())
|
let mut s = repeat(" ").take(max_name_len - x.chars().count())
|
||||||
.collect::<String>();
|
.collect::<String>();
|
||||||
s.push_str(x);
|
s.push_str(x);
|
||||||
@ -400,7 +400,7 @@ Available lint options:
|
|||||||
println!(" {} {}", padded("name"), "sub-lints");
|
println!(" {} {}", padded("name"), "sub-lints");
|
||||||
println!(" {} {}", padded("----"), "---------");
|
println!(" {} {}", padded("----"), "---------");
|
||||||
|
|
||||||
let print_lint_groups = |&: lints: Vec<(&'static str, Vec<lint::LintId>)>| {
|
let print_lint_groups = |lints: Vec<(&'static str, Vec<lint::LintId>)>| {
|
||||||
for (name, to) in lints {
|
for (name, to) in lints {
|
||||||
let name = name.chars().map(|x| x.to_lowercase())
|
let name = name.chars().map(|x| x.to_lowercase())
|
||||||
.collect::<String>().replace("_", "-");
|
.collect::<String>().replace("_", "-");
|
||||||
|
@ -388,7 +388,7 @@ impl UserIdentifiedItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn to_one_node_id(self, user_option: &str, sess: &Session, map: &ast_map::Map) -> ast::NodeId {
|
fn to_one_node_id(self, user_option: &str, sess: &Session, map: &ast_map::Map) -> ast::NodeId {
|
||||||
let fail_because = |&: is_wrong_because| -> ast::NodeId {
|
let fail_because = |is_wrong_because| -> ast::NodeId {
|
||||||
let message =
|
let message =
|
||||||
format!("{} needs NodeId (int) or unique \
|
format!("{} needs NodeId (int) or unique \
|
||||||
path suffix (b::c::d); got {}, which {}",
|
path suffix (b::c::d); got {}, which {}",
|
||||||
|
@ -719,8 +719,8 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
|
|||||||
fn check_path(&mut self, span: Span, path_id: ast::NodeId, path: &ast::Path) {
|
fn check_path(&mut self, span: Span, path_id: ast::NodeId, path: &ast::Path) {
|
||||||
debug!("privacy - path {}", self.nodestr(path_id));
|
debug!("privacy - path {}", self.nodestr(path_id));
|
||||||
let orig_def = self.tcx.def_map.borrow()[path_id].clone();
|
let orig_def = self.tcx.def_map.borrow()[path_id].clone();
|
||||||
let ck = |&: tyname: &str| {
|
let ck = |tyname: &str| {
|
||||||
let ck_public = |&: def: ast::DefId| {
|
let ck_public = |def: ast::DefId| {
|
||||||
debug!("privacy - ck_public {:?}", def);
|
debug!("privacy - ck_public {:?}", def);
|
||||||
let name = token::get_ident(path.segments.last().unwrap().identifier);
|
let name = token::get_ident(path.segments.last().unwrap().identifier);
|
||||||
let origdid = orig_def.def_id();
|
let origdid = orig_def.def_id();
|
||||||
@ -924,7 +924,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast::ExprPath(_) | ast::ExprQPath(_) => {
|
ast::ExprPath(_) | ast::ExprQPath(_) => {
|
||||||
let guard = |&: did: ast::DefId| {
|
let guard = |did: ast::DefId| {
|
||||||
let fields = ty::lookup_struct_fields(self.tcx, did);
|
let fields = ty::lookup_struct_fields(self.tcx, did);
|
||||||
let any_priv = fields.iter().any(|f| {
|
let any_priv = fields.iter().any(|f| {
|
||||||
f.vis != ast::Public && (
|
f.vis != ast::Public && (
|
||||||
@ -1076,7 +1076,7 @@ impl<'a, 'tcx> SanePrivacyVisitor<'a, 'tcx> {
|
|||||||
/// later on down the road...
|
/// later on down the road...
|
||||||
fn check_sane_privacy(&self, item: &ast::Item) {
|
fn check_sane_privacy(&self, item: &ast::Item) {
|
||||||
let tcx = self.tcx;
|
let tcx = self.tcx;
|
||||||
let check_inherited = |&: sp: Span, vis: ast::Visibility, note: &str| {
|
let check_inherited = |sp: Span, vis: ast::Visibility, note: &str| {
|
||||||
if vis != ast::Inherited {
|
if vis != ast::Inherited {
|
||||||
tcx.sess.span_err(sp, "unnecessary visibility qualifier");
|
tcx.sess.span_err(sp, "unnecessary visibility qualifier");
|
||||||
if note.len() > 0 {
|
if note.len() > 0 {
|
||||||
@ -1156,7 +1156,7 @@ impl<'a, 'tcx> SanePrivacyVisitor<'a, 'tcx> {
|
|||||||
tcx.sess.span_err(sp, "visibility has no effect inside functions");
|
tcx.sess.span_err(sp, "visibility has no effect inside functions");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let check_struct = |&: def: &ast::StructDef| {
|
let check_struct = |def: &ast::StructDef| {
|
||||||
for f in &def.fields {
|
for f in &def.fields {
|
||||||
match f.node.kind {
|
match f.node.kind {
|
||||||
ast::NamedField(_, p) => check_inherited(tcx, f.span, p),
|
ast::NamedField(_, p) => check_inherited(tcx, f.span, p),
|
||||||
|
@ -1475,7 +1475,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||||||
let mut import_resolutions = module_.import_resolutions.borrow_mut();
|
let mut import_resolutions = module_.import_resolutions.borrow_mut();
|
||||||
let import_resolution = &mut (*import_resolutions)[target];
|
let import_resolution = &mut (*import_resolutions)[target];
|
||||||
{
|
{
|
||||||
let mut check_and_write_import = |&mut: namespace, result: &_, used_public: &mut bool| {
|
let mut check_and_write_import = |namespace, result: &_, used_public: &mut bool| {
|
||||||
let namespace_name = match namespace {
|
let namespace_name = match namespace {
|
||||||
TypeNS => "type",
|
TypeNS => "type",
|
||||||
ValueNS => "value",
|
ValueNS => "value",
|
||||||
@ -1714,7 +1714,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||||||
|
|
||||||
// Merge the child item into the import resolution.
|
// Merge the child item into the import resolution.
|
||||||
{
|
{
|
||||||
let mut merge_child_item = |&mut : namespace| {
|
let mut merge_child_item = |namespace| {
|
||||||
if name_bindings.defined_in_namespace_with(namespace, IMPORTABLE | PUBLIC) {
|
if name_bindings.defined_in_namespace_with(namespace, IMPORTABLE | PUBLIC) {
|
||||||
let namespace_name = match namespace {
|
let namespace_name = match namespace {
|
||||||
TypeNS => "type",
|
TypeNS => "type",
|
||||||
|
@ -126,7 +126,7 @@ pub const RLIB_BYTECODE_OBJECT_V1_DATA_OFFSET: uint =
|
|||||||
pub fn find_crate_name(sess: Option<&Session>,
|
pub fn find_crate_name(sess: Option<&Session>,
|
||||||
attrs: &[ast::Attribute],
|
attrs: &[ast::Attribute],
|
||||||
input: &Input) -> String {
|
input: &Input) -> String {
|
||||||
let validate = |&: s: String, span: Option<Span>| {
|
let validate = |s: String, span: Option<Span>| {
|
||||||
creader::validate_crate_name(sess, &s[], span);
|
creader::validate_crate_name(sess, &s[], span);
|
||||||
s
|
s
|
||||||
};
|
};
|
||||||
@ -1006,7 +1006,7 @@ fn link_args(cmd: &mut Command,
|
|||||||
if sess.opts.cg.rpath {
|
if sess.opts.cg.rpath {
|
||||||
let sysroot = sess.sysroot();
|
let sysroot = sess.sysroot();
|
||||||
let target_triple = &sess.opts.target_triple[];
|
let target_triple = &sess.opts.target_triple[];
|
||||||
let get_install_prefix_lib_path = |:| {
|
let get_install_prefix_lib_path = || {
|
||||||
let install_prefix = option_env!("CFG_PREFIX").expect("CFG_PREFIX");
|
let install_prefix = option_env!("CFG_PREFIX").expect("CFG_PREFIX");
|
||||||
let tlib = filesearch::relative_target_lib_path(sysroot, target_triple);
|
let tlib = filesearch::relative_target_lib_path(sysroot, target_triple);
|
||||||
let mut path = Path::new(install_prefix);
|
let mut path = Path::new(install_prefix);
|
||||||
|
@ -439,7 +439,7 @@ unsafe fn optimize_and_codegen(cgcx: &CodegenContext,
|
|||||||
|
|
||||||
// If we're verifying or linting, add them to the function pass
|
// If we're verifying or linting, add them to the function pass
|
||||||
// manager.
|
// manager.
|
||||||
let addpass = |&: pass: &str| {
|
let addpass = |pass: &str| {
|
||||||
let pass = CString::from_slice(pass.as_bytes());
|
let pass = CString::from_slice(pass.as_bytes());
|
||||||
llvm::LLVMRustAddPass(fpm, pass.as_ptr())
|
llvm::LLVMRustAddPass(fpm, pass.as_ptr())
|
||||||
};
|
};
|
||||||
@ -660,7 +660,7 @@ pub fn run_passes(sess: &Session,
|
|||||||
|
|
||||||
// Produce final compile outputs.
|
// Produce final compile outputs.
|
||||||
|
|
||||||
let copy_if_one_unit = |&: ext: &str, output_type: config::OutputType, keep_numbered: bool| {
|
let copy_if_one_unit = |ext: &str, output_type: config::OutputType, keep_numbered: bool| {
|
||||||
// Three cases:
|
// Three cases:
|
||||||
if sess.opts.cg.codegen_units == 1 {
|
if sess.opts.cg.codegen_units == 1 {
|
||||||
// 1) Only one codegen unit. In this case it's no difficulty
|
// 1) Only one codegen unit. In this case it's no difficulty
|
||||||
@ -685,7 +685,7 @@ pub fn run_passes(sess: &Session,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let link_obj = |&: output_path: &Path| {
|
let link_obj = |output_path: &Path| {
|
||||||
// Running `ld -r` on a single input is kind of pointless.
|
// Running `ld -r` on a single input is kind of pointless.
|
||||||
if sess.opts.cg.codegen_units == 1 {
|
if sess.opts.cg.codegen_units == 1 {
|
||||||
fs::copy(&crate_output.with_extension("0.o"),
|
fs::copy(&crate_output.with_extension("0.o"),
|
||||||
@ -910,7 +910,7 @@ fn run_work_multithreaded(sess: &Session,
|
|||||||
let mut tx = Some(tx);
|
let mut tx = Some(tx);
|
||||||
futures.push(rx);
|
futures.push(rx);
|
||||||
|
|
||||||
thread::Builder::new().name(format!("codegen-{}", i)).spawn(move |:| {
|
thread::Builder::new().name(format!("codegen-{}", i)).spawn(move || {
|
||||||
let diag_handler = mk_handler(true, box diag_emitter);
|
let diag_handler = mk_handler(true, box diag_emitter);
|
||||||
|
|
||||||
// Must construct cgcx inside the proc because it has non-Send
|
// Must construct cgcx inside the proc because it has non-Send
|
||||||
@ -1001,7 +1001,7 @@ unsafe fn configure_llvm(sess: &Session) {
|
|||||||
let mut llvm_c_strs = Vec::new();
|
let mut llvm_c_strs = Vec::new();
|
||||||
let mut llvm_args = Vec::new();
|
let mut llvm_args = Vec::new();
|
||||||
{
|
{
|
||||||
let mut add = |&mut : arg: &str| {
|
let mut add = |arg: &str| {
|
||||||
let s = CString::from_slice(arg.as_bytes());
|
let s = CString::from_slice(arg.as_bytes());
|
||||||
llvm_args.push(s.as_ptr());
|
llvm_args.push(s.as_ptr());
|
||||||
llvm_c_strs.push(s);
|
llvm_c_strs.push(s);
|
||||||
|
@ -747,7 +747,7 @@ fn pick_column_to_specialize(def_map: &DefMap, m: &[Match]) -> Option<uint> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let column_score = |&: m: &[Match], col: uint| -> uint {
|
let column_score = |m: &[Match], col: uint| -> uint {
|
||||||
let total_score = m.iter()
|
let total_score = m.iter()
|
||||||
.map(|row| row.pats[col])
|
.map(|row| row.pats[col])
|
||||||
.map(|pat| pat_score(def_map, pat))
|
.map(|pat| pat_score(def_map, pat))
|
||||||
@ -761,7 +761,7 @@ fn pick_column_to_specialize(def_map: &DefMap, m: &[Match]) -> Option<uint> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let column_contains_any_nonwild_patterns = |&: &col: &uint| -> bool {
|
let column_contains_any_nonwild_patterns = |&col: &uint| -> bool {
|
||||||
m.iter().any(|row| match row.pats[col].node {
|
m.iter().any(|row| match row.pats[col].node {
|
||||||
ast::PatWild(_) => false,
|
ast::PatWild(_) => false,
|
||||||
_ => true
|
_ => true
|
||||||
|
@ -540,7 +540,7 @@ pub fn compare_scalar_types<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
|
|||||||
t: Ty<'tcx>,
|
t: Ty<'tcx>,
|
||||||
op: ast::BinOp_)
|
op: ast::BinOp_)
|
||||||
-> Result<'blk, 'tcx> {
|
-> Result<'blk, 'tcx> {
|
||||||
let f = |&: a| Result::new(cx, compare_scalar_values(cx, lhs, rhs, a, op));
|
let f = |a| Result::new(cx, compare_scalar_values(cx, lhs, rhs, a, op));
|
||||||
|
|
||||||
match t.sty {
|
match t.sty {
|
||||||
ty::ty_tup(ref tys) if tys.is_empty() => f(nil_type),
|
ty::ty_tup(ref tys) if tys.is_empty() => f(nil_type),
|
||||||
@ -2757,7 +2757,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
|
|||||||
let val = match item {
|
let val = match item {
|
||||||
ast_map::NodeItem(i) => {
|
ast_map::NodeItem(i) => {
|
||||||
let ty = ty::node_id_to_type(ccx.tcx(), i.id);
|
let ty = ty::node_id_to_type(ccx.tcx(), i.id);
|
||||||
let sym = |&:| exported_name(ccx, id, ty, &i.attrs[]);
|
let sym = || exported_name(ccx, id, ty, &i.attrs[]);
|
||||||
|
|
||||||
let v = match i.node {
|
let v = match i.node {
|
||||||
ast::ItemStatic(_, _, ref expr) => {
|
ast::ItemStatic(_, _, ref expr) => {
|
||||||
@ -3016,14 +3016,14 @@ fn internalize_symbols(cx: &SharedCrateContext, reachable: &HashSet<String>) {
|
|||||||
unsafe {
|
unsafe {
|
||||||
let mut declared = HashSet::new();
|
let mut declared = HashSet::new();
|
||||||
|
|
||||||
let iter_globals = |&: llmod| {
|
let iter_globals = |llmod| {
|
||||||
ValueIter {
|
ValueIter {
|
||||||
cur: llvm::LLVMGetFirstGlobal(llmod),
|
cur: llvm::LLVMGetFirstGlobal(llmod),
|
||||||
step: llvm::LLVMGetNextGlobal,
|
step: llvm::LLVMGetNextGlobal,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let iter_functions = |&: llmod| {
|
let iter_functions = |llmod| {
|
||||||
ValueIter {
|
ValueIter {
|
||||||
cur: llvm::LLVMGetFirstFunction(llmod),
|
cur: llvm::LLVMGetFirstFunction(llmod),
|
||||||
step: llvm::LLVMGetNextFunction,
|
step: llvm::LLVMGetNextFunction,
|
||||||
|
@ -289,7 +289,7 @@ pub fn const_expr<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, e: &ast::Expr)
|
|||||||
// the bool returned is whether this expression can be inlined into other crates
|
// the bool returned is whether this expression can be inlined into other crates
|
||||||
// if it's assigned to a static.
|
// if it's assigned to a static.
|
||||||
fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef {
|
fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef {
|
||||||
let map_list = |&: exprs: &[P<ast::Expr>]| {
|
let map_list = |exprs: &[P<ast::Expr>]| {
|
||||||
exprs.iter().map(|e| const_expr(cx, &**e).0)
|
exprs.iter().map(|e| const_expr(cx, &**e).0)
|
||||||
.fold(Vec::new(), |mut l, val| { l.push(val); l })
|
.fold(Vec::new(), |mut l, val| { l.push(val); l })
|
||||||
};
|
};
|
||||||
|
@ -2453,7 +2453,7 @@ fn prepare_enum_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
|||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let discriminant_type_metadata = |&: inttype| {
|
let discriminant_type_metadata = |inttype| {
|
||||||
// We can reuse the type of the discriminant for all monomorphized
|
// We can reuse the type of the discriminant for all monomorphized
|
||||||
// instances of an enum because it doesn't depend on any type parameters.
|
// instances of an enum because it doesn't depend on any type parameters.
|
||||||
// The def_id, uniquely identifying the enum's polytype acts as key in
|
// The def_id, uniquely identifying the enum's polytype acts as key in
|
||||||
|
@ -350,7 +350,7 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
|||||||
debug!("dest_ty={}", unsized_ty.repr(bcx.tcx()));
|
debug!("dest_ty={}", unsized_ty.repr(bcx.tcx()));
|
||||||
// Closures for extracting and manipulating the data and payload parts of
|
// Closures for extracting and manipulating the data and payload parts of
|
||||||
// the fat pointer.
|
// the fat pointer.
|
||||||
let info = |: bcx, _val| unsized_info(bcx,
|
let info = |bcx, _val| unsized_info(bcx,
|
||||||
k,
|
k,
|
||||||
expr.id,
|
expr.id,
|
||||||
datum_ty,
|
datum_ty,
|
||||||
@ -382,8 +382,8 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
|||||||
-> DatumBlock<'blk, 'tcx, Expr> {
|
-> DatumBlock<'blk, 'tcx, Expr> {
|
||||||
let tcx = bcx.tcx();
|
let tcx = bcx.tcx();
|
||||||
let dest_ty = ty::close_type(tcx, datum.ty);
|
let dest_ty = ty::close_type(tcx, datum.ty);
|
||||||
let base = |: bcx, val| Load(bcx, get_dataptr(bcx, val));
|
let base = |bcx, val| Load(bcx, get_dataptr(bcx, val));
|
||||||
let len = |: bcx, val| Load(bcx, get_len(bcx, val));
|
let len = |bcx, val| Load(bcx, get_len(bcx, val));
|
||||||
into_fat_ptr(bcx, expr, datum, dest_ty, base, len)
|
into_fat_ptr(bcx, expr, datum, dest_ty, base, len)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,7 +431,7 @@ pub fn trans_native_call<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
|||||||
// ABIs are handled at all correctly.
|
// ABIs are handled at all correctly.
|
||||||
fn gate_simd_ffi(tcx: &ty::ctxt, decl: &ast::FnDecl, ty: &ty::BareFnTy) {
|
fn gate_simd_ffi(tcx: &ty::ctxt, decl: &ast::FnDecl, ty: &ty::BareFnTy) {
|
||||||
if !tcx.sess.features.borrow().simd_ffi {
|
if !tcx.sess.features.borrow().simd_ffi {
|
||||||
let check = |&: ast_ty: &ast::Ty, ty: ty::Ty| {
|
let check = |ast_ty: &ast::Ty, ty: ty::Ty| {
|
||||||
if ty::type_is_simd(tcx, ty) {
|
if ty::type_is_simd(tcx, ty) {
|
||||||
tcx.sess.span_err(ast_ty.span,
|
tcx.sess.span_err(ast_ty.span,
|
||||||
&format!("use of SIMD type `{}` in FFI is highly experimental and \
|
&format!("use of SIMD type `{}` in FFI is highly experimental and \
|
||||||
@ -649,7 +649,7 @@ pub fn trans_rust_fn_with_foreign_abi<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
|
|||||||
// Array for the arguments we will pass to the rust function.
|
// Array for the arguments we will pass to the rust function.
|
||||||
let mut llrust_args = Vec::new();
|
let mut llrust_args = Vec::new();
|
||||||
let mut next_foreign_arg_counter: c_uint = 0;
|
let mut next_foreign_arg_counter: c_uint = 0;
|
||||||
let mut next_foreign_arg = |&mut : pad: bool| -> c_uint {
|
let mut next_foreign_arg = |pad: bool| -> c_uint {
|
||||||
next_foreign_arg_counter += if pad {
|
next_foreign_arg_counter += if pad {
|
||||||
2
|
2
|
||||||
} else {
|
} else {
|
||||||
|
@ -183,7 +183,7 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
|
|||||||
// This should be caught by the intrinsicck pass
|
// This should be caught by the intrinsicck pass
|
||||||
assert_eq!(in_type_size, out_type_size);
|
assert_eq!(in_type_size, out_type_size);
|
||||||
|
|
||||||
let nonpointer_nonaggregate = |&: llkind: TypeKind| -> bool {
|
let nonpointer_nonaggregate = |llkind: TypeKind| -> bool {
|
||||||
use llvm::TypeKind::*;
|
use llvm::TypeKind::*;
|
||||||
match llkind {
|
match llkind {
|
||||||
Half | Float | Double | X86_FP80 | FP128 |
|
Half | Float | Double | X86_FP80 | FP128 |
|
||||||
|
@ -139,7 +139,7 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
|
|||||||
|
|
||||||
// This shouldn't need to option dance.
|
// This shouldn't need to option dance.
|
||||||
let mut hash_id = Some(hash_id);
|
let mut hash_id = Some(hash_id);
|
||||||
let mut mk_lldecl = |&mut : abi: abi::Abi| {
|
let mut mk_lldecl = |abi: abi::Abi| {
|
||||||
let lldecl = if abi != abi::Rust {
|
let lldecl = if abi != abi::Rust {
|
||||||
foreign::decl_rust_fn_with_foreign_abi(ccx, mono_ty, &s[])
|
foreign::decl_rust_fn_with_foreign_abi(ccx, mono_ty, &s[])
|
||||||
} else {
|
} else {
|
||||||
@ -149,7 +149,7 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
|
|||||||
ccx.monomorphized().borrow_mut().insert(hash_id.take().unwrap(), lldecl);
|
ccx.monomorphized().borrow_mut().insert(hash_id.take().unwrap(), lldecl);
|
||||||
lldecl
|
lldecl
|
||||||
};
|
};
|
||||||
let setup_lldecl = |&: lldecl, attrs: &[ast::Attribute]| {
|
let setup_lldecl = |lldecl, attrs: &[ast::Attribute]| {
|
||||||
base::update_linkage(ccx, lldecl, None, base::OriginalTranslation);
|
base::update_linkage(ccx, lldecl, None, base::OriginalTranslation);
|
||||||
set_llvm_fn_attrs(ccx, attrs, lldecl);
|
set_llvm_fn_attrs(ccx, attrs, lldecl);
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ pub fn all_traits<'a>(ccx: &'a CrateCtxt) -> AllTraits<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let cstore = &ccx.tcx.sess.cstore;
|
let cstore = &ccx.tcx.sess.cstore;
|
||||||
cstore.iter_crate_data(|&mut: cnum, _| {
|
cstore.iter_crate_data(|cnum, _| {
|
||||||
csearch::each_top_level_item_of_crate(cstore, cnum, |dl, _, _| {
|
csearch::each_top_level_item_of_crate(cstore, cnum, |dl, _, _| {
|
||||||
handle_external_def(&mut traits, ccx, cstore, dl)
|
handle_external_def(&mut traits, ccx, cstore, dl)
|
||||||
})
|
})
|
||||||
|
@ -801,7 +801,7 @@ pub fn check_item<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx ast::Item) {
|
|||||||
fn check_trait_on_unimplemented<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
|
fn check_trait_on_unimplemented<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
|
||||||
generics: &ast::Generics,
|
generics: &ast::Generics,
|
||||||
item: &ast::Item) {
|
item: &ast::Item) {
|
||||||
if let Some(ref attr) = item.attrs.iter().find(|&: a| {
|
if let Some(ref attr) = item.attrs.iter().find(|a| {
|
||||||
a.check_name("rustc_on_unimplemented")
|
a.check_name("rustc_on_unimplemented")
|
||||||
}) {
|
}) {
|
||||||
if let Some(ref istring) = attr.value_str() {
|
if let Some(ref istring) = attr.value_str() {
|
||||||
@ -1715,7 +1715,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
{
|
{
|
||||||
let raw_ty = self.expr_ty(expr);
|
let raw_ty = self.expr_ty(expr);
|
||||||
let raw_ty = self.infcx().shallow_resolve(raw_ty);
|
let raw_ty = self.infcx().shallow_resolve(raw_ty);
|
||||||
let resolve_ty = |&: ty: Ty<'tcx>| self.infcx().resolve_type_vars_if_possible(&ty);
|
let resolve_ty = |ty: Ty<'tcx>| self.infcx().resolve_type_vars_if_possible(&ty);
|
||||||
ty::adjust_ty(self.tcx(),
|
ty::adjust_ty(self.tcx(),
|
||||||
expr.span,
|
expr.span,
|
||||||
expr.id,
|
expr.id,
|
||||||
|
@ -597,7 +597,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
|
|||||||
// parameter (by inspecting parent of its binding declaration
|
// parameter (by inspecting parent of its binding declaration
|
||||||
// to see if it is introduced by a type or by a fn/impl).
|
// to see if it is introduced by a type or by a fn/impl).
|
||||||
|
|
||||||
let check_result = |&: this:&ConstraintContext| -> bool {
|
let check_result = |this:&ConstraintContext| -> bool {
|
||||||
let tcx = this.terms_cx.tcx;
|
let tcx = this.terms_cx.tcx;
|
||||||
let decl_id = this.find_binding_for_lifetime(param_id);
|
let decl_id = this.find_binding_for_lifetime(param_id);
|
||||||
// Currently only called on lifetimes; double-checking that.
|
// Currently only called on lifetimes; double-checking that.
|
||||||
|
@ -61,7 +61,7 @@ fn doit(sess: &parse::ParseSess, mut lexer: lexer::StringReader,
|
|||||||
loop {
|
loop {
|
||||||
let next = lexer.next_token();
|
let next = lexer.next_token();
|
||||||
|
|
||||||
let snip = |&: sp| sess.span_diagnostic.cm.span_to_snippet(sp).unwrap();
|
let snip = |sp| sess.span_diagnostic.cm.span_to_snippet(sp).unwrap();
|
||||||
|
|
||||||
if next.tok == token::Eof { break }
|
if next.tok == token::Eof { break }
|
||||||
|
|
||||||
|
@ -420,7 +420,7 @@ impl LangString {
|
|||||||
let mut seen_other_tags = false;
|
let mut seen_other_tags = false;
|
||||||
let mut data = LangString::all_false();
|
let mut data = LangString::all_false();
|
||||||
|
|
||||||
let tokens = string.split(|&: c: char|
|
let tokens = string.split(|c: char|
|
||||||
!(c == '_' || c == '-' || c.is_alphanumeric())
|
!(c == '_' || c == '-' || c.is_alphanumeric())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche
|
|||||||
let cr = Path::new(cratefile);
|
let cr = Path::new(cratefile);
|
||||||
info!("starting to run rustc");
|
info!("starting to run rustc");
|
||||||
|
|
||||||
let (mut krate, analysis) = std::thread::Thread::scoped(move |:| {
|
let (mut krate, analysis) = std::thread::Thread::scoped(move || {
|
||||||
use rustc::session::config::Input;
|
use rustc::session::config::Input;
|
||||||
|
|
||||||
let cr = cr;
|
let cr = cr;
|
||||||
|
@ -148,7 +148,7 @@ fn runtest(test: &str, cratename: &str, libs: SearchPaths,
|
|||||||
let w1 = old_io::ChanWriter::new(tx);
|
let w1 = old_io::ChanWriter::new(tx);
|
||||||
let w2 = w1.clone();
|
let w2 = w1.clone();
|
||||||
let old = old_io::stdio::set_stderr(box w1);
|
let old = old_io::stdio::set_stderr(box w1);
|
||||||
Thread::spawn(move |:| {
|
Thread::spawn(move || {
|
||||||
let mut p = old_io::ChanReader::new(rx);
|
let mut p = old_io::ChanReader::new(rx);
|
||||||
let mut err = match old {
|
let mut err = match old {
|
||||||
Some(old) => {
|
Some(old) => {
|
||||||
|
@ -321,10 +321,10 @@ pub fn float_to_str_bytes_common<T: Float>(
|
|||||||
// cut off the one extra digit, and depending on its value
|
// cut off the one extra digit, and depending on its value
|
||||||
// round the remaining ones.
|
// round the remaining ones.
|
||||||
if limit_digits && dig == digit_count {
|
if limit_digits && dig == digit_count {
|
||||||
let ascii2value = |&: chr: u8| {
|
let ascii2value = |chr: u8| {
|
||||||
(chr as char).to_digit(radix).unwrap()
|
(chr as char).to_digit(radix).unwrap()
|
||||||
};
|
};
|
||||||
let value2ascii = |&: val: uint| {
|
let value2ascii = |val: uint| {
|
||||||
char::from_digit(val, radix).unwrap() as u8
|
char::from_digit(val, radix).unwrap() as u8
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -323,25 +323,25 @@ impl<'a> Parser<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn read_ip_addr(&mut self) -> Option<IpAddr> {
|
fn read_ip_addr(&mut self) -> Option<IpAddr> {
|
||||||
let ipv4_addr = |&mut: p: &mut Parser| p.read_ipv4_addr();
|
let ipv4_addr = |p: &mut Parser| p.read_ipv4_addr();
|
||||||
let ipv6_addr = |&mut: p: &mut Parser| p.read_ipv6_addr();
|
let ipv6_addr = |p: &mut Parser| p.read_ipv6_addr();
|
||||||
self.read_or(&mut [box ipv4_addr, box ipv6_addr])
|
self.read_or(&mut [box ipv4_addr, box ipv6_addr])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_socket_addr(&mut self) -> Option<SocketAddr> {
|
fn read_socket_addr(&mut self) -> Option<SocketAddr> {
|
||||||
let ip_addr = |&: p: &mut Parser| {
|
let ip_addr = |p: &mut Parser| {
|
||||||
let ipv4_p = |&mut: p: &mut Parser| p.read_ip_addr();
|
let ipv4_p = |p: &mut Parser| p.read_ip_addr();
|
||||||
let ipv6_p = |&mut: p: &mut Parser| {
|
let ipv6_p = |p: &mut Parser| {
|
||||||
let open_br = |&: p: &mut Parser| p.read_given_char('[');
|
let open_br = |p: &mut Parser| p.read_given_char('[');
|
||||||
let ip_addr = |&: p: &mut Parser| p.read_ipv6_addr();
|
let ip_addr = |p: &mut Parser| p.read_ipv6_addr();
|
||||||
let clos_br = |&: p: &mut Parser| p.read_given_char(']');
|
let clos_br = |p: &mut Parser| p.read_given_char(']');
|
||||||
p.read_seq_3::<char, IpAddr, char, _, _, _>(open_br, ip_addr, clos_br)
|
p.read_seq_3::<char, IpAddr, char, _, _, _>(open_br, ip_addr, clos_br)
|
||||||
.map(|t| match t { (_, ip, _) => ip })
|
.map(|t| match t { (_, ip, _) => ip })
|
||||||
};
|
};
|
||||||
p.read_or(&mut [box ipv4_p, box ipv6_p])
|
p.read_or(&mut [box ipv4_p, box ipv6_p])
|
||||||
};
|
};
|
||||||
let colon = |&: p: &mut Parser| p.read_given_char(':');
|
let colon = |p: &mut Parser| p.read_given_char(':');
|
||||||
let port = |&: p: &mut Parser| p.read_number(10, 5, 0x10000).map(|n| n as u16);
|
let port = |p: &mut Parser| p.read_number(10, 5, 0x10000).map(|n| n as u16);
|
||||||
|
|
||||||
// host, colon, port
|
// host, colon, port
|
||||||
self.read_seq_3::<IpAddr, char, u16, _, _, _>(ip_addr, colon, port)
|
self.read_seq_3::<IpAddr, char, u16, _, _, _>(ip_addr, colon, port)
|
||||||
|
@ -703,7 +703,7 @@ impl Process {
|
|||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
match stream {
|
match stream {
|
||||||
Some(stream) => {
|
Some(stream) => {
|
||||||
Thread::spawn(move |:| {
|
Thread::spawn(move || {
|
||||||
let mut stream = stream;
|
let mut stream = stream;
|
||||||
tx.send(stream.read_to_end()).unwrap();
|
tx.send(stream.read_to_end()).unwrap();
|
||||||
});
|
});
|
||||||
|
@ -125,7 +125,7 @@ mod imp {
|
|||||||
assert!(take() == Some(expected.clone()));
|
assert!(take() == Some(expected.clone()));
|
||||||
assert!(take() == None);
|
assert!(take() == None);
|
||||||
|
|
||||||
(|&mut:| {
|
(|| {
|
||||||
}).finally(|| {
|
}).finally(|| {
|
||||||
// Restore the actual global state.
|
// Restore the actual global state.
|
||||||
match saved_value {
|
match saved_value {
|
||||||
|
@ -126,7 +126,7 @@ impl<A:Send> Future<A> {
|
|||||||
* waiting for the result to be received on the port.
|
* waiting for the result to be received on the port.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Future::from_fn(move |:| {
|
Future::from_fn(move || {
|
||||||
rx.recv().unwrap()
|
rx.recv().unwrap()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ impl<A:Send> Future<A> {
|
|||||||
|
|
||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
|
|
||||||
Thread::spawn(move |:| {
|
Thread::spawn(move || {
|
||||||
// Don't panic if the other end has hung up
|
// Don't panic if the other end has hung up
|
||||||
let _ = tx.send(blk());
|
let _ = tx.send(blk());
|
||||||
});
|
});
|
||||||
|
@ -112,7 +112,7 @@ impl TaskPool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn spawn_in_pool(jobs: Arc<Mutex<Receiver<Thunk>>>) {
|
fn spawn_in_pool(jobs: Arc<Mutex<Receiver<Thunk>>>) {
|
||||||
Thread::spawn(move |:| {
|
Thread::spawn(move || {
|
||||||
// Will spawn a new thread on panic unless it is cancelled.
|
// Will spawn a new thread on panic unless it is cancelled.
|
||||||
let sentinel = Sentinel::new(&jobs);
|
let sentinel = Sentinel::new(&jobs);
|
||||||
|
|
||||||
|
@ -95,14 +95,14 @@ impl<M: Send> Helper<M> {
|
|||||||
let receive = RaceBox(receive);
|
let receive = RaceBox(receive);
|
||||||
|
|
||||||
let t = f();
|
let t = f();
|
||||||
Thread::spawn(move |:| {
|
Thread::spawn(move || {
|
||||||
helper(receive.0, rx, t);
|
helper(receive.0, rx, t);
|
||||||
let _g = self.lock.lock().unwrap();
|
let _g = self.lock.lock().unwrap();
|
||||||
*self.shutdown.get() = true;
|
*self.shutdown.get() = true;
|
||||||
self.cond.notify_one()
|
self.cond.notify_one()
|
||||||
});
|
});
|
||||||
|
|
||||||
rt::at_exit(move|:| { self.shutdown() });
|
rt::at_exit(move|| { self.shutdown() });
|
||||||
*self.initialized.get() = true;
|
*self.initialized.get() = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -723,8 +723,8 @@ impl TcpStream {
|
|||||||
|
|
||||||
pub fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
|
pub fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
|
||||||
let fd = self.fd();
|
let fd = self.fd();
|
||||||
let dolock = |&:| self.lock_nonblocking();
|
let dolock = || self.lock_nonblocking();
|
||||||
let doread = |&mut: nb| unsafe {
|
let doread = |nb| unsafe {
|
||||||
let flags = if nb {c::MSG_DONTWAIT} else {0};
|
let flags = if nb {c::MSG_DONTWAIT} else {0};
|
||||||
libc::recv(fd,
|
libc::recv(fd,
|
||||||
buf.as_mut_ptr() as *mut libc::c_void,
|
buf.as_mut_ptr() as *mut libc::c_void,
|
||||||
@ -736,8 +736,8 @@ impl TcpStream {
|
|||||||
|
|
||||||
pub fn write(&mut self, buf: &[u8]) -> IoResult<()> {
|
pub fn write(&mut self, buf: &[u8]) -> IoResult<()> {
|
||||||
let fd = self.fd();
|
let fd = self.fd();
|
||||||
let dolock = |&:| self.lock_nonblocking();
|
let dolock = || self.lock_nonblocking();
|
||||||
let dowrite = |&: nb: bool, buf: *const u8, len: uint| unsafe {
|
let dowrite = |nb: bool, buf: *const u8, len: uint| unsafe {
|
||||||
let flags = if nb {c::MSG_DONTWAIT} else {0};
|
let flags = if nb {c::MSG_DONTWAIT} else {0};
|
||||||
libc::send(fd,
|
libc::send(fd,
|
||||||
buf as *const _,
|
buf as *const _,
|
||||||
@ -871,7 +871,7 @@ impl UdpSocket {
|
|||||||
let mut addrlen: libc::socklen_t =
|
let mut addrlen: libc::socklen_t =
|
||||||
mem::size_of::<libc::sockaddr_storage>() as libc::socklen_t;
|
mem::size_of::<libc::sockaddr_storage>() as libc::socklen_t;
|
||||||
|
|
||||||
let dolock = |&:| self.lock_nonblocking();
|
let dolock = || self.lock_nonblocking();
|
||||||
let n = try!(read(fd, self.read_deadline, dolock, |nb| unsafe {
|
let n = try!(read(fd, self.read_deadline, dolock, |nb| unsafe {
|
||||||
let flags = if nb {c::MSG_DONTWAIT} else {0};
|
let flags = if nb {c::MSG_DONTWAIT} else {0};
|
||||||
libc::recvfrom(fd,
|
libc::recvfrom(fd,
|
||||||
@ -892,8 +892,8 @@ impl UdpSocket {
|
|||||||
let dstp = &storage as *const _ as *const libc::sockaddr;
|
let dstp = &storage as *const _ as *const libc::sockaddr;
|
||||||
|
|
||||||
let fd = self.fd();
|
let fd = self.fd();
|
||||||
let dolock = |&: | self.lock_nonblocking();
|
let dolock = || self.lock_nonblocking();
|
||||||
let dowrite = |&mut: nb, buf: *const u8, len: uint| unsafe {
|
let dowrite = |nb, buf: *const u8, len: uint| unsafe {
|
||||||
let flags = if nb {c::MSG_DONTWAIT} else {0};
|
let flags = if nb {c::MSG_DONTWAIT} else {0};
|
||||||
libc::sendto(fd,
|
libc::sendto(fd,
|
||||||
buf as *const libc::c_void,
|
buf as *const libc::c_void,
|
||||||
|
@ -151,8 +151,8 @@ impl UnixStream {
|
|||||||
|
|
||||||
pub fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
|
pub fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
|
||||||
let fd = self.fd();
|
let fd = self.fd();
|
||||||
let dolock = |&:| self.lock_nonblocking();
|
let dolock = || self.lock_nonblocking();
|
||||||
let doread = |&mut: nb| unsafe {
|
let doread = |nb| unsafe {
|
||||||
let flags = if nb {c::MSG_DONTWAIT} else {0};
|
let flags = if nb {c::MSG_DONTWAIT} else {0};
|
||||||
libc::recv(fd,
|
libc::recv(fd,
|
||||||
buf.as_mut_ptr() as *mut libc::c_void,
|
buf.as_mut_ptr() as *mut libc::c_void,
|
||||||
@ -164,8 +164,8 @@ impl UnixStream {
|
|||||||
|
|
||||||
pub fn write(&mut self, buf: &[u8]) -> IoResult<()> {
|
pub fn write(&mut self, buf: &[u8]) -> IoResult<()> {
|
||||||
let fd = self.fd();
|
let fd = self.fd();
|
||||||
let dolock = |&: | self.lock_nonblocking();
|
let dolock = || self.lock_nonblocking();
|
||||||
let dowrite = |&: nb: bool, buf: *const u8, len: uint| unsafe {
|
let dowrite = |nb: bool, buf: *const u8, len: uint| unsafe {
|
||||||
let flags = if nb {c::MSG_DONTWAIT} else {0};
|
let flags = if nb {c::MSG_DONTWAIT} else {0};
|
||||||
libc::send(fd,
|
libc::send(fd,
|
||||||
buf as *const _,
|
buf as *const _,
|
||||||
|
@ -84,8 +84,8 @@ impl Process {
|
|||||||
mem::transmute::<&ProcessConfig<K,V>,&'static ProcessConfig<K,V>>(cfg)
|
mem::transmute::<&ProcessConfig<K,V>,&'static ProcessConfig<K,V>>(cfg)
|
||||||
};
|
};
|
||||||
|
|
||||||
with_envp(cfg.env(), move|: envp: *const c_void| {
|
with_envp(cfg.env(), move|envp: *const c_void| {
|
||||||
with_argv(cfg.program(), cfg.args(), move|: argv: *const *const libc::c_char| unsafe {
|
with_argv(cfg.program(), cfg.args(), move|argv: *const *const libc::c_char| unsafe {
|
||||||
let (input, mut output) = try!(sys::os::pipe());
|
let (input, mut output) = try!(sys::os::pipe());
|
||||||
|
|
||||||
// We may use this in the child, so perform allocations before the
|
// We may use this in the child, so perform allocations before the
|
||||||
@ -185,7 +185,7 @@ impl Process {
|
|||||||
// up /dev/null into that file descriptor. Otherwise, the first file
|
// up /dev/null into that file descriptor. Otherwise, the first file
|
||||||
// descriptor opened up in the child would be numbered as one of the
|
// descriptor opened up in the child would be numbered as one of the
|
||||||
// stdio file descriptors, which is likely to wreak havoc.
|
// stdio file descriptors, which is likely to wreak havoc.
|
||||||
let setup = |&: src: Option<P>, dst: c_int| {
|
let setup = |src: Option<P>, dst: c_int| {
|
||||||
let src = match src {
|
let src = match src {
|
||||||
None => {
|
None => {
|
||||||
let flags = if dst == libc::STDIN_FILENO {
|
let flags = if dst == libc::STDIN_FILENO {
|
||||||
|
@ -169,7 +169,7 @@ impl Process {
|
|||||||
// Similarly to unix, we don't actually leave holes for the stdio file
|
// Similarly to unix, we don't actually leave holes for the stdio file
|
||||||
// descriptors, but rather open up /dev/null equivalents. These
|
// descriptors, but rather open up /dev/null equivalents. These
|
||||||
// equivalents are drawn from libuv's windows process spawning.
|
// equivalents are drawn from libuv's windows process spawning.
|
||||||
let set_fd = |&: fd: &Option<P>, slot: &mut HANDLE,
|
let set_fd = |fd: &Option<P>, slot: &mut HANDLE,
|
||||||
is_stdin: bool| {
|
is_stdin: bool| {
|
||||||
match *fd {
|
match *fd {
|
||||||
None => {
|
None => {
|
||||||
|
@ -246,7 +246,7 @@ impl Builder {
|
|||||||
{
|
{
|
||||||
let my_packet = Packet(Arc::new(UnsafeCell::new(None)));
|
let my_packet = Packet(Arc::new(UnsafeCell::new(None)));
|
||||||
let their_packet = Packet(my_packet.0.clone());
|
let their_packet = Packet(my_packet.0.clone());
|
||||||
let (native, thread) = self.spawn_inner(Thunk::new(f), Thunk::with_arg(move |: ret| unsafe {
|
let (native, thread) = self.spawn_inner(Thunk::new(f), Thunk::with_arg(move |ret| unsafe {
|
||||||
*their_packet.0.get() = Some(ret);
|
*their_packet.0.get() = Some(ret);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -273,7 +273,7 @@ impl Builder {
|
|||||||
// because by the time that this function is executing we've already
|
// because by the time that this function is executing we've already
|
||||||
// consumed at least a little bit of stack (we don't know the exact byte
|
// consumed at least a little bit of stack (we don't know the exact byte
|
||||||
// address at which our stack started).
|
// address at which our stack started).
|
||||||
let main = move |:| {
|
let main = move || {
|
||||||
let something_around_the_top_of_the_stack = 1;
|
let something_around_the_top_of_the_stack = 1;
|
||||||
let addr = &something_around_the_top_of_the_stack as *const int;
|
let addr = &something_around_the_top_of_the_stack as *const int;
|
||||||
let my_stack_top = addr as uint;
|
let my_stack_top = addr as uint;
|
||||||
@ -289,7 +289,7 @@ impl Builder {
|
|||||||
|
|
||||||
let mut output = None;
|
let mut output = None;
|
||||||
let f: Thunk<(), T> = if stdout.is_some() || stderr.is_some() {
|
let f: Thunk<(), T> = if stdout.is_some() || stderr.is_some() {
|
||||||
Thunk::new(move |:| {
|
Thunk::new(move || {
|
||||||
let _ = stdout.map(stdio::set_stdout);
|
let _ = stdout.map(stdio::set_stdout);
|
||||||
let _ = stderr.map(stdio::set_stderr);
|
let _ = stderr.map(stdio::set_stderr);
|
||||||
f.invoke(())
|
f.invoke(())
|
||||||
|
@ -24,7 +24,7 @@ impl<R> Thunk<(),R> {
|
|||||||
pub fn new<F>(func: F) -> Thunk<(),R>
|
pub fn new<F>(func: F) -> Thunk<(),R>
|
||||||
where F : FnOnce() -> R, F : Send
|
where F : FnOnce() -> R, F : Send
|
||||||
{
|
{
|
||||||
Thunk::with_arg(move|: ()| func())
|
Thunk::with_arg(move|()| func())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,13 +179,13 @@ impl<'a> FnLikeNode<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn kind(self) -> visit::FnKind<'a> {
|
pub fn kind(self) -> visit::FnKind<'a> {
|
||||||
let item = |: p: ItemFnParts<'a>| -> visit::FnKind<'a> {
|
let item = |p: ItemFnParts<'a>| -> visit::FnKind<'a> {
|
||||||
visit::FkItemFn(p.ident, p.generics, p.unsafety, p.abi)
|
visit::FkItemFn(p.ident, p.generics, p.unsafety, p.abi)
|
||||||
};
|
};
|
||||||
let closure = |: _: ClosureParts| {
|
let closure = |_: ClosureParts| {
|
||||||
visit::FkFnBlock
|
visit::FkFnBlock
|
||||||
};
|
};
|
||||||
let method = |: m: &'a ast::Method| {
|
let method = |m: &'a ast::Method| {
|
||||||
visit::FkMethod(m.pe_ident(), m.pe_generics(), m)
|
visit::FkMethod(m.pe_ident(), m.pe_generics(), m)
|
||||||
};
|
};
|
||||||
self.handle(item, method, closure)
|
self.handle(item, method, closure)
|
||||||
|
@ -63,7 +63,7 @@ fn cs_clone(
|
|||||||
cx.ident_of("Clone"),
|
cx.ident_of("Clone"),
|
||||||
cx.ident_of("clone"),
|
cx.ident_of("clone"),
|
||||||
];
|
];
|
||||||
let subcall = |&: field: &FieldInfo| {
|
let subcall = |field: &FieldInfo| {
|
||||||
let args = vec![cx.expr_addr_of(field.span, field.self_.clone())];
|
let args = vec![cx.expr_addr_of(field.span, field.self_.clone())];
|
||||||
|
|
||||||
cx.expr_call_global(field.span, fn_path.clone(), args)
|
cx.expr_call_global(field.span, fn_path.clone(), args)
|
||||||
|
@ -57,7 +57,7 @@ fn default_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructur
|
|||||||
cx.ident_of("Default"),
|
cx.ident_of("Default"),
|
||||||
cx.ident_of("default")
|
cx.ident_of("default")
|
||||||
);
|
);
|
||||||
let default_call = |&: span| cx.expr_call_global(span, default_ident.clone(), Vec::new());
|
let default_call = |span| cx.expr_call_global(span, default_ident.clone(), Vec::new());
|
||||||
|
|
||||||
return match *substr.fields {
|
return match *substr.fields {
|
||||||
StaticStruct(_, ref summary) => {
|
StaticStruct(_, ref summary) => {
|
||||||
|
@ -957,7 +957,7 @@ impl<'a> MethodDef<'a> {
|
|||||||
// where each tuple has length = self_args.len()
|
// where each tuple has length = self_args.len()
|
||||||
let mut match_arms: Vec<ast::Arm> = variants.iter().enumerate()
|
let mut match_arms: Vec<ast::Arm> = variants.iter().enumerate()
|
||||||
.map(|(index, variant)| {
|
.map(|(index, variant)| {
|
||||||
let mk_self_pat = |&: cx: &mut ExtCtxt, self_arg_name: &str| {
|
let mk_self_pat = |cx: &mut ExtCtxt, self_arg_name: &str| {
|
||||||
let (p, idents) = trait_.create_enum_variant_pattern(cx, type_ident,
|
let (p, idents) = trait_.create_enum_variant_pattern(cx, type_ident,
|
||||||
&**variant,
|
&**variant,
|
||||||
self_arg_name,
|
self_arg_name,
|
||||||
|
@ -66,7 +66,7 @@ fn hash_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure)
|
|||||||
[ref state_expr] => state_expr,
|
[ref state_expr] => state_expr,
|
||||||
_ => cx.span_bug(trait_span, "incorrect number of arguments in `derive(Hash)`")
|
_ => cx.span_bug(trait_span, "incorrect number of arguments in `derive(Hash)`")
|
||||||
};
|
};
|
||||||
let call_hash = |&: span, thing_expr| {
|
let call_hash = |span, thing_expr| {
|
||||||
let hash_path = {
|
let hash_path = {
|
||||||
let strs = vec![
|
let strs = vec![
|
||||||
cx.ident_of("std"),
|
cx.ident_of("std"),
|
||||||
|
@ -70,7 +70,7 @@ fn rand_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure)
|
|||||||
cx.ident_of("Rand"),
|
cx.ident_of("Rand"),
|
||||||
cx.ident_of("rand")
|
cx.ident_of("rand")
|
||||||
);
|
);
|
||||||
let rand_call = |&: cx: &mut ExtCtxt, span| {
|
let rand_call = |cx: &mut ExtCtxt, span| {
|
||||||
cx.expr_call_global(span,
|
cx.expr_call_global(span,
|
||||||
rand_ident.clone(),
|
rand_ident.clone(),
|
||||||
vec!(rng.clone()))
|
vec!(rng.clone()))
|
||||||
|
@ -1089,7 +1089,7 @@ fn expand_annotatable(a: Annotatable,
|
|||||||
// but that double-mut-borrows fld
|
// but that double-mut-borrows fld
|
||||||
let mut items: SmallVector<P<ast::Item>> = SmallVector::zero();
|
let mut items: SmallVector<P<ast::Item>> = SmallVector::zero();
|
||||||
dec.expand(fld.cx, attr.span, &*attr.node.value, &**it,
|
dec.expand(fld.cx, attr.span, &*attr.node.value, &**it,
|
||||||
box |&mut: item| items.push(item));
|
box |item| items.push(item));
|
||||||
decorator_items.extend(items.into_iter()
|
decorator_items.extend(items.into_iter()
|
||||||
.flat_map(|item| expand_item(item, fld).into_iter()));
|
.flat_map(|item| expand_item(item, fld).into_iter()));
|
||||||
|
|
||||||
@ -1850,7 +1850,7 @@ mod test {
|
|||||||
assert!((shouldmatch.len() == 0) ||
|
assert!((shouldmatch.len() == 0) ||
|
||||||
(varrefs.len() > *shouldmatch.iter().max().unwrap()));
|
(varrefs.len() > *shouldmatch.iter().max().unwrap()));
|
||||||
for (idx,varref) in varrefs.iter().enumerate() {
|
for (idx,varref) in varrefs.iter().enumerate() {
|
||||||
let print_hygiene_debug_info = |&:| {
|
let print_hygiene_debug_info = || {
|
||||||
// good lord, you can't make a path with 0 segments, can you?
|
// good lord, you can't make a path with 0 segments, can you?
|
||||||
let final_varref_ident = match varref.segments.last() {
|
let final_varref_ident = match varref.segments.last() {
|
||||||
Some(pathsegment) => pathsegment.identifier,
|
Some(pathsegment) => pathsegment.identifier,
|
||||||
|
@ -307,7 +307,7 @@ impl<'a, 'b> Context<'a, 'b> {
|
|||||||
|
|
||||||
fn trans_count(&self, c: parse::Count) -> P<ast::Expr> {
|
fn trans_count(&self, c: parse::Count) -> P<ast::Expr> {
|
||||||
let sp = self.fmtsp;
|
let sp = self.fmtsp;
|
||||||
let count = |: c, arg| {
|
let count = |c, arg| {
|
||||||
let mut path = Context::rtpath(self.ecx, "Count");
|
let mut path = Context::rtpath(self.ecx, "Count");
|
||||||
path.push(self.ecx.ident_of(c));
|
path.push(self.ecx.ident_of(c));
|
||||||
match arg {
|
match arg {
|
||||||
@ -353,7 +353,7 @@ impl<'a, 'b> Context<'a, 'b> {
|
|||||||
parse::NextArgument(ref arg) => {
|
parse::NextArgument(ref arg) => {
|
||||||
// Translate the position
|
// Translate the position
|
||||||
let pos = {
|
let pos = {
|
||||||
let pos = |: c, arg| {
|
let pos = |c, arg| {
|
||||||
let mut path = Context::rtpath(self.ecx, "Position");
|
let mut path = Context::rtpath(self.ecx, "Position");
|
||||||
path.push(self.ecx.ident_of(c));
|
path.push(self.ecx.ident_of(c));
|
||||||
match arg {
|
match arg {
|
||||||
@ -404,7 +404,7 @@ impl<'a, 'b> Context<'a, 'b> {
|
|||||||
|
|
||||||
// Translate the format
|
// Translate the format
|
||||||
let fill = self.ecx.expr_lit(sp, ast::LitChar(fill));
|
let fill = self.ecx.expr_lit(sp, ast::LitChar(fill));
|
||||||
let align = |:name| {
|
let align = |name| {
|
||||||
let mut p = Context::rtpath(self.ecx, "Alignment");
|
let mut p = Context::rtpath(self.ecx, "Alignment");
|
||||||
p.push(self.ecx.ident_of(name));
|
p.push(self.ecx.ident_of(name));
|
||||||
self.ecx.path_global(sp, p)
|
self.ecx.path_global(sp, p)
|
||||||
|
@ -791,11 +791,11 @@ fn expand_parse_call(cx: &ExtCtxt,
|
|||||||
tts: &[ast::TokenTree]) -> P<ast::Expr> {
|
tts: &[ast::TokenTree]) -> P<ast::Expr> {
|
||||||
let (cx_expr, tts_expr) = expand_tts(cx, sp, tts);
|
let (cx_expr, tts_expr) = expand_tts(cx, sp, tts);
|
||||||
|
|
||||||
let cfg_call = |&:| cx.expr_method_call(
|
let cfg_call = || cx.expr_method_call(
|
||||||
sp, cx.expr_ident(sp, id_ext("ext_cx")),
|
sp, cx.expr_ident(sp, id_ext("ext_cx")),
|
||||||
id_ext("cfg"), Vec::new());
|
id_ext("cfg"), Vec::new());
|
||||||
|
|
||||||
let parse_sess_call = |&:| cx.expr_method_call(
|
let parse_sess_call = || cx.expr_method_call(
|
||||||
sp, cx.expr_ident(sp, id_ext("ext_cx")),
|
sp, cx.expr_ident(sp, id_ext("ext_cx")),
|
||||||
id_ext("parse_sess"), Vec::new());
|
id_ext("parse_sess"), Vec::new());
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ pub fn new_parser_from_tts<'a>(sess: &'a ParseSess,
|
|||||||
/// add the path to the session's codemap and return the new filemap.
|
/// add the path to the session's codemap and return the new filemap.
|
||||||
pub fn file_to_filemap(sess: &ParseSess, path: &Path, spanopt: Option<Span>)
|
pub fn file_to_filemap(sess: &ParseSess, path: &Path, spanopt: Option<Span>)
|
||||||
-> Rc<FileMap> {
|
-> Rc<FileMap> {
|
||||||
let err = |&: msg: &str| {
|
let err = |msg: &str| {
|
||||||
match spanopt {
|
match spanopt {
|
||||||
Some(sp) => sess.span_diagnostic.span_fatal(sp, msg),
|
Some(sp) => sess.span_diagnostic.span_fatal(sp, msg),
|
||||||
None => sess.span_diagnostic.handler().fatal(msg),
|
None => sess.span_diagnostic.handler().fatal(msg),
|
||||||
@ -406,7 +406,7 @@ pub fn char_lit(lit: &str) -> (char, isize) {
|
|||||||
.map(|x| (x, len as isize))
|
.map(|x| (x, len as isize))
|
||||||
}
|
}
|
||||||
|
|
||||||
let unicode_escape = |&: | -> Option<(char, isize)>
|
let unicode_escape = || -> Option<(char, isize)>
|
||||||
if lit.as_bytes()[2] == b'{' {
|
if lit.as_bytes()[2] == b'{' {
|
||||||
let idx = lit.find('}').expect(msg2);
|
let idx = lit.find('}').expect(msg2);
|
||||||
let subslice = &lit[3..idx];
|
let subslice = &lit[3..idx];
|
||||||
@ -433,7 +433,7 @@ pub fn str_lit(lit: &str) -> String {
|
|||||||
let mut res = String::with_capacity(lit.len());
|
let mut res = String::with_capacity(lit.len());
|
||||||
|
|
||||||
// FIXME #8372: This could be a for-loop if it didn't borrow the iterator
|
// FIXME #8372: This could be a for-loop if it didn't borrow the iterator
|
||||||
let error = |&: i| format!("lexer should have rejected {} at {}", lit, i);
|
let error = |i| format!("lexer should have rejected {} at {}", lit, i);
|
||||||
|
|
||||||
/// Eat everything up to a non-whitespace
|
/// Eat everything up to a non-whitespace
|
||||||
fn eat<'a>(it: &mut iter::Peekable<str::CharIndices<'a>>) {
|
fn eat<'a>(it: &mut iter::Peekable<str::CharIndices<'a>>) {
|
||||||
@ -568,7 +568,7 @@ pub fn float_lit(s: &str, suffix: Option<&str>, sd: &SpanHandler, sp: Span) -> a
|
|||||||
|
|
||||||
/// Parse a string representing a byte literal into its final form. Similar to `char_lit`
|
/// Parse a string representing a byte literal into its final form. Similar to `char_lit`
|
||||||
pub fn byte_lit(lit: &str) -> (u8, usize) {
|
pub fn byte_lit(lit: &str) -> (u8, usize) {
|
||||||
let err = |&: i| format!("lexer accepted invalid byte literal {} step {}", lit, i);
|
let err = |i| format!("lexer accepted invalid byte literal {} step {}", lit, i);
|
||||||
|
|
||||||
if lit.len() == 1 {
|
if lit.len() == 1 {
|
||||||
(lit.as_bytes()[0], 1)
|
(lit.as_bytes()[0], 1)
|
||||||
@ -602,7 +602,7 @@ pub fn binary_lit(lit: &str) -> Rc<Vec<u8>> {
|
|||||||
let mut res = Vec::with_capacity(lit.len());
|
let mut res = Vec::with_capacity(lit.len());
|
||||||
|
|
||||||
// FIXME #8372: This could be a for-loop if it didn't borrow the iterator
|
// FIXME #8372: This could be a for-loop if it didn't borrow the iterator
|
||||||
let error = |&: i| format!("lexer should have rejected {} at {}", lit, i);
|
let error = |i| format!("lexer should have rejected {} at {}", lit, i);
|
||||||
|
|
||||||
/// Eat everything up to a non-whitespace
|
/// Eat everything up to a non-whitespace
|
||||||
fn eat<'a, I: Iterator<Item=(usize, u8)>>(it: &mut iter::Peekable<I>) {
|
fn eat<'a, I: Iterator<Item=(usize, u8)>>(it: &mut iter::Peekable<I>) {
|
||||||
|
@ -609,11 +609,11 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> P<ast::Expr> {
|
|||||||
let test_id = ecx.ident_of("test");
|
let test_id = ecx.ident_of("test");
|
||||||
|
|
||||||
// creates self::test::$name
|
// creates self::test::$name
|
||||||
let test_path = |&: name| {
|
let test_path = |name| {
|
||||||
ecx.path(span, vec![self_id, test_id, ecx.ident_of(name)])
|
ecx.path(span, vec![self_id, test_id, ecx.ident_of(name)])
|
||||||
};
|
};
|
||||||
// creates $name: $expr
|
// creates $name: $expr
|
||||||
let field = |&: name, expr| ecx.field_imm(span, ecx.ident_of(name), expr);
|
let field = |name, expr| ecx.field_imm(span, ecx.ident_of(name), expr);
|
||||||
|
|
||||||
debug!("encoding {}", ast_util::path_name_i(&path[]));
|
debug!("encoding {}", ast_util::path_name_i(&path[]));
|
||||||
|
|
||||||
@ -627,7 +627,7 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> P<ast::Expr> {
|
|||||||
vec![name_expr]);
|
vec![name_expr]);
|
||||||
|
|
||||||
let ignore_expr = ecx.expr_bool(span, test.ignore);
|
let ignore_expr = ecx.expr_bool(span, test.ignore);
|
||||||
let should_fail_path = |&: name| {
|
let should_fail_path = |name| {
|
||||||
ecx.path(span, vec![self_id, test_id, ecx.ident_of("ShouldFail"), ecx.ident_of(name)])
|
ecx.path(span, vec![self_id, test_id, ecx.ident_of("ShouldFail"), ecx.ident_of(name)])
|
||||||
};
|
};
|
||||||
let fail_expr = match test.should_fail {
|
let fail_expr = match test.should_fail {
|
||||||
|
@ -89,12 +89,12 @@ impl UnicodeStr for str {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn trim_left(&self) -> &str {
|
fn trim_left(&self) -> &str {
|
||||||
self.trim_left_matches(|&: c: char| c.is_whitespace())
|
self.trim_left_matches(|c: char| c.is_whitespace())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn trim_right(&self) -> &str {
|
fn trim_right(&self) -> &str {
|
||||||
self.trim_right_matches(|&: c: char| c.is_whitespace())
|
self.trim_right_matches(|c: char| c.is_whitespace())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,5 +12,5 @@
|
|||||||
#![crate_type = "rlib"]
|
#![crate_type = "rlib"]
|
||||||
|
|
||||||
pub fn inner<F>(f: F) -> F {
|
pub fn inner<F>(f: F) -> F {
|
||||||
(move |:| f)()
|
(move || f)()
|
||||||
}
|
}
|
||||||
|
@ -12,5 +12,5 @@
|
|||||||
|
|
||||||
pub fn foo<T>() {
|
pub fn foo<T>() {
|
||||||
fn death() -> int { panic!() }
|
fn death() -> int { panic!() }
|
||||||
debug!("{}", (|&:|{ death() })());
|
debug!("{}", (||{ death() })());
|
||||||
}
|
}
|
||||||
|
@ -15,14 +15,14 @@ use std::ops::Add;
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn has_closures() -> uint {
|
pub fn has_closures() -> uint {
|
||||||
let x = 1u;
|
let x = 1u;
|
||||||
let mut f = move |&mut:| x;
|
let mut f = move || x;
|
||||||
let y = 1u;
|
let y = 1u;
|
||||||
let g = |:| y;
|
let g = || y;
|
||||||
f() + g()
|
f() + g()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn has_generic_closures<T: Add<Output=T> + Copy>(x: T, y: T) -> T {
|
pub fn has_generic_closures<T: Add<Output=T> + Copy>(x: T, y: T) -> T {
|
||||||
let mut f = move |&mut:| x;
|
let mut f = move || x;
|
||||||
let g = |:| y;
|
let g = || y;
|
||||||
f() + g()
|
f() + g()
|
||||||
}
|
}
|
||||||
|
@ -251,6 +251,6 @@ fn parallel<'a, I, T, F>(iter: I, f: F)
|
|||||||
fn main() {
|
fn main() {
|
||||||
let mut data = read_to_end(&mut stdin_raw()).unwrap();
|
let mut data = read_to_end(&mut stdin_raw()).unwrap();
|
||||||
let tables = &Tables::new();
|
let tables = &Tables::new();
|
||||||
parallel(mut_dna_seqs(data.as_mut_slice()), |&: seq| reverse_complement(seq, tables));
|
parallel(mut_dna_seqs(data.as_mut_slice()), |seq| reverse_complement(seq, tables));
|
||||||
stdout_raw().write(data.as_mut_slice()).unwrap();
|
stdout_raw().write(data.as_mut_slice()).unwrap();
|
||||||
}
|
}
|
||||||
|
@ -27,5 +27,5 @@ fn cat(in_x : usize, in_y : isize) -> cat {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let nyan : cat = cat(52us, 99);
|
let nyan : cat = cat(52us, 99);
|
||||||
nyan.speak = |&:| println!("meow"); //~ ERROR attempted to take value of method
|
nyan.speak = || println!("meow"); //~ ERROR attempted to take value of method
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ mod bar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let foo = |&:| false;
|
let foo = || false;
|
||||||
use bar::foo;
|
use bar::foo;
|
||||||
//~^ ERROR imports are not allowed after non-item statements
|
//~^ ERROR imports are not allowed after non-item statements
|
||||||
assert_eq!(foo(), false);
|
assert_eq!(foo(), false);
|
||||||
|
@ -49,15 +49,15 @@ fn test5(f: &mut Test) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn test6() {
|
fn test6() {
|
||||||
let mut f = |&mut:| {};
|
let mut f = || {};
|
||||||
(|&mut:| {
|
(|| {
|
||||||
f();
|
f();
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test7() {
|
fn test7() {
|
||||||
fn foo<F>(_: F) where F: FnMut(Box<FnMut(isize)>, isize) {}
|
fn foo<F>(_: F) where F: FnMut(Box<FnMut(isize)>, isize) {}
|
||||||
let mut f = |&mut: g: Box<FnMut(isize)>, b: isize| {};
|
let mut f = |g: Box<FnMut(isize)>, b: isize| {};
|
||||||
f(box |a| {
|
f(box |a| {
|
||||||
foo(f);
|
foo(f);
|
||||||
//~^ ERROR cannot move `f` into closure because it is borrowed
|
//~^ ERROR cannot move `f` into closure because it is borrowed
|
||||||
|
@ -23,37 +23,37 @@ fn set(x: &mut isize) {
|
|||||||
|
|
||||||
fn a() {
|
fn a() {
|
||||||
let mut x = 3;
|
let mut x = 3;
|
||||||
let c1 = |&mut:| x = 4;
|
let c1 = || x = 4;
|
||||||
let c2 = |&mut:| x * 5; //~ ERROR cannot borrow `x`
|
let c2 = || x * 5; //~ ERROR cannot borrow `x`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn b() {
|
fn b() {
|
||||||
let mut x = 3;
|
let mut x = 3;
|
||||||
let c1 = |&mut:| set(&mut x);
|
let c1 = || set(&mut x);
|
||||||
let c2 = |&mut:| get(&x); //~ ERROR cannot borrow `x`
|
let c2 = || get(&x); //~ ERROR cannot borrow `x`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn c() {
|
fn c() {
|
||||||
let mut x = 3;
|
let mut x = 3;
|
||||||
let c1 = |&mut:| set(&mut x);
|
let c1 = || set(&mut x);
|
||||||
let c2 = |&mut:| x * 5; //~ ERROR cannot borrow `x`
|
let c2 = || x * 5; //~ ERROR cannot borrow `x`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn d() {
|
fn d() {
|
||||||
let mut x = 3;
|
let mut x = 3;
|
||||||
let c2 = |&mut:| x * 5;
|
let c2 = || x * 5;
|
||||||
x = 5; //~ ERROR cannot assign
|
x = 5; //~ ERROR cannot assign
|
||||||
}
|
}
|
||||||
|
|
||||||
fn e() {
|
fn e() {
|
||||||
let mut x = 3;
|
let mut x = 3;
|
||||||
let c1 = |&mut:| get(&x);
|
let c1 = || get(&x);
|
||||||
x = 5; //~ ERROR cannot assign
|
x = 5; //~ ERROR cannot assign
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f() {
|
fn f() {
|
||||||
let mut x = box 3;
|
let mut x = box 3;
|
||||||
let c1 = |&mut:| get(&*x);
|
let c1 = || get(&*x);
|
||||||
*x = 5; //~ ERROR cannot assign
|
*x = 5; //~ ERROR cannot assign
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ fn g() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut x = box Foo { f: box 3 };
|
let mut x = box Foo { f: box 3 };
|
||||||
let c1 = |&mut:| get(&*x.f);
|
let c1 = || get(&*x.f);
|
||||||
*x.f = 5; //~ ERROR cannot assign to `*x.f`
|
*x.f = 5; //~ ERROR cannot assign to `*x.f`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,8 +73,8 @@ fn h() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut x = box Foo { f: box 3 };
|
let mut x = box Foo { f: box 3 };
|
||||||
let c1 = |&mut:| get(&*x.f);
|
let c1 = || get(&*x.f);
|
||||||
let c2 = |&mut:| *x.f = 5; //~ ERROR cannot borrow `x` as mutable
|
let c2 = || *x.f = 5; //~ ERROR cannot borrow `x` as mutable
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -20,9 +20,9 @@ fn set(x: &mut isize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn a(x: &isize) {
|
fn a(x: &isize) {
|
||||||
let c1 = |&mut:| set(&mut *x);
|
let c1 = || set(&mut *x);
|
||||||
//~^ ERROR cannot borrow
|
//~^ ERROR cannot borrow
|
||||||
let c2 = |&mut:| set(&mut *x);
|
let c2 = || set(&mut *x);
|
||||||
//~^ ERROR cannot borrow
|
//~^ ERROR cannot borrow
|
||||||
//~| ERROR closure requires unique access
|
//~| ERROR closure requires unique access
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,12 @@
|
|||||||
|
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
|
fn to_fn_mut<F: FnMut()>(f: F) -> F { f }
|
||||||
|
|
||||||
fn a() {
|
fn a() {
|
||||||
let mut x = 3;
|
let mut x = 3;
|
||||||
let c1 = |&mut:| x = 4;
|
let c1 = to_fn_mut(|| x = 4);
|
||||||
let c2 = |&mut:| x = 5; //~ ERROR cannot borrow `x` as mutable more than once
|
let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set(x: &mut isize) {
|
fn set(x: &mut isize) {
|
||||||
@ -26,20 +28,20 @@ fn set(x: &mut isize) {
|
|||||||
|
|
||||||
fn b() {
|
fn b() {
|
||||||
let mut x = 3;
|
let mut x = 3;
|
||||||
let c1 = |&mut:| set(&mut x);
|
let c1 = to_fn_mut(|| set(&mut x));
|
||||||
let c2 = |&mut:| set(&mut x); //~ ERROR cannot borrow `x` as mutable more than once
|
let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
|
||||||
}
|
}
|
||||||
|
|
||||||
fn c() {
|
fn c() {
|
||||||
let mut x = 3;
|
let mut x = 3;
|
||||||
let c1 = |&mut:| x = 5;
|
let c1 = to_fn_mut(|| x = 5);
|
||||||
let c2 = |&mut:| set(&mut x); //~ ERROR cannot borrow `x` as mutable more than once
|
let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
|
||||||
}
|
}
|
||||||
|
|
||||||
fn d() {
|
fn d() {
|
||||||
let mut x = 3;
|
let mut x = 3;
|
||||||
let c1 = |&mut:| x = 5;
|
let c1 = to_fn_mut(|| x = 5);
|
||||||
let c2 = |&mut:| { let _y = |&mut:| set(&mut x); }; // (nested closure)
|
let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
|
||||||
//~^ ERROR cannot borrow `x` as mutable more than once
|
//~^ ERROR cannot borrow `x` as mutable more than once
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,8 +51,8 @@ fn g() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut x = box Foo { f: box 3 };
|
let mut x = box Foo { f: box 3 };
|
||||||
let c1 = |&mut:| set(&mut *x.f);
|
let c1 = to_fn_mut(|| set(&mut *x.f));
|
||||||
let c2 = |&mut:| set(&mut *x.f);
|
let c2 = to_fn_mut(|| set(&mut *x.f));
|
||||||
//~^ ERROR cannot borrow `x` as mutable more than once
|
//~^ ERROR cannot borrow `x` as mutable more than once
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ pub fn main() {
|
|||||||
let mut this = &mut Foo {
|
let mut this = &mut Foo {
|
||||||
x: 1,
|
x: 1,
|
||||||
};
|
};
|
||||||
let mut r = |&mut:| {
|
let mut r = || {
|
||||||
let p = &this.x;
|
let p = &this.x;
|
||||||
&mut this.x; //~ ERROR cannot borrow
|
&mut this.x; //~ ERROR cannot borrow
|
||||||
};
|
};
|
||||||
|
@ -23,27 +23,27 @@ fn set(x: &mut isize) -> isize {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn a(x: &mut isize) {
|
fn a(x: &mut isize) {
|
||||||
let c1 = |&mut:| get(x);
|
let c1 = || get(x);
|
||||||
let c2 = |&mut:| get(x);
|
let c2 = || get(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn b(x: &mut isize) {
|
fn b(x: &mut isize) {
|
||||||
let c1 = |&mut:| get(x);
|
let c1 = || get(x);
|
||||||
let c2 = |&mut:| set(x); //~ ERROR closure requires unique access to `x`
|
let c2 = || set(x); //~ ERROR closure requires unique access to `x`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn c(x: &mut isize) {
|
fn c(x: &mut isize) {
|
||||||
let c1 = |&mut:| get(x);
|
let c1 = || get(x);
|
||||||
let c2 = |&mut:| { get(x); set(x); }; //~ ERROR closure requires unique access to `x`
|
let c2 = || { get(x); set(x); }; //~ ERROR closure requires unique access to `x`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn d(x: &mut isize) {
|
fn d(x: &mut isize) {
|
||||||
let c1 = |&mut:| set(x);
|
let c1 = || set(x);
|
||||||
let c2 = |&mut:| set(x); //~ ERROR closure requires unique access to `x`
|
let c2 = || set(x); //~ ERROR closure requires unique access to `x`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn e(x: &mut isize) {
|
fn e(x: &mut isize) {
|
||||||
let c1 = |&mut:| x = panic!(); //~ ERROR closure cannot assign to immutable local variable
|
let c1 = || x = panic!(); //~ ERROR closure cannot assign to immutable local variable
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -26,7 +26,7 @@ impl Drop for Foo {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut ptr = box Foo { x: 0 };
|
let mut ptr = box Foo { x: 0 };
|
||||||
let mut test = |&mut: foo: &Foo| {
|
let mut test = |foo: &Foo| {
|
||||||
ptr = box Foo { x: ptr.x + 1 };
|
ptr = box Foo { x: ptr.x + 1 };
|
||||||
};
|
};
|
||||||
test(&*ptr); //~ ERROR cannot borrow `*ptr`
|
test(&*ptr); //~ ERROR cannot borrow `*ptr`
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let j = |&:| -> isize {
|
let j = || -> isize {
|
||||||
let i: isize;
|
let i: isize;
|
||||||
i //~ ERROR use of possibly uninitialized variable: `i`
|
i //~ ERROR use of possibly uninitialized variable: `i`
|
||||||
};
|
};
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let f = |&:| -> isize {
|
let f = || -> isize {
|
||||||
let i: isize;
|
let i: isize;
|
||||||
i //~ ERROR use of possibly uninitialized variable: `i`
|
i //~ ERROR use of possibly uninitialized variable: `i`
|
||||||
};
|
};
|
||||||
|
@ -32,7 +32,7 @@ fn foo() {
|
|||||||
|
|
||||||
fn bar() {
|
fn bar() {
|
||||||
// Original borrow ends at end of closure
|
// Original borrow ends at end of closure
|
||||||
|&:| {
|
|| {
|
||||||
let mut x = 1us;
|
let mut x = 1us;
|
||||||
let y = &mut x;
|
let y = &mut x;
|
||||||
let z = &mut x; //~ ERROR cannot borrow
|
let z = &mut x; //~ ERROR cannot borrow
|
||||||
|
@ -14,10 +14,10 @@ fn to_fn_once<A,F:FnOnce<A>>(f: F) -> F { f }
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = 1;
|
let x = 1;
|
||||||
to_fn_once(move|:| { x = 2; });
|
to_fn_once(move|| { x = 2; });
|
||||||
//~^ ERROR: cannot assign to immutable captured outer variable
|
//~^ ERROR: cannot assign to immutable captured outer variable
|
||||||
|
|
||||||
let s = std::old_io::stdin();
|
let s = std::old_io::stdin();
|
||||||
to_fn_once(move|:| { s.read_to_end(); });
|
to_fn_once(move|| { s.read_to_end(); });
|
||||||
//~^ ERROR: cannot borrow immutable captured outer variable
|
//~^ ERROR: cannot borrow immutable captured outer variable
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ fn call_bare(f: fn(&str)) {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let string = "world!";
|
let string = "world!";
|
||||||
let f = |&: s: &str| println!("{}{}", s, string);
|
let f = |s: &str| println!("{}{}", s, string);
|
||||||
call_bare(f) //~ ERROR mismatched types
|
call_bare(f) //~ ERROR mismatched types
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#![deny(unreachable_code)]
|
#![deny(unreachable_code)]
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = |:| panic!();
|
let x = || panic!();
|
||||||
x();
|
x();
|
||||||
std::io::println("Foo bar"); //~ ERROR: unreachable statement
|
std::io::println("Foo bar"); //~ ERROR: unreachable statement
|
||||||
}
|
}
|
||||||
|
@ -14,20 +14,20 @@
|
|||||||
fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {}
|
fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _: () = (box |:_: isize| {}) as Box<FnOnce(isize)>;
|
let _: () = (box |_: isize| {}) as Box<FnOnce(isize)>;
|
||||||
//~^ ERROR object-safe
|
//~^ ERROR object-safe
|
||||||
//~| ERROR mismatched types
|
//~| ERROR mismatched types
|
||||||
//~| expected `()`
|
//~| expected `()`
|
||||||
//~| found `Box<core::ops::FnOnce(isize)>`
|
//~| found `Box<core::ops::FnOnce(isize)>`
|
||||||
//~| expected ()
|
//~| expected ()
|
||||||
//~| found box
|
//~| found box
|
||||||
let _: () = (box |&:_: isize, isize| {}) as Box<Fn(isize, isize)>;
|
let _: () = (box |_: isize, isize| {}) as Box<Fn(isize, isize)>;
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected `()`
|
//~| expected `()`
|
||||||
//~| found `Box<core::ops::Fn(isize, isize)>`
|
//~| found `Box<core::ops::Fn(isize, isize)>`
|
||||||
//~| expected ()
|
//~| expected ()
|
||||||
//~| found box
|
//~| found box
|
||||||
let _: () = (box |&mut:| -> isize unimplemented!()) as Box<FnMut() -> isize>;
|
let _: () = (box || -> isize unimplemented!()) as Box<FnMut() -> isize>;
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected `()`
|
//~| expected `()`
|
||||||
//~| found `Box<core::ops::FnMut() -> isize>`
|
//~| found `Box<core::ops::FnMut() -> isize>`
|
||||||
|
@ -14,7 +14,7 @@ fn f(y: Box<isize>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn g() {
|
fn g() {
|
||||||
let _frob = |&: q: Box<isize>| { *q = 2; }; //~ ERROR cannot assign
|
let _frob = |q: Box<isize>| { *q = 2; }; //~ ERROR cannot assign
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = box 1;
|
let x = box 1;
|
||||||
let f = move|:| {
|
let f = move|| {
|
||||||
let _a = x;
|
let _a = x;
|
||||||
drop(x);
|
drop(x);
|
||||||
//~^ ERROR: use of moved value: `x`
|
//~^ ERROR: use of moved value: `x`
|
||||||
|
@ -22,7 +22,7 @@ impl Drop for Foo {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut ptr = box Foo { x: 0 };
|
let mut ptr = box Foo { x: 0 };
|
||||||
let mut test = |&mut: foo: &Foo| {
|
let mut test = |foo: &Foo| {
|
||||||
println!("access {}", foo.x);
|
println!("access {}", foo.x);
|
||||||
ptr = box Foo { x: ptr.x + 1 };
|
ptr = box Foo { x: ptr.x + 1 };
|
||||||
println!("access {}", foo.x);
|
println!("access {}", foo.x);
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut v = vec!(1);
|
let mut v = vec!(1);
|
||||||
let mut f = |&mut:| v.push(2);
|
let mut f = || v.push(2);
|
||||||
let _w = v; //~ ERROR: cannot move out of `v`
|
let _w = v; //~ ERROR: cannot move out of `v`
|
||||||
|
|
||||||
f();
|
f();
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// wrong arity.
|
// wrong arity.
|
||||||
|
|
||||||
fn _foo<F: Fn()> (f: F) {
|
fn _foo<F: Fn()> (f: F) {
|
||||||
|&: t| f(t); //~ ERROR E0057
|
|t| f(t); //~ ERROR E0057
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -14,5 +14,5 @@ struct B<T>;
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let foo = B;
|
let foo = B;
|
||||||
let closure = |:| foo; //~ ERROR unable to infer enough type information
|
let closure = || foo; //~ ERROR unable to infer enough type information
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
(|&:| box *[0us].as_slice())();
|
(|| box *[0us].as_slice())();
|
||||||
//~^ ERROR cannot move out of borrowed content
|
//~^ ERROR cannot move out of borrowed content
|
||||||
//~^^ ERROR cannot move a value of type [usize]
|
//~^^ ERROR cannot move a value of type [usize]
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user