summaryrefslogtreecommitdiffstats
path: root/src/test/ui/static
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/static')
-rw-r--r--src/test/ui/static/issue-5216.rs10
-rw-r--r--src/test/ui/static/issue-5216.stderr28
-rw-r--r--src/test/ui/static/static-drop-scope.stderr4
-rw-r--r--src/test/ui/static/static-reference-to-fn-2.stderr6
-rw-r--r--src/test/ui/static/static-region-bound.stderr2
5 files changed, 44 insertions, 6 deletions
diff --git a/src/test/ui/static/issue-5216.rs b/src/test/ui/static/issue-5216.rs
new file mode 100644
index 000000000..4072a57cb
--- /dev/null
+++ b/src/test/ui/static/issue-5216.rs
@@ -0,0 +1,10 @@
+fn f() { }
+struct S(Box<dyn FnMut() + Sync>);
+pub static C: S = S(f); //~ ERROR mismatched types
+
+
+fn g() { }
+type T = Box<dyn FnMut() + Sync>;
+pub static D: T = g; //~ ERROR mismatched types
+
+fn main() {}
diff --git a/src/test/ui/static/issue-5216.stderr b/src/test/ui/static/issue-5216.stderr
new file mode 100644
index 000000000..1afff28f0
--- /dev/null
+++ b/src/test/ui/static/issue-5216.stderr
@@ -0,0 +1,28 @@
+error[E0308]: mismatched types
+ --> $DIR/issue-5216.rs:3:21
+ |
+LL | pub static C: S = S(f);
+ | - ^ expected struct `Box`, found fn item
+ | |
+ | arguments to this struct are incorrect
+ |
+ = note: expected struct `Box<(dyn FnMut() + Sync + 'static)>`
+ found fn item `fn() {f}`
+note: tuple struct defined here
+ --> $DIR/issue-5216.rs:2:8
+ |
+LL | struct S(Box<dyn FnMut() + Sync>);
+ | ^
+
+error[E0308]: mismatched types
+ --> $DIR/issue-5216.rs:8:19
+ |
+LL | pub static D: T = g;
+ | ^ expected struct `Box`, found fn item
+ |
+ = note: expected struct `Box<(dyn FnMut() + Sync + 'static)>`
+ found fn item `fn() {g}`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/static/static-drop-scope.stderr b/src/test/ui/static/static-drop-scope.stderr
index 112bfc003..cedcb7367 100644
--- a/src/test/ui/static/static-drop-scope.stderr
+++ b/src/test/ui/static/static-drop-scope.stderr
@@ -13,7 +13,7 @@ LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor);
| ------^^^^^^^^-
| | | |
| | | temporary value is freed at the end of this statement
- | | creates a temporary which is freed while still in use
+ | | creates a temporary value which is freed while still in use
| using this value as a static requires that borrow lasts for `'static`
error[E0493]: destructor of `WithDtor` cannot be evaluated at compile-time
@@ -31,7 +31,7 @@ LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor);
| ------^^^^^^^^-
| | | |
| | | temporary value is freed at the end of this statement
- | | creates a temporary which is freed while still in use
+ | | creates a temporary value which is freed while still in use
| using this value as a constant requires that borrow lasts for `'static`
error[E0493]: destructor of `(WithDtor, i32)` cannot be evaluated at compile-time
diff --git a/src/test/ui/static/static-reference-to-fn-2.stderr b/src/test/ui/static/static-reference-to-fn-2.stderr
index ff15884bd..133d8ec2e 100644
--- a/src/test/ui/static/static-reference-to-fn-2.stderr
+++ b/src/test/ui/static/static-reference-to-fn-2.stderr
@@ -6,7 +6,7 @@ LL | fn state1(self_: &mut StateMachineIter) -> Option<&'static str> {
LL | self_.statefn = &id(state2 as StateMachineFunc);
| -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
| | |
- | | creates a temporary which is freed while still in use
+ | | creates a temporary value which is freed while still in use
| assignment requires that borrow lasts for `'1`
error[E0716]: temporary value dropped while borrowed
@@ -17,7 +17,7 @@ LL | fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> {
LL | self_.statefn = &id(state3 as StateMachineFunc);
| -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
| | |
- | | creates a temporary which is freed while still in use
+ | | creates a temporary value which is freed while still in use
| assignment requires that borrow lasts for `'1`
error[E0716]: temporary value dropped while borrowed
@@ -28,7 +28,7 @@ LL | fn state3(self_: &mut StateMachineIter) -> Option<(&'static str)> {
LL | self_.statefn = &id(finished as StateMachineFunc);
| -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
| | |
- | | creates a temporary which is freed while still in use
+ | | creates a temporary value which is freed while still in use
| assignment requires that borrow lasts for `'1`
error[E0515]: cannot return value referencing temporary value
diff --git a/src/test/ui/static/static-region-bound.stderr b/src/test/ui/static/static-region-bound.stderr
index 15261259e..1a607e3c0 100644
--- a/src/test/ui/static/static-region-bound.stderr
+++ b/src/test/ui/static/static-region-bound.stderr
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/static-region-bound.rs:10:14
|
LL | let x = &id(3);
- | ^^^^^ creates a temporary which is freed while still in use
+ | ^^^^^ creates a temporary value which is freed while still in use
LL | f(x);
| ---- argument requires that borrow lasts for `'static`
LL | }