Navigation Menu

Skip to content

Commit

Permalink
Add tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
luqmana committed Aug 23, 2014
1 parent 30ab05a commit f6dfff2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/test/compile-fail/cannot-mutate-captured-non-mut-var.rs
Expand Up @@ -12,4 +12,8 @@ fn main() {
let x = 1i;
proc() { x = 2; };
//~^ ERROR: cannot assign to immutable captured outer variable in a proc `x`

let s = std::io::stdin();
proc() { s.lines(); };
//~^ ERROR: cannot borrow immutable captured outer variable in a proc `s` as mutable
}
24 changes: 24 additions & 0 deletions src/test/run-pass/issue-16671.rs
@@ -0,0 +1,24 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![forbid(warnings)]

// Pretty printing tests complain about `use std::predule::*`
#![allow(unused_imports)]

// A var moved into a proc, that has a mutable loan path should
// not trigger a misleading unused_mut warning.

pub fn main() {
let mut stdin = std::io::stdin();
spawn(proc() {
let _ = stdin.lines();
});
}

5 comments on commit f6dfff2

@bors
Copy link
Contributor

@bors bors commented on f6dfff2 Aug 23, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at luqmana@f6dfff2

@bors
Copy link
Contributor

@bors bors commented on f6dfff2 Aug 23, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging luqmana/rust/pmu = f6dfff2 into auto

@bors
Copy link
Contributor

@bors bors commented on f6dfff2 Aug 23, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

luqmana/rust/pmu = f6dfff2 merged ok, testing candidate = a284240

@bors
Copy link
Contributor

@bors bors commented on f6dfff2 Aug 23, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = a284240

Please sign in to comment.