summaryrefslogtreecommitdiffstats
path: root/src/test/ui/fn
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/fn
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/fn')
-rw-r--r--src/test/ui/fn/bad-main.rs1
-rw-r--r--src/test/ui/fn/bad-main.stderr12
-rw-r--r--src/test/ui/fn/dyn-fn-alignment.rs23
-rw-r--r--src/test/ui/fn/expr-fn-panic.rs11
-rw-r--r--src/test/ui/fn/expr-fn.rs62
-rw-r--r--src/test/ui/fn/fn-bad-block-type.rs5
-rw-r--r--src/test/ui/fn/fn-bad-block-type.stderr11
-rw-r--r--src/test/ui/fn/fn-closure-mutable-capture.rs12
-rw-r--r--src/test/ui/fn/fn-closure-mutable-capture.stderr15
-rw-r--r--src/test/ui/fn/fn-compare-mismatch.rs7
-rw-r--r--src/test/ui/fn/fn-compare-mismatch.stderr26
-rw-r--r--src/test/ui/fn/fn-item-type.rs53
-rw-r--r--src/test/ui/fn/fn-item-type.stderr97
-rw-r--r--src/test/ui/fn/fn-recover-return-sign.fixed28
-rw-r--r--src/test/ui/fn/fn-recover-return-sign.rs28
-rw-r--r--src/test/ui/fn/fn-recover-return-sign.stderr26
-rw-r--r--src/test/ui/fn/fn-recover-return-sign2.rs8
-rw-r--r--src/test/ui/fn/fn-recover-return-sign2.stderr14
-rw-r--r--src/test/ui/fn/fn-trait-formatting.rs21
-rw-r--r--src/test/ui/fn/fn-trait-formatting.stderr60
-rw-r--r--src/test/ui/fn/fun-call-variants.rs12
-rw-r--r--src/test/ui/fn/implied-bounds-unnorm-associated-type-2.rs23
-rw-r--r--src/test/ui/fn/implied-bounds-unnorm-associated-type-2.stderr17
-rw-r--r--src/test/ui/fn/implied-bounds-unnorm-associated-type-3.rs22
-rw-r--r--src/test/ui/fn/implied-bounds-unnorm-associated-type-4.rs24
-rw-r--r--src/test/ui/fn/implied-bounds-unnorm-associated-type-4.stderr14
-rw-r--r--src/test/ui/fn/implied-bounds-unnorm-associated-type-5.rs23
-rw-r--r--src/test/ui/fn/implied-bounds-unnorm-associated-type-5.stderr19
-rw-r--r--src/test/ui/fn/implied-bounds-unnorm-associated-type.rs23
-rw-r--r--src/test/ui/fn/implied-bounds-unnorm-associated-type.stderr14
-rw-r--r--src/test/ui/fn/issue-80179.rs27
-rw-r--r--src/test/ui/fn/issue-80179.stderr21
-rw-r--r--src/test/ui/fn/keyword-order.rs6
-rw-r--r--src/test/ui/fn/keyword-order.stderr16
-rw-r--r--src/test/ui/fn/nested-function-names-issue-8587.rs42
-rw-r--r--src/test/ui/fn/signature-error-reporting-under-verbose.rs15
-rw-r--r--src/test/ui/fn/signature-error-reporting-under-verbose.stderr19
37 files changed, 0 insertions, 857 deletions
diff --git a/src/test/ui/fn/bad-main.rs b/src/test/ui/fn/bad-main.rs
deleted file mode 100644
index 751159961..000000000
--- a/src/test/ui/fn/bad-main.rs
+++ /dev/null
@@ -1 +0,0 @@
-fn main(x: isize) { } //~ ERROR: `main` function has wrong type [E0580]
diff --git a/src/test/ui/fn/bad-main.stderr b/src/test/ui/fn/bad-main.stderr
deleted file mode 100644
index 675b66d05..000000000
--- a/src/test/ui/fn/bad-main.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0580]: `main` function has wrong type
- --> $DIR/bad-main.rs:1:1
- |
-LL | fn main(x: isize) { }
- | ^^^^^^^^^^^^^^^^^ incorrect number of function parameters
- |
- = note: expected fn pointer `fn()`
- found fn pointer `fn(isize)`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0580`.
diff --git a/src/test/ui/fn/dyn-fn-alignment.rs b/src/test/ui/fn/dyn-fn-alignment.rs
deleted file mode 100644
index cedfd1cf2..000000000
--- a/src/test/ui/fn/dyn-fn-alignment.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// run-pass
-
-#![allow(dead_code)]
-#[repr(align(256))]
-struct A {
- v: u8,
-}
-
-impl A {
- fn f(&self) -> *const A {
- self
- }
-}
-
-fn f2(v: u8) -> Box<dyn FnOnce() -> *const A> {
- let a = A { v };
- Box::new(move || a.f())
-}
-
-fn main() {
- let addr = f2(0)();
- assert_eq!(addr as usize % 256, 0, "addr: {:?}", addr);
-}
diff --git a/src/test/ui/fn/expr-fn-panic.rs b/src/test/ui/fn/expr-fn-panic.rs
deleted file mode 100644
index 123b57f97..000000000
--- a/src/test/ui/fn/expr-fn-panic.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// run-fail
-// error-pattern:explicit panic
-// ignore-emscripten no processes
-
-fn f() -> ! {
- panic!()
-}
-
-fn main() {
- f();
-}
diff --git a/src/test/ui/fn/expr-fn.rs b/src/test/ui/fn/expr-fn.rs
deleted file mode 100644
index 253cbfd5d..000000000
--- a/src/test/ui/fn/expr-fn.rs
+++ /dev/null
@@ -1,62 +0,0 @@
-// run-pass
-#![allow(unused_braces)]
-
-fn test_int() {
- fn f() -> isize { 10 }
- assert_eq!(f(), 10);
-}
-
-fn test_vec() {
- fn f() -> Vec<isize> { vec![10, 11] }
- let vect = f();
- assert_eq!(vect[1], 11);
-}
-
-fn test_generic() {
- fn f<T>(t: T) -> T { t }
- assert_eq!(f(10), 10);
-}
-
-fn test_alt() {
- fn f() -> isize { match true { false => { 10 } true => { 20 } } }
- assert_eq!(f(), 20);
-}
-
-fn test_if() {
- fn f() -> isize { if true { 10 } else { 20 } }
- assert_eq!(f(), 10);
-}
-
-fn test_block() {
- fn f() -> isize { { 10 } }
- assert_eq!(f(), 10);
-}
-
-fn test_ret() {
- fn f() -> isize {
- return 10 // no semi
-
- }
- assert_eq!(f(), 10);
-}
-
-
-// From issue #372
-fn test_372() {
- fn f() -> isize { let x = { 3 }; x }
- assert_eq!(f(), 3);
-}
-
-fn test_nil() { () }
-
-pub fn main() {
- test_int();
- test_vec();
- test_generic();
- test_alt();
- test_if();
- test_block();
- test_ret();
- test_372();
- test_nil();
-}
diff --git a/src/test/ui/fn/fn-bad-block-type.rs b/src/test/ui/fn/fn-bad-block-type.rs
deleted file mode 100644
index 01dcff058..000000000
--- a/src/test/ui/fn/fn-bad-block-type.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-// error-pattern:mismatched types
-
-fn f() -> isize { true }
-
-fn main() { }
diff --git a/src/test/ui/fn/fn-bad-block-type.stderr b/src/test/ui/fn/fn-bad-block-type.stderr
deleted file mode 100644
index 13ebfd1e2..000000000
--- a/src/test/ui/fn/fn-bad-block-type.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0308]: mismatched types
- --> $DIR/fn-bad-block-type.rs:3:19
- |
-LL | fn f() -> isize { true }
- | ----- ^^^^ expected `isize`, found `bool`
- | |
- | expected `isize` because of return type
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/fn/fn-closure-mutable-capture.rs b/src/test/ui/fn/fn-closure-mutable-capture.rs
deleted file mode 100644
index 97141886f..000000000
--- a/src/test/ui/fn/fn-closure-mutable-capture.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-pub fn bar<F: Fn()>(_f: F) {} //~ NOTE change this to accept `FnMut` instead of `Fn`
-
-pub fn foo() {
- let mut x = 0;
- bar(move || x = 1);
- //~^ ERROR cannot assign to `x`, as it is a captured variable in a `Fn` closure
- //~| NOTE cannot assign
- //~| NOTE expects `Fn` instead of `FnMut`
- //~| NOTE in this closure
-}
-
-fn main() {}
diff --git a/src/test/ui/fn/fn-closure-mutable-capture.stderr b/src/test/ui/fn/fn-closure-mutable-capture.stderr
deleted file mode 100644
index 03e3d545a..000000000
--- a/src/test/ui/fn/fn-closure-mutable-capture.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
- --> $DIR/fn-closure-mutable-capture.rs:5:17
- |
-LL | pub fn bar<F: Fn()>(_f: F) {}
- | - change this to accept `FnMut` instead of `Fn`
-...
-LL | bar(move || x = 1);
- | --- ------- ^^^^^ cannot assign
- | | |
- | | in this closure
- | expects `Fn` instead of `FnMut`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/fn/fn-compare-mismatch.rs b/src/test/ui/fn/fn-compare-mismatch.rs
deleted file mode 100644
index d734d54e8..000000000
--- a/src/test/ui/fn/fn-compare-mismatch.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-fn main() {
- fn f() { }
- fn g() { }
- let x = f == g;
- //~^ ERROR binary operation `==` cannot be applied
- //~| ERROR mismatched types
-}
diff --git a/src/test/ui/fn/fn-compare-mismatch.stderr b/src/test/ui/fn/fn-compare-mismatch.stderr
deleted file mode 100644
index df838cb11..000000000
--- a/src/test/ui/fn/fn-compare-mismatch.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error[E0369]: binary operation `==` cannot be applied to type `fn() {f}`
- --> $DIR/fn-compare-mismatch.rs:4:15
- |
-LL | let x = f == g;
- | - ^^ - fn() {g}
- | |
- | fn() {f}
- |
-help: use parentheses to call these
- |
-LL | let x = f() == g();
- | ++ ++
-
-error[E0308]: mismatched types
- --> $DIR/fn-compare-mismatch.rs:4:18
- |
-LL | let x = f == g;
- | ^ expected fn item, found a different fn item
- |
- = note: expected fn item `fn() {f}`
- found fn item `fn() {g}`
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0308, E0369.
-For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/fn/fn-item-type.rs b/src/test/ui/fn/fn-item-type.rs
deleted file mode 100644
index 1831e6cbf..000000000
--- a/src/test/ui/fn/fn-item-type.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-// Test that the types of distinct fn items are not compatible by
-// default. See also `run-pass/fn-item-type-*.rs`.
-
-fn foo<T>(x: isize) -> isize { x * 2 }
-fn bar<T>(x: isize) -> isize { x * 4 }
-
-fn eq<T>(x: T, y: T) { }
-
-trait Foo { fn foo() { /* this is a default fn */ } }
-impl<T> Foo for T { /* `foo` is still default here */ }
-
-fn main() {
- eq(foo::<u8>, bar::<u8>);
- //~^ ERROR mismatched types
- //~| expected fn item `fn(_) -> _ {foo::<u8>}`
- //~| found fn item `fn(_) -> _ {bar::<u8>}`
- //~| expected fn item, found a different fn item
- //~| different `fn` items always have unique types, even if their signatures are the same
- //~| change the expected type to be function pointer
- //~| if the expected type is due to type inference, cast the expected `fn` to a function pointer
-
- eq(foo::<u8>, foo::<i8>);
- //~^ ERROR mismatched types
- //~| expected `u8`, found `i8`
- //~| different `fn` items always have unique types, even if their signatures are the same
- //~| change the expected type to be function pointer
- //~| if the expected type is due to type inference, cast the expected `fn` to a function pointer
-
- eq(bar::<String>, bar::<Vec<u8>>);
- //~^ ERROR mismatched types
- //~| found fn item `fn(_) -> _ {bar::<Vec<u8>>}`
- //~| expected struct `String`, found struct `Vec`
- //~| different `fn` items always have unique types, even if their signatures are the same
- //~| change the expected type to be function pointer
- //~| if the expected type is due to type inference, cast the expected `fn` to a function pointer
-
- // Make sure we distinguish between trait methods correctly.
- eq(<u8 as Foo>::foo, <u16 as Foo>::foo);
- //~^ ERROR mismatched types
- //~| expected `u8`, found `u16`
- //~| different `fn` items always have unique types, even if their signatures are the same
- //~| change the expected type to be function pointer
- //~| if the expected type is due to type inference, cast the expected `fn` to a function pointer
-
- eq(foo::<u8>, bar::<u8> as fn(isize) -> isize);
- //~^ ERROR mismatched types
- //~| found fn pointer `fn(_) -> _`
- //~| expected fn item, found fn pointer
- //~| change the expected type to be function pointer
- //~| if the expected type is due to type inference, cast the expected `fn` to a function pointer
-
- eq(foo::<u8> as fn(isize) -> isize, bar::<u8>); // ok!
-}
diff --git a/src/test/ui/fn/fn-item-type.stderr b/src/test/ui/fn/fn-item-type.stderr
deleted file mode 100644
index f03a47d5c..000000000
--- a/src/test/ui/fn/fn-item-type.stderr
+++ /dev/null
@@ -1,97 +0,0 @@
-error[E0308]: mismatched types
- --> $DIR/fn-item-type.rs:13:19
- |
-LL | eq(foo::<u8>, bar::<u8>);
- | -- ^^^^^^^^^ expected fn item, found a different fn item
- | |
- | arguments to this function are incorrect
- |
- = note: expected fn item `fn(_) -> _ {foo::<u8>}`
- found fn item `fn(_) -> _ {bar::<u8>}`
- = note: different `fn` items always have unique types, even if their signatures are the same
- = help: change the expected type to be function pointer `fn(isize) -> isize`
- = help: if the expected type is due to type inference, cast the expected `fn` to a function pointer: `foo::<u8> as fn(isize) -> isize`
-note: function defined here
- --> $DIR/fn-item-type.rs:7:4
- |
-LL | fn eq<T>(x: T, y: T) { }
- | ^^ ----
-
-error[E0308]: mismatched types
- --> $DIR/fn-item-type.rs:22:19
- |
-LL | eq(foo::<u8>, foo::<i8>);
- | -- ^^^^^^^^^ expected `u8`, found `i8`
- | |
- | arguments to this function are incorrect
- |
- = note: expected fn item `fn(_) -> _ {foo::<u8>}`
- found fn item `fn(_) -> _ {foo::<i8>}`
- = note: different `fn` items always have unique types, even if their signatures are the same
- = help: change the expected type to be function pointer `fn(isize) -> isize`
- = help: if the expected type is due to type inference, cast the expected `fn` to a function pointer: `foo::<u8> as fn(isize) -> isize`
-note: function defined here
- --> $DIR/fn-item-type.rs:7:4
- |
-LL | fn eq<T>(x: T, y: T) { }
- | ^^ ----
-
-error[E0308]: mismatched types
- --> $DIR/fn-item-type.rs:29:23
- |
-LL | eq(bar::<String>, bar::<Vec<u8>>);
- | -- ^^^^^^^^^^^^^^ expected struct `String`, found struct `Vec`
- | |
- | arguments to this function are incorrect
- |
- = note: expected fn item `fn(_) -> _ {bar::<String>}`
- found fn item `fn(_) -> _ {bar::<Vec<u8>>}`
- = note: different `fn` items always have unique types, even if their signatures are the same
- = help: change the expected type to be function pointer `fn(isize) -> isize`
- = help: if the expected type is due to type inference, cast the expected `fn` to a function pointer: `bar::<String> as fn(isize) -> isize`
-note: function defined here
- --> $DIR/fn-item-type.rs:7:4
- |
-LL | fn eq<T>(x: T, y: T) { }
- | ^^ ----
-
-error[E0308]: mismatched types
- --> $DIR/fn-item-type.rs:38:26
- |
-LL | eq(<u8 as Foo>::foo, <u16 as Foo>::foo);
- | -- ^^^^^^^^^^^^^^^^^ expected `u8`, found `u16`
- | |
- | arguments to this function are incorrect
- |
- = note: expected fn item `fn() {<u8 as Foo>::foo}`
- found fn item `fn() {<u16 as Foo>::foo}`
- = note: different `fn` items always have unique types, even if their signatures are the same
- = help: change the expected type to be function pointer `fn()`
- = help: if the expected type is due to type inference, cast the expected `fn` to a function pointer: `<u8 as Foo>::foo as fn()`
-note: function defined here
- --> $DIR/fn-item-type.rs:7:4
- |
-LL | fn eq<T>(x: T, y: T) { }
- | ^^ ----
-
-error[E0308]: mismatched types
- --> $DIR/fn-item-type.rs:45:19
- |
-LL | eq(foo::<u8>, bar::<u8> as fn(isize) -> isize);
- | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn item, found fn pointer
- | |
- | arguments to this function are incorrect
- |
- = note: expected fn item `fn(_) -> _ {foo::<u8>}`
- found fn pointer `fn(_) -> _`
- = help: change the expected type to be function pointer `fn(isize) -> isize`
- = help: if the expected type is due to type inference, cast the expected `fn` to a function pointer: `foo::<u8> as fn(isize) -> isize`
-note: function defined here
- --> $DIR/fn-item-type.rs:7:4
- |
-LL | fn eq<T>(x: T, y: T) { }
- | ^^ ----
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/fn/fn-recover-return-sign.fixed b/src/test/ui/fn/fn-recover-return-sign.fixed
deleted file mode 100644
index 076be6a35..000000000
--- a/src/test/ui/fn/fn-recover-return-sign.fixed
+++ /dev/null
@@ -1,28 +0,0 @@
-// run-rustfix
-#![allow(unused)]
-fn a() -> usize { 0 }
-//~^ ERROR return types are denoted using `->`
-
-fn b()-> usize { 0 }
-//~^ ERROR return types are denoted using `->`
-
-fn bar(_: u32) {}
-
-fn baz() -> *const dyn Fn(u32) { unimplemented!() }
-
-fn foo() {
- match () {
- _ if baz() == &bar as &dyn Fn(u32) => (),
- () => (),
- }
-}
-
-fn main() {
- let foo = |a: bool| -> bool { a };
- //~^ ERROR return types are denoted using `->`
- dbg!(foo(false));
-
- let bar = |a: bool|-> bool { a };
- //~^ ERROR return types are denoted using `->`
- dbg!(bar(false));
-}
diff --git a/src/test/ui/fn/fn-recover-return-sign.rs b/src/test/ui/fn/fn-recover-return-sign.rs
deleted file mode 100644
index 0656023c0..000000000
--- a/src/test/ui/fn/fn-recover-return-sign.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-// run-rustfix
-#![allow(unused)]
-fn a() => usize { 0 }
-//~^ ERROR return types are denoted using `->`
-
-fn b(): usize { 0 }
-//~^ ERROR return types are denoted using `->`
-
-fn bar(_: u32) {}
-
-fn baz() -> *const dyn Fn(u32) { unimplemented!() }
-
-fn foo() {
- match () {
- _ if baz() == &bar as &dyn Fn(u32) => (),
- () => (),
- }
-}
-
-fn main() {
- let foo = |a: bool| => bool { a };
- //~^ ERROR return types are denoted using `->`
- dbg!(foo(false));
-
- let bar = |a: bool|: bool { a };
- //~^ ERROR return types are denoted using `->`
- dbg!(bar(false));
-}
diff --git a/src/test/ui/fn/fn-recover-return-sign.stderr b/src/test/ui/fn/fn-recover-return-sign.stderr
deleted file mode 100644
index 983109730..000000000
--- a/src/test/ui/fn/fn-recover-return-sign.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error: return types are denoted using `->`
- --> $DIR/fn-recover-return-sign.rs:3:8
- |
-LL | fn a() => usize { 0 }
- | ^^ help: use `->` instead
-
-error: return types are denoted using `->`
- --> $DIR/fn-recover-return-sign.rs:6:7
- |
-LL | fn b(): usize { 0 }
- | ^ help: use `->` instead
-
-error: return types are denoted using `->`
- --> $DIR/fn-recover-return-sign.rs:21:25
- |
-LL | let foo = |a: bool| => bool { a };
- | ^^ help: use `->` instead
-
-error: return types are denoted using `->`
- --> $DIR/fn-recover-return-sign.rs:25:24
- |
-LL | let bar = |a: bool|: bool { a };
- | ^ help: use `->` instead
-
-error: aborting due to 4 previous errors
-
diff --git a/src/test/ui/fn/fn-recover-return-sign2.rs b/src/test/ui/fn/fn-recover-return-sign2.rs
deleted file mode 100644
index 31f56565c..000000000
--- a/src/test/ui/fn/fn-recover-return-sign2.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// Separate test file because `Fn() => bool` isn't getting fixed and rustfix complained that
-// even though a fix was applied the code was still incorrect
-
-fn foo() => impl Fn() => bool {
- //~^ ERROR return types are denoted using `->`
- //~| ERROR expected one of `+`, `->`, `::`, `where`, or `{`, found `=>`
- unimplemented!()
-}
diff --git a/src/test/ui/fn/fn-recover-return-sign2.stderr b/src/test/ui/fn/fn-recover-return-sign2.stderr
deleted file mode 100644
index 25ee8dd0c..000000000
--- a/src/test/ui/fn/fn-recover-return-sign2.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error: return types are denoted using `->`
- --> $DIR/fn-recover-return-sign2.rs:4:10
- |
-LL | fn foo() => impl Fn() => bool {
- | ^^ help: use `->` instead
-
-error: expected one of `+`, `->`, `::`, `where`, or `{`, found `=>`
- --> $DIR/fn-recover-return-sign2.rs:4:23
- |
-LL | fn foo() => impl Fn() => bool {
- | ^^ expected one of `+`, `->`, `::`, `where`, or `{`
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/fn/fn-trait-formatting.rs b/src/test/ui/fn/fn-trait-formatting.rs
deleted file mode 100644
index 636ac7107..000000000
--- a/src/test/ui/fn/fn-trait-formatting.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {}
-
-
-
-fn main() {
- let _: () = Box::new(|_: isize| {}) as Box<dyn FnOnce(isize)>;
- //~^ ERROR mismatched types
- //~| expected unit type `()`
- //~| found struct `Box<dyn FnOnce(isize)>`
- let _: () = Box::new(|_: isize, isize| {}) as Box<dyn Fn(isize, isize)>;
- //~^ ERROR mismatched types
- //~| expected unit type `()`
- //~| found struct `Box<dyn Fn(isize, isize)>`
- let _: () = Box::new(|| -> isize { unimplemented!() }) as Box<dyn FnMut() -> isize>;
- //~^ ERROR mismatched types
- //~| expected unit type `()`
- //~| found struct `Box<dyn FnMut() -> isize>`
-
- needs_fn(1);
- //~^ ERROR expected a `Fn<(isize,)>` closure, found `{integer}`
-}
diff --git a/src/test/ui/fn/fn-trait-formatting.stderr b/src/test/ui/fn/fn-trait-formatting.stderr
deleted file mode 100644
index 2a674d3c1..000000000
--- a/src/test/ui/fn/fn-trait-formatting.stderr
+++ /dev/null
@@ -1,60 +0,0 @@
-error[E0308]: mismatched types
- --> $DIR/fn-trait-formatting.rs:6:17
- |
-LL | let _: () = Box::new(|_: isize| {}) as Box<dyn FnOnce(isize)>;
- | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box`
- | |
- | expected due to this
- |
- = note: expected unit type `()`
- found struct `Box<dyn FnOnce(isize)>`
-help: use parentheses to call this trait object
- |
-LL | let _: () = (Box::new(|_: isize| {}) as Box<dyn FnOnce(isize)>)(/* isize */);
- | + ++++++++++++++
-
-error[E0308]: mismatched types
- --> $DIR/fn-trait-formatting.rs:10:17
- |
-LL | let _: () = Box::new(|_: isize, isize| {}) as Box<dyn Fn(isize, isize)>;
- | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box`
- | |
- | expected due to this
- |
- = note: expected unit type `()`
- found struct `Box<dyn Fn(isize, isize)>`
-help: use parentheses to call this trait object
- |
-LL | let _: () = (Box::new(|_: isize, isize| {}) as Box<dyn Fn(isize, isize)>)(/* isize */, /* isize */);
- | + +++++++++++++++++++++++++++
-
-error[E0308]: mismatched types
- --> $DIR/fn-trait-formatting.rs:14:17
- |
-LL | let _: () = Box::new(|| -> isize { unimplemented!() }) as Box<dyn FnMut() -> isize>;
- | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box`
- | |
- | expected due to this
- |
- = note: expected unit type `()`
- found struct `Box<dyn FnMut() -> isize>`
-
-error[E0277]: expected a `Fn<(isize,)>` closure, found `{integer}`
- --> $DIR/fn-trait-formatting.rs:19:14
- |
-LL | needs_fn(1);
- | -------- ^ expected an `Fn<(isize,)>` closure, found `{integer}`
- | |
- | required by a bound introduced by this call
- |
- = help: the trait `Fn<(isize,)>` is not implemented for `{integer}`
-note: required by a bound in `needs_fn`
- --> $DIR/fn-trait-formatting.rs:1:31
- |
-LL | fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {}
- | ^^^^^^^^^^^^^^^^^^ required by this bound in `needs_fn`
-
-error: aborting due to 4 previous errors
-
-Some errors have detailed explanations: E0277, E0308.
-For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/fn/fun-call-variants.rs b/src/test/ui/fn/fun-call-variants.rs
deleted file mode 100644
index 5b83e2620..000000000
--- a/src/test/ui/fn/fun-call-variants.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// run-pass
-
-fn ho<F>(f: F) -> isize where F: FnOnce(isize) -> isize { let n: isize = f(3); return n; }
-
-fn direct(x: isize) -> isize { return x + 1; }
-
-pub fn main() {
- let a: isize = direct(3); // direct
- let b: isize = ho(direct); // indirect unbound
-
- assert_eq!(a, b);
-}
diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-2.rs b/src/test/ui/fn/implied-bounds-unnorm-associated-type-2.rs
deleted file mode 100644
index 5d9245556..000000000
--- a/src/test/ui/fn/implied-bounds-unnorm-associated-type-2.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// check-fail
-
-trait Trait {
- type Type;
-}
-
-impl<T> Trait for T {
- type Type = ();
-}
-
-fn f<'a, 'b>(_: <&'a &'b () as Trait>::Type)
-where
- 'a: 'a,
- 'b: 'b,
-{
-}
-
-fn g<'a, 'b>() {
- f::<'a, 'b>(());
- //~^ ERROR lifetime may not live long enough
-}
-
-fn main() {}
diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-2.stderr b/src/test/ui/fn/implied-bounds-unnorm-associated-type-2.stderr
deleted file mode 100644
index 0c3df04ea..000000000
--- a/src/test/ui/fn/implied-bounds-unnorm-associated-type-2.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error: lifetime may not live long enough
- --> $DIR/implied-bounds-unnorm-associated-type-2.rs:19:5
- |
-LL | fn g<'a, 'b>() {
- | -- -- lifetime `'b` defined here
- | |
- | lifetime `'a` defined here
-LL | f::<'a, 'b>(());
- | ^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a`
- |
- = help: consider adding the following bound: `'b: 'a`
- = note: requirement occurs because of a function pointer to `f`
- = note: the function `f` is invariant over the parameter `'a`
- = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-3.rs b/src/test/ui/fn/implied-bounds-unnorm-associated-type-3.rs
deleted file mode 100644
index 888f74cf6..000000000
--- a/src/test/ui/fn/implied-bounds-unnorm-associated-type-3.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-// check-pass
-
-pub trait Yokeable<'a>: 'static {
- type Output: 'a;
-}
-
-impl<'a, T: 'static + ?Sized> Yokeable<'a> for &'static T {
- type Output = &'a T;
-}
-
-pub trait ZeroCopyFrom<C: ?Sized>: for<'a> Yokeable<'a> {
- /// Clone the cart `C` into a [`Yokeable`] struct, which may retain references into `C`.
- fn zero_copy_from<'b>(cart: &'b C) -> <Self as Yokeable<'b>>::Output;
-}
-
-impl<T> ZeroCopyFrom<[T]> for &'static [T] {
- fn zero_copy_from<'b>(cart: &'b [T]) -> &'b [T] {
- cart
- }
-}
-
-fn main() {}
diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-4.rs b/src/test/ui/fn/implied-bounds-unnorm-associated-type-4.rs
deleted file mode 100644
index 12859252c..000000000
--- a/src/test/ui/fn/implied-bounds-unnorm-associated-type-4.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-// A regression test for #98543
-
-trait Trait {
- type Type;
-}
-
-impl<T> Trait for T {
- type Type = ();
-}
-
-fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str
-where
- &'a &'b (): Trait, // <- adding this bound is the change from #91068
-{
- s
-}
-
-fn main() {
- let x = String::from("Hello World!");
- let y = f(&x, ());
- drop(x);
- //~^ ERROR cannot move out of `x` because it is borrowed
- println!("{}", y);
-}
diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-4.stderr b/src/test/ui/fn/implied-bounds-unnorm-associated-type-4.stderr
deleted file mode 100644
index fcbaa91d1..000000000
--- a/src/test/ui/fn/implied-bounds-unnorm-associated-type-4.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0505]: cannot move out of `x` because it is borrowed
- --> $DIR/implied-bounds-unnorm-associated-type-4.rs:21:10
- |
-LL | let y = f(&x, ());
- | -- borrow of `x` occurs here
-LL | drop(x);
- | ^ move out of `x` occurs here
-LL |
-LL | println!("{}", y);
- | - borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-5.rs b/src/test/ui/fn/implied-bounds-unnorm-associated-type-5.rs
deleted file mode 100644
index 2a9a6a8cc..000000000
--- a/src/test/ui/fn/implied-bounds-unnorm-associated-type-5.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-trait Trait<'a>: 'a {
- type Type;
-}
-
-// if the `T: 'a` bound gets implied we would probably get ub here again
-impl<'a, T> Trait<'a> for T {
- //~^ ERROR the parameter type `T` may not live long enough
- type Type = ();
-}
-
-fn f<'a, 'b>(s: &'b str, _: <&'b () as Trait<'a>>::Type) -> &'a str
-where
- &'b (): Trait<'a>,
-{
- s
-}
-
-fn main() {
- let x = String::from("Hello World!");
- let y = f(&x, ());
- drop(x);
- println!("{}", y);
-}
diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-5.stderr b/src/test/ui/fn/implied-bounds-unnorm-associated-type-5.stderr
deleted file mode 100644
index 458756a3d..000000000
--- a/src/test/ui/fn/implied-bounds-unnorm-associated-type-5.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0309]: the parameter type `T` may not live long enough
- --> $DIR/implied-bounds-unnorm-associated-type-5.rs:6:13
- |
-LL | impl<'a, T> Trait<'a> for T {
- | ^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
- |
-note: ...that is required by this bound
- --> $DIR/implied-bounds-unnorm-associated-type-5.rs:1:18
- |
-LL | trait Trait<'a>: 'a {
- | ^^
-help: consider adding an explicit lifetime bound...
- |
-LL | impl<'a, T: 'a> Trait<'a> for T {
- | ++++
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type.rs b/src/test/ui/fn/implied-bounds-unnorm-associated-type.rs
deleted file mode 100644
index d58d25036..000000000
--- a/src/test/ui/fn/implied-bounds-unnorm-associated-type.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// check-fail
-// See issue #91068. We check that the unnormalized associated types in
-// function signatures are implied
-
-trait Trait {
- type Type;
-}
-
-impl<T> Trait for T {
- type Type = ();
-}
-
-fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str {
- s
-}
-
-fn main() {
- let x = String::from("Hello World!");
- let y = f(&x, ());
- drop(x);
- //~^ ERROR cannot move out of `x` because it is borrowed
- println!("{}", y);
-}
diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type.stderr b/src/test/ui/fn/implied-bounds-unnorm-associated-type.stderr
deleted file mode 100644
index e35f46e44..000000000
--- a/src/test/ui/fn/implied-bounds-unnorm-associated-type.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0505]: cannot move out of `x` because it is borrowed
- --> $DIR/implied-bounds-unnorm-associated-type.rs:20:10
- |
-LL | let y = f(&x, ());
- | -- borrow of `x` occurs here
-LL | drop(x);
- | ^ move out of `x` occurs here
-LL |
-LL | println!("{}", y);
- | - borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/fn/issue-80179.rs b/src/test/ui/fn/issue-80179.rs
deleted file mode 100644
index fcef6f1b6..000000000
--- a/src/test/ui/fn/issue-80179.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Functions with a type placeholder `_` as the return type should
-// show a function pointer suggestion when given a function item
-// and suggest how to return closures correctly from a function.
-// This is a regression test of #80179
-
-fn returns_i32() -> i32 {
- 0
-}
-
-fn returns_fn_ptr() -> _ {
-//~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types [E0121]
-//~| NOTE not allowed in type signatures
-//~| HELP replace with the correct return type
-//~| SUGGESTION fn() -> i32
- returns_i32
-}
-
-fn returns_closure() -> _ {
-//~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types [E0121]
-//~| NOTE not allowed in type signatures
-//~| HELP consider using an `Fn`, `FnMut`, or `FnOnce` trait bound
-//~| NOTE for more information on `Fn` traits and closure types, see
-// https://doc.rust-lang.org/book/ch13-01-closures.html
- || 0
-}
-
-fn main() {}
diff --git a/src/test/ui/fn/issue-80179.stderr b/src/test/ui/fn/issue-80179.stderr
deleted file mode 100644
index 2ca4ae982..000000000
--- a/src/test/ui/fn/issue-80179.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
- --> $DIR/issue-80179.rs:10:24
- |
-LL | fn returns_fn_ptr() -> _ {
- | ^
- | |
- | not allowed in type signatures
- | help: replace with the correct return type: `fn() -> i32`
-
-error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
- --> $DIR/issue-80179.rs:18:25
- |
-LL | fn returns_closure() -> _ {
- | ^ not allowed in type signatures
- |
- = help: consider using an `Fn`, `FnMut`, or `FnOnce` trait bound
- = note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0121`.
diff --git a/src/test/ui/fn/keyword-order.rs b/src/test/ui/fn/keyword-order.rs
deleted file mode 100644
index 8a21db673..000000000
--- a/src/test/ui/fn/keyword-order.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-// edition:2018
-
-default pub const async unsafe extern fn err() {} //~ ERROR `default` is not followed by an item
-//~^ ERROR expected item, found keyword `pub`
-
-pub default const async unsafe extern fn ok() {}
diff --git a/src/test/ui/fn/keyword-order.stderr b/src/test/ui/fn/keyword-order.stderr
deleted file mode 100644
index d3b140c85..000000000
--- a/src/test/ui/fn/keyword-order.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error: `default` is not followed by an item
- --> $DIR/keyword-order.rs:3:1
- |
-LL | default pub const async unsafe extern fn err() {}
- | ^^^^^^^ the `default` qualifier
- |
- = note: only `fn`, `const`, `type`, or `impl` items may be prefixed by `default`
-
-error: expected item, found keyword `pub`
- --> $DIR/keyword-order.rs:3:9
- |
-LL | default pub const async unsafe extern fn err() {}
- | ^^^ expected item
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/fn/nested-function-names-issue-8587.rs b/src/test/ui/fn/nested-function-names-issue-8587.rs
deleted file mode 100644
index 8fafd41d9..000000000
--- a/src/test/ui/fn/nested-function-names-issue-8587.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-// run-pass
-// Make sure nested functions are separate, even if they have
-// equal name.
-//
-// Issue #8587
-
-
-pub struct X;
-
-impl X {
- fn f(&self) -> isize {
- #[inline(never)]
- fn inner() -> isize {
- 0
- }
- inner()
- }
-
- fn g(&self) -> isize {
- #[inline(never)]
- fn inner_2() -> isize {
- 1
- }
- inner_2()
- }
-
- fn h(&self) -> isize {
- #[inline(never)]
- fn inner() -> isize {
- 2
- }
- inner()
- }
-}
-
-pub fn main() {
- let n = X;
- assert_eq!(n.f(), 0);
- assert_eq!(n.g(), 1);
- // This test `h` used to fail.
- assert_eq!(n.h(), 2);
-}
diff --git a/src/test/ui/fn/signature-error-reporting-under-verbose.rs b/src/test/ui/fn/signature-error-reporting-under-verbose.rs
deleted file mode 100644
index d7a8c95e8..000000000
--- a/src/test/ui/fn/signature-error-reporting-under-verbose.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// compile-flags: -Zverbose
-
-fn foo(_: i32, _: i32) {}
-
-fn needs_ptr(_: fn(i32, u32)) {}
-//~^ NOTE function defined here
-//~| NOTE
-
-fn main() {
- needs_ptr(foo);
- //~^ ERROR mismatched types
- //~| NOTE expected `u32`, found `i32`
- //~| NOTE expected fn pointer `fn(i32, u32)`
- //~| NOTE arguments to this function are incorrect
-}
diff --git a/src/test/ui/fn/signature-error-reporting-under-verbose.stderr b/src/test/ui/fn/signature-error-reporting-under-verbose.stderr
deleted file mode 100644
index 6260fc8dc..000000000
--- a/src/test/ui/fn/signature-error-reporting-under-verbose.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0308]: mismatched types
- --> $DIR/signature-error-reporting-under-verbose.rs:10:15
- |
-LL | needs_ptr(foo);
- | --------- ^^^ expected `u32`, found `i32`
- | |
- | arguments to this function are incorrect
- |
- = note: expected fn pointer `fn(i32, u32)`
- found fn item `fn(i32, i32) {foo}`
-note: function defined here
- --> $DIR/signature-error-reporting-under-verbose.rs:5:4
- |
-LL | fn needs_ptr(_: fn(i32, u32)) {}
- | ^^^^^^^^^ ---------------
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0308`.