More deprecating of i/u suffixes in libraries
This commit is contained in:
parent
fe4340ab18
commit
00a933f9ec
40 changed files with 201 additions and 201 deletions
|
|
@ -493,7 +493,7 @@ pub struct BoxPointers;
|
|||
impl BoxPointers {
|
||||
fn check_heap_type<'a, 'tcx>(&self, cx: &Context<'a, 'tcx>,
|
||||
span: Span, ty: Ty<'tcx>) {
|
||||
let mut n_uniq = 0u;
|
||||
let mut n_uniq = 0us;
|
||||
ty::fold_ty(cx.tcx, ty, |t| {
|
||||
match t.sty {
|
||||
ty::ty_uniq(_) => {
|
||||
|
|
|
|||
|
|
@ -490,7 +490,7 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
|
|||
// current dictionary of lint information. Along the way, keep a history
|
||||
// of what we changed so we can roll everything back after invoking the
|
||||
// specified closure
|
||||
let mut pushed = 0u;
|
||||
let mut pushed = 0;
|
||||
|
||||
for result in gather_attrs(attrs).into_iter() {
|
||||
let v = match result {
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ pub fn maybe_find_item<'a>(item_id: ast::NodeId,
|
|||
items: rbml::Doc<'a>) -> Option<rbml::Doc<'a>> {
|
||||
fn eq_item(bytes: &[u8], item_id: ast::NodeId) -> bool {
|
||||
return u64_from_be_bytes(
|
||||
&bytes[0u..4u], 0u, 4u) as ast::NodeId
|
||||
&bytes[0..4], 0, 4) as ast::NodeId
|
||||
== item_id;
|
||||
}
|
||||
lookup_hash(items,
|
||||
|
|
@ -1164,7 +1164,7 @@ fn get_attributes(md: rbml::Doc) -> Vec<ast::Attribute> {
|
|||
let meta_items = get_meta_items(attr_doc);
|
||||
// Currently it's only possible to have a single meta item on
|
||||
// an attribute
|
||||
assert_eq!(meta_items.len(), 1u);
|
||||
assert_eq!(meta_items.len(), 1);
|
||||
let meta_item = meta_items.into_iter().nth(0).unwrap();
|
||||
attrs.push(
|
||||
codemap::Spanned {
|
||||
|
|
|
|||
|
|
@ -1071,7 +1071,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
|
|||
encode_name(rbml_w, item.ident.name);
|
||||
encode_path(rbml_w, path);
|
||||
encode_attributes(rbml_w, &item.attrs[]);
|
||||
if tps_len > 0u || should_inline(&item.attrs[]) {
|
||||
if tps_len > 0 || should_inline(&item.attrs[]) {
|
||||
encode_inlined_item(ecx, rbml_w, IIItemRef(item));
|
||||
}
|
||||
if tps_len == 0 {
|
||||
|
|
|
|||
|
|
@ -487,7 +487,7 @@ impl<'a> Context<'a> {
|
|||
fn extract_one(&mut self, m: HashMap<Path, PathKind>, flavor: &str,
|
||||
slot: &mut Option<MetadataBlob>) -> Option<(Path, PathKind)> {
|
||||
let mut ret = None::<(Path, PathKind)>;
|
||||
let mut error = 0u;
|
||||
let mut error = 0;
|
||||
|
||||
if slot.is_some() {
|
||||
// FIXME(#10786): for an optimization, we only read one of the
|
||||
|
|
|
|||
|
|
@ -76,13 +76,13 @@ fn peek(st: &PState) -> char {
|
|||
|
||||
fn next(st: &mut PState) -> char {
|
||||
let ch = st.data[st.pos] as char;
|
||||
st.pos = st.pos + 1u;
|
||||
st.pos = st.pos + 1;
|
||||
return ch;
|
||||
}
|
||||
|
||||
fn next_byte(st: &mut PState) -> u8 {
|
||||
let b = st.data[st.pos];
|
||||
st.pos = st.pos + 1u;
|
||||
st.pos = st.pos + 1;
|
||||
return b;
|
||||
}
|
||||
|
||||
|
|
@ -498,7 +498,7 @@ fn parse_ty_<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>, conv: &mut F) -> Ty<'tcx> w
|
|||
assert_eq!(next(st), '[');
|
||||
let mut params = Vec::new();
|
||||
while peek(st) != ']' { params.push(parse_ty_(st, conv)); }
|
||||
st.pos = st.pos + 1u;
|
||||
st.pos = st.pos + 1;
|
||||
return ty::mk_tup(tcx, params);
|
||||
}
|
||||
'F' => {
|
||||
|
|
@ -590,7 +590,7 @@ fn parse_uint(st: &mut PState) -> uint {
|
|||
loop {
|
||||
let cur = peek(st);
|
||||
if cur < '0' || cur > '9' { return n; }
|
||||
st.pos = st.pos + 1u;
|
||||
st.pos = st.pos + 1;
|
||||
n *= 10;
|
||||
n += (cur as uint) - ('0' as uint);
|
||||
};
|
||||
|
|
@ -608,15 +608,15 @@ fn parse_param_space(st: &mut PState) -> subst::ParamSpace {
|
|||
}
|
||||
|
||||
fn parse_hex(st: &mut PState) -> uint {
|
||||
let mut n = 0u;
|
||||
let mut n = 0;
|
||||
loop {
|
||||
let cur = peek(st);
|
||||
if (cur < '0' || cur > '9') && (cur < 'a' || cur > 'f') { return n; }
|
||||
st.pos = st.pos + 1u;
|
||||
n *= 16u;
|
||||
st.pos = st.pos + 1;
|
||||
n *= 16;
|
||||
if '0' <= cur && cur <= '9' {
|
||||
n += (cur as uint) - ('0' as uint);
|
||||
} else { n += 10u + (cur as uint) - ('a' as uint); }
|
||||
} else { n += 10 + (cur as uint) - ('a' as uint); }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -686,7 +686,7 @@ fn parse_sig_<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>, conv: &mut F) -> ty::PolyF
|
|||
while peek(st) != ']' {
|
||||
inputs.push(parse_ty_(st, conv));
|
||||
}
|
||||
st.pos += 1u; // eat the ']'
|
||||
st.pos += 1; // eat the ']'
|
||||
let variadic = match next(st) {
|
||||
'V' => true,
|
||||
'N' => false,
|
||||
|
|
@ -694,7 +694,7 @@ fn parse_sig_<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>, conv: &mut F) -> ty::PolyF
|
|||
};
|
||||
let output = match peek(st) {
|
||||
'z' => {
|
||||
st.pos += 1u;
|
||||
st.pos += 1;
|
||||
ty::FnDiverging
|
||||
}
|
||||
_ => ty::FnConverging(parse_ty_(st, conv))
|
||||
|
|
@ -706,16 +706,16 @@ fn parse_sig_<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>, conv: &mut F) -> ty::PolyF
|
|||
|
||||
// Rust metadata parsing
|
||||
pub fn parse_def_id(buf: &[u8]) -> ast::DefId {
|
||||
let mut colon_idx = 0u;
|
||||
let mut colon_idx = 0;
|
||||
let len = buf.len();
|
||||
while colon_idx < len && buf[colon_idx] != ':' as u8 { colon_idx += 1u; }
|
||||
while colon_idx < len && buf[colon_idx] != ':' as u8 { colon_idx += 1; }
|
||||
if colon_idx == len {
|
||||
error!("didn't find ':' when parsing def id");
|
||||
panic!();
|
||||
}
|
||||
|
||||
let crate_part = &buf[0u..colon_idx];
|
||||
let def_part = &buf[colon_idx + 1u..len];
|
||||
let crate_part = &buf[0..colon_idx];
|
||||
let def_part = &buf[colon_idx + 1..len];
|
||||
|
||||
let crate_num = match str::from_utf8(crate_part).ok().and_then(|s| {
|
||||
s.parse::<uint>().ok()
|
||||
|
|
|
|||
|
|
@ -25,14 +25,14 @@ pub const NO_TPS: uint = 2;
|
|||
pub fn check_path_args(tcx: &ty::ctxt,
|
||||
path: &ast::Path,
|
||||
flags: uint) {
|
||||
if (flags & NO_TPS) != 0u {
|
||||
if (flags & NO_TPS) != 0 {
|
||||
if path.segments.iter().any(|s| s.parameters.has_types()) {
|
||||
span_err!(tcx.sess, path.span, E0109,
|
||||
"type parameters are not allowed on this type");
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & NO_REGIONS) != 0u {
|
||||
if (flags & NO_REGIONS) != 0 {
|
||||
if path.segments.iter().any(|s| s.parameters.has_lifetimes()) {
|
||||
span_err!(tcx.sess, path.span, E0110,
|
||||
"region parameters are not allowed on this type");
|
||||
|
|
|
|||
|
|
@ -579,16 +579,16 @@ fn encode_method_callee<'a, 'tcx>(ecx: &e::EncodeContext<'a, 'tcx>,
|
|||
use serialize::Encoder;
|
||||
|
||||
rbml_w.emit_struct("MethodCallee", 4, |rbml_w| {
|
||||
rbml_w.emit_struct_field("adjustment", 0u, |rbml_w| {
|
||||
rbml_w.emit_struct_field("adjustment", 0, |rbml_w| {
|
||||
adjustment.encode(rbml_w)
|
||||
});
|
||||
rbml_w.emit_struct_field("origin", 1u, |rbml_w| {
|
||||
rbml_w.emit_struct_field("origin", 1, |rbml_w| {
|
||||
Ok(rbml_w.emit_method_origin(ecx, &method.origin))
|
||||
});
|
||||
rbml_w.emit_struct_field("ty", 2u, |rbml_w| {
|
||||
rbml_w.emit_struct_field("ty", 2, |rbml_w| {
|
||||
Ok(rbml_w.emit_ty(ecx, method.ty))
|
||||
});
|
||||
rbml_w.emit_struct_field("substs", 3u, |rbml_w| {
|
||||
rbml_w.emit_struct_field("substs", 3, |rbml_w| {
|
||||
Ok(rbml_w.emit_substs(ecx, &method.substs))
|
||||
})
|
||||
}).unwrap();
|
||||
|
|
@ -743,30 +743,30 @@ impl<'tcx, 'a> vtable_decoder_helpers<'tcx> for reader::Decoder<'a> {
|
|||
Ok(match i {
|
||||
0 => {
|
||||
ty::vtable_static(
|
||||
this.read_enum_variant_arg(0u, |this| {
|
||||
this.read_enum_variant_arg(0, |this| {
|
||||
Ok(this.read_def_id_nodcx(cdata))
|
||||
}).unwrap(),
|
||||
this.read_enum_variant_arg(1u, |this| {
|
||||
this.read_enum_variant_arg(1, |this| {
|
||||
Ok(this.read_substs_nodcx(tcx, cdata))
|
||||
}).unwrap(),
|
||||
this.read_enum_variant_arg(2u, |this| {
|
||||
this.read_enum_variant_arg(2, |this| {
|
||||
Ok(this.read_vtable_res(tcx, cdata))
|
||||
}).unwrap()
|
||||
)
|
||||
}
|
||||
1 => {
|
||||
ty::vtable_param(
|
||||
this.read_enum_variant_arg(0u, |this| {
|
||||
this.read_enum_variant_arg(0, |this| {
|
||||
Decodable::decode(this)
|
||||
}).unwrap(),
|
||||
this.read_enum_variant_arg(1u, |this| {
|
||||
this.read_enum_variant_arg(1, |this| {
|
||||
this.read_uint()
|
||||
}).unwrap()
|
||||
)
|
||||
}
|
||||
2 => {
|
||||
ty::vtable_closure(
|
||||
this.read_enum_variant_arg(0u, |this| {
|
||||
this.read_enum_variant_arg(0, |this| {
|
||||
Ok(this.read_def_id_nodcx(cdata))
|
||||
}).unwrap()
|
||||
)
|
||||
|
|
|
|||
|
|
@ -68,10 +68,10 @@ impl<'a> fmt::Debug for Matrix<'a> {
|
|||
.collect::<Vec<String>>()
|
||||
}).collect();
|
||||
|
||||
let column_count = m.iter().map(|row| row.len()).max().unwrap_or(0u);
|
||||
let column_count = m.iter().map(|row| row.len()).max().unwrap_or(0);
|
||||
assert!(m.iter().all(|row| row.len() == column_count));
|
||||
let column_widths: Vec<uint> = (0..column_count).map(|col| {
|
||||
pretty_printed_matrix.iter().map(|row| row[col].len()).max().unwrap_or(0u)
|
||||
pretty_printed_matrix.iter().map(|row| row[col].len()).max().unwrap_or(0)
|
||||
}).collect();
|
||||
|
||||
let total_width = column_widths.iter().map(|n| *n).sum() + column_count * 3 + 1;
|
||||
|
|
@ -588,13 +588,13 @@ fn is_useful(cx: &MatchCheckCtxt,
|
|||
-> Usefulness {
|
||||
let &Matrix(ref rows) = matrix;
|
||||
debug!("{:?}", matrix);
|
||||
if rows.len() == 0u {
|
||||
if rows.len() == 0 {
|
||||
return match witness {
|
||||
ConstructWitness => UsefulWithWitness(vec!()),
|
||||
LeaveOutWitness => Useful
|
||||
};
|
||||
}
|
||||
if rows[0].len() == 0u {
|
||||
if rows[0].len() == 0 {
|
||||
return NotUseful;
|
||||
}
|
||||
let real_pat = match rows.iter().find(|r| (*r)[0].id != DUMMY_NODE_ID) {
|
||||
|
|
@ -669,9 +669,9 @@ fn is_useful_specialized(cx: &MatchCheckCtxt, &Matrix(ref m): &Matrix,
|
|||
witness: WitnessPreference) -> Usefulness {
|
||||
let arity = constructor_arity(cx, &ctor, lty);
|
||||
let matrix = Matrix(m.iter().filter_map(|r| {
|
||||
specialize(cx, &r[], &ctor, 0u, arity)
|
||||
specialize(cx, &r[], &ctor, 0, arity)
|
||||
}).collect());
|
||||
match specialize(cx, v, &ctor, 0u, arity) {
|
||||
match specialize(cx, v, &ctor, 0, arity) {
|
||||
Some(v) => is_useful(cx, &matrix, &v[], witness),
|
||||
None => NotUseful
|
||||
}
|
||||
|
|
@ -742,20 +742,20 @@ fn pat_constructors(cx: &MatchCheckCtxt, p: &Pat,
|
|||
/// This computes the arity of a constructor. The arity of a constructor
|
||||
/// is how many subpattern patterns of that constructor should be expanded to.
|
||||
///
|
||||
/// For instance, a tuple pattern (_, 42u, Some([])) has the arity of 3.
|
||||
/// For instance, a tuple pattern (_, 42, Some([])) has the arity of 3.
|
||||
/// A struct pattern's arity is the number of fields it contains, etc.
|
||||
pub fn constructor_arity(cx: &MatchCheckCtxt, ctor: &Constructor, ty: Ty) -> uint {
|
||||
match ty.sty {
|
||||
ty::ty_tup(ref fs) => fs.len(),
|
||||
ty::ty_uniq(_) => 1u,
|
||||
ty::ty_uniq(_) => 1,
|
||||
ty::ty_rptr(_, ty::mt { ty, .. }) => match ty.sty {
|
||||
ty::ty_vec(_, None) => match *ctor {
|
||||
Slice(length) => length,
|
||||
ConstantValue(_) => 0u,
|
||||
ConstantValue(_) => 0,
|
||||
_ => unreachable!()
|
||||
},
|
||||
ty::ty_str => 0u,
|
||||
_ => 1u
|
||||
ty::ty_str => 0,
|
||||
_ => 1
|
||||
},
|
||||
ty::ty_enum(eid, _) => {
|
||||
match *ctor {
|
||||
|
|
@ -765,7 +765,7 @@ pub fn constructor_arity(cx: &MatchCheckCtxt, ctor: &Constructor, ty: Ty) -> uin
|
|||
}
|
||||
ty::ty_struct(cid, _) => ty::lookup_struct_fields(cx.tcx, cid).len(),
|
||||
ty::ty_vec(_, Some(n)) => n,
|
||||
_ => 0u
|
||||
_ => 0
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
|||
for (word_index, &word) in words.iter().enumerate() {
|
||||
if word != 0 {
|
||||
let base_index = word_index * uint::BITS;
|
||||
for offset in 0u..uint::BITS {
|
||||
for offset in 0..uint::BITS {
|
||||
let bit = 1 << offset;
|
||||
if (word & bit) != 0 {
|
||||
// NB: we round up the total number of bits
|
||||
|
|
@ -447,7 +447,7 @@ impl<'a, 'tcx, O:DataFlowOperator+Clone+'static> DataFlowContext<'a, 'tcx, O> {
|
|||
changed: true
|
||||
};
|
||||
|
||||
let mut temp: Vec<_> = repeat(0u).take(words_per_id).collect();
|
||||
let mut temp: Vec<_> = repeat(0).take(words_per_id).collect();
|
||||
while propcx.changed {
|
||||
propcx.changed = false;
|
||||
propcx.reset(temp.as_mut_slice());
|
||||
|
|
@ -466,7 +466,7 @@ impl<'a, 'tcx, O:DataFlowOperator+Clone+'static> DataFlowContext<'a, 'tcx, O> {
|
|||
blk: &ast::Block) -> old_io::IoResult<()> {
|
||||
let mut ps = pprust::rust_printer_annotated(wr, self);
|
||||
try!(ps.cbox(pprust::indent_unit));
|
||||
try!(ps.ibox(0u));
|
||||
try!(ps.ibox(0));
|
||||
try!(ps.print_block(blk));
|
||||
pp::eof(&mut ps.s)
|
||||
}
|
||||
|
|
@ -552,7 +552,7 @@ fn bits_to_string(words: &[uint]) -> String {
|
|||
|
||||
for &word in words.iter() {
|
||||
let mut v = word;
|
||||
for _ in 0u..uint::BYTES {
|
||||
for _ in 0..uint::BYTES {
|
||||
result.push(sep);
|
||||
result.push_str(&format!("{:02x}", v & 0xFF)[]);
|
||||
v >>= 8;
|
||||
|
|
@ -593,7 +593,7 @@ fn set_bit(words: &mut [uint], bit: uint) -> bool {
|
|||
|
||||
fn bit_str(bit: uint) -> String {
|
||||
let byte = bit >> 8;
|
||||
let lobits = 1u << (bit & 0xFF);
|
||||
let lobits = 1 << (bit & 0xFF);
|
||||
format!("[{}:{}-{:02x}]", bit, byte, lobits)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1259,7 +1259,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
|
||||
let mut opt_graph = None;
|
||||
|
||||
for idx in 0u..self.num_vars() as uint {
|
||||
for idx in 0..self.num_vars() as uint {
|
||||
match var_data[idx].value {
|
||||
Value(_) => {
|
||||
/* Inference successful */
|
||||
|
|
@ -1548,7 +1548,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
fn iterate_until_fixed_point<F>(&self, tag: &str, mut body: F) where
|
||||
F: FnMut(&Constraint) -> bool,
|
||||
{
|
||||
let mut iteration = 0u;
|
||||
let mut iteration = 0;
|
||||
let mut changed = true;
|
||||
while changed {
|
||||
changed = false;
|
||||
|
|
|
|||
|
|
@ -540,9 +540,9 @@ struct Specials {
|
|||
clean_exit_var: Variable
|
||||
}
|
||||
|
||||
static ACC_READ: uint = 1u;
|
||||
static ACC_WRITE: uint = 2u;
|
||||
static ACC_USE: uint = 4u;
|
||||
static ACC_READ: uint = 1;
|
||||
static ACC_WRITE: uint = 2;
|
||||
static ACC_USE: uint = 4;
|
||||
|
||||
struct Liveness<'a, 'tcx: 'a> {
|
||||
ir: &'a mut IrMaps<'a, 'tcx>,
|
||||
|
|
@ -672,9 +672,9 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
|||
fn indices2<F>(&mut self, ln: LiveNode, succ_ln: LiveNode, mut op: F) where
|
||||
F: FnMut(&mut Liveness<'a, 'tcx>, uint, uint),
|
||||
{
|
||||
let node_base_idx = self.idx(ln, Variable(0u));
|
||||
let succ_base_idx = self.idx(succ_ln, Variable(0u));
|
||||
for var_idx in 0u..self.ir.num_vars {
|
||||
let node_base_idx = self.idx(ln, Variable(0));
|
||||
let succ_base_idx = self.idx(succ_ln, Variable(0));
|
||||
for var_idx in 0..self.ir.num_vars {
|
||||
op(self, node_base_idx + var_idx, succ_base_idx + var_idx);
|
||||
}
|
||||
}
|
||||
|
|
@ -687,7 +687,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
|||
F: FnMut(uint) -> LiveNode,
|
||||
{
|
||||
let node_base_idx = self.idx(ln, Variable(0));
|
||||
for var_idx in 0u..self.ir.num_vars {
|
||||
for var_idx in 0..self.ir.num_vars {
|
||||
let idx = node_base_idx + var_idx;
|
||||
if test(idx).is_valid() {
|
||||
try!(write!(wr, " {:?}", Variable(var_idx)));
|
||||
|
|
@ -847,7 +847,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
|||
// hack to skip the loop unless debug! is enabled:
|
||||
debug!("^^ liveness computation results for body {} (entry={:?})",
|
||||
{
|
||||
for ln_idx in 0u..self.ir.num_live_nodes {
|
||||
for ln_idx in 0..self.ir.num_live_nodes {
|
||||
debug!("{:?}", self.ln_str(LiveNode(ln_idx)));
|
||||
}
|
||||
body.id
|
||||
|
|
@ -1303,7 +1303,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
|||
match self.ir.tcx.def_map.borrow()[expr.id].clone() {
|
||||
DefLocal(nid) => {
|
||||
let ln = self.live_node(expr.id, expr.span);
|
||||
if acc != 0u {
|
||||
if acc != 0 {
|
||||
self.init_from_succ(ln, succ);
|
||||
let var = self.variable(nid, expr.span);
|
||||
self.acc(ln, var, acc);
|
||||
|
|
|
|||
|
|
@ -454,7 +454,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
|
|||
debug!("cat_expr_autoderefd: autoderefs={}, cmt={}",
|
||||
autoderefs,
|
||||
cmt.repr(self.tcx()));
|
||||
for deref in 1u..autoderefs + 1 {
|
||||
for deref in 1..autoderefs + 1 {
|
||||
cmt = try!(self.cat_deref(expr, cmt, deref));
|
||||
}
|
||||
return Ok(cmt);
|
||||
|
|
|
|||
|
|
@ -461,8 +461,8 @@ impl RegionMaps {
|
|||
|
||||
let a_ancestors = ancestors_of(self, scope_a);
|
||||
let b_ancestors = ancestors_of(self, scope_b);
|
||||
let mut a_index = a_ancestors.len() - 1u;
|
||||
let mut b_index = b_ancestors.len() - 1u;
|
||||
let mut a_index = a_ancestors.len() - 1;
|
||||
let mut b_index = b_ancestors.len() - 1;
|
||||
|
||||
// Here, ~[ab]_ancestors is a vector going from narrow to broad.
|
||||
// The end of each vector will be the item where the scope is
|
||||
|
|
@ -479,10 +479,10 @@ impl RegionMaps {
|
|||
loop {
|
||||
// Loop invariant: a_ancestors[a_index] == b_ancestors[b_index]
|
||||
// for all indices between a_index and the end of the array
|
||||
if a_index == 0u { return Some(scope_a); }
|
||||
if b_index == 0u { return Some(scope_b); }
|
||||
a_index -= 1u;
|
||||
b_index -= 1u;
|
||||
if a_index == 0 { return Some(scope_a); }
|
||||
if b_index == 0 { return Some(scope_b); }
|
||||
a_index -= 1;
|
||||
b_index -= 1;
|
||||
if a_ancestors[a_index] != b_ancestors[b_index] {
|
||||
return Some(a_ancestors[a_index + 1]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4475,7 +4475,7 @@ pub fn expr_kind(tcx: &ctxt, expr: &ast::Expr) -> ExprKind {
|
|||
match resolve_expr(tcx, expr) {
|
||||
def::DefVariant(tid, vid, _) => {
|
||||
let variant_info = enum_variant_with_id(tcx, tid, vid);
|
||||
if variant_info.args.len() > 0u {
|
||||
if variant_info.args.len() > 0 {
|
||||
// N-ary variant.
|
||||
RvalueDatumExpr
|
||||
} else {
|
||||
|
|
@ -4639,8 +4639,8 @@ pub fn stmt_node_id(s: &ast::Stmt) -> ast::NodeId {
|
|||
|
||||
pub fn field_idx_strict(tcx: &ctxt, name: ast::Name, fields: &[field])
|
||||
-> uint {
|
||||
let mut i = 0u;
|
||||
for f in fields.iter() { if f.name == name { return i; } i += 1u; }
|
||||
let mut i = 0;
|
||||
for f in fields.iter() { if f.name == name { return i; } i += 1; }
|
||||
tcx.sess.bug(&format!(
|
||||
"no field named `{}` found in the list of fields `{:?}`",
|
||||
token::get_name(name),
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ fn split_msg_into_multilines(msg: &str) -> Option<String> {
|
|||
}).map(|(a, b)| (a - 1, b));
|
||||
|
||||
let mut new_msg = String::new();
|
||||
let mut head = 0u;
|
||||
let mut head = 0;
|
||||
|
||||
// Insert `\n` before expected and found.
|
||||
for (pos1, pos2) in first.zip(second) {
|
||||
|
|
|
|||
|
|
@ -531,8 +531,8 @@ pub fn parameterized<'tcx>(cx: &ctxt<'tcx>,
|
|||
|
||||
pub fn ty_to_short_str<'tcx>(cx: &ctxt<'tcx>, typ: Ty<'tcx>) -> String {
|
||||
let mut s = typ.repr(cx).to_string();
|
||||
if s.len() >= 32u {
|
||||
s = (&s[0u..32u]).to_string();
|
||||
if s.len() >= 32 {
|
||||
s = (&s[0u..32]).to_string();
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue