Skip to content

Commit e311348

Browse files
committed
---
yaml --- r: 55750 b: refs/heads/master c: aba93c6 h: refs/heads/master v: v3
1 parent 39e0665 commit e311348

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+335
-181
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: a117cf03bc90addb9c0b6364db8ff7e54b10d753
2+
refs/heads/master: aba93c6b60a91fc4b6b60408e51b23dbee5f44c9
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 79a2b2eafc3c766cecec8a5f76317693bae9ed17
55
refs/heads/try: 8eb2bab100b42f0ba751552d8eff00eb2134c55a

trunk/src/libcore/cell.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ fn test_with_ref() {
121121
#[test]
122122
fn test_with_mut_ref() {
123123
let good = ~[1, 2, 3];
124-
let mut v = ~[1, 2];
124+
let v = ~[1, 2];
125125
let c = Cell(v);
126126
do c.with_mut_ref() |v| { v.push(3); }
127127
let v = c.take();

trunk/src/libcore/flate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub fn deflate_bytes(bytes: &const [u8]) -> ~[u8] {
6767
pub fn inflate_bytes(bytes: &const [u8]) -> ~[u8] {
6868
do vec::as_const_buf(bytes) |b, len| {
6969
unsafe {
70-
let mut outsz : size_t = 0;
70+
let outsz : size_t = 0;
7171
let res =
7272
rustrt::tinfl_decompress_mem_to_heap(b as *c_void,
7373
len as size_t,

trunk/src/libcore/path.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ pub trait GenericPath {
6767
fn is_restricted(&self) -> bool;
6868

6969
fn normalize(&self) -> Self;
70+
71+
fn is_absolute(&self) -> bool;
7072
}
7173

7274
#[cfg(windows)]
@@ -379,10 +381,11 @@ impl ToStr for PosixPath {
379381
// FIXME (#3227): when default methods in traits are working, de-duplicate
380382
// PosixPath and WindowsPath, most of their methods are common.
381383
impl GenericPath for PosixPath {
382-
383384
fn from_str(s: &str) -> PosixPath {
384385
let mut components = ~[];
385-
for str::each_split_nonempty(s, |c| c == '/') |s| { components.push(s.to_owned()) }
386+
for str::each_split_nonempty(s, |c| c == '/') |s| {
387+
components.push(s.to_owned())
388+
}
386389
let is_absolute = (s.len() != 0 && s[0] == '/' as u8);
387390
return PosixPath { is_absolute: is_absolute,
388391
components: components }
@@ -540,6 +543,10 @@ impl GenericPath for PosixPath {
540543
// ..self
541544
}
542545
}
546+
547+
fn is_absolute(&self) -> bool {
548+
self.is_absolute
549+
}
543550
}
544551

545552

@@ -563,7 +570,6 @@ impl ToStr for WindowsPath {
563570

564571

565572
impl GenericPath for WindowsPath {
566-
567573
fn from_str(s: &str) -> WindowsPath {
568574
let host;
569575
let device;
@@ -809,6 +815,10 @@ impl GenericPath for WindowsPath {
809815
components: normalize(self.components)
810816
}
811817
}
818+
819+
fn is_absolute(&self) -> bool {
820+
self.is_absolute
821+
}
812822
}
813823

814824

@@ -844,7 +854,7 @@ pub mod windows {
844854
while i < s.len() {
845855
if is_sep(s[i]) {
846856
let pre = s.slice(2, i).to_owned();
847-
let mut rest = s.slice(i, s.len()).to_owned();
857+
let rest = s.slice(i, s.len()).to_owned();
848858
return Some((pre, rest));
849859
}
850860
i += 1;

trunk/src/libcore/rand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ struct XorShiftState {
742742
impl Rng for XorShiftState {
743743
fn next(&self) -> u32 {
744744
let x = self.x;
745-
let mut t = x ^ (x << 11);
745+
let t = x ^ (x << 11);
746746
self.x = self.y;
747747
self.y = self.z;
748748
self.z = self.w;

trunk/src/libcore/repr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ pub impl ReprVisitor {
210210
#[inline(always)]
211211
fn visit_ptr_inner(&self, ptr: *c_void, inner: *TyDesc) -> bool {
212212
unsafe {
213-
let mut u = ReprVisitor(ptr, self.writer);
213+
let u = ReprVisitor(ptr, self.writer);
214214
let v = reflect::MovePtrAdaptor(u);
215215
visit_tydesc(inner, @v as @TyVisitor);
216216
true
@@ -667,7 +667,7 @@ pub fn write_repr<T>(writer: @Writer, object: &T) {
667667
unsafe {
668668
let ptr = ptr::to_unsafe_ptr(object) as *c_void;
669669
let tydesc = intrinsic::get_tydesc::<T>();
670-
let mut u = ReprVisitor(ptr, writer);
670+
let u = ReprVisitor(ptr, writer);
671671
let v = reflect::MovePtrAdaptor(u);
672672
visit_tydesc(tydesc, @v as @TyVisitor)
673673
}

trunk/src/libcore/rt/uv/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ fn loop_smoke_test() {
402402
fn idle_new_then_close() {
403403
do run_in_bare_thread {
404404
let mut loop_ = Loop::new();
405-
let mut idle_watcher = { IdleWatcher::new(&mut loop_) };
405+
let idle_watcher = { IdleWatcher::new(&mut loop_) };
406406
idle_watcher.close();
407407
}
408408
}

trunk/src/libcore/rt/uv/net.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ fn connect_read() {
393393
let buf = vec_from_uv_buf(buf);
394394
rtdebug!("read cb!");
395395
if status.is_none() {
396-
let bytes = buf.unwrap();
396+
let _bytes = buf.unwrap();
397397
rtdebug!("%s", bytes.slice(0, nread as uint).to_str());
398398
} else {
399399
rtdebug!("status after read: %s", status.get().to_str());

trunk/src/libcore/rt/uvio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ impl TcpListener for UvTcpListener {
206206
let mut server_stream_watcher = server_stream_watcher;
207207
let mut loop_ = loop_from_watcher(&server_stream_watcher);
208208
let mut client_tcp_watcher = TcpWatcher::new(&mut loop_);
209-
let mut client_tcp_watcher = client_tcp_watcher.as_stream();
209+
let client_tcp_watcher = client_tcp_watcher.as_stream();
210210
// XXX: Need's to be surfaced in interface
211211
server_stream_watcher.accept(client_tcp_watcher);
212212
Some(~UvStream::new(client_tcp_watcher))

trunk/src/libcore/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ pub fn start_program(prog: &str, args: &[~str]) -> @Program {
343343
fn force_destroy(&mut self) { destroy_repr(&mut self.r, true); }
344344
}
345345

346-
let mut repr = ProgRepr {
346+
let repr = ProgRepr {
347347
pid: pid,
348348
in_fd: pipe_input.out,
349349
out_file: os::fdopen(pipe_output.in),

trunk/src/libcore/str.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ pub fn levdistance(s: &str, t: &str) -> uint {
673673

674674
for t.each_chari |j, tc| {
675675

676-
let mut next = dcol[j + 1];
676+
let next = dcol[j + 1];
677677

678678
if sc == tc {
679679
dcol[j + 1] = current;
@@ -909,7 +909,7 @@ impl TotalOrd for @str {
909909
/// Bytewise slice less than
910910
fn lt(a: &str, b: &str) -> bool {
911911
let (a_len, b_len) = (a.len(), b.len());
912-
let mut end = uint::min(a_len, b_len);
912+
let end = uint::min(a_len, b_len);
913913

914914
let mut i = 0;
915915
while i < end {
@@ -1715,7 +1715,7 @@ pub fn utf16_chars(v: &[u16], f: &fn(char)) {
17151715
let len = vec::len(v);
17161716
let mut i = 0u;
17171717
while (i < len && v[i] != 0u16) {
1718-
let mut u = v[i];
1718+
let u = v[i];
17191719

17201720
if u <= 0xD7FF_u16 || u >= 0xE000_u16 {
17211721
f(u as char);

trunk/src/libcore/task/spawn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ fn spawn_raw_oldsched(opts: TaskOpts, f: ~fn()) {
575575
};
576576
assert!(!new_task.is_null());
577577
// Getting killed after here would leak the task.
578-
let mut notify_chan = if opts.notify_chan.is_none() {
578+
let notify_chan = if opts.notify_chan.is_none() {
579579
None
580580
} else {
581581
Some(opts.notify_chan.swap_unwrap())

trunk/src/libcore/unstable/extfmt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ pub mod rt {
538538
pub fn conv_str(cv: Conv, s: &str, buf: &mut ~str) {
539539
// For strings, precision is the maximum characters
540540
// displayed
541-
let mut unpadded = match cv.precision {
541+
let unpadded = match cv.precision {
542542
CountImplied => s,
543543
CountIs(max) => if (max as uint) < str::char_len(s) {
544544
str::slice(s, 0, max as uint)
@@ -596,7 +596,7 @@ pub mod rt {
596596
#[deriving(Eq)]
597597
pub enum PadMode { PadSigned, PadUnsigned, PadNozero, PadFloat }
598598
599-
pub fn pad(cv: Conv, mut s: &str, head: Option<char>, mode: PadMode,
599+
pub fn pad(cv: Conv, s: &str, head: Option<char>, mode: PadMode,
600600
buf: &mut ~str) {
601601
let headsize = match head { Some(_) => 1, _ => 0 };
602602
let uwidth : uint = match cv.width {

trunk/src/libcore/vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,7 +1755,7 @@ impl<T: TotalOrd> TotalOrd for @[T] {
17551755

17561756
fn lt<T:Ord>(a: &[T], b: &[T]) -> bool {
17571757
let (a_len, b_len) = (a.len(), b.len());
1758-
let mut end = uint::min(a_len, b_len);
1758+
let end = uint::min(a_len, b_len);
17591759

17601760
let mut i = 0;
17611761
while i < end {
@@ -3897,7 +3897,7 @@ mod tests {
38973897

38983898
#[test]
38993899
fn reversed_mut() {
3900-
let mut v2 = reversed::<int>(~[10, 20]);
3900+
let v2 = reversed::<int>(~[10, 20]);
39013901
assert!(v2[0] == 20);
39023902
assert!(v2[1] == 10);
39033903
}

trunk/src/librustc/back/link.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ pub mod write {
273273
let LLVMOptDefault = 2 as c_int; // -O2, -Os
274274
let LLVMOptAggressive = 3 as c_int; // -O3
275275

276-
let mut CodeGenOptLevel = match opts.optimize {
276+
let CodeGenOptLevel = match opts.optimize {
277277
session::No => LLVMOptNone,
278278
session::Less => LLVMOptLess,
279279
session::Default => LLVMOptDefault,
@@ -294,7 +294,7 @@ pub mod write {
294294
return;
295295
}
296296

297-
let mut FileType;
297+
let FileType;
298298
if output_type == output_type_object ||
299299
output_type == output_type_exe {
300300
FileType = lib::llvm::ObjectFile;
@@ -820,7 +820,7 @@ pub fn link_binary(sess: Session,
820820
cc_args.push(output.to_str());
821821
cc_args.push(obj_filename.to_str());
822822
823-
let mut lib_cmd;
823+
let lib_cmd;
824824
let os = sess.targ_cfg.os;
825825
if os == session::os_macos {
826826
lib_cmd = ~"-dynamiclib";

trunk/src/librustc/driver/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ pub fn compile_upto(sess: Session, cfg: ast::crate_cfg,
349349
outputs: Option<@OutputFilenames>)
350350
-> (@ast::crate, Option<ty::ctxt>) {
351351
let time_passes = sess.time_passes();
352-
let mut crate = time(time_passes, ~"parsing",
352+
let crate = time(time_passes, ~"parsing",
353353
|| parse_input(sess, copy cfg, input) );
354354
if upto == cu_parse { return (crate, None); }
355355

trunk/src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@ pub static metadata_encoding_version : &'static [u8] =
13411341
13421342
pub fn encode_metadata(parms: EncodeParams, crate: &crate) -> ~[u8] {
13431343
let wr = @io::BytesWriter();
1344-
let mut stats = Stats {
1344+
let stats = Stats {
13451345
inline_bytes: 0,
13461346
attr_bytes: 0,
13471347
dep_bytes: 0,

trunk/src/librustc/middle/borrowck/check_loans.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,18 @@ pub impl CheckLoanCtxt {
367367
// are only assigned once
368368
} else {
369369
match cmt.mutbl {
370-
McDeclared | McInherited => { /*ok*/ }
370+
McDeclared | McInherited => {
371+
// Ok, but if this loan is a mutable loan, then mark the
372+
// loan path (if it exists) as being used. This is similar
373+
// to the check performed in loan.rs in issue_loan(). This
374+
// type of use of mutable is different from issuing a loan,
375+
// however.
376+
for cmt.lp.each |lp| {
377+
for lp.node_id().each |&id| {
378+
self.tcx().used_mut_nodes.insert(id);
379+
}
380+
}
381+
}
371382
McReadOnly | McImmutable => {
372383
self.bccx.span_err(
373384
ex.span,

trunk/src/librustc/middle/borrowck/gather_loans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ pub impl GatherLoanCtxt {
305305
let mcx = &mem_categorization_ctxt {
306306
tcx: self.tcx(),
307307
method_map: self.bccx.method_map};
308-
let mut cmt = mcx.cat_expr_autoderefd(expr, autoderefs);
308+
let cmt = mcx.cat_expr_autoderefd(expr, autoderefs);
309309
debug!("after autoderef, cmt=%s", self.bccx.cmt_to_repr(cmt));
310310

311311
match autoref.kind {

trunk/src/librustc/middle/borrowck/loan.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,17 @@ pub impl LoanContext {
274274
if !owns_lent_data ||
275275
self.bccx.is_subregion_of(self.scope_region, scope_ub)
276276
{
277-
if loan_kind.is_take() && !cmt.mutbl.is_mutable() {
277+
if cmt.mutbl.is_mutable() {
278+
// If this loan is a mutable loan, then mark the loan path (if
279+
// it exists) as being used. This is similar to the check
280+
// performed in check_loans.rs in check_assignment(), but this
281+
// is for a different purpose of having the 'mut' qualifier.
282+
for cmt.lp.each |lp| {
283+
for lp.node_id().each |&id| {
284+
self.tcx().used_mut_nodes.insert(id);
285+
}
286+
}
287+
} else if loan_kind.is_take() {
278288
// We do not allow non-mutable data to be "taken"
279289
// under any circumstances.
280290
return Err(bckerr {

trunk/src/librustc/middle/check_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ pub fn specialize(cx: @MatchCheckCtxt,
481481
left_ty: ty::t)
482482
-> Option<~[@pat]> {
483483
// Sad, but I can't get rid of this easily
484-
let mut r0 = copy *raw_pat(r[0]);
484+
let r0 = copy *raw_pat(r[0]);
485485
match r0 {
486486
pat{id: pat_id, node: n, span: pat_span} =>
487487
match n {

0 commit comments

Comments
 (0)