Changed most vec! invocations to use square braces
Most of the Rust community agrees that the vec! macro is clearer when called using square brackets [] instead of regular brackets (). Most of these ocurrences are from before macros allowed using different types of brackets. There is one left unchanged in a pretty-print test, as the pretty printer still wants it to have regular brackets.
This commit is contained in:
parent
f26eedb571
commit
e593c3b893
189 changed files with 511 additions and 511 deletions
|
@ -1170,7 +1170,7 @@ impl<T> [T] {
|
||||||
/// let x = s.into_vec();
|
/// let x = s.into_vec();
|
||||||
/// // `s` cannot be used anymore because it has been converted into `x`.
|
/// // `s` cannot be used anymore because it has been converted into `x`.
|
||||||
///
|
///
|
||||||
/// assert_eq!(x, vec!(10, 40, 30));
|
/// assert_eq!(x, vec![10, 40, 30]);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -148,7 +148,7 @@ use super::range::RangeArgument;
|
||||||
/// [`Index`] trait. An example will be more explicit:
|
/// [`Index`] trait. An example will be more explicit:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// let v = vec!(0, 2, 4, 6);
|
/// let v = vec![0, 2, 4, 6];
|
||||||
/// println!("{}", v[1]); // it will display '2'
|
/// println!("{}", v[1]); // it will display '2'
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
|
@ -156,7 +156,7 @@ use super::range::RangeArgument;
|
||||||
/// your software will panic! You cannot do this:
|
/// your software will panic! You cannot do this:
|
||||||
///
|
///
|
||||||
/// ```ignore
|
/// ```ignore
|
||||||
/// let v = vec!(0, 2, 4, 6);
|
/// let v = vec![0, 2, 4, 6];
|
||||||
/// println!("{}", v[6]); // it will panic!
|
/// println!("{}", v[6]); // it will panic!
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
|
@ -173,7 +173,7 @@ use super::range::RangeArgument;
|
||||||
/// // ...
|
/// // ...
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// let v = vec!(0, 1);
|
/// let v = vec![0, 1];
|
||||||
/// read_slice(&v);
|
/// read_slice(&v);
|
||||||
///
|
///
|
||||||
/// // ... and that's all!
|
/// // ... and that's all!
|
||||||
|
|
|
@ -914,12 +914,12 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
|
||||||
/// ```
|
/// ```
|
||||||
/// use std::u16;
|
/// use std::u16;
|
||||||
///
|
///
|
||||||
/// let v = vec!(1, 2);
|
/// let v = vec![1, 2];
|
||||||
/// let res: Option<Vec<u16>> = v.iter().map(|&x: &u16|
|
/// let res: Option<Vec<u16>> = v.iter().map(|&x: &u16|
|
||||||
/// if x == u16::MAX { None }
|
/// if x == u16::MAX { None }
|
||||||
/// else { Some(x + 1) }
|
/// else { Some(x + 1) }
|
||||||
/// ).collect();
|
/// ).collect();
|
||||||
/// assert!(res == Some(vec!(2, 3)));
|
/// assert!(res == Some(vec![2, 3]));
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from_iter<I: IntoIterator<Item=Option<A>>>(iter: I) -> Option<V> {
|
fn from_iter<I: IntoIterator<Item=Option<A>>>(iter: I) -> Option<V> {
|
||||||
|
|
|
@ -977,12 +977,12 @@ impl<A, E, V: FromIterator<A>> FromIterator<Result<A, E>> for Result<V, E> {
|
||||||
/// ```
|
/// ```
|
||||||
/// use std::u32;
|
/// use std::u32;
|
||||||
///
|
///
|
||||||
/// let v = vec!(1, 2);
|
/// let v = vec![1, 2];
|
||||||
/// let res: Result<Vec<u32>, &'static str> = v.iter().map(|&x: &u32|
|
/// let res: Result<Vec<u32>, &'static str> = v.iter().map(|&x: &u32|
|
||||||
/// if x == u32::MAX { Err("Overflow!") }
|
/// if x == u32::MAX { Err("Overflow!") }
|
||||||
/// else { Ok(x + 1) }
|
/// else { Ok(x + 1) }
|
||||||
/// ).collect();
|
/// ).collect();
|
||||||
/// assert!(res == Ok(vec!(2, 3)));
|
/// assert!(res == Ok(vec![2, 3]));
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from_iter<I: IntoIterator<Item=Result<A, E>>>(iter: I) -> Result<V, E> {
|
fn from_iter<I: IntoIterator<Item=Result<A, E>>>(iter: I) -> Result<V, E> {
|
||||||
|
|
|
@ -1610,8 +1610,8 @@ Options:
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_args_with_equals() {
|
fn test_args_with_equals() {
|
||||||
let args = vec!("--one".to_string(), "A=B".to_string(),
|
let args = vec!["--one".to_string(), "A=B".to_string(),
|
||||||
"--two=C=D".to_string());
|
"--two=C=D".to_string()];
|
||||||
let opts = vec![optopt("o", "one", "One", "INFO"),
|
let opts = vec![optopt("o", "one", "One", "INFO"),
|
||||||
optopt("t", "two", "Two", "INFO")];
|
optopt("t", "two", "Two", "INFO")];
|
||||||
let matches = &match getopts(&args, &opts) {
|
let matches = &match getopts(&args, &opts) {
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
//! struct Edges(Vec<Ed>);
|
//! struct Edges(Vec<Ed>);
|
||||||
//!
|
//!
|
||||||
//! pub fn render_to<W: Write>(output: &mut W) {
|
//! pub fn render_to<W: Write>(output: &mut W) {
|
||||||
//! let edges = Edges(vec!((0,1), (0,2), (1,3), (2,3), (3,4), (4,4)));
|
//! let edges = Edges(vec![(0,1), (0,2), (1,3), (2,3), (3,4), (4,4)]);
|
||||||
//! dot::render(&edges, output).unwrap()
|
//! dot::render(&edges, output).unwrap()
|
||||||
//! }
|
//! }
|
||||||
//!
|
//!
|
||||||
|
@ -164,8 +164,8 @@
|
||||||
//! struct Graph { nodes: Vec<&'static str>, edges: Vec<(usize,usize)> }
|
//! struct Graph { nodes: Vec<&'static str>, edges: Vec<(usize,usize)> }
|
||||||
//!
|
//!
|
||||||
//! pub fn render_to<W: Write>(output: &mut W) {
|
//! pub fn render_to<W: Write>(output: &mut W) {
|
||||||
//! let nodes = vec!("{x,y}","{x}","{y}","{}");
|
//! let nodes = vec!["{x,y}","{x}","{y}","{}"];
|
||||||
//! let edges = vec!((0,1), (0,2), (1,3), (2,3));
|
//! let edges = vec![(0,1), (0,2), (1,3), (2,3)];
|
||||||
//! let graph = Graph { nodes: nodes, edges: edges };
|
//! let graph = Graph { nodes: nodes, edges: edges };
|
||||||
//!
|
//!
|
||||||
//! dot::render(&graph, output).unwrap()
|
//! dot::render(&graph, output).unwrap()
|
||||||
|
@ -226,8 +226,8 @@
|
||||||
//! struct Graph { nodes: Vec<&'static str>, edges: Vec<(usize,usize)> }
|
//! struct Graph { nodes: Vec<&'static str>, edges: Vec<(usize,usize)> }
|
||||||
//!
|
//!
|
||||||
//! pub fn render_to<W: Write>(output: &mut W) {
|
//! pub fn render_to<W: Write>(output: &mut W) {
|
||||||
//! let nodes = vec!("{x,y}","{x}","{y}","{}");
|
//! let nodes = vec!["{x,y}","{x}","{y}","{}"];
|
||||||
//! let edges = vec!((0,1), (0,2), (1,3), (2,3));
|
//! let edges = vec![(0,1), (0,2), (1,3), (2,3)];
|
||||||
//! let graph = Graph { nodes: nodes, edges: edges };
|
//! let graph = Graph { nodes: nodes, edges: edges };
|
||||||
//!
|
//!
|
||||||
//! dot::render(&graph, output).unwrap()
|
//! dot::render(&graph, output).unwrap()
|
||||||
|
|
|
@ -253,17 +253,17 @@ mod tests {
|
||||||
|
|
||||||
let v = (0..16).map(|_| ra.next_u32()).collect::<Vec<_>>();
|
let v = (0..16).map(|_| ra.next_u32()).collect::<Vec<_>>();
|
||||||
assert_eq!(v,
|
assert_eq!(v,
|
||||||
vec!(0xade0b876, 0x903df1a0, 0xe56a5d40, 0x28bd8653,
|
vec![0xade0b876, 0x903df1a0, 0xe56a5d40, 0x28bd8653,
|
||||||
0xb819d2bd, 0x1aed8da0, 0xccef36a8, 0xc70d778b,
|
0xb819d2bd, 0x1aed8da0, 0xccef36a8, 0xc70d778b,
|
||||||
0x7c5941da, 0x8d485751, 0x3fe02477, 0x374ad8b8,
|
0x7c5941da, 0x8d485751, 0x3fe02477, 0x374ad8b8,
|
||||||
0xf4b8436a, 0x1ca11815, 0x69b687c3, 0x8665eeb2));
|
0xf4b8436a, 0x1ca11815, 0x69b687c3, 0x8665eeb2]);
|
||||||
|
|
||||||
let v = (0..16).map(|_| ra.next_u32()).collect::<Vec<_>>();
|
let v = (0..16).map(|_| ra.next_u32()).collect::<Vec<_>>();
|
||||||
assert_eq!(v,
|
assert_eq!(v,
|
||||||
vec!(0xbee7079f, 0x7a385155, 0x7c97ba98, 0x0d082d73,
|
vec![0xbee7079f, 0x7a385155, 0x7c97ba98, 0x0d082d73,
|
||||||
0xa0290fcb, 0x6965e348, 0x3e53c612, 0xed7aee32,
|
0xa0290fcb, 0x6965e348, 0x3e53c612, 0xed7aee32,
|
||||||
0x7621b729, 0x434ee69c, 0xb03371d5, 0xd539d874,
|
0x7621b729, 0x434ee69c, 0xb03371d5, 0xd539d874,
|
||||||
0x281fed31, 0x45fb0a51, 0x1f0ae1ac, 0x6f4d794b));
|
0x281fed31, 0x45fb0a51, 0x1f0ae1ac, 0x6f4d794b]);
|
||||||
|
|
||||||
|
|
||||||
let seed: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7];
|
let seed: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7];
|
||||||
|
@ -280,10 +280,10 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(v,
|
assert_eq!(v,
|
||||||
vec!(0xf225c81a, 0x6ab1be57, 0x04d42951, 0x70858036,
|
vec![0xf225c81a, 0x6ab1be57, 0x04d42951, 0x70858036,
|
||||||
0x49884684, 0x64efec72, 0x4be2d186, 0x3615b384,
|
0x49884684, 0x64efec72, 0x4be2d186, 0x3615b384,
|
||||||
0x11cfa18e, 0xd3c50049, 0x75c775f6, 0x434c6530,
|
0x11cfa18e, 0xd3c50049, 0x75c775f6, 0x434c6530,
|
||||||
0x2c5bad8f, 0x898881dc, 0x5f1c86d9, 0xc1f8e7f4));
|
0x2c5bad8f, 0x898881dc, 0x5f1c86d9, 0xc1f8e7f4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -312,37 +312,37 @@ mod tests {
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
t!(vec!(Weighted { weight: 1, item: 10 }),
|
t!(vec![Weighted { weight: 1, item: 10 }],
|
||||||
[10]);
|
[10]);
|
||||||
|
|
||||||
// skip some
|
// skip some
|
||||||
t!(vec!(Weighted { weight: 0, item: 20 },
|
t!(vec![Weighted { weight: 0, item: 20 },
|
||||||
Weighted { weight: 2, item: 21 },
|
Weighted { weight: 2, item: 21 },
|
||||||
Weighted { weight: 0, item: 22 },
|
Weighted { weight: 0, item: 22 },
|
||||||
Weighted { weight: 1, item: 23 }),
|
Weighted { weight: 1, item: 23 }],
|
||||||
[21, 21, 23]);
|
[21, 21, 23]);
|
||||||
|
|
||||||
// different weights
|
// different weights
|
||||||
t!(vec!(Weighted { weight: 4, item: 30 },
|
t!(vec![Weighted { weight: 4, item: 30 },
|
||||||
Weighted { weight: 3, item: 31 }),
|
Weighted { weight: 3, item: 31 }],
|
||||||
[30, 30, 30, 30, 31, 31, 31]);
|
[30, 30, 30, 30, 31, 31, 31]);
|
||||||
|
|
||||||
// check that we're binary searching
|
// check that we're binary searching
|
||||||
// correctly with some vectors of odd
|
// correctly with some vectors of odd
|
||||||
// length.
|
// length.
|
||||||
t!(vec!(Weighted { weight: 1, item: 40 },
|
t!(vec![Weighted { weight: 1, item: 40 },
|
||||||
Weighted { weight: 1, item: 41 },
|
Weighted { weight: 1, item: 41 },
|
||||||
Weighted { weight: 1, item: 42 },
|
Weighted { weight: 1, item: 42 },
|
||||||
Weighted { weight: 1, item: 43 },
|
Weighted { weight: 1, item: 43 },
|
||||||
Weighted { weight: 1, item: 44 }),
|
Weighted { weight: 1, item: 44 }],
|
||||||
[40, 41, 42, 43, 44]);
|
[40, 41, 42, 43, 44]);
|
||||||
t!(vec!(Weighted { weight: 1, item: 50 },
|
t!(vec![Weighted { weight: 1, item: 50 },
|
||||||
Weighted { weight: 1, item: 51 },
|
Weighted { weight: 1, item: 51 },
|
||||||
Weighted { weight: 1, item: 52 },
|
Weighted { weight: 1, item: 52 },
|
||||||
Weighted { weight: 1, item: 53 },
|
Weighted { weight: 1, item: 53 },
|
||||||
Weighted { weight: 1, item: 54 },
|
Weighted { weight: 1, item: 54 },
|
||||||
Weighted { weight: 1, item: 55 },
|
Weighted { weight: 1, item: 55 },
|
||||||
Weighted { weight: 1, item: 56 }),
|
Weighted { weight: 1, item: 56 }],
|
||||||
[50, 51, 52, 53, 54, 55, 56]);
|
[50, 51, 52, 53, 54, 55, 56]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -662,8 +662,8 @@ mod tests {
|
||||||
// Regression test that isaac is actually using the above vector
|
// Regression test that isaac is actually using the above vector
|
||||||
let v = (0..10).map(|_| ra.next_u32()).collect::<Vec<_>>();
|
let v = (0..10).map(|_| ra.next_u32()).collect::<Vec<_>>();
|
||||||
assert_eq!(v,
|
assert_eq!(v,
|
||||||
vec!(2558573138, 873787463, 263499565, 2103644246, 3595684709,
|
vec![2558573138, 873787463, 263499565, 2103644246, 3595684709,
|
||||||
4203127393, 264982119, 2765226902, 2737944514, 3900253796));
|
4203127393, 264982119, 2765226902, 2737944514, 3900253796]);
|
||||||
|
|
||||||
let seed: &[_] = &[12345, 67890, 54321, 9876];
|
let seed: &[_] = &[12345, 67890, 54321, 9876];
|
||||||
let mut rb: IsaacRng = SeedableRng::from_seed(seed);
|
let mut rb: IsaacRng = SeedableRng::from_seed(seed);
|
||||||
|
@ -674,8 +674,8 @@ mod tests {
|
||||||
|
|
||||||
let v = (0..10).map(|_| rb.next_u32()).collect::<Vec<_>>();
|
let v = (0..10).map(|_| rb.next_u32()).collect::<Vec<_>>();
|
||||||
assert_eq!(v,
|
assert_eq!(v,
|
||||||
vec!(3676831399, 3183332890, 2834741178, 3854698763, 2717568474,
|
vec![3676831399, 3183332890, 2834741178, 3854698763, 2717568474,
|
||||||
1576568959, 3507990155, 179069555, 141456972, 2478885421));
|
1576568959, 3507990155, 179069555, 141456972, 2478885421]);
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
#[rustfmt_skip]
|
#[rustfmt_skip]
|
||||||
|
@ -685,10 +685,10 @@ mod tests {
|
||||||
// Regression test that isaac is actually using the above vector
|
// Regression test that isaac is actually using the above vector
|
||||||
let v = (0..10).map(|_| ra.next_u64()).collect::<Vec<_>>();
|
let v = (0..10).map(|_| ra.next_u64()).collect::<Vec<_>>();
|
||||||
assert_eq!(v,
|
assert_eq!(v,
|
||||||
vec!(547121783600835980, 14377643087320773276, 17351601304698403469,
|
vec![547121783600835980, 14377643087320773276, 17351601304698403469,
|
||||||
1238879483818134882, 11952566807690396487, 13970131091560099343,
|
1238879483818134882, 11952566807690396487, 13970131091560099343,
|
||||||
4469761996653280935, 15552757044682284409, 6860251611068737823,
|
4469761996653280935, 15552757044682284409, 6860251611068737823,
|
||||||
13722198873481261842));
|
13722198873481261842]);
|
||||||
|
|
||||||
let seed: &[_] = &[12345, 67890, 54321, 9876];
|
let seed: &[_] = &[12345, 67890, 54321, 9876];
|
||||||
let mut rb: Isaac64Rng = SeedableRng::from_seed(seed);
|
let mut rb: Isaac64Rng = SeedableRng::from_seed(seed);
|
||||||
|
@ -699,10 +699,10 @@ mod tests {
|
||||||
|
|
||||||
let v = (0..10).map(|_| rb.next_u64()).collect::<Vec<_>>();
|
let v = (0..10).map(|_| rb.next_u64()).collect::<Vec<_>>();
|
||||||
assert_eq!(v,
|
assert_eq!(v,
|
||||||
vec!(18143823860592706164, 8491801882678285927, 2699425367717515619,
|
vec![18143823860592706164, 8491801882678285927, 2699425367717515619,
|
||||||
17196852593171130876, 2606123525235546165, 15790932315217671084,
|
17196852593171130876, 2606123525235546165, 15790932315217671084,
|
||||||
596345674630742204, 9947027391921273664, 11788097613744130851,
|
596345674630742204, 9947027391921273664, 11788097613744130851,
|
||||||
10391409374914919106));
|
10391409374914919106]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -536,7 +536,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
|
||||||
fn add_contained_edge(&mut self,
|
fn add_contained_edge(&mut self,
|
||||||
source: CFGIndex,
|
source: CFGIndex,
|
||||||
target: CFGIndex) {
|
target: CFGIndex) {
|
||||||
let data = CFGEdgeData {exiting_scopes: vec!() };
|
let data = CFGEdgeData {exiting_scopes: vec![] };
|
||||||
self.graph.add_edge(source, target, data);
|
self.graph.add_edge(source, target, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,7 +545,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
|
||||||
from_index: CFGIndex,
|
from_index: CFGIndex,
|
||||||
to_loop: LoopScope,
|
to_loop: LoopScope,
|
||||||
to_index: CFGIndex) {
|
to_index: CFGIndex) {
|
||||||
let mut data = CFGEdgeData {exiting_scopes: vec!() };
|
let mut data = CFGEdgeData {exiting_scopes: vec![] };
|
||||||
let mut scope = self.tcx.region_maps.node_extent(from_expr.id);
|
let mut scope = self.tcx.region_maps.node_extent(from_expr.id);
|
||||||
let target_scope = self.tcx.region_maps.node_extent(to_loop.loop_id);
|
let target_scope = self.tcx.region_maps.node_extent(to_loop.loop_id);
|
||||||
while scope != target_scope {
|
while scope != target_scope {
|
||||||
|
@ -559,7 +559,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
|
||||||
_from_expr: &hir::Expr,
|
_from_expr: &hir::Expr,
|
||||||
from_index: CFGIndex) {
|
from_index: CFGIndex) {
|
||||||
let mut data = CFGEdgeData {
|
let mut data = CFGEdgeData {
|
||||||
exiting_scopes: vec!(),
|
exiting_scopes: vec![],
|
||||||
};
|
};
|
||||||
for &LoopScope { loop_id: id, .. } in self.loop_scopes.iter().rev() {
|
for &LoopScope { loop_id: id, .. } in self.loop_scopes.iter().rev() {
|
||||||
data.exiting_scopes.push(id);
|
data.exiting_scopes.push(id);
|
||||||
|
|
|
@ -457,7 +457,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
||||||
}
|
}
|
||||||
same_regions.push(SameRegions {
|
same_regions.push(SameRegions {
|
||||||
scope_id: scope_id,
|
scope_id: scope_id,
|
||||||
regions: vec!(sub_fr.bound_region, sup_fr.bound_region)
|
regions: vec![sub_fr.bound_region, sup_fr.bound_region]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1359,7 +1359,7 @@ impl<'a, 'gcx, 'tcx> Rebuilder<'a, 'gcx, 'tcx> {
|
||||||
region_names: &HashSet<ast::Name>)
|
region_names: &HashSet<ast::Name>)
|
||||||
-> P<hir::Ty> {
|
-> P<hir::Ty> {
|
||||||
let mut new_ty = P(ty.clone());
|
let mut new_ty = P(ty.clone());
|
||||||
let mut ty_queue = vec!(ty);
|
let mut ty_queue = vec![ty];
|
||||||
while !ty_queue.is_empty() {
|
while !ty_queue.is_empty() {
|
||||||
let cur_ty = ty_queue.remove(0);
|
let cur_ty = ty_queue.remove(0);
|
||||||
match cur_ty.node {
|
match cur_ty.node {
|
||||||
|
|
|
@ -127,9 +127,9 @@ impl LintStore {
|
||||||
|
|
||||||
pub fn new() -> LintStore {
|
pub fn new() -> LintStore {
|
||||||
LintStore {
|
LintStore {
|
||||||
lints: vec!(),
|
lints: vec![],
|
||||||
early_passes: Some(vec!()),
|
early_passes: Some(vec![]),
|
||||||
late_passes: Some(vec!()),
|
late_passes: Some(vec![]),
|
||||||
by_name: FnvHashMap(),
|
by_name: FnvHashMap(),
|
||||||
levels: FnvHashMap(),
|
levels: FnvHashMap(),
|
||||||
future_incompatible: FnvHashMap(),
|
future_incompatible: FnvHashMap(),
|
||||||
|
@ -345,7 +345,7 @@ macro_rules! run_lints { ($cx:expr, $f:ident, $ps:ident, $($args:expr),*) => ({
|
||||||
// See also the hir version just below.
|
// See also the hir version just below.
|
||||||
pub fn gather_attrs(attrs: &[ast::Attribute])
|
pub fn gather_attrs(attrs: &[ast::Attribute])
|
||||||
-> Vec<Result<(InternedString, Level, Span), Span>> {
|
-> Vec<Result<(InternedString, Level, Span), Span>> {
|
||||||
let mut out = vec!();
|
let mut out = vec![];
|
||||||
for attr in attrs {
|
for attr in attrs {
|
||||||
let r = gather_attr(attr);
|
let r = gather_attr(attr);
|
||||||
out.extend(r.into_iter());
|
out.extend(r.into_iter());
|
||||||
|
@ -355,7 +355,7 @@ pub fn gather_attrs(attrs: &[ast::Attribute])
|
||||||
|
|
||||||
pub fn gather_attr(attr: &ast::Attribute)
|
pub fn gather_attr(attr: &ast::Attribute)
|
||||||
-> Vec<Result<(InternedString, Level, Span), Span>> {
|
-> Vec<Result<(InternedString, Level, Span), Span>> {
|
||||||
let mut out = vec!();
|
let mut out = vec![];
|
||||||
|
|
||||||
let level = match Level::from_str(&attr.name()) {
|
let level = match Level::from_str(&attr.name()) {
|
||||||
None => return out,
|
None => return out,
|
||||||
|
|
|
@ -59,7 +59,7 @@ impl LanguageItems {
|
||||||
fn foo(_: LangItem) -> Option<DefId> { None }
|
fn foo(_: LangItem) -> Option<DefId> { None }
|
||||||
|
|
||||||
LanguageItems {
|
LanguageItems {
|
||||||
items: vec!($(foo($variant)),*),
|
items: vec![$(foo($variant)),*],
|
||||||
missing: Vec::new(),
|
missing: Vec::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -715,7 +715,7 @@ macro_rules! options {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
v => {
|
v => {
|
||||||
let mut passes = vec!();
|
let mut passes = vec![];
|
||||||
if parse_list(&mut passes, v) {
|
if parse_list(&mut passes, v) {
|
||||||
*slot = SomePasses(passes);
|
*slot = SomePasses(passes);
|
||||||
true
|
true
|
||||||
|
@ -1293,7 +1293,7 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
|
||||||
let crate_types = parse_crate_types_from_list(unparsed_crate_types)
|
let crate_types = parse_crate_types_from_list(unparsed_crate_types)
|
||||||
.unwrap_or_else(|e| early_error(error_format, &e[..]));
|
.unwrap_or_else(|e| early_error(error_format, &e[..]));
|
||||||
|
|
||||||
let mut lint_opts = vec!();
|
let mut lint_opts = vec![];
|
||||||
let mut describe_lints = false;
|
let mut describe_lints = false;
|
||||||
|
|
||||||
for &level in &[lint::Allow, lint::Warn, lint::Deny, lint::Forbid] {
|
for &level in &[lint::Allow, lint::Warn, lint::Deny, lint::Forbid] {
|
||||||
|
|
|
@ -272,7 +272,7 @@ impl Session {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lints.insert(id, vec!((lint_id, sp, msg)));
|
lints.insert(id, vec![(lint_id, sp, msg)]);
|
||||||
}
|
}
|
||||||
pub fn reserve_node_ids(&self, count: usize) -> ast::NodeId {
|
pub fn reserve_node_ids(&self, count: usize) -> ast::NodeId {
|
||||||
let id = self.next_node_id.get();
|
let id = self.next_node_id.get();
|
||||||
|
|
|
@ -275,7 +275,7 @@ impl<'a, 'b, 'gcx, 'tcx> AssociatedTypeNormalizer<'a, 'b, 'gcx, 'tcx> {
|
||||||
AssociatedTypeNormalizer {
|
AssociatedTypeNormalizer {
|
||||||
selcx: selcx,
|
selcx: selcx,
|
||||||
cause: cause,
|
cause: cause,
|
||||||
obligations: vec!(),
|
obligations: vec![],
|
||||||
depth: depth,
|
depth: depth,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,7 +396,7 @@ pub fn normalize_projection_type<'a, 'b, 'gcx, 'tcx>(
|
||||||
cause, depth + 1, projection.to_predicate());
|
cause, depth + 1, projection.to_predicate());
|
||||||
Normalized {
|
Normalized {
|
||||||
value: ty_var,
|
value: ty_var,
|
||||||
obligations: vec!(obligation)
|
obligations: vec![obligation]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -545,7 +545,7 @@ fn opt_normalize_projection_type<'a, 'b, 'gcx, 'tcx>(
|
||||||
projected_ty);
|
projected_ty);
|
||||||
let result = Normalized {
|
let result = Normalized {
|
||||||
value: projected_ty,
|
value: projected_ty,
|
||||||
obligations: vec!()
|
obligations: vec![]
|
||||||
};
|
};
|
||||||
infcx.projection_cache.borrow_mut()
|
infcx.projection_cache.borrow_mut()
|
||||||
.complete(projection_ty, &result, true);
|
.complete(projection_ty, &result, true);
|
||||||
|
@ -604,7 +604,7 @@ fn normalize_to_error<'a, 'gcx, 'tcx>(selcx: &mut SelectionContext<'a, 'gcx, 'tc
|
||||||
let new_value = selcx.infcx().next_ty_var();
|
let new_value = selcx.infcx().next_ty_var();
|
||||||
Normalized {
|
Normalized {
|
||||||
value: new_value,
|
value: new_value,
|
||||||
obligations: vec!(trait_obligation)
|
obligations: vec![trait_obligation]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ pub struct TypeWalker<'tcx> {
|
||||||
|
|
||||||
impl<'tcx> TypeWalker<'tcx> {
|
impl<'tcx> TypeWalker<'tcx> {
|
||||||
pub fn new(ty: Ty<'tcx>) -> TypeWalker<'tcx> {
|
pub fn new(ty: Ty<'tcx>) -> TypeWalker<'tcx> {
|
||||||
TypeWalker { stack: vec!(ty), last_subtree: 1, }
|
TypeWalker { stack: vec![ty], last_subtree: 1, }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Skips the subtree of types corresponding to the last type
|
/// Skips the subtree of types corresponding to the last type
|
||||||
|
|
|
@ -201,11 +201,11 @@ fn implied_bounds_from_components<'tcx>(sub_region: &'tcx ty::Region,
|
||||||
.flat_map(|component| {
|
.flat_map(|component| {
|
||||||
match component {
|
match component {
|
||||||
Component::Region(r) =>
|
Component::Region(r) =>
|
||||||
vec!(ImpliedBound::RegionSubRegion(sub_region, r)),
|
vec![ImpliedBound::RegionSubRegion(sub_region, r)],
|
||||||
Component::Param(p) =>
|
Component::Param(p) =>
|
||||||
vec!(ImpliedBound::RegionSubParam(sub_region, p)),
|
vec![ImpliedBound::RegionSubParam(sub_region, p)],
|
||||||
Component::Projection(p) =>
|
Component::Projection(p) =>
|
||||||
vec!(ImpliedBound::RegionSubProjection(sub_region, p)),
|
vec![ImpliedBound::RegionSubProjection(sub_region, p)],
|
||||||
Component::EscapingProjection(_) =>
|
Component::EscapingProjection(_) =>
|
||||||
// If the projection has escaping regions, don't
|
// If the projection has escaping regions, don't
|
||||||
// try to infer any implied bounds even for its
|
// try to infer any implied bounds even for its
|
||||||
|
@ -215,9 +215,9 @@ fn implied_bounds_from_components<'tcx>(sub_region: &'tcx ty::Region,
|
||||||
// idea is that the WAY that the caller proves
|
// idea is that the WAY that the caller proves
|
||||||
// that may change in the future and we want to
|
// that may change in the future and we want to
|
||||||
// give ourselves room to get smarter here.
|
// give ourselves room to get smarter here.
|
||||||
vec!(),
|
vec![],
|
||||||
Component::UnresolvedInferenceVariable(..) =>
|
Component::UnresolvedInferenceVariable(..) =>
|
||||||
vec!(),
|
vec![],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
|
|
|
@ -17,7 +17,7 @@ pub fn opts() -> TargetOptions {
|
||||||
executables: true,
|
executables: true,
|
||||||
linker_is_gnu: true,
|
linker_is_gnu: true,
|
||||||
has_rpath: true,
|
has_rpath: true,
|
||||||
pre_link_args: vec!(
|
pre_link_args: vec![
|
||||||
// GNU-style linkers will use this to omit linking to libraries
|
// GNU-style linkers will use this to omit linking to libraries
|
||||||
// which don't actually fulfill any relocations, but only for
|
// which don't actually fulfill any relocations, but only for
|
||||||
// libraries which follow this flag. Thus, use it before
|
// libraries which follow this flag. Thus, use it before
|
||||||
|
@ -26,7 +26,7 @@ pub fn opts() -> TargetOptions {
|
||||||
|
|
||||||
// Always enable NX protection when it is available
|
// Always enable NX protection when it is available
|
||||||
"-Wl,-z,noexecstack".to_string(),
|
"-Wl,-z,noexecstack".to_string(),
|
||||||
),
|
],
|
||||||
position_independent_executables: true,
|
position_independent_executables: true,
|
||||||
exe_allocation_crate: super::maybe_jemalloc(),
|
exe_allocation_crate: super::maybe_jemalloc(),
|
||||||
.. Default::default()
|
.. Default::default()
|
||||||
|
|
|
@ -17,7 +17,7 @@ pub fn opts() -> TargetOptions {
|
||||||
executables: true,
|
executables: true,
|
||||||
linker_is_gnu: true,
|
linker_is_gnu: true,
|
||||||
has_rpath: true,
|
has_rpath: true,
|
||||||
pre_link_args: vec!(
|
pre_link_args: vec![
|
||||||
// GNU-style linkers will use this to omit linking to libraries
|
// GNU-style linkers will use this to omit linking to libraries
|
||||||
// which don't actually fulfill any relocations, but only for
|
// which don't actually fulfill any relocations, but only for
|
||||||
// libraries which follow this flag. Thus, use it before
|
// libraries which follow this flag. Thus, use it before
|
||||||
|
@ -26,7 +26,7 @@ pub fn opts() -> TargetOptions {
|
||||||
|
|
||||||
// Always enable NX protection when it is available
|
// Always enable NX protection when it is available
|
||||||
"-Wl,-z,noexecstack".to_string(),
|
"-Wl,-z,noexecstack".to_string(),
|
||||||
),
|
],
|
||||||
position_independent_executables: true,
|
position_independent_executables: true,
|
||||||
exe_allocation_crate: super::maybe_jemalloc(),
|
exe_allocation_crate: super::maybe_jemalloc(),
|
||||||
.. Default::default()
|
.. Default::default()
|
||||||
|
|
|
@ -15,10 +15,10 @@ pub fn target() -> TargetResult {
|
||||||
linker: "pnacl-clang".to_string(),
|
linker: "pnacl-clang".to_string(),
|
||||||
ar: "pnacl-ar".to_string(),
|
ar: "pnacl-ar".to_string(),
|
||||||
|
|
||||||
pre_link_args: vec!("--pnacl-exceptions=sjlj".to_string(),
|
pre_link_args: vec!["--pnacl-exceptions=sjlj".to_string(),
|
||||||
"--target=le32-unknown-nacl".to_string(),
|
"--target=le32-unknown-nacl".to_string(),
|
||||||
"-Wl,--start-group".to_string()),
|
"-Wl,--start-group".to_string()],
|
||||||
post_link_args: vec!("-Wl,--end-group".to_string()),
|
post_link_args: vec!["-Wl,--end-group".to_string()],
|
||||||
dynamic_linking: false,
|
dynamic_linking: false,
|
||||||
executables: true,
|
executables: true,
|
||||||
exe_suffix: ".pexe".to_string(),
|
exe_suffix: ".pexe".to_string(),
|
||||||
|
|
|
@ -17,7 +17,7 @@ pub fn opts() -> TargetOptions {
|
||||||
executables: true,
|
executables: true,
|
||||||
linker_is_gnu: true,
|
linker_is_gnu: true,
|
||||||
has_rpath: true,
|
has_rpath: true,
|
||||||
pre_link_args: vec!(
|
pre_link_args: vec![
|
||||||
// GNU-style linkers will use this to omit linking to libraries
|
// GNU-style linkers will use this to omit linking to libraries
|
||||||
// which don't actually fulfill any relocations, but only for
|
// which don't actually fulfill any relocations, but only for
|
||||||
// libraries which follow this flag. Thus, use it before
|
// libraries which follow this flag. Thus, use it before
|
||||||
|
@ -26,7 +26,7 @@ pub fn opts() -> TargetOptions {
|
||||||
|
|
||||||
// Always enable NX protection when it is available
|
// Always enable NX protection when it is available
|
||||||
"-Wl,-z,noexecstack".to_string(),
|
"-Wl,-z,noexecstack".to_string(),
|
||||||
),
|
],
|
||||||
position_independent_executables: true,
|
position_independent_executables: true,
|
||||||
.. Default::default()
|
.. Default::default()
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ pub fn opts() -> TargetOptions {
|
||||||
executables: true,
|
executables: true,
|
||||||
linker_is_gnu: true,
|
linker_is_gnu: true,
|
||||||
has_rpath: true,
|
has_rpath: true,
|
||||||
pre_link_args: vec!(
|
pre_link_args: vec![
|
||||||
// GNU-style linkers will use this to omit linking to libraries
|
// GNU-style linkers will use this to omit linking to libraries
|
||||||
// which don't actually fulfill any relocations, but only for
|
// which don't actually fulfill any relocations, but only for
|
||||||
// libraries which follow this flag. Thus, use it before
|
// libraries which follow this flag. Thus, use it before
|
||||||
|
@ -26,7 +26,7 @@ pub fn opts() -> TargetOptions {
|
||||||
|
|
||||||
// Always enable NX protection when it is available
|
// Always enable NX protection when it is available
|
||||||
"-Wl,-z,noexecstack".to_string(),
|
"-Wl,-z,noexecstack".to_string(),
|
||||||
),
|
],
|
||||||
position_independent_executables: true,
|
position_independent_executables: true,
|
||||||
exe_allocation_crate: "alloc_system".to_string(),
|
exe_allocation_crate: "alloc_system".to_string(),
|
||||||
.. Default::default()
|
.. Default::default()
|
||||||
|
|
|
@ -26,7 +26,7 @@ pub fn opts() -> TargetOptions {
|
||||||
no_default_libraries: true,
|
no_default_libraries: true,
|
||||||
is_like_windows: true,
|
is_like_windows: true,
|
||||||
allows_weak_linkage: false,
|
allows_weak_linkage: false,
|
||||||
pre_link_args: vec!(
|
pre_link_args: vec![
|
||||||
// And here, we see obscure linker flags #45. On windows, it has been
|
// And here, we see obscure linker flags #45. On windows, it has been
|
||||||
// found to be necessary to have this flag to compile liblibc.
|
// found to be necessary to have this flag to compile liblibc.
|
||||||
//
|
//
|
||||||
|
@ -63,26 +63,26 @@ pub fn opts() -> TargetOptions {
|
||||||
|
|
||||||
// Do not use the standard system startup files or libraries when linking
|
// Do not use the standard system startup files or libraries when linking
|
||||||
"-nostdlib".to_string(),
|
"-nostdlib".to_string(),
|
||||||
),
|
],
|
||||||
pre_link_objects_exe: vec!(
|
pre_link_objects_exe: vec![
|
||||||
"crt2.o".to_string(), // mingw C runtime initialization for executables
|
"crt2.o".to_string(), // mingw C runtime initialization for executables
|
||||||
"rsbegin.o".to_string(), // Rust compiler runtime initialization, see rsbegin.rs
|
"rsbegin.o".to_string(), // Rust compiler runtime initialization, see rsbegin.rs
|
||||||
),
|
],
|
||||||
pre_link_objects_dll: vec!(
|
pre_link_objects_dll: vec![
|
||||||
"dllcrt2.o".to_string(), // mingw C runtime initialization for dlls
|
"dllcrt2.o".to_string(), // mingw C runtime initialization for dlls
|
||||||
"rsbegin.o".to_string(),
|
"rsbegin.o".to_string(),
|
||||||
),
|
],
|
||||||
late_link_args: vec!(
|
late_link_args: vec![
|
||||||
"-lmingwex".to_string(),
|
"-lmingwex".to_string(),
|
||||||
"-lmingw32".to_string(),
|
"-lmingw32".to_string(),
|
||||||
"-lgcc".to_string(), // alas, mingw* libraries above depend on libgcc
|
"-lgcc".to_string(), // alas, mingw* libraries above depend on libgcc
|
||||||
"-lmsvcrt".to_string(),
|
"-lmsvcrt".to_string(),
|
||||||
"-luser32".to_string(),
|
"-luser32".to_string(),
|
||||||
"-lkernel32".to_string(),
|
"-lkernel32".to_string(),
|
||||||
),
|
],
|
||||||
post_link_objects: vec!(
|
post_link_objects: vec![
|
||||||
"rsend.o".to_string()
|
"rsend.o".to_string()
|
||||||
),
|
],
|
||||||
custom_unwind_resume: true,
|
custom_unwind_resume: true,
|
||||||
|
|
||||||
.. Default::default()
|
.. Default::default()
|
||||||
|
|
|
@ -92,7 +92,7 @@ fn group_errors_with_same_origin<'tcx>(errors: &Vec<MoveError<'tcx>>)
|
||||||
let move_from_id = error.move_from.id;
|
let move_from_id = error.move_from.id;
|
||||||
debug!("append_to_grouped_errors(move_from_id={})", move_from_id);
|
debug!("append_to_grouped_errors(move_from_id={})", move_from_id);
|
||||||
let move_to = if error.move_to.is_some() {
|
let move_to = if error.move_to.is_some() {
|
||||||
vec!(error.move_to.clone().unwrap())
|
vec![error.move_to.clone().unwrap()]
|
||||||
} else {
|
} else {
|
||||||
Vec::new()
|
Vec::new()
|
||||||
};
|
};
|
||||||
|
|
|
@ -331,7 +331,7 @@ impl<'a, 'tcx> MoveData<'tcx> {
|
||||||
|
|
||||||
fn existing_base_paths(&self, lp: &Rc<LoanPath<'tcx>>)
|
fn existing_base_paths(&self, lp: &Rc<LoanPath<'tcx>>)
|
||||||
-> Vec<MovePathIndex> {
|
-> Vec<MovePathIndex> {
|
||||||
let mut result = vec!();
|
let mut result = vec![];
|
||||||
self.add_existing_base_paths(lp, &mut result);
|
self.add_existing_base_paths(lp, &mut result);
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
|
@ -454,7 +454,7 @@ loop variable, consider using a `match` or `if let` inside the loop body. For
|
||||||
instance:
|
instance:
|
||||||
|
|
||||||
```compile_fail,E0297
|
```compile_fail,E0297
|
||||||
let xs : Vec<Option<i32>> = vec!(Some(1), None);
|
let xs : Vec<Option<i32>> = vec![Some(1), None];
|
||||||
|
|
||||||
// This fails because `None` is not covered.
|
// This fails because `None` is not covered.
|
||||||
for Some(x) in xs {
|
for Some(x) in xs {
|
||||||
|
@ -465,7 +465,7 @@ for Some(x) in xs {
|
||||||
Match inside the loop instead:
|
Match inside the loop instead:
|
||||||
|
|
||||||
```
|
```
|
||||||
let xs : Vec<Option<i32>> = vec!(Some(1), None);
|
let xs : Vec<Option<i32>> = vec![Some(1), None];
|
||||||
|
|
||||||
for item in xs {
|
for item in xs {
|
||||||
match item {
|
match item {
|
||||||
|
@ -478,7 +478,7 @@ for item in xs {
|
||||||
Or use `if let`:
|
Or use `if let`:
|
||||||
|
|
||||||
```
|
```
|
||||||
let xs : Vec<Option<i32>> = vec!(Some(1), None);
|
let xs : Vec<Option<i32>> = vec![Some(1), None];
|
||||||
|
|
||||||
for item in xs {
|
for item in xs {
|
||||||
if let Some(x) = item {
|
if let Some(x) = item {
|
||||||
|
|
|
@ -340,10 +340,10 @@ impl<'a> CrateLoader<'a> {
|
||||||
target: &self.sess.target.target,
|
target: &self.sess.target.target,
|
||||||
triple: &self.sess.opts.target_triple,
|
triple: &self.sess.opts.target_triple,
|
||||||
root: root,
|
root: root,
|
||||||
rejected_via_hash: vec!(),
|
rejected_via_hash: vec![],
|
||||||
rejected_via_triple: vec!(),
|
rejected_via_triple: vec![],
|
||||||
rejected_via_kind: vec!(),
|
rejected_via_kind: vec![],
|
||||||
rejected_via_version: vec!(),
|
rejected_via_version: vec![],
|
||||||
should_match_name: true,
|
should_match_name: true,
|
||||||
};
|
};
|
||||||
match self.load(&mut locate_ctxt) {
|
match self.load(&mut locate_ctxt) {
|
||||||
|
@ -481,10 +481,10 @@ impl<'a> CrateLoader<'a> {
|
||||||
target: &self.sess.host,
|
target: &self.sess.host,
|
||||||
triple: config::host_triple(),
|
triple: config::host_triple(),
|
||||||
root: &None,
|
root: &None,
|
||||||
rejected_via_hash: vec!(),
|
rejected_via_hash: vec![],
|
||||||
rejected_via_triple: vec!(),
|
rejected_via_triple: vec![],
|
||||||
rejected_via_kind: vec!(),
|
rejected_via_kind: vec![],
|
||||||
rejected_via_version: vec!(),
|
rejected_via_version: vec![],
|
||||||
should_match_name: true,
|
should_match_name: true,
|
||||||
};
|
};
|
||||||
let library = self.load(&mut locate_ctxt).or_else(|| {
|
let library = self.load(&mut locate_ctxt).or_else(|| {
|
||||||
|
|
|
@ -73,12 +73,12 @@ impl<'a> Registry<'a> {
|
||||||
sess: sess,
|
sess: sess,
|
||||||
args_hidden: None,
|
args_hidden: None,
|
||||||
krate_span: krate_span,
|
krate_span: krate_span,
|
||||||
syntax_exts: vec!(),
|
syntax_exts: vec![],
|
||||||
early_lint_passes: vec!(),
|
early_lint_passes: vec![],
|
||||||
late_lint_passes: vec!(),
|
late_lint_passes: vec![],
|
||||||
lint_groups: HashMap::new(),
|
lint_groups: HashMap::new(),
|
||||||
llvm_passes: vec!(),
|
llvm_passes: vec![],
|
||||||
attributes: vec!(),
|
attributes: vec![],
|
||||||
mir_passes: Vec::new(),
|
mir_passes: Vec::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
|
||||||
// What could go wrong...?
|
// What could go wrong...?
|
||||||
if spans.len() < path.segments.len() {
|
if spans.len() < path.segments.len() {
|
||||||
if generated_code(path.span) {
|
if generated_code(path.span) {
|
||||||
return vec!();
|
return vec![];
|
||||||
}
|
}
|
||||||
error!("Mis-calculated spans for path '{}'. Found {} spans, expected {}. Found spans:",
|
error!("Mis-calculated spans for path '{}'. Found {} spans, expected {}. Found spans:",
|
||||||
path_to_string(path),
|
path_to_string(path),
|
||||||
|
@ -167,12 +167,12 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
|
||||||
loc.line);
|
loc.line);
|
||||||
}
|
}
|
||||||
error!(" master span: {:?}: `{}`", path.span, self.span.snippet(path.span));
|
error!(" master span: {:?}: `{}`", path.span, self.span.snippet(path.span));
|
||||||
return vec!();
|
return vec![];
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut result: Vec<(Span, String)> = vec!();
|
let mut result: Vec<(Span, String)> = vec![];
|
||||||
|
|
||||||
let mut segs = vec!();
|
let mut segs = vec![];
|
||||||
for (i, (seg, span)) in path.segments.iter().zip(&spans).enumerate() {
|
for (i, (seg, span)) in path.segments.iter().zip(&spans).enumerate() {
|
||||||
segs.push(seg.clone());
|
segs.push(seg.clone());
|
||||||
let sub_path = ast::Path {
|
let sub_path = ast::Path {
|
||||||
|
|
|
@ -225,7 +225,7 @@ impl<'a> SpanUtils<'a> {
|
||||||
// Nesting = 0: all idents outside of brackets: [Foo]
|
// Nesting = 0: all idents outside of brackets: [Foo]
|
||||||
// Nesting = 1: idents within one level of brackets: [Bar, Bar]
|
// Nesting = 1: idents within one level of brackets: [Bar, Bar]
|
||||||
pub fn spans_with_brackets(&self, span: Span, nesting: isize, limit: isize) -> Vec<Span> {
|
pub fn spans_with_brackets(&self, span: Span, nesting: isize, limit: isize) -> Vec<Span> {
|
||||||
let mut result: Vec<Span> = vec!();
|
let mut result: Vec<Span> = vec![];
|
||||||
|
|
||||||
let mut toks = self.retokenise_span(span);
|
let mut toks = self.retokenise_span(span);
|
||||||
// We keep track of how many brackets we're nested in
|
// We keep track of how many brackets we're nested in
|
||||||
|
@ -236,7 +236,7 @@ impl<'a> SpanUtils<'a> {
|
||||||
if ts.tok == token::Eof {
|
if ts.tok == token::Eof {
|
||||||
if bracket_count != 0 {
|
if bracket_count != 0 {
|
||||||
if generated_code(span) {
|
if generated_code(span) {
|
||||||
return vec!();
|
return vec![];
|
||||||
}
|
}
|
||||||
let loc = self.sess.codemap().lookup_char_pos(span.lo);
|
let loc = self.sess.codemap().lookup_char_pos(span.lo);
|
||||||
span_bug!(span,
|
span_bug!(span,
|
||||||
|
|
|
@ -61,7 +61,7 @@ pub fn trans_inline_asm<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
||||||
// Default per-arch clobbers
|
// Default per-arch clobbers
|
||||||
// Basically what clang does
|
// Basically what clang does
|
||||||
let arch_clobbers = match &bcx.sess().target.target.arch[..] {
|
let arch_clobbers = match &bcx.sess().target.target.arch[..] {
|
||||||
"x86" | "x86_64" => vec!("~{dirflag}", "~{fpsr}", "~{flags}"),
|
"x86" | "x86_64" => vec!["~{dirflag}", "~{fpsr}", "~{flags}"],
|
||||||
_ => Vec::new()
|
_ => Vec::new()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ fn get_rpaths(config: &mut RPathConfig, libs: &[PathBuf]) -> Vec<String> {
|
||||||
let rel_rpaths = get_rpaths_relative_to_output(config, libs);
|
let rel_rpaths = get_rpaths_relative_to_output(config, libs);
|
||||||
|
|
||||||
// And a final backup rpath to the global library location.
|
// And a final backup rpath to the global library location.
|
||||||
let fallback_rpaths = vec!(get_install_prefix_rpath(config));
|
let fallback_rpaths = vec![get_install_prefix_rpath(config)];
|
||||||
|
|
||||||
fn log_rpaths(desc: &str, rpaths: &[String]) {
|
fn log_rpaths(desc: &str, rpaths: &[String]) {
|
||||||
debug!("{} rpaths:", desc);
|
debug!("{} rpaths:", desc);
|
||||||
|
|
|
@ -665,7 +665,7 @@ pub fn run_passes(sess: &Session,
|
||||||
// Figure out what we actually need to build.
|
// Figure out what we actually need to build.
|
||||||
|
|
||||||
let mut modules_config = ModuleConfig::new(tm, sess.opts.cg.passes.clone());
|
let mut modules_config = ModuleConfig::new(tm, sess.opts.cg.passes.clone());
|
||||||
let mut metadata_config = ModuleConfig::new(tm, vec!());
|
let mut metadata_config = ModuleConfig::new(tm, vec![]);
|
||||||
|
|
||||||
modules_config.opt_level = Some(get_llvm_opt_level(sess.opts.optimize));
|
modules_config.opt_level = Some(get_llvm_opt_level(sess.opts.optimize));
|
||||||
modules_config.opt_size = Some(get_llvm_opt_size(sess.opts.optimize));
|
modules_config.opt_size = Some(get_llvm_opt_size(sess.opts.optimize));
|
||||||
|
|
|
@ -305,7 +305,7 @@ impl<'blk, 'tcx> FunctionContext<'blk, 'tcx> {
|
||||||
assert!(orig_scopes_len > 0);
|
assert!(orig_scopes_len > 0);
|
||||||
|
|
||||||
// Remove any scopes that do not have cleanups on panic:
|
// Remove any scopes that do not have cleanups on panic:
|
||||||
let mut popped_scopes = vec!();
|
let mut popped_scopes = vec![];
|
||||||
while !self.top_scope(|s| s.needs_invoke()) {
|
while !self.top_scope(|s| s.needs_invoke()) {
|
||||||
debug!("top scope does not need invoke");
|
debug!("top scope does not need invoke");
|
||||||
popped_scopes.push(self.pop_scope());
|
popped_scopes.push(self.pop_scope());
|
||||||
|
@ -402,7 +402,7 @@ impl<'blk, 'tcx> FunctionContext<'blk, 'tcx> {
|
||||||
|
|
||||||
let orig_scopes_len = self.scopes_len();
|
let orig_scopes_len = self.scopes_len();
|
||||||
let mut prev_llbb;
|
let mut prev_llbb;
|
||||||
let mut popped_scopes = vec!();
|
let mut popped_scopes = vec![];
|
||||||
let mut skip = 0;
|
let mut skip = 0;
|
||||||
|
|
||||||
// First we pop off all the cleanup stacks that are
|
// First we pop off all the cleanup stacks that are
|
||||||
|
@ -585,8 +585,8 @@ impl<'tcx> CleanupScope<'tcx> {
|
||||||
fn new(debug_loc: DebugLoc) -> CleanupScope<'tcx> {
|
fn new(debug_loc: DebugLoc) -> CleanupScope<'tcx> {
|
||||||
CleanupScope {
|
CleanupScope {
|
||||||
debug_loc: debug_loc,
|
debug_loc: debug_loc,
|
||||||
cleanups: vec!(),
|
cleanups: vec![],
|
||||||
cached_early_exits: vec!(),
|
cached_early_exits: vec![],
|
||||||
cached_landing_pad: None,
|
cached_landing_pad: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,18 +86,18 @@ pub fn check_intrinsic_type(ccx: &CrateCtxt, it: &hir::ForeignItem) {
|
||||||
|
|
||||||
//We only care about the operation here
|
//We only care about the operation here
|
||||||
let (n_tps, inputs, output) = match split[1] {
|
let (n_tps, inputs, output) = match split[1] {
|
||||||
"cxchg" | "cxchgweak" => (1, vec!(tcx.mk_mut_ptr(param(ccx, 0)),
|
"cxchg" | "cxchgweak" => (1, vec![tcx.mk_mut_ptr(param(ccx, 0)),
|
||||||
param(ccx, 0),
|
param(ccx, 0),
|
||||||
param(ccx, 0)),
|
param(ccx, 0)],
|
||||||
tcx.intern_tup(&[param(ccx, 0), tcx.types.bool])),
|
tcx.intern_tup(&[param(ccx, 0), tcx.types.bool])),
|
||||||
"load" => (1, vec!(tcx.mk_imm_ptr(param(ccx, 0))),
|
"load" => (1, vec![tcx.mk_imm_ptr(param(ccx, 0))],
|
||||||
param(ccx, 0)),
|
param(ccx, 0)),
|
||||||
"store" => (1, vec!(tcx.mk_mut_ptr(param(ccx, 0)), param(ccx, 0)),
|
"store" => (1, vec![tcx.mk_mut_ptr(param(ccx, 0)), param(ccx, 0)],
|
||||||
tcx.mk_nil()),
|
tcx.mk_nil()),
|
||||||
|
|
||||||
"xchg" | "xadd" | "xsub" | "and" | "nand" | "or" | "xor" | "max" |
|
"xchg" | "xadd" | "xsub" | "and" | "nand" | "or" | "xor" | "max" |
|
||||||
"min" | "umax" | "umin" => {
|
"min" | "umax" | "umin" => {
|
||||||
(1, vec!(tcx.mk_mut_ptr(param(ccx, 0)), param(ccx, 0)),
|
(1, vec![tcx.mk_mut_ptr(param(ccx, 0)), param(ccx, 0)],
|
||||||
param(ccx, 0))
|
param(ccx, 0))
|
||||||
}
|
}
|
||||||
"fence" | "singlethreadfence" => {
|
"fence" | "singlethreadfence" => {
|
||||||
|
@ -129,14 +129,14 @@ pub fn check_intrinsic_type(ccx: &CrateCtxt, it: &hir::ForeignItem) {
|
||||||
"rustc_peek" => (1, vec![param(ccx, 0)], param(ccx, 0)),
|
"rustc_peek" => (1, vec![param(ccx, 0)], param(ccx, 0)),
|
||||||
"init" => (1, Vec::new(), param(ccx, 0)),
|
"init" => (1, Vec::new(), param(ccx, 0)),
|
||||||
"uninit" => (1, Vec::new(), param(ccx, 0)),
|
"uninit" => (1, Vec::new(), param(ccx, 0)),
|
||||||
"forget" => (1, vec!( param(ccx, 0) ), tcx.mk_nil()),
|
"forget" => (1, vec![ param(ccx, 0) ], tcx.mk_nil()),
|
||||||
"transmute" => (2, vec!( param(ccx, 0) ), param(ccx, 1)),
|
"transmute" => (2, vec![ param(ccx, 0) ], param(ccx, 1)),
|
||||||
"move_val_init" => {
|
"move_val_init" => {
|
||||||
(1,
|
(1,
|
||||||
vec!(
|
vec![
|
||||||
tcx.mk_mut_ptr(param(ccx, 0)),
|
tcx.mk_mut_ptr(param(ccx, 0)),
|
||||||
param(ccx, 0)
|
param(ccx, 0)
|
||||||
),
|
],
|
||||||
tcx.mk_nil())
|
tcx.mk_nil())
|
||||||
}
|
}
|
||||||
"drop_in_place" => {
|
"drop_in_place" => {
|
||||||
|
@ -148,13 +148,13 @@ pub fn check_intrinsic_type(ccx: &CrateCtxt, it: &hir::ForeignItem) {
|
||||||
"type_id" => (1, Vec::new(), ccx.tcx.types.u64),
|
"type_id" => (1, Vec::new(), ccx.tcx.types.u64),
|
||||||
"offset" | "arith_offset" => {
|
"offset" | "arith_offset" => {
|
||||||
(1,
|
(1,
|
||||||
vec!(
|
vec![
|
||||||
tcx.mk_ptr(ty::TypeAndMut {
|
tcx.mk_ptr(ty::TypeAndMut {
|
||||||
ty: param(ccx, 0),
|
ty: param(ccx, 0),
|
||||||
mutbl: hir::MutImmutable
|
mutbl: hir::MutImmutable
|
||||||
}),
|
}),
|
||||||
ccx.tcx.types.isize
|
ccx.tcx.types.isize
|
||||||
),
|
],
|
||||||
tcx.mk_ptr(ty::TypeAndMut {
|
tcx.mk_ptr(ty::TypeAndMut {
|
||||||
ty: param(ccx, 0),
|
ty: param(ccx, 0),
|
||||||
mutbl: hir::MutImmutable
|
mutbl: hir::MutImmutable
|
||||||
|
@ -162,7 +162,7 @@ pub fn check_intrinsic_type(ccx: &CrateCtxt, it: &hir::ForeignItem) {
|
||||||
}
|
}
|
||||||
"copy" | "copy_nonoverlapping" => {
|
"copy" | "copy_nonoverlapping" => {
|
||||||
(1,
|
(1,
|
||||||
vec!(
|
vec![
|
||||||
tcx.mk_ptr(ty::TypeAndMut {
|
tcx.mk_ptr(ty::TypeAndMut {
|
||||||
ty: param(ccx, 0),
|
ty: param(ccx, 0),
|
||||||
mutbl: hir::MutImmutable
|
mutbl: hir::MutImmutable
|
||||||
|
@ -172,12 +172,12 @@ pub fn check_intrinsic_type(ccx: &CrateCtxt, it: &hir::ForeignItem) {
|
||||||
mutbl: hir::MutMutable
|
mutbl: hir::MutMutable
|
||||||
}),
|
}),
|
||||||
tcx.types.usize,
|
tcx.types.usize,
|
||||||
),
|
],
|
||||||
tcx.mk_nil())
|
tcx.mk_nil())
|
||||||
}
|
}
|
||||||
"volatile_copy_memory" | "volatile_copy_nonoverlapping_memory" => {
|
"volatile_copy_memory" | "volatile_copy_nonoverlapping_memory" => {
|
||||||
(1,
|
(1,
|
||||||
vec!(
|
vec![
|
||||||
tcx.mk_ptr(ty::TypeAndMut {
|
tcx.mk_ptr(ty::TypeAndMut {
|
||||||
ty: param(ccx, 0),
|
ty: param(ccx, 0),
|
||||||
mutbl: hir::MutMutable
|
mutbl: hir::MutMutable
|
||||||
|
@ -187,93 +187,93 @@ pub fn check_intrinsic_type(ccx: &CrateCtxt, it: &hir::ForeignItem) {
|
||||||
mutbl: hir::MutImmutable
|
mutbl: hir::MutImmutable
|
||||||
}),
|
}),
|
||||||
tcx.types.usize,
|
tcx.types.usize,
|
||||||
),
|
],
|
||||||
tcx.mk_nil())
|
tcx.mk_nil())
|
||||||
}
|
}
|
||||||
"write_bytes" | "volatile_set_memory" => {
|
"write_bytes" | "volatile_set_memory" => {
|
||||||
(1,
|
(1,
|
||||||
vec!(
|
vec![
|
||||||
tcx.mk_ptr(ty::TypeAndMut {
|
tcx.mk_ptr(ty::TypeAndMut {
|
||||||
ty: param(ccx, 0),
|
ty: param(ccx, 0),
|
||||||
mutbl: hir::MutMutable
|
mutbl: hir::MutMutable
|
||||||
}),
|
}),
|
||||||
tcx.types.u8,
|
tcx.types.u8,
|
||||||
tcx.types.usize,
|
tcx.types.usize,
|
||||||
),
|
],
|
||||||
tcx.mk_nil())
|
tcx.mk_nil())
|
||||||
}
|
}
|
||||||
"sqrtf32" => (0, vec!( tcx.types.f32 ), tcx.types.f32),
|
"sqrtf32" => (0, vec![ tcx.types.f32 ], tcx.types.f32),
|
||||||
"sqrtf64" => (0, vec!( tcx.types.f64 ), tcx.types.f64),
|
"sqrtf64" => (0, vec![ tcx.types.f64 ], tcx.types.f64),
|
||||||
"powif32" => {
|
"powif32" => {
|
||||||
(0,
|
(0,
|
||||||
vec!( tcx.types.f32, tcx.types.i32 ),
|
vec![ tcx.types.f32, tcx.types.i32 ],
|
||||||
tcx.types.f32)
|
tcx.types.f32)
|
||||||
}
|
}
|
||||||
"powif64" => {
|
"powif64" => {
|
||||||
(0,
|
(0,
|
||||||
vec!( tcx.types.f64, tcx.types.i32 ),
|
vec![ tcx.types.f64, tcx.types.i32 ],
|
||||||
tcx.types.f64)
|
tcx.types.f64)
|
||||||
}
|
}
|
||||||
"sinf32" => (0, vec!( tcx.types.f32 ), tcx.types.f32),
|
"sinf32" => (0, vec![ tcx.types.f32 ], tcx.types.f32),
|
||||||
"sinf64" => (0, vec!( tcx.types.f64 ), tcx.types.f64),
|
"sinf64" => (0, vec![ tcx.types.f64 ], tcx.types.f64),
|
||||||
"cosf32" => (0, vec!( tcx.types.f32 ), tcx.types.f32),
|
"cosf32" => (0, vec![ tcx.types.f32 ], tcx.types.f32),
|
||||||
"cosf64" => (0, vec!( tcx.types.f64 ), tcx.types.f64),
|
"cosf64" => (0, vec![ tcx.types.f64 ], tcx.types.f64),
|
||||||
"powf32" => {
|
"powf32" => {
|
||||||
(0,
|
(0,
|
||||||
vec!( tcx.types.f32, tcx.types.f32 ),
|
vec![ tcx.types.f32, tcx.types.f32 ],
|
||||||
tcx.types.f32)
|
tcx.types.f32)
|
||||||
}
|
}
|
||||||
"powf64" => {
|
"powf64" => {
|
||||||
(0,
|
(0,
|
||||||
vec!( tcx.types.f64, tcx.types.f64 ),
|
vec![ tcx.types.f64, tcx.types.f64 ],
|
||||||
tcx.types.f64)
|
tcx.types.f64)
|
||||||
}
|
}
|
||||||
"expf32" => (0, vec!( tcx.types.f32 ), tcx.types.f32),
|
"expf32" => (0, vec![ tcx.types.f32 ], tcx.types.f32),
|
||||||
"expf64" => (0, vec!( tcx.types.f64 ), tcx.types.f64),
|
"expf64" => (0, vec![ tcx.types.f64 ], tcx.types.f64),
|
||||||
"exp2f32" => (0, vec!( tcx.types.f32 ), tcx.types.f32),
|
"exp2f32" => (0, vec![ tcx.types.f32 ], tcx.types.f32),
|
||||||
"exp2f64" => (0, vec!( tcx.types.f64 ), tcx.types.f64),
|
"exp2f64" => (0, vec![ tcx.types.f64 ], tcx.types.f64),
|
||||||
"logf32" => (0, vec!( tcx.types.f32 ), tcx.types.f32),
|
"logf32" => (0, vec![ tcx.types.f32 ], tcx.types.f32),
|
||||||
"logf64" => (0, vec!( tcx.types.f64 ), tcx.types.f64),
|
"logf64" => (0, vec![ tcx.types.f64 ], tcx.types.f64),
|
||||||
"log10f32" => (0, vec!( tcx.types.f32 ), tcx.types.f32),
|
"log10f32" => (0, vec![ tcx.types.f32 ], tcx.types.f32),
|
||||||
"log10f64" => (0, vec!( tcx.types.f64 ), tcx.types.f64),
|
"log10f64" => (0, vec![ tcx.types.f64 ], tcx.types.f64),
|
||||||
"log2f32" => (0, vec!( tcx.types.f32 ), tcx.types.f32),
|
"log2f32" => (0, vec![ tcx.types.f32 ], tcx.types.f32),
|
||||||
"log2f64" => (0, vec!( tcx.types.f64 ), tcx.types.f64),
|
"log2f64" => (0, vec![ tcx.types.f64 ], tcx.types.f64),
|
||||||
"fmaf32" => {
|
"fmaf32" => {
|
||||||
(0,
|
(0,
|
||||||
vec!( tcx.types.f32, tcx.types.f32, tcx.types.f32 ),
|
vec![ tcx.types.f32, tcx.types.f32, tcx.types.f32 ],
|
||||||
tcx.types.f32)
|
tcx.types.f32)
|
||||||
}
|
}
|
||||||
"fmaf64" => {
|
"fmaf64" => {
|
||||||
(0,
|
(0,
|
||||||
vec!( tcx.types.f64, tcx.types.f64, tcx.types.f64 ),
|
vec![ tcx.types.f64, tcx.types.f64, tcx.types.f64 ],
|
||||||
tcx.types.f64)
|
tcx.types.f64)
|
||||||
}
|
}
|
||||||
"fabsf32" => (0, vec!( tcx.types.f32 ), tcx.types.f32),
|
"fabsf32" => (0, vec![ tcx.types.f32 ], tcx.types.f32),
|
||||||
"fabsf64" => (0, vec!( tcx.types.f64 ), tcx.types.f64),
|
"fabsf64" => (0, vec![ tcx.types.f64 ], tcx.types.f64),
|
||||||
"copysignf32" => (0, vec!( tcx.types.f32, tcx.types.f32 ), tcx.types.f32),
|
"copysignf32" => (0, vec![ tcx.types.f32, tcx.types.f32 ], tcx.types.f32),
|
||||||
"copysignf64" => (0, vec!( tcx.types.f64, tcx.types.f64 ), tcx.types.f64),
|
"copysignf64" => (0, vec![ tcx.types.f64, tcx.types.f64 ], tcx.types.f64),
|
||||||
"floorf32" => (0, vec!( tcx.types.f32 ), tcx.types.f32),
|
"floorf32" => (0, vec![ tcx.types.f32 ], tcx.types.f32),
|
||||||
"floorf64" => (0, vec!( tcx.types.f64 ), tcx.types.f64),
|
"floorf64" => (0, vec![ tcx.types.f64 ], tcx.types.f64),
|
||||||
"ceilf32" => (0, vec!( tcx.types.f32 ), tcx.types.f32),
|
"ceilf32" => (0, vec![ tcx.types.f32 ], tcx.types.f32),
|
||||||
"ceilf64" => (0, vec!( tcx.types.f64 ), tcx.types.f64),
|
"ceilf64" => (0, vec![ tcx.types.f64 ], tcx.types.f64),
|
||||||
"truncf32" => (0, vec!( tcx.types.f32 ), tcx.types.f32),
|
"truncf32" => (0, vec![ tcx.types.f32 ], tcx.types.f32),
|
||||||
"truncf64" => (0, vec!( tcx.types.f64 ), tcx.types.f64),
|
"truncf64" => (0, vec![ tcx.types.f64 ], tcx.types.f64),
|
||||||
"rintf32" => (0, vec!( tcx.types.f32 ), tcx.types.f32),
|
"rintf32" => (0, vec![ tcx.types.f32 ], tcx.types.f32),
|
||||||
"rintf64" => (0, vec!( tcx.types.f64 ), tcx.types.f64),
|
"rintf64" => (0, vec![ tcx.types.f64 ], tcx.types.f64),
|
||||||
"nearbyintf32" => (0, vec!( tcx.types.f32 ), tcx.types.f32),
|
"nearbyintf32" => (0, vec![ tcx.types.f32 ], tcx.types.f32),
|
||||||
"nearbyintf64" => (0, vec!( tcx.types.f64 ), tcx.types.f64),
|
"nearbyintf64" => (0, vec![ tcx.types.f64 ], tcx.types.f64),
|
||||||
"roundf32" => (0, vec!( tcx.types.f32 ), tcx.types.f32),
|
"roundf32" => (0, vec![ tcx.types.f32 ], tcx.types.f32),
|
||||||
"roundf64" => (0, vec!( tcx.types.f64 ), tcx.types.f64),
|
"roundf64" => (0, vec![ tcx.types.f64 ], tcx.types.f64),
|
||||||
|
|
||||||
"volatile_load" =>
|
"volatile_load" =>
|
||||||
(1, vec!( tcx.mk_imm_ptr(param(ccx, 0)) ), param(ccx, 0)),
|
(1, vec![ tcx.mk_imm_ptr(param(ccx, 0)) ], param(ccx, 0)),
|
||||||
"volatile_store" =>
|
"volatile_store" =>
|
||||||
(1, vec!( tcx.mk_mut_ptr(param(ccx, 0)), param(ccx, 0) ), tcx.mk_nil()),
|
(1, vec![ tcx.mk_mut_ptr(param(ccx, 0)), param(ccx, 0) ], tcx.mk_nil()),
|
||||||
|
|
||||||
"ctpop" | "ctlz" | "cttz" | "bswap" => (1, vec!(param(ccx, 0)), param(ccx, 0)),
|
"ctpop" | "ctlz" | "cttz" | "bswap" => (1, vec![param(ccx, 0)], param(ccx, 0)),
|
||||||
|
|
||||||
"add_with_overflow" | "sub_with_overflow" | "mul_with_overflow" =>
|
"add_with_overflow" | "sub_with_overflow" | "mul_with_overflow" =>
|
||||||
(1, vec!(param(ccx, 0), param(ccx, 0)),
|
(1, vec![param(ccx, 0), param(ccx, 0)],
|
||||||
tcx.intern_tup(&[param(ccx, 0), tcx.types.bool])),
|
tcx.intern_tup(&[param(ccx, 0), tcx.types.bool])),
|
||||||
|
|
||||||
"unchecked_div" | "unchecked_rem" =>
|
"unchecked_div" | "unchecked_rem" =>
|
||||||
|
|
|
@ -1387,7 +1387,7 @@ fn convert_trait_predicates<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, it: &hir::Item)
|
||||||
let bounds = match trait_item.node {
|
let bounds = match trait_item.node {
|
||||||
hir::TypeTraitItem(ref bounds, _) => bounds,
|
hir::TypeTraitItem(ref bounds, _) => bounds,
|
||||||
_ => {
|
_ => {
|
||||||
return vec!().into_iter();
|
return vec![].into_iter();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -291,10 +291,10 @@ fn check_start_fn_ty(ccx: &CrateCtxt,
|
||||||
unsafety: hir::Unsafety::Normal,
|
unsafety: hir::Unsafety::Normal,
|
||||||
abi: Abi::Rust,
|
abi: Abi::Rust,
|
||||||
sig: ty::Binder(ty::FnSig {
|
sig: ty::Binder(ty::FnSig {
|
||||||
inputs: vec!(
|
inputs: vec![
|
||||||
tcx.types.isize,
|
tcx.types.isize,
|
||||||
tcx.mk_imm_ptr(tcx.mk_imm_ptr(tcx.types.u8))
|
tcx.mk_imm_ptr(tcx.mk_imm_ptr(tcx.types.u8))
|
||||||
),
|
],
|
||||||
output: tcx.types.isize,
|
output: tcx.types.isize,
|
||||||
variadic: false,
|
variadic: false,
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -143,8 +143,8 @@ pub fn run_core(search_paths: SearchPaths,
|
||||||
let sessopts = config::Options {
|
let sessopts = config::Options {
|
||||||
maybe_sysroot: maybe_sysroot,
|
maybe_sysroot: maybe_sysroot,
|
||||||
search_paths: search_paths,
|
search_paths: search_paths,
|
||||||
crate_types: vec!(config::CrateTypeRlib),
|
crate_types: vec![config::CrateTypeRlib],
|
||||||
lint_opts: vec!((warning_lint, lint::Allow)),
|
lint_opts: vec![(warning_lint, lint::Allow)],
|
||||||
lint_cap: Some(lint::Allow),
|
lint_cap: Some(lint::Allow),
|
||||||
externs: externs,
|
externs: externs,
|
||||||
target_triple: triple.unwrap_or(config::host_triple().to_string()),
|
target_triple: triple.unwrap_or(config::host_triple().to_string()),
|
||||||
|
|
|
@ -644,7 +644,7 @@ mod tests {
|
||||||
t("test_harness", false, false, false, true, true, false, Vec::new());
|
t("test_harness", false, false, false, true, true, false, Vec::new());
|
||||||
t("compile_fail", false, true, false, true, false, true, Vec::new());
|
t("compile_fail", false, true, false, true, false, true, Vec::new());
|
||||||
t("E0450", false, false, false, true, false, false,
|
t("E0450", false, false, false, true, false, false,
|
||||||
vec!("E0450".to_owned()));
|
vec!["E0450".to_owned()]);
|
||||||
t("{.no_run .example}", false, true, false, true, false, false, Vec::new());
|
t("{.no_run .example}", false, true, false, true, false, false, Vec::new());
|
||||||
t("{.sh .should_panic}", true, false, false, true, false, false, Vec::new());
|
t("{.sh .should_panic}", true, false, false, true, false, false, Vec::new());
|
||||||
t("{.example .rust}", false, false, false, true, false, false, Vec::new());
|
t("{.example .rust}", false, false, false, true, false, false, Vec::new());
|
||||||
|
|
|
@ -1260,7 +1260,7 @@ impl Context {
|
||||||
item.name = Some(krate.name);
|
item.name = Some(krate.name);
|
||||||
|
|
||||||
// render the crate documentation
|
// render the crate documentation
|
||||||
let mut work = vec!((self, item));
|
let mut work = vec![(self, item)];
|
||||||
|
|
||||||
while let Some((mut cx, item)) = work.pop() {
|
while let Some((mut cx, item)) = work.pop() {
|
||||||
cx.item(item, |cx, item| {
|
cx.item(item, |cx, item| {
|
||||||
|
|
|
@ -247,7 +247,7 @@ mod tests {
|
||||||
macro_rules! toc {
|
macro_rules! toc {
|
||||||
($(($level: expr, $name: expr, $(($sub: tt))* )),*) => {
|
($(($level: expr, $name: expr, $(($sub: tt))* )),*) => {
|
||||||
Toc {
|
Toc {
|
||||||
entries: vec!(
|
entries: vec![
|
||||||
$(
|
$(
|
||||||
TocEntry {
|
TocEntry {
|
||||||
level: $level,
|
level: $level,
|
||||||
|
@ -257,7 +257,7 @@ mod tests {
|
||||||
children: toc!($($sub),*)
|
children: toc!($($sub),*)
|
||||||
}
|
}
|
||||||
),*
|
),*
|
||||||
)
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ fn unstable(g: getopts::OptGroup) -> RustcOptGroup { RustcOptGroup::unstable(g)
|
||||||
|
|
||||||
pub fn opts() -> Vec<RustcOptGroup> {
|
pub fn opts() -> Vec<RustcOptGroup> {
|
||||||
use getopts::*;
|
use getopts::*;
|
||||||
vec!(
|
vec![
|
||||||
stable(optflag("h", "help", "show this help message")),
|
stable(optflag("h", "help", "show this help message")),
|
||||||
stable(optflag("V", "version", "print rustdoc's version")),
|
stable(optflag("V", "version", "print rustdoc's version")),
|
||||||
stable(optflag("v", "verbose", "use verbose output")),
|
stable(optflag("v", "verbose", "use verbose output")),
|
||||||
|
@ -162,7 +162,7 @@ pub fn opts() -> Vec<RustcOptGroup> {
|
||||||
unstable(optmulti("Z", "",
|
unstable(optmulti("Z", "",
|
||||||
"internal and debugging options (only on nightly build)", "FLAG")),
|
"internal and debugging options (only on nightly build)", "FLAG")),
|
||||||
stable(optopt("", "sysroot", "Override the system root", "PATH")),
|
stable(optopt("", "sysroot", "Override the system root", "PATH")),
|
||||||
)
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn usage(argv0: &str) {
|
pub fn usage(argv0: &str) {
|
||||||
|
|
|
@ -66,7 +66,7 @@ pub fn run(input: &str,
|
||||||
maybe_sysroot: Some(env::current_exe().unwrap().parent().unwrap()
|
maybe_sysroot: Some(env::current_exe().unwrap().parent().unwrap()
|
||||||
.parent().unwrap().to_path_buf()),
|
.parent().unwrap().to_path_buf()),
|
||||||
search_paths: libs.clone(),
|
search_paths: libs.clone(),
|
||||||
crate_types: vec!(config::CrateTypeDylib),
|
crate_types: vec![config::CrateTypeDylib],
|
||||||
externs: externs.clone(),
|
externs: externs.clone(),
|
||||||
unstable_features: UnstableFeatures::from_environment(),
|
unstable_features: UnstableFeatures::from_environment(),
|
||||||
..config::basic_options().clone()
|
..config::basic_options().clone()
|
||||||
|
@ -185,7 +185,7 @@ fn runtest(test: &str, cratename: &str, cfgs: Vec<String>, libs: SearchPaths,
|
||||||
maybe_sysroot: Some(env::current_exe().unwrap().parent().unwrap()
|
maybe_sysroot: Some(env::current_exe().unwrap().parent().unwrap()
|
||||||
.parent().unwrap().to_path_buf()),
|
.parent().unwrap().to_path_buf()),
|
||||||
search_paths: libs,
|
search_paths: libs,
|
||||||
crate_types: vec!(config::CrateTypeExecutable),
|
crate_types: vec![config::CrateTypeExecutable],
|
||||||
output_types: outputs,
|
output_types: outputs,
|
||||||
externs: externs,
|
externs: externs,
|
||||||
cg: config::CodegenOptions {
|
cg: config::CodegenOptions {
|
||||||
|
|
|
@ -3880,8 +3880,8 @@ mod tests {
|
||||||
use std::collections::{HashMap,BTreeMap};
|
use std::collections::{HashMap,BTreeMap};
|
||||||
use super::ToJson;
|
use super::ToJson;
|
||||||
|
|
||||||
let array2 = Array(vec!(U64(1), U64(2)));
|
let array2 = Array(vec![U64(1), U64(2)]);
|
||||||
let array3 = Array(vec!(U64(1), U64(2), U64(3)));
|
let array3 = Array(vec![U64(1), U64(2), U64(3)]);
|
||||||
let object = {
|
let object = {
|
||||||
let mut tree_map = BTreeMap::new();
|
let mut tree_map = BTreeMap::new();
|
||||||
tree_map.insert("a".to_string(), U64(1));
|
tree_map.insert("a".to_string(), U64(1));
|
||||||
|
@ -3915,7 +3915,7 @@ mod tests {
|
||||||
assert_eq!([1_usize, 2_usize].to_json(), array2);
|
assert_eq!([1_usize, 2_usize].to_json(), array2);
|
||||||
assert_eq!((&[1_usize, 2_usize, 3_usize]).to_json(), array3);
|
assert_eq!((&[1_usize, 2_usize, 3_usize]).to_json(), array3);
|
||||||
assert_eq!((vec![1_usize, 2_usize]).to_json(), array2);
|
assert_eq!((vec![1_usize, 2_usize]).to_json(), array2);
|
||||||
assert_eq!(vec!(1_usize, 2_usize, 3_usize).to_json(), array3);
|
assert_eq!(vec![1_usize, 2_usize, 3_usize].to_json(), array3);
|
||||||
let mut tree_map = BTreeMap::new();
|
let mut tree_map = BTreeMap::new();
|
||||||
tree_map.insert("a".to_string(), 1 as usize);
|
tree_map.insert("a".to_string(), 1 as usize);
|
||||||
tree_map.insert("b".to_string(), 2);
|
tree_map.insert("b".to_string(), 2);
|
||||||
|
|
|
@ -392,7 +392,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mem_reader() {
|
fn test_mem_reader() {
|
||||||
let mut reader = Cursor::new(vec!(0, 1, 2, 3, 4, 5, 6, 7));
|
let mut reader = Cursor::new(vec![0, 1, 2, 3, 4, 5, 6, 7]);
|
||||||
let mut buf = [];
|
let mut buf = [];
|
||||||
assert_eq!(reader.read(&mut buf).unwrap(), 0);
|
assert_eq!(reader.read(&mut buf).unwrap(), 0);
|
||||||
assert_eq!(reader.position(), 0);
|
assert_eq!(reader.position(), 0);
|
||||||
|
@ -414,7 +414,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_boxed_slice_reader() {
|
fn test_boxed_slice_reader() {
|
||||||
let mut reader = Cursor::new(vec!(0, 1, 2, 3, 4, 5, 6, 7).into_boxed_slice());
|
let mut reader = Cursor::new(vec![0, 1, 2, 3, 4, 5, 6, 7].into_boxed_slice());
|
||||||
let mut buf = [];
|
let mut buf = [];
|
||||||
assert_eq!(reader.read(&mut buf).unwrap(), 0);
|
assert_eq!(reader.read(&mut buf).unwrap(), 0);
|
||||||
assert_eq!(reader.position(), 0);
|
assert_eq!(reader.position(), 0);
|
||||||
|
@ -436,7 +436,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn read_to_end() {
|
fn read_to_end() {
|
||||||
let mut reader = Cursor::new(vec!(0, 1, 2, 3, 4, 5, 6, 7));
|
let mut reader = Cursor::new(vec![0, 1, 2, 3, 4, 5, 6, 7]);
|
||||||
let mut v = Vec::new();
|
let mut v = Vec::new();
|
||||||
reader.read_to_end(&mut v).unwrap();
|
reader.read_to_end(&mut v).unwrap();
|
||||||
assert_eq!(v, [0, 1, 2, 3, 4, 5, 6, 7]);
|
assert_eq!(v, [0, 1, 2, 3, 4, 5, 6, 7]);
|
||||||
|
@ -512,7 +512,7 @@ mod tests {
|
||||||
assert_eq!(r.seek(SeekFrom::Start(10)).unwrap(), 10);
|
assert_eq!(r.seek(SeekFrom::Start(10)).unwrap(), 10);
|
||||||
assert_eq!(r.read(&mut [0]).unwrap(), 0);
|
assert_eq!(r.read(&mut [0]).unwrap(), 0);
|
||||||
|
|
||||||
let mut r = Cursor::new(vec!(10));
|
let mut r = Cursor::new(vec![10]);
|
||||||
assert_eq!(r.seek(SeekFrom::Start(10)).unwrap(), 10);
|
assert_eq!(r.seek(SeekFrom::Start(10)).unwrap(), 10);
|
||||||
assert_eq!(r.read(&mut [0]).unwrap(), 0);
|
assert_eq!(r.read(&mut [0]).unwrap(), 0);
|
||||||
|
|
||||||
|
@ -532,14 +532,14 @@ mod tests {
|
||||||
let mut r = Cursor::new(&buf[..]);
|
let mut r = Cursor::new(&buf[..]);
|
||||||
assert!(r.seek(SeekFrom::End(-2)).is_err());
|
assert!(r.seek(SeekFrom::End(-2)).is_err());
|
||||||
|
|
||||||
let mut r = Cursor::new(vec!(10));
|
let mut r = Cursor::new(vec![10]);
|
||||||
assert!(r.seek(SeekFrom::End(-2)).is_err());
|
assert!(r.seek(SeekFrom::End(-2)).is_err());
|
||||||
|
|
||||||
let mut buf = [0];
|
let mut buf = [0];
|
||||||
let mut r = Cursor::new(&mut buf[..]);
|
let mut r = Cursor::new(&mut buf[..]);
|
||||||
assert!(r.seek(SeekFrom::End(-2)).is_err());
|
assert!(r.seek(SeekFrom::End(-2)).is_err());
|
||||||
|
|
||||||
let mut r = Cursor::new(vec!(10).into_boxed_slice());
|
let mut r = Cursor::new(vec![10].into_boxed_slice());
|
||||||
assert!(r.seek(SeekFrom::End(-2)).is_err());
|
assert!(r.seek(SeekFrom::End(-2)).is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -245,7 +245,7 @@ mod tests {
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(target_os = "emscripten", ignore)]
|
||||||
fn test_os_rng_tasks() {
|
fn test_os_rng_tasks() {
|
||||||
|
|
||||||
let mut txs = vec!();
|
let mut txs = vec![];
|
||||||
for _ in 0..20 {
|
for _ in 0..20 {
|
||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
txs.push(tx);
|
txs.push(tx);
|
||||||
|
|
|
@ -161,12 +161,12 @@ impl Path {
|
||||||
Path {
|
Path {
|
||||||
span: s,
|
span: s,
|
||||||
global: false,
|
global: false,
|
||||||
segments: vec!(
|
segments: vec![
|
||||||
PathSegment {
|
PathSegment {
|
||||||
identifier: identifier,
|
identifier: identifier,
|
||||||
parameters: PathParameters::none()
|
parameters: PathParameters::none()
|
||||||
}
|
}
|
||||||
),
|
],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -312,7 +312,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||||
self.path_all(span, false, strs, Vec::new(), Vec::new(), Vec::new())
|
self.path_all(span, false, strs, Vec::new(), Vec::new(), Vec::new())
|
||||||
}
|
}
|
||||||
fn path_ident(&self, span: Span, id: ast::Ident) -> ast::Path {
|
fn path_ident(&self, span: Span, id: ast::Ident) -> ast::Path {
|
||||||
self.path(span, vec!(id))
|
self.path(span, vec![id])
|
||||||
}
|
}
|
||||||
fn path_global(&self, span: Span, strs: Vec<ast::Ident> ) -> ast::Path {
|
fn path_global(&self, span: Span, strs: Vec<ast::Ident> ) -> ast::Path {
|
||||||
self.path_all(span, true, strs, Vec::new(), Vec::new(), Vec::new())
|
self.path_all(span, true, strs, Vec::new(), Vec::new(), Vec::new())
|
||||||
|
@ -443,7 +443,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||||
true,
|
true,
|
||||||
self.std_path(&["option", "Option"]),
|
self.std_path(&["option", "Option"]),
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
vec!( ty ),
|
vec![ ty ],
|
||||||
Vec::new()))
|
Vec::new()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,7 +477,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||||
fn ty_vars_global(&self, ty_params: &P<[ast::TyParam]>) -> Vec<P<ast::Ty>> {
|
fn ty_vars_global(&self, ty_params: &P<[ast::TyParam]>) -> Vec<P<ast::Ty>> {
|
||||||
ty_params
|
ty_params
|
||||||
.iter()
|
.iter()
|
||||||
.map(|p| self.ty_path(self.path_global(DUMMY_SP, vec!(p.ident))))
|
.map(|p| self.ty_path(self.path_global(DUMMY_SP, vec![p.ident])))
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -770,7 +770,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||||
|
|
||||||
fn expr_some(&self, sp: Span, expr: P<ast::Expr>) -> P<ast::Expr> {
|
fn expr_some(&self, sp: Span, expr: P<ast::Expr>) -> P<ast::Expr> {
|
||||||
let some = self.std_path(&["option", "Option", "Some"]);
|
let some = self.std_path(&["option", "Option", "Some"]);
|
||||||
self.expr_call_global(sp, some, vec!(expr))
|
self.expr_call_global(sp, some, vec![expr])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn expr_none(&self, sp: Span) -> P<ast::Expr> {
|
fn expr_none(&self, sp: Span) -> P<ast::Expr> {
|
||||||
|
@ -794,14 +794,14 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||||
let expr_file = self.expr_str(span,
|
let expr_file = self.expr_str(span,
|
||||||
token::intern_and_get_ident(&loc.file.name));
|
token::intern_and_get_ident(&loc.file.name));
|
||||||
let expr_line = self.expr_u32(span, loc.line as u32);
|
let expr_line = self.expr_u32(span, loc.line as u32);
|
||||||
let expr_file_line_tuple = self.expr_tuple(span, vec!(expr_file, expr_line));
|
let expr_file_line_tuple = self.expr_tuple(span, vec![expr_file, expr_line]);
|
||||||
let expr_file_line_ptr = self.expr_addr_of(span, expr_file_line_tuple);
|
let expr_file_line_ptr = self.expr_addr_of(span, expr_file_line_tuple);
|
||||||
self.expr_call_global(
|
self.expr_call_global(
|
||||||
span,
|
span,
|
||||||
self.std_path(&["rt", "begin_panic"]),
|
self.std_path(&["rt", "begin_panic"]),
|
||||||
vec!(
|
vec![
|
||||||
self.expr_str(span, msg),
|
self.expr_str(span, msg),
|
||||||
expr_file_line_ptr))
|
expr_file_line_ptr])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn expr_unreachable(&self, span: Span) -> P<ast::Expr> {
|
fn expr_unreachable(&self, span: Span) -> P<ast::Expr> {
|
||||||
|
@ -812,12 +812,12 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||||
|
|
||||||
fn expr_ok(&self, sp: Span, expr: P<ast::Expr>) -> P<ast::Expr> {
|
fn expr_ok(&self, sp: Span, expr: P<ast::Expr>) -> P<ast::Expr> {
|
||||||
let ok = self.std_path(&["result", "Result", "Ok"]);
|
let ok = self.std_path(&["result", "Result", "Ok"]);
|
||||||
self.expr_call_global(sp, ok, vec!(expr))
|
self.expr_call_global(sp, ok, vec![expr])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn expr_err(&self, sp: Span, expr: P<ast::Expr>) -> P<ast::Expr> {
|
fn expr_err(&self, sp: Span, expr: P<ast::Expr>) -> P<ast::Expr> {
|
||||||
let err = self.std_path(&["result", "Result", "Err"]);
|
let err = self.std_path(&["result", "Result", "Err"]);
|
||||||
self.expr_call_global(sp, err, vec!(expr))
|
self.expr_call_global(sp, err, vec![expr])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn expr_try(&self, sp: Span, head: P<ast::Expr>) -> P<ast::Expr> {
|
fn expr_try(&self, sp: Span, head: P<ast::Expr>) -> P<ast::Expr> {
|
||||||
|
@ -836,17 +836,17 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||||
// Err(__try_var) (pattern and expression resp.)
|
// Err(__try_var) (pattern and expression resp.)
|
||||||
let err_pat = self.pat_tuple_struct(sp, err_path.clone(), vec![binding_pat]);
|
let err_pat = self.pat_tuple_struct(sp, err_path.clone(), vec![binding_pat]);
|
||||||
let err_inner_expr = self.expr_call(sp, self.expr_path(err_path),
|
let err_inner_expr = self.expr_call(sp, self.expr_path(err_path),
|
||||||
vec!(binding_expr.clone()));
|
vec![binding_expr.clone()]);
|
||||||
// return Err(__try_var)
|
// return Err(__try_var)
|
||||||
let err_expr = self.expr(sp, ast::ExprKind::Ret(Some(err_inner_expr)));
|
let err_expr = self.expr(sp, ast::ExprKind::Ret(Some(err_inner_expr)));
|
||||||
|
|
||||||
// Ok(__try_var) => __try_var
|
// Ok(__try_var) => __try_var
|
||||||
let ok_arm = self.arm(sp, vec!(ok_pat), binding_expr);
|
let ok_arm = self.arm(sp, vec![ok_pat], binding_expr);
|
||||||
// Err(__try_var) => return Err(__try_var)
|
// Err(__try_var) => return Err(__try_var)
|
||||||
let err_arm = self.arm(sp, vec!(err_pat), err_expr);
|
let err_arm = self.arm(sp, vec![err_pat], err_expr);
|
||||||
|
|
||||||
// match head { Ok() => ..., Err() => ... }
|
// match head { Ok() => ..., Err() => ... }
|
||||||
self.expr_match(sp, head, vec!(ok_arm, err_arm))
|
self.expr_match(sp, head, vec![ok_arm, err_arm])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -912,7 +912,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||||
|
|
||||||
fn arm(&self, _span: Span, pats: Vec<P<ast::Pat>>, expr: P<ast::Expr>) -> ast::Arm {
|
fn arm(&self, _span: Span, pats: Vec<P<ast::Pat>>, expr: P<ast::Expr>) -> ast::Arm {
|
||||||
ast::Arm {
|
ast::Arm {
|
||||||
attrs: vec!(),
|
attrs: vec![],
|
||||||
pats: pats,
|
pats: pats,
|
||||||
guard: None,
|
guard: None,
|
||||||
body: expr
|
body: expr
|
||||||
|
@ -920,7 +920,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn arm_unreachable(&self, span: Span) -> ast::Arm {
|
fn arm_unreachable(&self, span: Span) -> ast::Arm {
|
||||||
self.arm(span, vec!(self.pat_wild(span)), self.expr_unreachable(span))
|
self.arm(span, vec![self.pat_wild(span)], self.expr_unreachable(span))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn expr_match(&self, span: Span, arg: P<ast::Expr>, arms: Vec<ast::Arm>) -> P<Expr> {
|
fn expr_match(&self, span: Span, arg: P<ast::Expr>, arms: Vec<ast::Arm>) -> P<Expr> {
|
||||||
|
@ -970,7 +970,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lambda1(&self, span: Span, blk: P<ast::Block>, ident: ast::Ident) -> P<ast::Expr> {
|
fn lambda1(&self, span: Span, blk: P<ast::Block>, ident: ast::Ident) -> P<ast::Expr> {
|
||||||
self.lambda(span, vec!(ident), blk)
|
self.lambda(span, vec![ident], blk)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lambda_expr(&self, span: Span, ids: Vec<ast::Ident>,
|
fn lambda_expr(&self, span: Span, ids: Vec<ast::Ident>,
|
||||||
|
|
|
@ -46,7 +46,7 @@ pub mod rt {
|
||||||
|
|
||||||
impl ToTokens for TokenTree {
|
impl ToTokens for TokenTree {
|
||||||
fn to_tokens(&self, _cx: &ExtCtxt) -> Vec<TokenTree> {
|
fn to_tokens(&self, _cx: &ExtCtxt) -> Vec<TokenTree> {
|
||||||
vec!(self.clone())
|
vec![self.clone()]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,7 +416,7 @@ pub fn expand_quote_expr<'cx>(cx: &'cx mut ExtCtxt,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
tts: &[TokenTree])
|
tts: &[TokenTree])
|
||||||
-> Box<base::MacResult+'cx> {
|
-> Box<base::MacResult+'cx> {
|
||||||
let expanded = expand_parse_call(cx, sp, "parse_expr_panic", vec!(), tts);
|
let expanded = expand_parse_call(cx, sp, "parse_expr_panic", vec![], tts);
|
||||||
base::MacEager::expr(expanded)
|
base::MacEager::expr(expanded)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ pub fn expand_quote_item<'cx>(cx: &'cx mut ExtCtxt,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
tts: &[TokenTree])
|
tts: &[TokenTree])
|
||||||
-> Box<base::MacResult+'cx> {
|
-> Box<base::MacResult+'cx> {
|
||||||
let expanded = expand_parse_call(cx, sp, "parse_item_panic", vec!(), tts);
|
let expanded = expand_parse_call(cx, sp, "parse_item_panic", vec![], tts);
|
||||||
base::MacEager::expr(expanded)
|
base::MacEager::expr(expanded)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,7 +432,7 @@ pub fn expand_quote_pat<'cx>(cx: &'cx mut ExtCtxt,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
tts: &[TokenTree])
|
tts: &[TokenTree])
|
||||||
-> Box<base::MacResult+'cx> {
|
-> Box<base::MacResult+'cx> {
|
||||||
let expanded = expand_parse_call(cx, sp, "parse_pat_panic", vec!(), tts);
|
let expanded = expand_parse_call(cx, sp, "parse_pat_panic", vec![], tts);
|
||||||
base::MacEager::expr(expanded)
|
base::MacEager::expr(expanded)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ pub fn expand_quote_arm(cx: &mut ExtCtxt,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
tts: &[TokenTree])
|
tts: &[TokenTree])
|
||||||
-> Box<base::MacResult+'static> {
|
-> Box<base::MacResult+'static> {
|
||||||
let expanded = expand_parse_call(cx, sp, "parse_arm_panic", vec!(), tts);
|
let expanded = expand_parse_call(cx, sp, "parse_arm_panic", vec![], tts);
|
||||||
base::MacEager::expr(expanded)
|
base::MacEager::expr(expanded)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ pub fn expand_quote_ty(cx: &mut ExtCtxt,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
tts: &[TokenTree])
|
tts: &[TokenTree])
|
||||||
-> Box<base::MacResult+'static> {
|
-> Box<base::MacResult+'static> {
|
||||||
let expanded = expand_parse_call(cx, sp, "parse_ty_panic", vec!(), tts);
|
let expanded = expand_parse_call(cx, sp, "parse_ty_panic", vec![], tts);
|
||||||
base::MacEager::expr(expanded)
|
base::MacEager::expr(expanded)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,7 +456,7 @@ pub fn expand_quote_stmt(cx: &mut ExtCtxt,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
tts: &[TokenTree])
|
tts: &[TokenTree])
|
||||||
-> Box<base::MacResult+'static> {
|
-> Box<base::MacResult+'static> {
|
||||||
let expanded = expand_parse_call(cx, sp, "parse_stmt_panic", vec!(), tts);
|
let expanded = expand_parse_call(cx, sp, "parse_stmt_panic", vec![], tts);
|
||||||
base::MacEager::expr(expanded)
|
base::MacEager::expr(expanded)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ pub fn expand_quote_attr(cx: &mut ExtCtxt,
|
||||||
tts: &[TokenTree])
|
tts: &[TokenTree])
|
||||||
-> Box<base::MacResult+'static> {
|
-> Box<base::MacResult+'static> {
|
||||||
let expanded = expand_parse_call(cx, sp, "parse_attribute_panic",
|
let expanded = expand_parse_call(cx, sp, "parse_attribute_panic",
|
||||||
vec!(cx.expr_bool(sp, true)), tts);
|
vec![cx.expr_bool(sp, true)], tts);
|
||||||
|
|
||||||
base::MacEager::expr(expanded)
|
base::MacEager::expr(expanded)
|
||||||
}
|
}
|
||||||
|
@ -474,7 +474,7 @@ pub fn expand_quote_arg(cx: &mut ExtCtxt,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
tts: &[TokenTree])
|
tts: &[TokenTree])
|
||||||
-> Box<base::MacResult+'static> {
|
-> Box<base::MacResult+'static> {
|
||||||
let expanded = expand_parse_call(cx, sp, "parse_arg_panic", vec!(), tts);
|
let expanded = expand_parse_call(cx, sp, "parse_arg_panic", vec![], tts);
|
||||||
base::MacEager::expr(expanded)
|
base::MacEager::expr(expanded)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,7 +482,7 @@ pub fn expand_quote_block(cx: &mut ExtCtxt,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
tts: &[TokenTree])
|
tts: &[TokenTree])
|
||||||
-> Box<base::MacResult+'static> {
|
-> Box<base::MacResult+'static> {
|
||||||
let expanded = expand_parse_call(cx, sp, "parse_block_panic", vec!(), tts);
|
let expanded = expand_parse_call(cx, sp, "parse_block_panic", vec![], tts);
|
||||||
base::MacEager::expr(expanded)
|
base::MacEager::expr(expanded)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,7 +490,7 @@ pub fn expand_quote_meta_item(cx: &mut ExtCtxt,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
tts: &[TokenTree])
|
tts: &[TokenTree])
|
||||||
-> Box<base::MacResult+'static> {
|
-> Box<base::MacResult+'static> {
|
||||||
let expanded = expand_parse_call(cx, sp, "parse_meta_item_panic", vec!(), tts);
|
let expanded = expand_parse_call(cx, sp, "parse_meta_item_panic", vec![], tts);
|
||||||
base::MacEager::expr(expanded)
|
base::MacEager::expr(expanded)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ pub fn expand_quote_path(cx: &mut ExtCtxt,
|
||||||
tts: &[TokenTree])
|
tts: &[TokenTree])
|
||||||
-> Box<base::MacResult+'static> {
|
-> Box<base::MacResult+'static> {
|
||||||
let mode = mk_parser_path(cx, sp, &["PathStyle", "Type"]);
|
let mode = mk_parser_path(cx, sp, &["PathStyle", "Type"]);
|
||||||
let expanded = expand_parse_call(cx, sp, "parse_path_panic", vec!(mode), tts);
|
let expanded = expand_parse_call(cx, sp, "parse_path_panic", vec![mode], tts);
|
||||||
base::MacEager::expr(expanded)
|
base::MacEager::expr(expanded)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,7 +531,7 @@ fn mk_ident(cx: &ExtCtxt, sp: Span, ident: ast::Ident) -> P<ast::Expr> {
|
||||||
cx.expr_method_call(sp,
|
cx.expr_method_call(sp,
|
||||||
cx.expr_ident(sp, id_ext("ext_cx")),
|
cx.expr_ident(sp, id_ext("ext_cx")),
|
||||||
id_ext("ident_of"),
|
id_ext("ident_of"),
|
||||||
vec!(e_str))
|
vec![e_str])
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lift a name to the expr that evaluates to that name
|
// Lift a name to the expr that evaluates to that name
|
||||||
|
@ -540,16 +540,16 @@ fn mk_name(cx: &ExtCtxt, sp: Span, ident: ast::Ident) -> P<ast::Expr> {
|
||||||
cx.expr_method_call(sp,
|
cx.expr_method_call(sp,
|
||||||
cx.expr_ident(sp, id_ext("ext_cx")),
|
cx.expr_ident(sp, id_ext("ext_cx")),
|
||||||
id_ext("name_of"),
|
id_ext("name_of"),
|
||||||
vec!(e_str))
|
vec![e_str])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mk_tt_path(cx: &ExtCtxt, sp: Span, name: &str) -> P<ast::Expr> {
|
fn mk_tt_path(cx: &ExtCtxt, sp: Span, name: &str) -> P<ast::Expr> {
|
||||||
let idents = vec!(id_ext("syntax"), id_ext("tokenstream"), id_ext("TokenTree"), id_ext(name));
|
let idents = vec![id_ext("syntax"), id_ext("tokenstream"), id_ext("TokenTree"), id_ext(name)];
|
||||||
cx.expr_path(cx.path_global(sp, idents))
|
cx.expr_path(cx.path_global(sp, idents))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mk_token_path(cx: &ExtCtxt, sp: Span, name: &str) -> P<ast::Expr> {
|
fn mk_token_path(cx: &ExtCtxt, sp: Span, name: &str) -> P<ast::Expr> {
|
||||||
let idents = vec!(id_ext("syntax"), id_ext("parse"), id_ext("token"), id_ext(name));
|
let idents = vec![id_ext("syntax"), id_ext("parse"), id_ext("token"), id_ext(name)];
|
||||||
cx.expr_path(cx.path_global(sp, idents))
|
cx.expr_path(cx.path_global(sp, idents))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,11 +599,11 @@ fn expr_mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> P<ast::Expr> {
|
||||||
}
|
}
|
||||||
match *tok {
|
match *tok {
|
||||||
token::BinOp(binop) => {
|
token::BinOp(binop) => {
|
||||||
return cx.expr_call(sp, mk_token_path(cx, sp, "BinOp"), vec!(mk_binop(cx, sp, binop)));
|
return cx.expr_call(sp, mk_token_path(cx, sp, "BinOp"), vec![mk_binop(cx, sp, binop)]);
|
||||||
}
|
}
|
||||||
token::BinOpEq(binop) => {
|
token::BinOpEq(binop) => {
|
||||||
return cx.expr_call(sp, mk_token_path(cx, sp, "BinOpEq"),
|
return cx.expr_call(sp, mk_token_path(cx, sp, "BinOpEq"),
|
||||||
vec!(mk_binop(cx, sp, binop)));
|
vec![mk_binop(cx, sp, binop)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
token::OpenDelim(delim) => {
|
token::OpenDelim(delim) => {
|
||||||
|
@ -653,13 +653,13 @@ fn expr_mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> P<ast::Expr> {
|
||||||
token::Lifetime(ident) => {
|
token::Lifetime(ident) => {
|
||||||
return cx.expr_call(sp,
|
return cx.expr_call(sp,
|
||||||
mk_token_path(cx, sp, "Lifetime"),
|
mk_token_path(cx, sp, "Lifetime"),
|
||||||
vec!(mk_ident(cx, sp, ident)));
|
vec![mk_ident(cx, sp, ident)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
token::DocComment(ident) => {
|
token::DocComment(ident) => {
|
||||||
return cx.expr_call(sp,
|
return cx.expr_call(sp,
|
||||||
mk_token_path(cx, sp, "DocComment"),
|
mk_token_path(cx, sp, "DocComment"),
|
||||||
vec!(mk_name(cx, sp, ast::Ident::with_empty_ctxt(ident))));
|
vec![mk_name(cx, sp, ast::Ident::with_empty_ctxt(ident))]);
|
||||||
}
|
}
|
||||||
|
|
||||||
token::MatchNt(name, kind) => {
|
token::MatchNt(name, kind) => {
|
||||||
|
@ -714,7 +714,7 @@ fn statements_mk_tt(cx: &ExtCtxt, tt: &TokenTree, matcher: bool) -> Vec<ast::Stm
|
||||||
cx.expr_method_call(sp,
|
cx.expr_method_call(sp,
|
||||||
cx.expr_ident(sp, ident),
|
cx.expr_ident(sp, ident),
|
||||||
id_ext("to_tokens"),
|
id_ext("to_tokens"),
|
||||||
vec!(cx.expr_ident(sp, id_ext("ext_cx"))));
|
vec![cx.expr_ident(sp, id_ext("ext_cx"))]);
|
||||||
let e_to_toks =
|
let e_to_toks =
|
||||||
cx.expr_method_call(sp, e_to_toks, id_ext("into_iter"), vec![]);
|
cx.expr_method_call(sp, e_to_toks, id_ext("into_iter"), vec![]);
|
||||||
|
|
||||||
|
@ -722,9 +722,9 @@ fn statements_mk_tt(cx: &ExtCtxt, tt: &TokenTree, matcher: bool) -> Vec<ast::Stm
|
||||||
cx.expr_method_call(sp,
|
cx.expr_method_call(sp,
|
||||||
cx.expr_ident(sp, id_ext("tt")),
|
cx.expr_ident(sp, id_ext("tt")),
|
||||||
id_ext("extend"),
|
id_ext("extend"),
|
||||||
vec!(e_to_toks));
|
vec![e_to_toks]);
|
||||||
|
|
||||||
vec!(cx.stmt_expr(e_push))
|
vec![cx.stmt_expr(e_push)]
|
||||||
}
|
}
|
||||||
ref tt @ TokenTree::Token(_, MatchNt(..)) if !matcher => {
|
ref tt @ TokenTree::Token(_, MatchNt(..)) if !matcher => {
|
||||||
let mut seq = vec![];
|
let mut seq = vec![];
|
||||||
|
@ -737,13 +737,13 @@ fn statements_mk_tt(cx: &ExtCtxt, tt: &TokenTree, matcher: bool) -> Vec<ast::Stm
|
||||||
let e_sp = cx.expr_ident(sp, id_ext("_sp"));
|
let e_sp = cx.expr_ident(sp, id_ext("_sp"));
|
||||||
let e_tok = cx.expr_call(sp,
|
let e_tok = cx.expr_call(sp,
|
||||||
mk_tt_path(cx, sp, "Token"),
|
mk_tt_path(cx, sp, "Token"),
|
||||||
vec!(e_sp, expr_mk_token(cx, sp, tok)));
|
vec![e_sp, expr_mk_token(cx, sp, tok)]);
|
||||||
let e_push =
|
let e_push =
|
||||||
cx.expr_method_call(sp,
|
cx.expr_method_call(sp,
|
||||||
cx.expr_ident(sp, id_ext("tt")),
|
cx.expr_ident(sp, id_ext("tt")),
|
||||||
id_ext("push"),
|
id_ext("push"),
|
||||||
vec!(e_tok));
|
vec![e_tok]);
|
||||||
vec!(cx.stmt_expr(e_push))
|
vec![cx.stmt_expr(e_push)]
|
||||||
},
|
},
|
||||||
TokenTree::Delimited(_, ref delimed) => {
|
TokenTree::Delimited(_, ref delimed) => {
|
||||||
statements_mk_tt(cx, &delimed.open_tt(), matcher).into_iter()
|
statements_mk_tt(cx, &delimed.open_tt(), matcher).into_iter()
|
||||||
|
@ -796,13 +796,13 @@ fn statements_mk_tt(cx: &ExtCtxt, tt: &TokenTree, matcher: bool) -> Vec<ast::Stm
|
||||||
vec![e_seq_struct]);
|
vec![e_seq_struct]);
|
||||||
let e_tok = cx.expr_call(sp,
|
let e_tok = cx.expr_call(sp,
|
||||||
mk_tt_path(cx, sp, "Sequence"),
|
mk_tt_path(cx, sp, "Sequence"),
|
||||||
vec!(e_sp, e_rc_new));
|
vec![e_sp, e_rc_new]);
|
||||||
let e_push =
|
let e_push =
|
||||||
cx.expr_method_call(sp,
|
cx.expr_method_call(sp,
|
||||||
cx.expr_ident(sp, id_ext("tt")),
|
cx.expr_ident(sp, id_ext("tt")),
|
||||||
id_ext("push"),
|
id_ext("push"),
|
||||||
vec!(e_tok));
|
vec![e_tok]);
|
||||||
vec!(cx.stmt_expr(e_push))
|
vec![cx.stmt_expr(e_push)]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -867,7 +867,7 @@ fn mk_stmts_let(cx: &ExtCtxt, sp: Span) -> Vec<ast::Stmt> {
|
||||||
|
|
||||||
let stmt_let_tt = cx.stmt_let(sp, true, id_ext("tt"), cx.expr_vec_ng(sp));
|
let stmt_let_tt = cx.stmt_let(sp, true, id_ext("tt"), cx.expr_vec_ng(sp));
|
||||||
|
|
||||||
vec!(stmt_let_sp, stmt_let_tt)
|
vec![stmt_let_sp, stmt_let_tt]
|
||||||
}
|
}
|
||||||
|
|
||||||
fn statements_mk_tts(cx: &ExtCtxt, tts: &[TokenTree], matcher: bool) -> Vec<ast::Stmt> {
|
fn statements_mk_tts(cx: &ExtCtxt, tts: &[TokenTree], matcher: bool) -> Vec<ast::Stmt> {
|
||||||
|
@ -923,7 +923,7 @@ fn expand_parse_call(cx: &ExtCtxt,
|
||||||
let new_parser_call =
|
let new_parser_call =
|
||||||
cx.expr_call(sp,
|
cx.expr_call(sp,
|
||||||
cx.expr_ident(sp, id_ext("new_parser_from_tts")),
|
cx.expr_ident(sp, id_ext("new_parser_from_tts")),
|
||||||
vec!(parse_sess_call(), tts_expr));
|
vec![parse_sess_call(), tts_expr]);
|
||||||
|
|
||||||
let path = vec![id_ext("syntax"), id_ext("ext"), id_ext("quote"), id_ext(parse_method)];
|
let path = vec![id_ext("syntax"), id_ext("ext"), id_ext("quote"), id_ext(parse_method)];
|
||||||
let mut args = vec![cx.expr_mut_addr_of(sp, new_parser_call)];
|
let mut args = vec![cx.expr_mut_addr_of(sp, new_parser_call)];
|
||||||
|
|
|
@ -624,12 +624,12 @@ mod tests {
|
||||||
node: ast::ExprKind::Path(None, ast::Path {
|
node: ast::ExprKind::Path(None, ast::Path {
|
||||||
span: sp(0, 1),
|
span: sp(0, 1),
|
||||||
global: false,
|
global: false,
|
||||||
segments: vec!(
|
segments: vec![
|
||||||
ast::PathSegment {
|
ast::PathSegment {
|
||||||
identifier: str_to_ident("a"),
|
identifier: str_to_ident("a"),
|
||||||
parameters: ast::PathParameters::none(),
|
parameters: ast::PathParameters::none(),
|
||||||
}
|
}
|
||||||
),
|
],
|
||||||
}),
|
}),
|
||||||
span: sp(0, 1),
|
span: sp(0, 1),
|
||||||
attrs: ThinVec::new(),
|
attrs: ThinVec::new(),
|
||||||
|
@ -643,7 +643,7 @@ mod tests {
|
||||||
node: ast::ExprKind::Path(None, ast::Path {
|
node: ast::ExprKind::Path(None, ast::Path {
|
||||||
span: sp(0, 6),
|
span: sp(0, 6),
|
||||||
global: true,
|
global: true,
|
||||||
segments: vec!(
|
segments: vec![
|
||||||
ast::PathSegment {
|
ast::PathSegment {
|
||||||
identifier: str_to_ident("a"),
|
identifier: str_to_ident("a"),
|
||||||
parameters: ast::PathParameters::none(),
|
parameters: ast::PathParameters::none(),
|
||||||
|
@ -652,7 +652,7 @@ mod tests {
|
||||||
identifier: str_to_ident("b"),
|
identifier: str_to_ident("b"),
|
||||||
parameters: ast::PathParameters::none(),
|
parameters: ast::PathParameters::none(),
|
||||||
}
|
}
|
||||||
)
|
]
|
||||||
}),
|
}),
|
||||||
span: sp(0, 6),
|
span: sp(0, 6),
|
||||||
attrs: ThinVec::new(),
|
attrs: ThinVec::new(),
|
||||||
|
@ -763,12 +763,12 @@ mod tests {
|
||||||
node:ast::ExprKind::Path(None, ast::Path{
|
node:ast::ExprKind::Path(None, ast::Path{
|
||||||
span: sp(7, 8),
|
span: sp(7, 8),
|
||||||
global: false,
|
global: false,
|
||||||
segments: vec!(
|
segments: vec![
|
||||||
ast::PathSegment {
|
ast::PathSegment {
|
||||||
identifier: str_to_ident("d"),
|
identifier: str_to_ident("d"),
|
||||||
parameters: ast::PathParameters::none(),
|
parameters: ast::PathParameters::none(),
|
||||||
}
|
}
|
||||||
),
|
],
|
||||||
}),
|
}),
|
||||||
span:sp(7,8),
|
span:sp(7,8),
|
||||||
attrs: ThinVec::new(),
|
attrs: ThinVec::new(),
|
||||||
|
@ -786,12 +786,12 @@ mod tests {
|
||||||
node: ast::ExprKind::Path(None, ast::Path {
|
node: ast::ExprKind::Path(None, ast::Path {
|
||||||
span:sp(0,1),
|
span:sp(0,1),
|
||||||
global:false,
|
global:false,
|
||||||
segments: vec!(
|
segments: vec![
|
||||||
ast::PathSegment {
|
ast::PathSegment {
|
||||||
identifier: str_to_ident("b"),
|
identifier: str_to_ident("b"),
|
||||||
parameters: ast::PathParameters::none(),
|
parameters: ast::PathParameters::none(),
|
||||||
}
|
}
|
||||||
),
|
],
|
||||||
}),
|
}),
|
||||||
span: sp(0,1),
|
span: sp(0,1),
|
||||||
attrs: ThinVec::new()})),
|
attrs: ThinVec::new()})),
|
||||||
|
@ -828,18 +828,18 @@ mod tests {
|
||||||
attrs:Vec::new(),
|
attrs:Vec::new(),
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
node: ast::ItemKind::Fn(P(ast::FnDecl {
|
node: ast::ItemKind::Fn(P(ast::FnDecl {
|
||||||
inputs: vec!(ast::Arg{
|
inputs: vec![ast::Arg{
|
||||||
ty: P(ast::Ty{id: ast::DUMMY_NODE_ID,
|
ty: P(ast::Ty{id: ast::DUMMY_NODE_ID,
|
||||||
node: ast::TyKind::Path(None, ast::Path{
|
node: ast::TyKind::Path(None, ast::Path{
|
||||||
span:sp(10,13),
|
span:sp(10,13),
|
||||||
global:false,
|
global:false,
|
||||||
segments: vec!(
|
segments: vec![
|
||||||
ast::PathSegment {
|
ast::PathSegment {
|
||||||
identifier:
|
identifier:
|
||||||
str_to_ident("i32"),
|
str_to_ident("i32"),
|
||||||
parameters: ast::PathParameters::none(),
|
parameters: ast::PathParameters::none(),
|
||||||
}
|
}
|
||||||
),
|
],
|
||||||
}),
|
}),
|
||||||
span:sp(10,13)
|
span:sp(10,13)
|
||||||
}),
|
}),
|
||||||
|
@ -855,7 +855,7 @@ mod tests {
|
||||||
span: sp(6,7)
|
span: sp(6,7)
|
||||||
}),
|
}),
|
||||||
id: ast::DUMMY_NODE_ID
|
id: ast::DUMMY_NODE_ID
|
||||||
}),
|
}],
|
||||||
output: ast::FunctionRetTy::Default(sp(15, 15)),
|
output: ast::FunctionRetTy::Default(sp(15, 15)),
|
||||||
variadic: false
|
variadic: false
|
||||||
}),
|
}),
|
||||||
|
@ -875,14 +875,14 @@ mod tests {
|
||||||
span: syntax_pos::DUMMY_SP,
|
span: syntax_pos::DUMMY_SP,
|
||||||
},
|
},
|
||||||
P(ast::Block {
|
P(ast::Block {
|
||||||
stmts: vec!(ast::Stmt {
|
stmts: vec![ast::Stmt {
|
||||||
node: ast::StmtKind::Semi(P(ast::Expr{
|
node: ast::StmtKind::Semi(P(ast::Expr{
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
node: ast::ExprKind::Path(None,
|
node: ast::ExprKind::Path(None,
|
||||||
ast::Path{
|
ast::Path{
|
||||||
span:sp(17,18),
|
span:sp(17,18),
|
||||||
global:false,
|
global:false,
|
||||||
segments: vec!(
|
segments: vec![
|
||||||
ast::PathSegment {
|
ast::PathSegment {
|
||||||
identifier:
|
identifier:
|
||||||
str_to_ident(
|
str_to_ident(
|
||||||
|
@ -890,12 +890,12 @@ mod tests {
|
||||||
parameters:
|
parameters:
|
||||||
ast::PathParameters::none(),
|
ast::PathParameters::none(),
|
||||||
}
|
}
|
||||||
),
|
],
|
||||||
}),
|
}),
|
||||||
span: sp(17,18),
|
span: sp(17,18),
|
||||||
attrs: ThinVec::new()})),
|
attrs: ThinVec::new()})),
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
span: sp(17,19)}),
|
span: sp(17,19)}],
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
rules: ast::BlockCheckMode::Default, // no idea
|
rules: ast::BlockCheckMode::Default, // no idea
|
||||||
span: sp(15,21),
|
span: sp(15,21),
|
||||||
|
|
|
@ -848,7 +848,7 @@ impl<'a> Parser<'a> {
|
||||||
Fe: FnMut(DiagnosticBuilder)
|
Fe: FnMut(DiagnosticBuilder)
|
||||||
{
|
{
|
||||||
let mut first: bool = true;
|
let mut first: bool = true;
|
||||||
let mut v = vec!();
|
let mut v = vec![];
|
||||||
while !kets.contains(&&self.token) {
|
while !kets.contains(&&self.token) {
|
||||||
match sep.sep {
|
match sep.sep {
|
||||||
Some(ref t) => {
|
Some(ref t) => {
|
||||||
|
@ -2224,13 +2224,13 @@ impl<'a> Parser<'a> {
|
||||||
SeqSep::trailing_allowed(token::Comma),
|
SeqSep::trailing_allowed(token::Comma),
|
||||||
|p| Ok(p.parse_expr()?)
|
|p| Ok(p.parse_expr()?)
|
||||||
)?;
|
)?;
|
||||||
let mut exprs = vec!(first_expr);
|
let mut exprs = vec![first_expr];
|
||||||
exprs.extend(remaining_exprs);
|
exprs.extend(remaining_exprs);
|
||||||
ex = ExprKind::Vec(exprs);
|
ex = ExprKind::Vec(exprs);
|
||||||
} else {
|
} else {
|
||||||
// Vector with one element.
|
// Vector with one element.
|
||||||
self.expect(&token::CloseDelim(token::Bracket))?;
|
self.expect(&token::CloseDelim(token::Bracket))?;
|
||||||
ex = ExprKind::Vec(vec!(first_expr));
|
ex = ExprKind::Vec(vec![first_expr]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hi = self.prev_span.hi;
|
hi = self.prev_span.hi;
|
||||||
|
@ -4224,7 +4224,7 @@ impl<'a> Parser<'a> {
|
||||||
mode: BoundParsingMode)
|
mode: BoundParsingMode)
|
||||||
-> PResult<'a, TyParamBounds>
|
-> PResult<'a, TyParamBounds>
|
||||||
{
|
{
|
||||||
let mut result = vec!();
|
let mut result = vec![];
|
||||||
loop {
|
loop {
|
||||||
let question_span = self.span;
|
let question_span = self.span;
|
||||||
let ate_question = self.eat(&token::Question);
|
let ate_question = self.eat(&token::Question);
|
||||||
|
|
|
@ -2277,7 +2277,7 @@ impl<'a> State<'a> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}));
|
}));
|
||||||
|
|
||||||
let mut options = vec!();
|
let mut options = vec![];
|
||||||
if a.volatile {
|
if a.volatile {
|
||||||
options.push("volatile");
|
options.push("volatile");
|
||||||
}
|
}
|
||||||
|
|
|
@ -430,7 +430,7 @@ fn mk_std(cx: &TestCtxt) -> P<ast::Item> {
|
||||||
let (vi, vis, ident) = if cx.is_test_crate {
|
let (vi, vis, ident) = if cx.is_test_crate {
|
||||||
(ast::ItemKind::Use(
|
(ast::ItemKind::Use(
|
||||||
P(nospan(ast::ViewPathSimple(id_test,
|
P(nospan(ast::ViewPathSimple(id_test,
|
||||||
path_node(vec!(id_test)))))),
|
path_node(vec![id_test]))))),
|
||||||
ast::Visibility::Public, keywords::Invalid.ident())
|
ast::Visibility::Public, keywords::Invalid.ident())
|
||||||
} else {
|
} else {
|
||||||
(ast::ItemKind::ExternCrate(None), ast::Visibility::Inherited, id_test)
|
(ast::ItemKind::ExternCrate(None), ast::Visibility::Inherited, id_test)
|
||||||
|
|
|
@ -105,7 +105,7 @@ impl<T> SmallVector<T> {
|
||||||
One(..) => {
|
One(..) => {
|
||||||
let one = mem::replace(&mut self.repr, Zero);
|
let one = mem::replace(&mut self.repr, Zero);
|
||||||
match one {
|
match one {
|
||||||
One(v1) => mem::replace(&mut self.repr, Many(vec!(v1, v))),
|
One(v1) => mem::replace(&mut self.repr, Many(vec![v1, v])),
|
||||||
_ => unreachable!()
|
_ => unreachable!()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -314,12 +314,12 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn test_expect_one_many() {
|
fn test_expect_one_many() {
|
||||||
SmallVector::many(vec!(1, 2)).expect_one("");
|
SmallVector::many(vec![1, 2]).expect_one("");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_expect_one_one() {
|
fn test_expect_one_one() {
|
||||||
assert_eq!(1, SmallVector::one(1).expect_one(""));
|
assert_eq!(1, SmallVector::one(1).expect_one(""));
|
||||||
assert_eq!(1, SmallVector::many(vec!(1)).expect_one(""));
|
assert_eq!(1, SmallVector::many(vec![1]).expect_one(""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,12 +65,12 @@ pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt,
|
||||||
macro_rules! md {
|
macro_rules! md {
|
||||||
($name:expr, $f:ident) => { {
|
($name:expr, $f:ident) => { {
|
||||||
let inline = cx.meta_word(span, InternedString::new("inline"));
|
let inline = cx.meta_word(span, InternedString::new("inline"));
|
||||||
let attrs = vec!(cx.attribute(span, inline));
|
let attrs = vec![cx.attribute(span, inline)];
|
||||||
MethodDef {
|
MethodDef {
|
||||||
name: $name,
|
name: $name,
|
||||||
generics: LifetimeBounds::empty(),
|
generics: LifetimeBounds::empty(),
|
||||||
explicit_self: borrowed_explicit_self(),
|
explicit_self: borrowed_explicit_self(),
|
||||||
args: vec!(borrowed_self()),
|
args: vec![borrowed_self()],
|
||||||
ret_ty: Literal(path_local!(bool)),
|
ret_ty: Literal(path_local!(bool)),
|
||||||
attributes: attrs,
|
attributes: attrs,
|
||||||
is_unsafe: false,
|
is_unsafe: false,
|
||||||
|
|
|
@ -28,12 +28,12 @@ pub fn expand_deriving_partial_ord(cx: &mut ExtCtxt,
|
||||||
macro_rules! md {
|
macro_rules! md {
|
||||||
($name:expr, $op:expr, $equal:expr) => { {
|
($name:expr, $op:expr, $equal:expr) => { {
|
||||||
let inline = cx.meta_word(span, InternedString::new("inline"));
|
let inline = cx.meta_word(span, InternedString::new("inline"));
|
||||||
let attrs = vec!(cx.attribute(span, inline));
|
let attrs = vec![cx.attribute(span, inline)];
|
||||||
MethodDef {
|
MethodDef {
|
||||||
name: $name,
|
name: $name,
|
||||||
generics: LifetimeBounds::empty(),
|
generics: LifetimeBounds::empty(),
|
||||||
explicit_self: borrowed_explicit_self(),
|
explicit_self: borrowed_explicit_self(),
|
||||||
args: vec!(borrowed_self()),
|
args: vec![borrowed_self()],
|
||||||
ret_ty: Literal(path_local!(bool)),
|
ret_ty: Literal(path_local!(bool)),
|
||||||
attributes: attrs,
|
attributes: attrs,
|
||||||
is_unsafe: false,
|
is_unsafe: false,
|
||||||
|
|
|
@ -79,9 +79,9 @@ fn expand_deriving_decodable_imp(cx: &mut ExtCtxt,
|
||||||
ret_ty:
|
ret_ty:
|
||||||
Literal(Path::new_(pathvec_std!(cx, core::result::Result),
|
Literal(Path::new_(pathvec_std!(cx, core::result::Result),
|
||||||
None,
|
None,
|
||||||
vec!(Box::new(Self_), Box::new(Literal(Path::new_(
|
vec![Box::new(Self_), Box::new(Literal(Path::new_(
|
||||||
vec![typaram, "Error"], None, vec![], false
|
vec![typaram, "Error"], None, vec![], false
|
||||||
)))),
|
)))],
|
||||||
true)),
|
true)),
|
||||||
attributes: Vec::new(),
|
attributes: Vec::new(),
|
||||||
is_unsafe: false,
|
is_unsafe: false,
|
||||||
|
|
|
@ -139,23 +139,23 @@ fn expand_deriving_encodable_imp(cx: &mut ExtCtxt,
|
||||||
generics: LifetimeBounds::empty(),
|
generics: LifetimeBounds::empty(),
|
||||||
is_unsafe: false,
|
is_unsafe: false,
|
||||||
supports_unions: false,
|
supports_unions: false,
|
||||||
methods: vec!(
|
methods: vec![
|
||||||
MethodDef {
|
MethodDef {
|
||||||
name: "encode",
|
name: "encode",
|
||||||
generics: LifetimeBounds {
|
generics: LifetimeBounds {
|
||||||
lifetimes: Vec::new(),
|
lifetimes: Vec::new(),
|
||||||
bounds: vec![(typaram,
|
bounds: vec![(typaram,
|
||||||
vec![Path::new_(vec![krate, "Encoder"], None, vec!(), true)])]
|
vec![Path::new_(vec![krate, "Encoder"], None, vec![], true)])]
|
||||||
},
|
},
|
||||||
explicit_self: borrowed_explicit_self(),
|
explicit_self: borrowed_explicit_self(),
|
||||||
args: vec!(Ptr(Box::new(Literal(Path::new_local(typaram))),
|
args: vec![Ptr(Box::new(Literal(Path::new_local(typaram))),
|
||||||
Borrowed(None, Mutability::Mutable))),
|
Borrowed(None, Mutability::Mutable))],
|
||||||
ret_ty: Literal(Path::new_(
|
ret_ty: Literal(Path::new_(
|
||||||
pathvec_std!(cx, core::result::Result),
|
pathvec_std!(cx, core::result::Result),
|
||||||
None,
|
None,
|
||||||
vec!(Box::new(Tuple(Vec::new())), Box::new(Literal(Path::new_(
|
vec![Box::new(Tuple(Vec::new())), Box::new(Literal(Path::new_(
|
||||||
vec![typaram, "Error"], None, vec![], false
|
vec![typaram, "Error"], None, vec![], false
|
||||||
)))),
|
)))],
|
||||||
true
|
true
|
||||||
)),
|
)),
|
||||||
attributes: Vec::new(),
|
attributes: Vec::new(),
|
||||||
|
@ -165,7 +165,7 @@ fn expand_deriving_encodable_imp(cx: &mut ExtCtxt,
|
||||||
encodable_substructure(a, b, c, krate)
|
encodable_substructure(a, b, c, krate)
|
||||||
})),
|
})),
|
||||||
}
|
}
|
||||||
),
|
],
|
||||||
associated_types: Vec::new(),
|
associated_types: Vec::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ macro_rules! pathvec {
|
||||||
|
|
||||||
macro_rules! path {
|
macro_rules! path {
|
||||||
($($x:tt)*) => (
|
($($x:tt)*) => (
|
||||||
::ext::deriving::generic::ty::Path::new( pathvec!( $($x)* ) )
|
::ext::deriving::generic::ty::Path::new( pathvec![ $($x)* ] )
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ macro_rules! path_local {
|
||||||
|
|
||||||
macro_rules! pathvec_std {
|
macro_rules! pathvec_std {
|
||||||
($cx:expr, $first:ident :: $($rest:ident)::+) => ({
|
($cx:expr, $first:ident :: $($rest:ident)::+) => ({
|
||||||
let mut v = pathvec!($($rest)::+);
|
let mut v = pathvec![$($rest)::+];
|
||||||
if let Some(s) = $cx.crate_root {
|
if let Some(s) = $cx.crate_root {
|
||||||
v.insert(0, s);
|
v.insert(0, s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,7 +336,7 @@ pub type OptRes = Result<TestOpts, String>;
|
||||||
|
|
||||||
#[cfg_attr(rustfmt, rustfmt_skip)]
|
#[cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
fn optgroups() -> Vec<getopts::OptGroup> {
|
fn optgroups() -> Vec<getopts::OptGroup> {
|
||||||
vec!(getopts::optflag("", "ignored", "Run ignored tests"),
|
vec![getopts::optflag("", "ignored", "Run ignored tests"),
|
||||||
getopts::optflag("", "test", "Run tests and not benchmarks"),
|
getopts::optflag("", "test", "Run tests and not benchmarks"),
|
||||||
getopts::optflag("", "bench", "Run benchmarks instead of tests"),
|
getopts::optflag("", "bench", "Run benchmarks instead of tests"),
|
||||||
getopts::optflag("h", "help", "Display this message (longer with --help)"),
|
getopts::optflag("h", "help", "Display this message (longer with --help)"),
|
||||||
|
@ -352,7 +352,7 @@ fn optgroups() -> Vec<getopts::OptGroup> {
|
||||||
getopts::optopt("", "color", "Configure coloring of output:
|
getopts::optopt("", "color", "Configure coloring of output:
|
||||||
auto = colorize if stdout is a tty and tests are run on serially (default);
|
auto = colorize if stdout is a tty and tests are run on serially (default);
|
||||||
always = always colorize output;
|
always = always colorize output;
|
||||||
never = never colorize output;", "auto|always|never"))
|
never = never colorize output;", "auto|always|never")]
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usage(binary: &str) {
|
fn usage(binary: &str) {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let xs : Vec<Option<i32>> = vec!(Some(1), None);
|
let xs : Vec<Option<i32>> = vec![Some(1), None];
|
||||||
|
|
||||||
for Some(x) in xs {}
|
for Some(x) in xs {}
|
||||||
//~^ ERROR E0297
|
//~^ ERROR E0297
|
||||||
|
|
|
@ -14,7 +14,7 @@ fn main() {
|
||||||
// Testing that method lookup does not automatically borrow
|
// Testing that method lookup does not automatically borrow
|
||||||
// vectors to slices then automatically create a self reference.
|
// vectors to slices then automatically create a self reference.
|
||||||
|
|
||||||
let mut a = vec!(0);
|
let mut a = vec![0];
|
||||||
a.test_mut(); //~ ERROR no method named `test_mut` found
|
a.test_mut(); //~ ERROR no method named `test_mut` found
|
||||||
a.test(); //~ ERROR no method named `test` found
|
a.test(); //~ ERROR no method named `test` found
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ struct Point {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn a() {
|
fn a() {
|
||||||
let mut p = vec!(1);
|
let mut p = vec![1];
|
||||||
|
|
||||||
// Create an immutable pointer into p's contents:
|
// Create an immutable pointer into p's contents:
|
||||||
let q: &isize = &p[0];
|
let q: &isize = &p[0];
|
||||||
|
@ -30,7 +30,7 @@ fn b() {
|
||||||
// here we alias the mutable vector into an imm slice and try to
|
// here we alias the mutable vector into an imm slice and try to
|
||||||
// modify the original:
|
// modify the original:
|
||||||
|
|
||||||
let mut p = vec!(1);
|
let mut p = vec![1];
|
||||||
|
|
||||||
borrow(
|
borrow(
|
||||||
&p,
|
&p,
|
||||||
|
@ -40,7 +40,7 @@ fn b() {
|
||||||
fn c() {
|
fn c() {
|
||||||
// Legal because the scope of the borrow does not include the
|
// Legal because the scope of the borrow does not include the
|
||||||
// modification:
|
// modification:
|
||||||
let mut p = vec!(1);
|
let mut p = vec![1];
|
||||||
borrow(&p, ||{});
|
borrow(&p, ||{});
|
||||||
p[0] = 5;
|
p[0] = 5;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,6 @@ fn defer<'r>(x: &'r [&'r str]) -> defer<'r> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = defer(&vec!("Goodbye", "world!"));
|
let x = defer(&vec!["Goodbye", "world!"]);
|
||||||
x.x[0];
|
x.x[0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,12 +17,12 @@ fn takes_imm_elt<F>(_v: &isize, f: F) where F: FnOnce() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_mut_vec_and_does_not_try_to_change_it() {
|
fn has_mut_vec_and_does_not_try_to_change_it() {
|
||||||
let mut v: Vec<isize> = vec!(1, 2, 3);
|
let mut v: Vec<isize> = vec![1, 2, 3];
|
||||||
takes_imm_elt(&v[0], || {})
|
takes_imm_elt(&v[0], || {})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_mut_vec_but_tries_to_change_it() {
|
fn has_mut_vec_but_tries_to_change_it() {
|
||||||
let mut v: Vec<isize> = vec!(1, 2, 3);
|
let mut v: Vec<isize> = vec![1, 2, 3];
|
||||||
takes_imm_elt(
|
takes_imm_elt(
|
||||||
&v[0],
|
&v[0],
|
||||||
|| { //~ ERROR cannot borrow `v` as mutable
|
|| { //~ ERROR cannot borrow `v` as mutable
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let _x = Rc::new(vec!(1, 2)).into_iter();
|
let _x = Rc::new(vec![1, 2]).into_iter();
|
||||||
//~^ ERROR cannot move out of borrowed content
|
//~^ ERROR cannot move out of borrowed content
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,11 @@ struct Foo {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let x = vec!(
|
let x = vec![
|
||||||
Foo { string: "foo".to_string() },
|
Foo { string: "foo".to_string() },
|
||||||
Foo { string: "bar".to_string() },
|
Foo { string: "bar".to_string() },
|
||||||
Foo { string: "baz".to_string() }
|
Foo { string: "baz".to_string() }
|
||||||
);
|
];
|
||||||
let x: &[Foo] = &x;
|
let x: &[Foo] = &x;
|
||||||
match *x {
|
match *x {
|
||||||
[_, ref tail..] => {
|
[_, ref tail..] => {
|
||||||
|
|
|
@ -13,6 +13,6 @@ fn write(v: &mut [isize]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let v = vec!(1, 2, 3);
|
let v = vec![1, 2, 3];
|
||||||
write(&mut v); //~ ERROR cannot borrow
|
write(&mut v); //~ ERROR cannot borrow
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ impl<T> Index<usize> for MyVec<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let v = MyVec::<Box<_>> { data: vec!(box 1, box 2, box 3) };
|
let v = MyVec::<Box<_>> { data: vec![box 1, box 2, box 3] };
|
||||||
let good = &v[0]; // Shouldn't fail here
|
let good = &v[0]; // Shouldn't fail here
|
||||||
let bad = v[0];
|
let bad = v[0];
|
||||||
//~^ ERROR cannot move out of indexed content
|
//~^ ERROR cannot move out of indexed content
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#![feature(slice_patterns)]
|
#![feature(slice_patterns)]
|
||||||
|
|
||||||
fn a<'a>() -> &'a [isize] {
|
fn a<'a>() -> &'a [isize] {
|
||||||
let vec = vec!(1, 2, 3, 4);
|
let vec = vec![1, 2, 3, 4];
|
||||||
let vec: &[isize] = &vec; //~ ERROR does not live long enough
|
let vec: &[isize] = &vec; //~ ERROR does not live long enough
|
||||||
let tail = match vec {
|
let tail = match vec {
|
||||||
&[_, ref tail..] => tail,
|
&[_, ref tail..] => tail,
|
||||||
|
@ -22,7 +22,7 @@ fn a<'a>() -> &'a [isize] {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn b<'a>() -> &'a [isize] {
|
fn b<'a>() -> &'a [isize] {
|
||||||
let vec = vec!(1, 2, 3, 4);
|
let vec = vec![1, 2, 3, 4];
|
||||||
let vec: &[isize] = &vec; //~ ERROR does not live long enough
|
let vec: &[isize] = &vec; //~ ERROR does not live long enough
|
||||||
let init = match vec {
|
let init = match vec {
|
||||||
&[ref init.., _] => init,
|
&[ref init.., _] => init,
|
||||||
|
@ -32,7 +32,7 @@ fn b<'a>() -> &'a [isize] {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn c<'a>() -> &'a [isize] {
|
fn c<'a>() -> &'a [isize] {
|
||||||
let vec = vec!(1, 2, 3, 4);
|
let vec = vec![1, 2, 3, 4];
|
||||||
let vec: &[isize] = &vec; //~ ERROR does not live long enough
|
let vec: &[isize] = &vec; //~ ERROR does not live long enough
|
||||||
let slice = match vec {
|
let slice = match vec {
|
||||||
&[_, ref slice.., _] => slice,
|
&[_, ref slice.., _] => slice,
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#![feature(slice_patterns)]
|
#![feature(slice_patterns)]
|
||||||
|
|
||||||
fn a() {
|
fn a() {
|
||||||
let mut v = vec!(1, 2, 3);
|
let mut v = vec![1, 2, 3];
|
||||||
let vb: &mut [isize] = &mut v;
|
let vb: &mut [isize] = &mut v;
|
||||||
match vb {
|
match vb {
|
||||||
&mut [_a, ref tail..] => {
|
&mut [_a, ref tail..] => {
|
||||||
|
|
|
@ -25,7 +25,7 @@ fn a() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn b() {
|
fn b() {
|
||||||
let mut vec = vec!(box 1, box 2, box 3);
|
let mut vec = vec![box 1, box 2, box 3];
|
||||||
let vec: &mut [Box<isize>] = &mut vec;
|
let vec: &mut [Box<isize>] = &mut vec;
|
||||||
match vec {
|
match vec {
|
||||||
&mut [ref _b..] => {
|
&mut [ref _b..] => {
|
||||||
|
@ -37,7 +37,7 @@ fn b() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn c() {
|
fn c() {
|
||||||
let mut vec = vec!(box 1, box 2, box 3);
|
let mut vec = vec![box 1, box 2, box 3];
|
||||||
let vec: &mut [Box<isize>] = &mut vec;
|
let vec: &mut [Box<isize>] = &mut vec;
|
||||||
match vec {
|
match vec {
|
||||||
&mut [_a, //~ ERROR cannot move out
|
&mut [_a, //~ ERROR cannot move out
|
||||||
|
@ -59,7 +59,7 @@ fn c() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn d() {
|
fn d() {
|
||||||
let mut vec = vec!(box 1, box 2, box 3);
|
let mut vec = vec![box 1, box 2, box 3];
|
||||||
let vec: &mut [Box<isize>] = &mut vec;
|
let vec: &mut [Box<isize>] = &mut vec;
|
||||||
match vec {
|
match vec {
|
||||||
&mut [ //~ ERROR cannot move out
|
&mut [ //~ ERROR cannot move out
|
||||||
|
@ -73,7 +73,7 @@ fn d() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn e() {
|
fn e() {
|
||||||
let mut vec = vec!(box 1, box 2, box 3);
|
let mut vec = vec![box 1, box 2, box 3];
|
||||||
let vec: &mut [Box<isize>] = &mut vec;
|
let vec: &mut [Box<isize>] = &mut vec;
|
||||||
match vec {
|
match vec {
|
||||||
&mut [_a, _b, _c] => {} //~ ERROR cannot move out
|
&mut [_a, _b, _c] => {} //~ ERROR cannot move out
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#![feature(slice_patterns)]
|
#![feature(slice_patterns)]
|
||||||
|
|
||||||
fn a<'a>() -> &'a isize {
|
fn a<'a>() -> &'a isize {
|
||||||
let vec = vec!(1, 2, 3, 4);
|
let vec = vec![1, 2, 3, 4];
|
||||||
let vec: &[isize] = &vec; //~ ERROR `vec` does not live long enough
|
let vec: &[isize] = &vec; //~ ERROR `vec` does not live long enough
|
||||||
let tail = match vec {
|
let tail = match vec {
|
||||||
&[_a, ref tail..] => &tail[0],
|
&[_a, ref tail..] => &tail[0],
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn read_lines_borrowed<'a>() -> Vec<&'a str> {
|
fn read_lines_borrowed<'a>() -> Vec<&'a str> {
|
||||||
let raw_lines: Vec<String> = vec!("foo ".to_string(), " bar".to_string());
|
let raw_lines: Vec<String> = vec!["foo ".to_string(), " bar".to_string()];
|
||||||
raw_lines.iter().map(|l| l.trim()).collect()
|
raw_lines.iter().map(|l| l.trim()).collect()
|
||||||
//~^ ERROR `raw_lines` does not live long enough
|
//~^ ERROR `raw_lines` does not live long enough
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let v: Vec<isize> = vec!(0, 1, 2, 3, 4, 5);
|
let v: Vec<isize> = vec![0, 1, 2, 3, 4, 5];
|
||||||
let s: String = "abcdef".to_string();
|
let s: String = "abcdef".to_string();
|
||||||
v[3_usize];
|
v[3_usize];
|
||||||
v[3];
|
v[3];
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut v = vec!(1);
|
let mut v = vec![1];
|
||||||
let mut f = || 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`
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,6 @@
|
||||||
|
|
||||||
// error-pattern: mismatched types
|
// error-pattern: mismatched types
|
||||||
|
|
||||||
static VEC: [u32; 256] = vec!();
|
static VEC: [u32; 256] = vec![];
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let needlesArr: Vec<char> = vec!('a', 'f');
|
let needlesArr: Vec<char> = vec!['a', 'f'];
|
||||||
needlesArr.iter().fold(|x, y| {
|
needlesArr.iter().fold(|x, y| {
|
||||||
});
|
});
|
||||||
//~^^ ERROR this function takes 2 parameters but 1 parameter was supplied
|
//~^^ ERROR this function takes 2 parameters but 1 parameter was supplied
|
||||||
|
|
|
@ -48,7 +48,7 @@ macro_rules! make_vec {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _ = make_vec!(a 1, a 2, a 3);
|
let _ = make_vec![a 1, a 2, a 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ fn main() {
|
||||||
let mut a = 3; //~ ERROR: variable does not need to be mutable
|
let mut a = 3; //~ ERROR: variable does not need to be mutable
|
||||||
let mut a = 2; //~ ERROR: variable does not need to be mutable
|
let mut a = 2; //~ ERROR: variable does not need to be mutable
|
||||||
let mut b = 3; //~ ERROR: variable does not need to be mutable
|
let mut b = 3; //~ ERROR: variable does not need to be mutable
|
||||||
let mut a = vec!(3); //~ ERROR: variable does not need to be mutable
|
let mut a = vec![3]; //~ ERROR: variable does not need to be mutable
|
||||||
let (mut a, b) = (1, 2); //~ ERROR: variable does not need to be mutable
|
let (mut a, b) = (1, 2); //~ ERROR: variable does not need to be mutable
|
||||||
let mut a; //~ ERROR: variable does not need to be mutable
|
let mut a; //~ ERROR: variable does not need to be mutable
|
||||||
a = 3;
|
a = 3;
|
||||||
|
@ -88,5 +88,5 @@ fn callback<F>(f: F) where F: FnOnce() {}
|
||||||
#[allow(unused_mut)]
|
#[allow(unused_mut)]
|
||||||
fn foo(mut a: isize) {
|
fn foo(mut a: isize) {
|
||||||
let mut a = 3;
|
let mut a = 3;
|
||||||
let mut b = vec!(2);
|
let mut b = vec![2];
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ fn main() {
|
||||||
_ => { }
|
_ => { }
|
||||||
}
|
}
|
||||||
|
|
||||||
let x: Vec<char> = vec!('a', 'b', 'c');
|
let x: Vec<char> = vec!['a', 'b', 'c'];
|
||||||
let x: &[char] = &x;
|
let x: &[char] = &x;
|
||||||
match *x {
|
match *x {
|
||||||
['a', 'b', 'c', ref _tail..] => {}
|
['a', 'b', 'c', ref _tail..] => {}
|
||||||
|
|
|
@ -16,7 +16,7 @@ fn consume(_s: String) {}
|
||||||
fn touch<A>(_a: &A) {}
|
fn touch<A>(_a: &A) {}
|
||||||
|
|
||||||
fn f20() {
|
fn f20() {
|
||||||
let x = vec!("hi".to_string());
|
let x = vec!["hi".to_string()];
|
||||||
consume(x.into_iter().next().unwrap());
|
consume(x.into_iter().next().unwrap());
|
||||||
touch(&x[0]); //~ ERROR use of moved value: `x`
|
touch(&x[0]); //~ ERROR use of moved value: `x`
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ fn f20() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f21() {
|
fn f21() {
|
||||||
let x = vec!(1, 2, 3);
|
let x = vec![1, 2, 3];
|
||||||
let _y = (x[0], 3);
|
let _y = (x[0], 3);
|
||||||
touch(&x);
|
touch(&x);
|
||||||
}
|
}
|
||||||
|
@ -77,24 +77,24 @@ fn f70() {
|
||||||
|
|
||||||
fn f80() {
|
fn f80() {
|
||||||
let x = "hi".to_string();
|
let x = "hi".to_string();
|
||||||
let _y = vec!(x);
|
let _y = vec![x];
|
||||||
touch(&x); //~ ERROR use of moved value: `x`
|
touch(&x); //~ ERROR use of moved value: `x`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f100() {
|
fn f100() {
|
||||||
let x = vec!("hi".to_string());
|
let x = vec!["hi".to_string()];
|
||||||
let _y = x.into_iter().next().unwrap();
|
let _y = x.into_iter().next().unwrap();
|
||||||
touch(&x); //~ ERROR use of moved value: `x`
|
touch(&x); //~ ERROR use of moved value: `x`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f110() {
|
fn f110() {
|
||||||
let x = vec!("hi".to_string());
|
let x = vec!["hi".to_string()];
|
||||||
let _y = [x.into_iter().next().unwrap(); 1];
|
let _y = [x.into_iter().next().unwrap(); 1];
|
||||||
touch(&x); //~ ERROR use of moved value: `x`
|
touch(&x); //~ ERROR use of moved value: `x`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f120() {
|
fn f120() {
|
||||||
let mut x = vec!("hi".to_string(), "ho".to_string());
|
let mut x = vec!["hi".to_string(), "ho".to_string()];
|
||||||
x.swap(0, 1);
|
x.swap(0, 1);
|
||||||
touch(&x[0]);
|
touch(&x[0]);
|
||||||
touch(&x[1]);
|
touch(&x[1]);
|
||||||
|
|
|
@ -14,7 +14,7 @@ use std::sync::Arc;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let v = vec!(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
let v = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||||
let arc_v = Arc::new(v);
|
let arc_v = Arc::new(v);
|
||||||
|
|
||||||
thread::spawn(move|| {
|
thread::spawn(move|| {
|
||||||
|
|
|
@ -12,7 +12,7 @@ use std::sync::Arc;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let v = vec!(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
let v = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||||
let arc_v = Arc::new(v);
|
let arc_v = Arc::new(v);
|
||||||
|
|
||||||
thread::spawn(move|| {
|
thread::spawn(move|| {
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x : *const Vec<isize> = &vec!(1,2,3);
|
let x : *const Vec<isize> = &vec![1,2,3];
|
||||||
let y : *const libc::c_void = x as *const libc::c_void;
|
let y : *const libc::c_void = x as *const libc::c_void;
|
||||||
unsafe {
|
unsafe {
|
||||||
let _z = (*y).clone();
|
let _z = (*y).clone();
|
||||||
|
|
|
@ -37,20 +37,20 @@ fn main() {
|
||||||
(_, t::a) => {}
|
(_, t::a) => {}
|
||||||
(t::b, t::b) => {}
|
(t::b, t::b) => {}
|
||||||
}
|
}
|
||||||
let vec = vec!(Some(42), None, Some(21));
|
let vec = vec![Some(42), None, Some(21)];
|
||||||
let vec: &[Option<isize>] = &vec;
|
let vec: &[Option<isize>] = &vec;
|
||||||
match *vec { //~ ERROR non-exhaustive patterns: `[]` not covered
|
match *vec { //~ ERROR non-exhaustive patterns: `[]` not covered
|
||||||
[Some(..), None, ref tail..] => {}
|
[Some(..), None, ref tail..] => {}
|
||||||
[Some(..), Some(..), ref tail..] => {}
|
[Some(..), Some(..), ref tail..] => {}
|
||||||
[None] => {}
|
[None] => {}
|
||||||
}
|
}
|
||||||
let vec = vec!(1);
|
let vec = vec![1];
|
||||||
let vec: &[isize] = &vec;
|
let vec: &[isize] = &vec;
|
||||||
match *vec {
|
match *vec {
|
||||||
[_, ref tail..] => (),
|
[_, ref tail..] => (),
|
||||||
[] => ()
|
[] => ()
|
||||||
}
|
}
|
||||||
let vec = vec!(0.5f32);
|
let vec = vec![0.5f32];
|
||||||
let vec: &[f32] = &vec;
|
let vec: &[f32] = &vec;
|
||||||
match *vec { //~ ERROR non-exhaustive patterns: `[_, _, _, _]` not covered
|
match *vec { //~ ERROR non-exhaustive patterns: `[_, _, _, _]` not covered
|
||||||
[0.1, 0.2, 0.3] => (),
|
[0.1, 0.2, 0.3] => (),
|
||||||
|
@ -58,7 +58,7 @@ fn main() {
|
||||||
[0.1] => (),
|
[0.1] => (),
|
||||||
[] => ()
|
[] => ()
|
||||||
}
|
}
|
||||||
let vec = vec!(Some(42), None, Some(21));
|
let vec = vec![Some(42), None, Some(21)];
|
||||||
let vec: &[Option<isize>] = &vec;
|
let vec: &[Option<isize>] = &vec;
|
||||||
match *vec {
|
match *vec {
|
||||||
[Some(..), None, ref tail..] => {}
|
[Some(..), None, ref tail..] => {}
|
||||||
|
|
|
@ -30,7 +30,7 @@ fn collect<A, I: Iterator<Item=A>, B: MyFromIterator<A>>(it: I) -> B {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let x = vec!(1u8, 2, 3, 4);
|
let x = vec![1u8, 2, 3, 4];
|
||||||
let y: Option<Vec<u8>> = collect(x.iter()); // this should give approximately the same error for x.iter().collect()
|
let y: Option<Vec<u8>> = collect(x.iter()); // this should give approximately the same error for x.iter().collect()
|
||||||
//~^ ERROR
|
//~^ ERROR
|
||||||
//~^^ NOTE a collection of type `std::option::Option<std::vec::Vec<u8>>` cannot be built from an iterator over elements of type `&u8`
|
//~^^ NOTE a collection of type `std::option::Option<std::vec::Vec<u8>>` cannot be built from an iterator over elements of type `&u8`
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// The type of `y` ends up getting inferred to the type of the block.
|
// The type of `y` ends up getting inferred to the type of the block.
|
||||||
fn broken() {
|
fn broken() {
|
||||||
let mut x = 3;
|
let mut x = 3;
|
||||||
let mut _y = vec!(&mut x);
|
let mut _y = vec![&mut x];
|
||||||
//~^ NOTE borrow of `x` occurs here
|
//~^ NOTE borrow of `x` occurs here
|
||||||
//~| NOTE borrow of `x` occurs here
|
//~| NOTE borrow of `x` occurs here
|
||||||
//~| NOTE borrow of `x` occurs here
|
//~| NOTE borrow of `x` occurs here
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
fn a() {
|
fn a() {
|
||||||
let mut closure0 = None;
|
let mut closure0 = None;
|
||||||
let vec = vec!(1, 2, 3);
|
let vec = vec![1, 2, 3];
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@ fn call<F>(f: F) where F : Fn() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let y = vec!(format!("World"));
|
let y = vec![format!("World")];
|
||||||
call(|| {
|
call(|| {
|
||||||
y.into_iter();
|
y.into_iter();
|
||||||
//~^ ERROR cannot move out of captured outer variable in an `Fn` closure
|
//~^ ERROR cannot move out of captured outer variable in an `Fn` closure
|
||||||
|
|
|
@ -9,5 +9,5 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
vec!(,); //~ ERROR expected expression, found `,`
|
vec![,]; //~ ERROR expected expression, found `,`
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut xs: Vec<isize> = vec!();
|
let mut xs: Vec<isize> = vec![];
|
||||||
|
|
||||||
for x in &mut xs {
|
for x in &mut xs {
|
||||||
xs.push(1) //~ ERROR cannot borrow `xs`
|
xs.push(1) //~ ERROR cannot borrow `xs`
|
||||||
|
|
|
@ -21,8 +21,8 @@ impl Drop for r {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// This can't make sense as it would copy the classes
|
// This can't make sense as it would copy the classes
|
||||||
let i = vec!(r(0));
|
let i = vec![r(0)];
|
||||||
let j = vec!(r(1));
|
let j = vec![r(1)];
|
||||||
let k = i + j;
|
let k = i + j;
|
||||||
//~^ ERROR binary operation `+` cannot be applied to type
|
//~^ ERROR binary operation `+` cannot be applied to type
|
||||||
println!("{:?}", j);
|
println!("{:?}", j);
|
||||||
|
|
|
@ -10,6 +10,6 @@
|
||||||
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let v: Vec<isize> = vec!(1, 2, 3);
|
let v: Vec<isize> = vec![1, 2, 3];
|
||||||
v[1] = 4; //~ ERROR cannot borrow immutable local variable `v` as mutable
|
v[1] = 4; //~ ERROR cannot borrow immutable local variable `v` as mutable
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,6 @@ fn test(a: &Vec<u8>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let data = vec!();
|
let data = vec![];
|
||||||
test(&data);
|
test(&data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ trait Serializable<'self, T> { //~ ERROR lifetimes cannot use keyword names
|
||||||
impl<'self> Serializable<str> for &'self str { //~ ERROR lifetimes cannot use keyword names
|
impl<'self> Serializable<str> for &'self str { //~ ERROR lifetimes cannot use keyword names
|
||||||
//~^ ERROR lifetimes cannot use keyword names
|
//~^ ERROR lifetimes cannot use keyword names
|
||||||
fn serialize(val : &'self str) -> Vec<u8> { //~ ERROR lifetimes cannot use keyword names
|
fn serialize(val : &'self str) -> Vec<u8> { //~ ERROR lifetimes cannot use keyword names
|
||||||
vec!(1)
|
vec![1]
|
||||||
}
|
}
|
||||||
fn deserialize(repr: &[u8]) -> &'self str { //~ ERROR lifetimes cannot use keyword names
|
fn deserialize(repr: &[u8]) -> &'self str { //~ ERROR lifetimes cannot use keyword names
|
||||||
"hi"
|
"hi"
|
||||||
|
|
|
@ -61,9 +61,9 @@ fn test9() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test10() -> isize {
|
fn test10() -> isize {
|
||||||
let regs = vec!(0);
|
let regs = vec![0];
|
||||||
match true { true => { } _ => { } }
|
match true { true => { } _ => { } }
|
||||||
regs[0]
|
regs[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test11() -> Vec<isize> { if true { } vec!(1, 2) }
|
fn test11() -> Vec<isize> { if true { } vec![1, 2] }
|
||||||
|
|
|
@ -53,12 +53,12 @@ fn expand_deriving_partial_eq(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, it
|
||||||
}
|
}
|
||||||
|
|
||||||
let inline = cx.meta_word(span, InternedString::new("inline"));
|
let inline = cx.meta_word(span, InternedString::new("inline"));
|
||||||
let attrs = vec!(cx.attribute(span, inline));
|
let attrs = vec![cx.attribute(span, inline)];
|
||||||
let methods = vec![MethodDef {
|
let methods = vec![MethodDef {
|
||||||
name: "eq",
|
name: "eq",
|
||||||
generics: LifetimeBounds::empty(),
|
generics: LifetimeBounds::empty(),
|
||||||
explicit_self: borrowed_explicit_self(),
|
explicit_self: borrowed_explicit_self(),
|
||||||
args: vec!(borrowed_self()),
|
args: vec![borrowed_self()],
|
||||||
ret_ty: Literal(deriving::generic::ty::Path::new_local("bool")),
|
ret_ty: Literal(deriving::generic::ty::Path::new_local("bool")),
|
||||||
attributes: attrs,
|
attributes: attrs,
|
||||||
is_unsafe: false,
|
is_unsafe: false,
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue