summaryrefslogtreecommitdiffstats
path: root/src/test/ui/functions-closures
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/functions-closures')
-rw-r--r--src/test/ui/functions-closures/auxiliary/fn-abi.rs2
-rw-r--r--src/test/ui/functions-closures/call-closure-from-overloaded-op.rs9
-rw-r--r--src/test/ui/functions-closures/capture-clauses-boxed-closures.rs14
-rw-r--r--src/test/ui/functions-closures/capture-clauses-unboxed-closures.rs13
-rw-r--r--src/test/ui/functions-closures/clone-closure.rs18
-rw-r--r--src/test/ui/functions-closures/closure-bounds-can-capture-chan.rs16
-rw-r--r--src/test/ui/functions-closures/closure-expected-type/README.md8
-rw-r--r--src/test/ui/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs19
-rw-r--r--src/test/ui/functions-closures/closure-expected-type/issue-38714.rs19
-rw-r--r--src/test/ui/functions-closures/closure-expected-type/supply-just-return-type.rs26
-rw-r--r--src/test/ui/functions-closures/closure-expected-type/supply-nothing.rs11
-rw-r--r--src/test/ui/functions-closures/closure-immediate.rs13
-rw-r--r--src/test/ui/functions-closures/closure-inference.rs11
-rw-r--r--src/test/ui/functions-closures/closure-inference2.rs9
-rw-r--r--src/test/ui/functions-closures/closure-reform.rs56
-rw-r--r--src/test/ui/functions-closures/closure-returning-closure.rs5
-rw-r--r--src/test/ui/functions-closures/closure-to-fn-coercion.rs35
-rw-r--r--src/test/ui/functions-closures/closure_to_fn_coercion-expected-types.rs9
-rw-r--r--src/test/ui/functions-closures/copy-closure.rs16
-rw-r--r--src/test/ui/functions-closures/fn-abi.rs18
-rw-r--r--src/test/ui/functions-closures/fn-bare-assign.rs17
-rw-r--r--src/test/ui/functions-closures/fn-bare-coerce-to-block.rs10
-rw-r--r--src/test/ui/functions-closures/fn-bare-item.rs8
-rw-r--r--src/test/ui/functions-closures/fn-bare-size.rs8
-rw-r--r--src/test/ui/functions-closures/fn-bare-spawn.rs15
-rw-r--r--src/test/ui/functions-closures/fn-coerce-field.rs13
-rw-r--r--src/test/ui/functions-closures/fn-help-with-err-generic-is-not-function.rs14
-rw-r--r--src/test/ui/functions-closures/fn-help-with-err-generic-is-not-function.stderr17
-rw-r--r--src/test/ui/functions-closures/fn-help-with-err.rs28
-rw-r--r--src/test/ui/functions-closures/fn-help-with-err.stderr40
-rw-r--r--src/test/ui/functions-closures/fn-item-type-cast.rs22
-rw-r--r--src/test/ui/functions-closures/fn-item-type-coerce.rs17
-rw-r--r--src/test/ui/functions-closures/fn-item-type-zero-sized.rs13
-rw-r--r--src/test/ui/functions-closures/fn-lval.rs11
-rw-r--r--src/test/ui/functions-closures/fn-type-infer.rs11
-rw-r--r--src/test/ui/functions-closures/implied-bounds-closure-arg-outlives.rs35
-rw-r--r--src/test/ui/functions-closures/nullable-pointer-opt-closures.rs34
-rw-r--r--src/test/ui/functions-closures/parallel-codegen-closures.rs28
-rw-r--r--src/test/ui/functions-closures/return-from-closure.rs33
39 files changed, 0 insertions, 701 deletions
diff --git a/src/test/ui/functions-closures/auxiliary/fn-abi.rs b/src/test/ui/functions-closures/auxiliary/fn-abi.rs
deleted file mode 100644
index ace9fbdfd..000000000
--- a/src/test/ui/functions-closures/auxiliary/fn-abi.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#[no_mangle]
-pub extern "C" fn foo() {}
diff --git a/src/test/ui/functions-closures/call-closure-from-overloaded-op.rs b/src/test/ui/functions-closures/call-closure-from-overloaded-op.rs
deleted file mode 100644
index 8e1c68fd7..000000000
--- a/src/test/ui/functions-closures/call-closure-from-overloaded-op.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// run-pass
-
-fn foo() -> isize { 22 }
-
-pub fn main() {
- let mut x: Vec<extern "Rust" fn() -> isize> = Vec::new();
- x.push(foo);
- assert_eq!((x[0])(), 22);
-}
diff --git a/src/test/ui/functions-closures/capture-clauses-boxed-closures.rs b/src/test/ui/functions-closures/capture-clauses-boxed-closures.rs
deleted file mode 100644
index bcde50463..000000000
--- a/src/test/ui/functions-closures/capture-clauses-boxed-closures.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// run-pass
-
-fn each<T, F>(x: &[T], mut f: F) where F: FnMut(&T) {
- for val in x {
- f(val)
- }
-}
-
-fn main() {
- let mut sum = 0_usize;
- let elems = [ 1_usize, 2, 3, 4, 5 ];
- each(&elems, |val| sum += *val);
- assert_eq!(sum, 15);
-}
diff --git a/src/test/ui/functions-closures/capture-clauses-unboxed-closures.rs b/src/test/ui/functions-closures/capture-clauses-unboxed-closures.rs
deleted file mode 100644
index 206b3d7b6..000000000
--- a/src/test/ui/functions-closures/capture-clauses-unboxed-closures.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// run-pass
-fn each<'a,T,F:FnMut(&'a T)>(x: &'a [T], mut f: F) {
- for val in x {
- f(val)
- }
-}
-
-fn main() {
- let mut sum = 0;
- let elems = [ 1, 2, 3, 4, 5 ];
- each(&elems, |val: &usize| sum += *val);
- assert_eq!(sum, 15);
-}
diff --git a/src/test/ui/functions-closures/clone-closure.rs b/src/test/ui/functions-closures/clone-closure.rs
deleted file mode 100644
index 1e725d805..000000000
--- a/src/test/ui/functions-closures/clone-closure.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// run-pass
-// Check that closures implement `Clone`.
-
-#[derive(Clone)]
-struct S(i32);
-
-fn main() {
- let mut a = S(5);
- let mut hello = move || {
- a.0 += 1;
- println!("Hello {}", a.0);
- a.0
- };
-
- let mut hello2 = hello.clone();
- assert_eq!(6, hello2());
- assert_eq!(6, hello());
-}
diff --git a/src/test/ui/functions-closures/closure-bounds-can-capture-chan.rs b/src/test/ui/functions-closures/closure-bounds-can-capture-chan.rs
deleted file mode 100644
index ccb2e201d..000000000
--- a/src/test/ui/functions-closures/closure-bounds-can-capture-chan.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// run-pass
-// pretty-expanded FIXME #23616
-
-use std::sync::mpsc::channel;
-
-fn foo<F:FnOnce()+Send>(blk: F) {
- blk();
-}
-
-pub fn main() {
- let (tx, rx) = channel();
- foo(move || {
- tx.send(()).unwrap();
- });
- rx.recv().unwrap();
-}
diff --git a/src/test/ui/functions-closures/closure-expected-type/README.md b/src/test/ui/functions-closures/closure-expected-type/README.md
deleted file mode 100644
index 11d2c9b7f..000000000
--- a/src/test/ui/functions-closures/closure-expected-type/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-Some tests targeted at how we deduce the types of closure arguments.
-This process is a result of some heuristics aimed at combining the
-*expected type* we have with the *actual types* that we get from
-inputs. This investigation was kicked off by #38714, which revealed
-some pretty deep flaws in the ad-hoc way that we were doing things
-before.
-
-See also `src/test/ui/closure-expected-type`.
diff --git a/src/test/ui/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs b/src/test/ui/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs
deleted file mode 100644
index 6d5a9876c..000000000
--- a/src/test/ui/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-// run-pass
-#![allow(dead_code)]
-#![allow(unused_variables)]
-fn with_closure<A, F>(_: F)
- where F: FnOnce(Vec<A>, A)
-{
-}
-
-fn expect_free_supply_free<'x>(x: &'x u32) {
- with_closure(|mut x: Vec<_>, y| {
- // Shows that the call to `x.push()` is influencing type of `y`...
- x.push(22_u32);
-
- // ...since we now know the type of `y` and can resolve the method call.
- let _ = y.wrapping_add(1);
- });
-}
-
-fn main() { }
diff --git a/src/test/ui/functions-closures/closure-expected-type/issue-38714.rs b/src/test/ui/functions-closures/closure-expected-type/issue-38714.rs
deleted file mode 100644
index e97785b5c..000000000
--- a/src/test/ui/functions-closures/closure-expected-type/issue-38714.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-// run-pass
-#![allow(dead_code)]
-#![allow(unused_variables)]
-struct UsizeRef<'a> {
- a: &'a usize
-}
-
-type RefTo = Box<dyn for<'r> Fn(&'r Vec<usize>) -> UsizeRef<'r>>;
-
-fn ref_to<'a>(vec: &'a Vec<usize>) -> UsizeRef<'a> {
- UsizeRef{ a: &vec[0]}
-}
-
-fn main() {
- // Regression test: this was causing ICEs; it should compile.
- let a: RefTo = Box::new(|vec: &Vec<usize>| {
- UsizeRef{ a: &vec[0] }
- });
-}
diff --git a/src/test/ui/functions-closures/closure-expected-type/supply-just-return-type.rs b/src/test/ui/functions-closures/closure-expected-type/supply-just-return-type.rs
deleted file mode 100644
index e9964531c..000000000
--- a/src/test/ui/functions-closures/closure-expected-type/supply-just-return-type.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-// run-pass
-fn with_closure<F, R>(f: F) -> Result<char, R>
- where F: FnOnce(&char) -> Result<char, R>,
-{
- f(&'a')
-}
-
-fn main() {
- // Test that supplying the `-> Result<char, ()>` manually here
- // (which is needed to constrain `R`) still allows us to figure
- // out that the type of `x` is `&'a char` where `'a` is bound in
- // the closure (if we didn't, we'd get a type-error because
- // `with_closure` requires a bound region).
- //
- // This pattern was found in the wild.
- let z = with_closure(|x| -> Result<char, ()> { Ok(*x) });
- assert_eq!(z.unwrap(), 'a');
-
- // It also works with `_`:
- let z = with_closure(|x: _| -> Result<char, ()> { Ok(*x) });
- assert_eq!(z.unwrap(), 'a');
-
- // It also works with `&_`:
- let z = with_closure(|x: &_| -> Result<char, ()> { Ok(*x) });
- assert_eq!(z.unwrap(), 'a');
-}
diff --git a/src/test/ui/functions-closures/closure-expected-type/supply-nothing.rs b/src/test/ui/functions-closures/closure-expected-type/supply-nothing.rs
deleted file mode 100644
index 8665cfc21..000000000
--- a/src/test/ui/functions-closures/closure-expected-type/supply-nothing.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// run-pass
-fn with_closure<F>(f: F) -> u32
- where F: FnOnce(&u32, &u32) -> u32
-{
- f(&22, &44)
-}
-
-fn main() {
- let z = with_closure(|x, y| x + y).wrapping_add(1);
- assert_eq!(z, 22 + 44 + 1);
-}
diff --git a/src/test/ui/functions-closures/closure-immediate.rs b/src/test/ui/functions-closures/closure-immediate.rs
deleted file mode 100644
index 428fc6bde..000000000
--- a/src/test/ui/functions-closures/closure-immediate.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// run-pass
-
-// After the work to reoptimize structs, it became possible for immediate logic to fail.
-// This test verifies that it actually works.
-
-fn main() {
- let c = |a: u8, b: u16, c: u8| {
- assert_eq!(a, 1);
- assert_eq!(b, 2);
- assert_eq!(c, 3);
- };
- c(1, 2, 3);
-}
diff --git a/src/test/ui/functions-closures/closure-inference.rs b/src/test/ui/functions-closures/closure-inference.rs
deleted file mode 100644
index 1877414f0..000000000
--- a/src/test/ui/functions-closures/closure-inference.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// run-pass
-#![allow(unused_braces)]
-
-fn foo(i: isize) -> isize { i + 1 }
-
-fn apply<A, F>(f: F, v: A) -> A where F: FnOnce(A) -> A { f(v) }
-
-pub fn main() {
- let f = {|i| foo(i)};
- assert_eq!(apply(f, 2), 3);
-}
diff --git a/src/test/ui/functions-closures/closure-inference2.rs b/src/test/ui/functions-closures/closure-inference2.rs
deleted file mode 100644
index 4ce132e86..000000000
--- a/src/test/ui/functions-closures/closure-inference2.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// run-pass
-// Test a rather underspecified example:
-#![allow(unused_braces)]
-
-pub fn main() {
- let f = {|i| i};
- assert_eq!(f(2), 2);
- assert_eq!(f(5), 5);
-}
diff --git a/src/test/ui/functions-closures/closure-reform.rs b/src/test/ui/functions-closures/closure-reform.rs
deleted file mode 100644
index 0bb6159ff..000000000
--- a/src/test/ui/functions-closures/closure-reform.rs
+++ /dev/null
@@ -1,56 +0,0 @@
-// run-pass
-#![allow(unused_variables)]
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-fn call_it<F>(f: F)
- where F : FnOnce(String) -> String
-{
- println!("{}", f("Fred".to_string()))
-}
-
-fn call_a_thunk<F>(f: F) where F: FnOnce() {
- f();
-}
-
-fn call_this<F>(f: F) where F: FnOnce(&str) + Send {
- f("Hello!");
-}
-
-fn call_bare(f: fn(&str)) {
- f("Hello world!")
-}
-
-fn call_bare_again(f: extern "Rust" fn(&str)) {
- f("Goodbye world!")
-}
-
-pub fn main() {
- // Procs
-
- let greeting = "Hello ".to_string();
- call_it(|s| {
- format!("{}{}", greeting, s)
- });
-
- let greeting = "Goodbye ".to_string();
- call_it(|s| format!("{}{}", greeting, s));
-
- let greeting = "How's life, ".to_string();
- call_it(|s: String| -> String {
- format!("{}{}", greeting, s)
- });
-
- // Closures
-
- call_a_thunk(|| println!("Hello world!"));
-
- call_this(|s| println!("{}", s));
-
- // External functions
-
- fn foo(s: &str) {}
- call_bare(foo);
-
- call_bare_again(foo);
-}
diff --git a/src/test/ui/functions-closures/closure-returning-closure.rs b/src/test/ui/functions-closures/closure-returning-closure.rs
deleted file mode 100644
index 17db81687..000000000
--- a/src/test/ui/functions-closures/closure-returning-closure.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-// run-pass
-fn main() {
- let f = |_||x, y| x+y;
- assert_eq!(f(())(1, 2), 3);
-}
diff --git a/src/test/ui/functions-closures/closure-to-fn-coercion.rs b/src/test/ui/functions-closures/closure-to-fn-coercion.rs
deleted file mode 100644
index 87ba488b5..000000000
--- a/src/test/ui/functions-closures/closure-to-fn-coercion.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-// run-pass
-use std::mem;
-
-const FOO: fn(u8) -> u8 = |v: u8| { v };
-
-const BAR: [fn(&mut u32); 5] = [
- |_: &mut u32| {},
- |v: &mut u32| *v += 1,
- |v: &mut u32| *v += 2,
- |v: &mut u32| *v += 3,
- |v: &mut u32| *v += 4,
-];
-fn func_specific() -> fn() -> u32 {
- || return 42
-}
-
-fn generic<T>(_: T) -> fn() -> usize {
- || mem::size_of::<T>()
-}
-
-fn main() {
- // Items
- assert_eq!(func_specific()(), 42);
- let foo: fn(u8) -> u8 = |v: u8| { v };
- assert_eq!(foo(31), 31);
- // Constants
- assert_eq!(FOO(31), 31);
- let mut a: u32 = 0;
- assert_eq!({ BAR[0](&mut a); a }, 0);
- assert_eq!({ BAR[1](&mut a); a }, 1);
- assert_eq!({ BAR[2](&mut a); a }, 3);
- assert_eq!({ BAR[3](&mut a); a }, 6);
- assert_eq!({ BAR[4](&mut a); a }, 10);
- assert_eq!(generic(0i8)(), 1);
-}
diff --git a/src/test/ui/functions-closures/closure_to_fn_coercion-expected-types.rs b/src/test/ui/functions-closures/closure_to_fn_coercion-expected-types.rs
deleted file mode 100644
index e7a938395..000000000
--- a/src/test/ui/functions-closures/closure_to_fn_coercion-expected-types.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// run-pass
-#![allow(unused_variables)]
-// Ensure that we deduce expected argument types when a `fn()` type is expected (#41755)
-
-fn foo(f: fn(Vec<u32>) -> usize) { }
-
-fn main() {
- foo(|x| x.len())
-}
diff --git a/src/test/ui/functions-closures/copy-closure.rs b/src/test/ui/functions-closures/copy-closure.rs
deleted file mode 100644
index 72da02421..000000000
--- a/src/test/ui/functions-closures/copy-closure.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// run-pass
-// Check that closures implement `Copy`.
-
-fn call<T, F: FnOnce() -> T>(f: F) -> T { f() }
-
-fn main() {
- let a = 5;
- let hello = || {
- println!("Hello {}", a);
- a
- };
-
- assert_eq!(5, call(hello.clone()));
- assert_eq!(5, call(hello));
- assert_eq!(5, call(hello));
-}
diff --git a/src/test/ui/functions-closures/fn-abi.rs b/src/test/ui/functions-closures/fn-abi.rs
deleted file mode 100644
index ac3a4be33..000000000
--- a/src/test/ui/functions-closures/fn-abi.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// run-pass
-// Ensure that declarations and types which use `extern fn` both have the same
-// ABI (#9309).
-
-// pretty-expanded FIXME #23616
-// aux-build:fn-abi.rs
-
-extern crate fn_abi;
-
-extern "C" {
- fn foo();
-}
-
-pub fn main() {
- // Will only type check if the type of _p and the decl of foo use the
- // same ABI
- let _p: unsafe extern "C" fn() = foo;
-}
diff --git a/src/test/ui/functions-closures/fn-bare-assign.rs b/src/test/ui/functions-closures/fn-bare-assign.rs
deleted file mode 100644
index f5dab3c84..000000000
--- a/src/test/ui/functions-closures/fn-bare-assign.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// run-pass
-
-fn f(i: isize, called: &mut bool) {
- assert_eq!(i, 10);
- *called = true;
-}
-
-fn g(f: fn(isize, v: &mut bool), called: &mut bool) {
- f(10, called);
-}
-
-pub fn main() {
- let mut called = false;
- let h = f;
- g(h, &mut called);
- assert_eq!(called, true);
-}
diff --git a/src/test/ui/functions-closures/fn-bare-coerce-to-block.rs b/src/test/ui/functions-closures/fn-bare-coerce-to-block.rs
deleted file mode 100644
index 922e016dd..000000000
--- a/src/test/ui/functions-closures/fn-bare-coerce-to-block.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// run-pass
-// pretty-expanded FIXME #23616
-
-fn bare() {}
-
-fn likes_block<F>(f: F) where F: FnOnce() { f() }
-
-pub fn main() {
- likes_block(bare);
-}
diff --git a/src/test/ui/functions-closures/fn-bare-item.rs b/src/test/ui/functions-closures/fn-bare-item.rs
deleted file mode 100644
index a6e6495a4..000000000
--- a/src/test/ui/functions-closures/fn-bare-item.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// run-pass
-fn f() {
- println!("This is a bare function");
-}
-
-pub fn main() {
- f();
-}
diff --git a/src/test/ui/functions-closures/fn-bare-size.rs b/src/test/ui/functions-closures/fn-bare-size.rs
deleted file mode 100644
index 2ba56eaae..000000000
--- a/src/test/ui/functions-closures/fn-bare-size.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// run-pass
-
-use std::mem;
-
-pub fn main() {
- // Bare functions should just be a pointer
- assert_eq!(mem::size_of::<extern "Rust" fn()>(), mem::size_of::<isize>());
-}
diff --git a/src/test/ui/functions-closures/fn-bare-spawn.rs b/src/test/ui/functions-closures/fn-bare-spawn.rs
deleted file mode 100644
index 0d46fe220..000000000
--- a/src/test/ui/functions-closures/fn-bare-spawn.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// run-pass
-// This is what the signature to spawn should look like with bare functions
-
-
-fn spawn<T:Send>(val: T, f: fn(T)) {
- f(val);
-}
-
-fn f(i: isize) {
- assert_eq!(i, 100);
-}
-
-pub fn main() {
- spawn(100, f);
-}
diff --git a/src/test/ui/functions-closures/fn-coerce-field.rs b/src/test/ui/functions-closures/fn-coerce-field.rs
deleted file mode 100644
index 38bde7b9e..000000000
--- a/src/test/ui/functions-closures/fn-coerce-field.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// run-pass
-#![allow(dead_code)]
-// pretty-expanded FIXME #23616
-#![allow(non_camel_case_types)]
-
-struct r<F> where F: FnOnce() {
- field: F,
-}
-
-pub fn main() {
- fn f() {}
- let _i: r<fn()> = r {field: f as fn()};
-}
diff --git a/src/test/ui/functions-closures/fn-help-with-err-generic-is-not-function.rs b/src/test/ui/functions-closures/fn-help-with-err-generic-is-not-function.rs
deleted file mode 100644
index e48ab4aa9..000000000
--- a/src/test/ui/functions-closures/fn-help-with-err-generic-is-not-function.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-struct Struct<T>(T);
-impl Struct<T>
-//~^ ERROR cannot find type `T` in this scope
-//~| NOTE not found in this scope
-//~| HELP you might be missing a type parameter
-where
- T: Copy,
- //~^ ERROR cannot find type `T` in this scope
- //~| NOTE not found in this scope
-{
- fn method(v: Vec<u8>) { v.len(); }
-}
-
-fn main() {}
diff --git a/src/test/ui/functions-closures/fn-help-with-err-generic-is-not-function.stderr b/src/test/ui/functions-closures/fn-help-with-err-generic-is-not-function.stderr
deleted file mode 100644
index 26bdf460f..000000000
--- a/src/test/ui/functions-closures/fn-help-with-err-generic-is-not-function.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0412]: cannot find type `T` in this scope
- --> $DIR/fn-help-with-err-generic-is-not-function.rs:2:13
- |
-LL | impl Struct<T>
- | - ^ not found in this scope
- | |
- | help: you might be missing a type parameter: `<T>`
-
-error[E0412]: cannot find type `T` in this scope
- --> $DIR/fn-help-with-err-generic-is-not-function.rs:7:5
- |
-LL | T: Copy,
- | ^ not found in this scope
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0412`.
diff --git a/src/test/ui/functions-closures/fn-help-with-err.rs b/src/test/ui/functions-closures/fn-help-with-err.rs
deleted file mode 100644
index 49a514a8b..000000000
--- a/src/test/ui/functions-closures/fn-help-with-err.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-// This test case checks the behavior of typeck::check::method::suggest::is_fn on Ty::Error.
-
-struct Foo;
-
-trait Bar {
- //~^ NOTE `Bar` defines an item `bar`, perhaps you need to implement it
- //~| NOTE `Bar` defines an item `bar`, perhaps you need to implement it
- fn bar(&self) {}
-}
-
-impl Bar for Foo {}
-
-fn main() {
- let arc = std::sync::Arc::new(oops);
- //~^ ERROR cannot find value `oops` in this scope
- //~| NOTE not found
- arc.bar();
- //~^ ERROR no method named `bar`
- //~| NOTE method not found
- //~| HELP items from traits can only be used if the trait is implemented and in scope
-
- let arc2 = std::sync::Arc::new(|| Foo);
- arc2.bar();
- //~^ ERROR no method named `bar`
- //~| NOTE method not found
- //~| HELP items from traits can only be used if the trait is implemented and in scope
- //~| HELP use parentheses to call this closure
-}
diff --git a/src/test/ui/functions-closures/fn-help-with-err.stderr b/src/test/ui/functions-closures/fn-help-with-err.stderr
deleted file mode 100644
index 229666621..000000000
--- a/src/test/ui/functions-closures/fn-help-with-err.stderr
+++ /dev/null
@@ -1,40 +0,0 @@
-error[E0425]: cannot find value `oops` in this scope
- --> $DIR/fn-help-with-err.rs:14:35
- |
-LL | let arc = std::sync::Arc::new(oops);
- | ^^^^ not found in this scope
-
-error[E0599]: no method named `bar` found for struct `Arc<_>` in the current scope
- --> $DIR/fn-help-with-err.rs:17:9
- |
-LL | arc.bar();
- | ^^^ method not found in `Arc<_>`
- |
- = help: items from traits can only be used if the trait is implemented and in scope
-note: `Bar` defines an item `bar`, perhaps you need to implement it
- --> $DIR/fn-help-with-err.rs:5:1
- |
-LL | trait Bar {
- | ^^^^^^^^^
-
-error[E0599]: no method named `bar` found for struct `Arc<[closure@$DIR/fn-help-with-err.rs:22:36: 22:38]>` in the current scope
- --> $DIR/fn-help-with-err.rs:23:10
- |
-LL | arc2.bar();
- | ^^^ method not found in `Arc<[closure@$DIR/fn-help-with-err.rs:22:36: 22:38]>`
- |
- = help: items from traits can only be used if the trait is implemented and in scope
-note: `Bar` defines an item `bar`, perhaps you need to implement it
- --> $DIR/fn-help-with-err.rs:5:1
- |
-LL | trait Bar {
- | ^^^^^^^^^
-help: use parentheses to call this closure
- |
-LL | arc2().bar();
- | ++
-
-error: aborting due to 3 previous errors
-
-Some errors have detailed explanations: E0425, E0599.
-For more information about an error, try `rustc --explain E0425`.
diff --git a/src/test/ui/functions-closures/fn-item-type-cast.rs b/src/test/ui/functions-closures/fn-item-type-cast.rs
deleted file mode 100644
index 4d50ea97b..000000000
--- a/src/test/ui/functions-closures/fn-item-type-cast.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-// run-pass
-#![allow(dead_code)]
-#![allow(unused_variables)]
-// Test explicit coercions from a fn item type to a fn pointer type.
-
-
-fn foo(x: isize) -> isize { x * 2 }
-fn bar(x: isize) -> isize { x * 4 }
-type IntMap = fn(isize) -> isize;
-
-fn eq<T>(x: T, y: T) { }
-
-static TEST: Option<IntMap> = Some(foo as IntMap);
-
-fn main() {
- let f = foo as IntMap;
-
- let f = if true { foo as IntMap } else { bar as IntMap };
- assert_eq!(f(4), 8);
-
- eq(foo as IntMap, bar as IntMap);
-}
diff --git a/src/test/ui/functions-closures/fn-item-type-coerce.rs b/src/test/ui/functions-closures/fn-item-type-coerce.rs
deleted file mode 100644
index 7a096764e..000000000
--- a/src/test/ui/functions-closures/fn-item-type-coerce.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// run-pass
-#![allow(unused_variables)]
-// Test implicit coercions from a fn item type to a fn pointer type.
-
-// pretty-expanded FIXME #23616
-
-fn foo(x: isize) -> isize { x * 2 }
-fn bar(x: isize) -> isize { x * 4 }
-type IntMap = fn(isize) -> isize;
-
-fn eq<T>(x: T, y: T) { }
-
-fn main() {
- let f: IntMap = foo;
-
- eq::<IntMap>(foo, bar);
-}
diff --git a/src/test/ui/functions-closures/fn-item-type-zero-sized.rs b/src/test/ui/functions-closures/fn-item-type-zero-sized.rs
deleted file mode 100644
index bd9f1ed66..000000000
--- a/src/test/ui/functions-closures/fn-item-type-zero-sized.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// run-pass
-// Test that fn item types are zero-sized.
-
-use std::mem::{size_of, size_of_val};
-
-fn main() {
- assert_eq!(size_of_val(&main), 0);
-
- let (a, b) = (size_of::<u8>, size_of::<u16>);
- assert_eq!(size_of_val(&a), 0);
- assert_eq!(size_of_val(&b), 0);
- assert_eq!((a(), b()), (1, 2));
-}
diff --git a/src/test/ui/functions-closures/fn-lval.rs b/src/test/ui/functions-closures/fn-lval.rs
deleted file mode 100644
index 01079eea4..000000000
--- a/src/test/ui/functions-closures/fn-lval.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// run-pass
-
-
-
-// pretty-expanded FIXME #23616
-
-fn foo(_f: fn(isize) -> isize) { }
-
-fn id(x: isize) -> isize { return x; }
-
-pub fn main() { foo(id); }
diff --git a/src/test/ui/functions-closures/fn-type-infer.rs b/src/test/ui/functions-closures/fn-type-infer.rs
deleted file mode 100644
index fe6567f22..000000000
--- a/src/test/ui/functions-closures/fn-type-infer.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// run-pass
-// pretty-expanded FIXME #23616
-
-#![allow(unused_variables)]
-
-pub fn main() {
- // We should be able to type infer inside of ||s.
- let _f = || {
- let i = 10;
- };
-}
diff --git a/src/test/ui/functions-closures/implied-bounds-closure-arg-outlives.rs b/src/test/ui/functions-closures/implied-bounds-closure-arg-outlives.rs
deleted file mode 100644
index 4ac07123d..000000000
--- a/src/test/ui/functions-closures/implied-bounds-closure-arg-outlives.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-// run-pass
-// Test that we are able to handle the relationships between free
-// regions bound in a closure callback.
-
-#[derive(Copy, Clone)]
-struct MyCx<'short, 'long: 'short> {
- short: &'short u32,
- long: &'long u32,
-}
-
-impl<'short, 'long> MyCx<'short, 'long> {
- fn short(self) -> &'short u32 { self.short }
- fn long(self) -> &'long u32 { self.long }
- fn set_short(&mut self, v: &'short u32) { self.short = v; }
-}
-
-fn with<F, R>(op: F) -> R
-where
- F: for<'short, 'long> FnOnce(MyCx<'short, 'long>) -> R,
-{
- op(MyCx {
- short: &22,
- long: &22,
- })
-}
-
-fn main() {
- with(|mut cx| {
- // For this to type-check, we need to be able to deduce that
- // the lifetime of `l` can be `'short`, even though it has
- // input from `'long`.
- let l = if true { cx.long() } else { cx.short() };
- cx.set_short(l);
- });
-}
diff --git a/src/test/ui/functions-closures/nullable-pointer-opt-closures.rs b/src/test/ui/functions-closures/nullable-pointer-opt-closures.rs
deleted file mode 100644
index 87dacfba2..000000000
--- a/src/test/ui/functions-closures/nullable-pointer-opt-closures.rs
+++ /dev/null
@@ -1,34 +0,0 @@
-// run-pass
-
-use std::mem;
-
-pub fn main() {
- // By Ref Capture
- let a = 10i32;
- let b = Some(|| println!("{}", a));
- // When we capture by reference we can use any of the
- // captures as the discriminant since they're all
- // behind a pointer.
- assert_eq!(mem::size_of_val(&b), mem::size_of::<usize>());
-
- // By Value Capture
- let a = Box::new(12i32);
- let b = Some(move || println!("{}", a));
- // We captured `a` by value and since it's a `Box` we can use it
- // as the discriminant.
- assert_eq!(mem::size_of_val(&b), mem::size_of::<Box<i32>>());
-
- // By Value Capture - Transitive case
- let a = "Hello".to_string(); // String -> Vec -> Unique -> NonZero
- let b = Some(move || println!("{}", a));
- // We captured `a` by value and since down the chain it contains
- // a `NonZero` field, we can use it as the discriminant.
- assert_eq!(mem::size_of_val(&b), mem::size_of::<String>());
-
- // By Value - No Optimization
- let a = 14i32;
- let b = Some(move || println!("{}", a));
- // We captured `a` by value but we can't use it as the discriminant
- // thus we end up with an extra field for the discriminant
- assert_eq!(mem::size_of_val(&b), mem::size_of::<(i32, i32)>());
-}
diff --git a/src/test/ui/functions-closures/parallel-codegen-closures.rs b/src/test/ui/functions-closures/parallel-codegen-closures.rs
deleted file mode 100644
index 79759daba..000000000
--- a/src/test/ui/functions-closures/parallel-codegen-closures.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-// run-pass
-#![allow(dead_code)]
-#![allow(unused_variables)]
-#![allow(stable_features)]
-
-// Tests parallel codegen - this can fail if the symbol for the anonymous
-// closure in `sum` pollutes the second codegen unit from the first.
-
-// compile-flags: -C codegen_units=2
-
-#![feature(iter_arith)]
-
-mod a {
- fn foo() {
- let x = ["a", "bob", "c"];
- let len: usize = x.iter().map(|s| s.len()).sum();
- }
-}
-
-mod b {
- fn bar() {
- let x = ["a", "bob", "c"];
- let len: usize = x.iter().map(|s| s.len()).sum();
- }
-}
-
-fn main() {
-}
diff --git a/src/test/ui/functions-closures/return-from-closure.rs b/src/test/ui/functions-closures/return-from-closure.rs
deleted file mode 100644
index 656a95f12..000000000
--- a/src/test/ui/functions-closures/return-from-closure.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-// run-pass
-#![allow(non_upper_case_globals)]
-// just to make sure that `return` is only returning from the closure,
-// not the surrounding function.
-
-static mut calls: usize = 0;
-
-fn surrounding() {
- let return_works = |n: isize| {
- unsafe { calls += 1 }
-
- if n >= 0 { return; }
- panic!()
- };
-
- return_works(10);
- return_works(20);
-
- let return_works_proc = |n: isize| {
- unsafe { calls += 1 }
-
- if n >= 0 { return; }
- panic!()
- };
-
- return_works_proc(10);
-}
-
-pub fn main() {
- surrounding();
-
- assert_eq!(unsafe {calls}, 3);
-}