about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-01-03 14:20:47 +0000
committerbors <bors@rust-lang.org>2015-01-03 14:20:47 +0000
commitfe7e285d0cbae8e44c3853a6965caf2b575dcfcc (patch)
treeb373f2a7540f38f2e2e70a5fd194839e2ddf576d /src/test
parentfc2ba13939aa9672d886beb06efde7aeda2d5f7f (diff)
parentcbeff8b8b3bd28e99a3a034a41c8bdcd830fa884 (diff)
downloadrust-fe7e285d0cbae8e44c3853a6965caf2b575dcfcc.tar.gz
rust-fe7e285d0cbae8e44c3853a6965caf2b575dcfcc.zip
auto merge of #20432 : nikomatsakis/rust/fn-inference-2, r=eddyb
Previously, the borrow mode of each upvar was inferred as part of regionck. This PR moves it into its own separate step. It also employs the `ExprUseVisitor`, further simplifying the code. The eventual goal is to support better inference of `Fn` vs `FnMut` vs `FnOnce` that is not based on the expected type, as well as supporting individual by-move upvars.

r? @eddyb 
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/borrowck-closures-mut-of-imm.rs1
-rw-r--r--src/test/compile-fail/issue-17551.rs4
-rw-r--r--src/test/compile-fail/privacy1.rs3
-rw-r--r--src/test/compile-fail/privacy4.rs1
4 files changed, 7 insertions, 2 deletions
diff --git a/src/test/compile-fail/borrowck-closures-mut-of-imm.rs b/src/test/compile-fail/borrowck-closures-mut-of-imm.rs
index 6360a913500..8163df5e967 100644
--- a/src/test/compile-fail/borrowck-closures-mut-of-imm.rs
+++ b/src/test/compile-fail/borrowck-closures-mut-of-imm.rs
@@ -24,6 +24,7 @@ fn a(x: &int) {
     //~^ ERROR cannot borrow
     let c2 = || set(&mut *x);
     //~^ ERROR cannot borrow
+    //~| ERROR closure requires unique access
 }
 
 fn main() {
diff --git a/src/test/compile-fail/issue-17551.rs b/src/test/compile-fail/issue-17551.rs
index e7f61a4f3ff..3889b6f4f7d 100644
--- a/src/test/compile-fail/issue-17551.rs
+++ b/src/test/compile-fail/issue-17551.rs
@@ -13,6 +13,6 @@
 struct B<T>;
 
 fn main() {
-    let foo = B; //~ ERROR unable to infer enough type information
-    let closure = |:| foo;
+    let foo = B;
+    let closure = |:| foo; //~ ERROR unable to infer enough type information
 }
diff --git a/src/test/compile-fail/privacy1.rs b/src/test/compile-fail/privacy1.rs
index 50261839b16..41621a934d1 100644
--- a/src/test/compile-fail/privacy1.rs
+++ b/src/test/compile-fail/privacy1.rs
@@ -14,6 +14,9 @@
 #[lang="sized"]
 pub trait Sized {}
 
+#[lang="copy"]
+pub trait Copy {}
+
 mod bar {
     // shouldn't bring in too much
     pub use self::glob::*;
diff --git a/src/test/compile-fail/privacy4.rs b/src/test/compile-fail/privacy4.rs
index b65ad2a2e6a..70e7e2df98a 100644
--- a/src/test/compile-fail/privacy4.rs
+++ b/src/test/compile-fail/privacy4.rs
@@ -12,6 +12,7 @@
 #![no_std] // makes debugging this test *a lot* easier (during resolve)
 
 #[lang = "sized"] pub trait Sized for Sized? {}
+#[lang="copy"] pub trait Copy {}
 
 // Test to make sure that private items imported through globs remain private
 // when  they're used.