Skip to content

Commit 113f8aa

Browse files
committed
Rebasing and reviewer changes
1 parent 3bf4056 commit 113f8aa

File tree

6 files changed

+47
-44
lines changed

6 files changed

+47
-44
lines changed

src/libcollections/ring_buf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ impl<T> RingBuf<T> {
453453

454454
if contiguous {
455455
let (empty, buf) = buf.split_at_mut(0);
456-
(buf[mut tail..head], empty)
456+
(buf.slice_mut(tail, head), empty)
457457
} else {
458458
let (mid, right) = buf.split_at_mut(tail);
459459
let (left, _) = mid.split_at_mut(head);

src/libgraphviz/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ mod tests {
735735
fn test_input(g: LabelledGraph) -> IoResult<String> {
736736
let mut writer = Vec::new();
737737
render(&g, &mut writer).unwrap();
738-
(&mut writer[]).read_to_string()
738+
(&mut writer.as_slice()).read_to_string()
739739
}
740740

741741
// All of the tests use raw-strings as the format for the expected outputs,
@@ -847,7 +847,7 @@ r#"digraph hasse_diagram {
847847
edge(1, 3, ";"), edge(2, 3, ";" )));
848848

849849
render(&g, &mut writer).unwrap();
850-
let r = (&mut writer[]).read_to_string();
850+
let r = (&mut writer.as_slice()).read_to_string();
851851

852852
assert_eq!(r.unwrap(),
853853
r#"digraph syntax_tree {

src/librustc/middle/mem_categorization.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
519519
ret_ty), 1, true)
520520
}
521521
None => {
522-
let base_cmt = if_ok!(self.cat_expr(&**base));
523-
self.cat_index(expr, base_cmt)
522+
self.cat_index(expr, self.cat_expr(&**base))
524523
}
525524
}
526525
}

src/librustc_trans/trans/expr.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1074,18 +1074,18 @@ fn trans_rvalue_dps_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
10741074
let (did, fields, ty_params) = match (start, end) {
10751075
(&Some(ref start), &Some(ref end)) => {
10761076
// Desugar to Range
1077-
let fields = vec!(make_field("start", start.clone()),
1078-
make_field("end", end.clone()));
1077+
let fields = vec![make_field("start", start.clone()),
1078+
make_field("end", end.clone())];
10791079
(tcx.lang_items.range_struct(), fields, vec![node_id_type(bcx, start.id)])
10801080
}
10811081
(&Some(ref start), &None) => {
10821082
// Desugar to RangeFrom
1083-
let fields = vec!(make_field("start", start.clone()));
1083+
let fields = vec![make_field("start", start.clone())];
10841084
(tcx.lang_items.range_from_struct(), fields, vec![node_id_type(bcx, start.id)])
10851085
}
10861086
(&None, &Some(ref end)) => {
10871087
// Desugar to RangeTo
1088-
let fields = vec!(make_field("end", end.clone()));
1088+
let fields = vec![make_field("end", end.clone())];
10891089
(tcx.lang_items.range_to_struct(), fields, vec![node_id_type(bcx, end.id)])
10901090
}
10911091
_ => {

src/librustc_typeck/check/mod.rs

+38-34
Original file line numberDiff line numberDiff line change
@@ -4183,9 +4183,6 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
41834183
// A slice, rather than an index. Special cased for now (KILLME).
41844184
let base_t = structurally_resolved_type(fcx, expr.span, base_t);
41854185

4186-
if lvalue_pref == PreferMutLvalue {
4187-
println!("mutable lvalue_pref");
4188-
}
41894186
let result =
41904187
autoderef_for_index(fcx, &**base, base_t, lvalue_pref, |adj_ty, adj| {
41914188
try_overloaded_slice_step(fcx,
@@ -4299,42 +4296,49 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
42994296
// bounds because right the range structs do not have any. If we add
43004297
// some bounds, then we'll need to check `t_start` against them here.
43014298

4302-
let range_type = if idx_type == Some(ty::mk_err()) {
4303-
ty::mk_err()
4304-
} else if idx_type.is_none() {
4305-
// Neither start nor end => FullRange
4306-
if let Some(did) = tcx.lang_items.full_range_struct() {
4307-
let substs = Substs::new_type(vec![], vec![]);
4308-
ty::mk_struct(tcx, did, substs)
4309-
} else {
4299+
let range_type = match idx_type {
4300+
Some(idx_type) if ty::type_is_error(idx_type) => {
43104301
ty::mk_err()
43114302
}
4312-
} else {
4313-
// Find the did from the appropriate lang item.
4314-
let did = match (start, end) {
4315-
(&Some(_), &Some(_)) => tcx.lang_items.range_struct(),
4316-
(&Some(_), &None) => tcx.lang_items.range_from_struct(),
4317-
(&None, &Some(_)) => tcx.lang_items.range_to_struct(),
4318-
(&None, &None) => {
4319-
tcx.sess.span_bug(expr.span,"full range should be dealt with above")
4320-
}
4321-
};
4303+
Some(idx_type) => {
4304+
// Find the did from the appropriate lang item.
4305+
let did = match (start, end) {
4306+
(&Some(_), &Some(_)) => tcx.lang_items.range_struct(),
4307+
(&Some(_), &None) => tcx.lang_items.range_from_struct(),
4308+
(&None, &Some(_)) => tcx.lang_items.range_to_struct(),
4309+
(&None, &None) => {
4310+
tcx.sess.span_bug(expr.span, "full range should be dealt with above")
4311+
}
4312+
};
43224313

4323-
if let Some(did) = did {
4324-
let polytype = ty::lookup_item_type(tcx, did);
4325-
let substs = Substs::new_type(vec![idx_type.unwrap()], vec![]);
4326-
let bounds = polytype.generics.to_bounds(tcx, &substs);
4327-
fcx.add_obligations_for_parameters(
4328-
traits::ObligationCause::new(expr.span,
4329-
fcx.body_id,
4330-
traits::ItemObligation(did)),
4331-
&bounds);
4332-
4333-
ty::mk_struct(tcx, did, tcx.mk_substs(substs))
4334-
} else {
4335-
ty::mk_err()
4314+
if let Some(did) = did {
4315+
let polytype = ty::lookup_item_type(tcx, did);
4316+
let substs = Substs::new_type(vec![idx_type], vec![]);
4317+
let bounds = polytype.generics.to_bounds(tcx, &substs);
4318+
fcx.add_obligations_for_parameters(
4319+
traits::ObligationCause::new(expr.span,
4320+
fcx.body_id,
4321+
traits::ItemObligation(did)),
4322+
&bounds);
4323+
4324+
ty::mk_struct(tcx, did, tcx.mk_substs(substs))
4325+
} else {
4326+
tcx.sess.span_err(expr.span, "No lang item for range syntax");
4327+
ty::mk_err()
4328+
}
4329+
}
4330+
None => {
4331+
// Neither start nor end => FullRange
4332+
if let Some(did) = tcx.lang_items.full_range_struct() {
4333+
let substs = Substs::new_type(vec![], vec![]);
4334+
ty::mk_struct(tcx, did, tcx.mk_substs(substs))
4335+
} else {
4336+
tcx.sess.span_err(expr.span, "No lang item for range syntax");
4337+
ty::mk_err()
4338+
}
43364339
}
43374340
};
4341+
43384342
fcx.write_ty(id, range_type);
43394343
}
43404344

src/libunicode/u_str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ impl<I> Iterator<u16> for Utf16Encoder<I> where I: Iterator<char> {
521521

522522
let mut buf = [0u16, ..2];
523523
self.chars.next().map(|ch| {
524-
let n = ch.encode_utf16(buf[mut]).unwrap_or(0);
524+
let n = ch.encode_utf16(buf.as_mut_slice()).unwrap_or(0);
525525
if n == 2 { self.extra = buf[1]; }
526526
buf[0]
527527
})

0 commit comments

Comments
 (0)