File: const_param_ty_bad.stderr

package info (click to toggle)
rustc 1.86.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid
  • size: 913,560 kB
  • sloc: xml: 158,127; python: 35,921; javascript: 19,689; sh: 19,600; cpp: 18,906; ansic: 13,124; asm: 4,376; makefile: 708; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (108 lines) | stat: -rw-r--r-- 4,028 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
error[E0277]: `fn() {main}` can't be used as a const parameter type
  --> $DIR/const_param_ty_bad.rs:7:11
   |
LL |     check(main);
   |     ----- ^^^^ the trait `UnsizedConstParamTy` is not implemented for fn item `fn() {main}`
   |     |
   |     required by a bound introduced by this call
   |
note: required by a bound in `check`
  --> $DIR/const_param_ty_bad.rs:4:18
   |
LL | fn check(_: impl std::marker::UnsizedConstParamTy) {}
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
help: use parentheses to call this function
   |
LL |     check(main());
   |               ++

error[E0277]: `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}` can't be used as a const parameter type
  --> $DIR/const_param_ty_bad.rs:8:11
   |
LL |     check(|| {});
   |     ----- ^^^^^ unsatisfied trait bound
   |     |
   |     required by a bound introduced by this call
   |
   = help: the trait `UnsizedConstParamTy` is not implemented for closure `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}`
note: required by a bound in `check`
  --> $DIR/const_param_ty_bad.rs:4:18
   |
LL | fn check(_: impl std::marker::UnsizedConstParamTy) {}
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
help: use parentheses to call this closure
   |
LL |     check(|| {}());
   |                ++

error[E0277]: `fn()` can't be used as a const parameter type
  --> $DIR/const_param_ty_bad.rs:9:11
   |
LL |     check(main as fn());
   |     ----- ^^^^^^^^^^^^ the trait `UnsizedConstParamTy` is not implemented for `fn()`
   |     |
   |     required by a bound introduced by this call
   |
note: required by a bound in `check`
  --> $DIR/const_param_ty_bad.rs:4:18
   |
LL | fn check(_: impl std::marker::UnsizedConstParamTy) {}
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
help: use parentheses to call this function pointer
   |
LL |     check(main as fn()());
   |                       ++

error[E0277]: `&mut ()` can't be used as a const parameter type
  --> $DIR/const_param_ty_bad.rs:10:11
   |
LL |     check(&mut ());
   |     ----- ^^^^^^^ the trait `UnsizedConstParamTy` is not implemented for `&mut ()`
   |     |
   |     required by a bound introduced by this call
   |
   = note: `UnsizedConstParamTy` is implemented for `&()`, but not for `&mut ()`
note: required by a bound in `check`
  --> $DIR/const_param_ty_bad.rs:4:18
   |
LL | fn check(_: impl std::marker::UnsizedConstParamTy) {}
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
help: consider removing the leading `&`-reference
   |
LL -     check(&mut ());
LL +     check(());
   |

error[E0277]: `*mut ()` can't be used as a const parameter type
  --> $DIR/const_param_ty_bad.rs:11:11
   |
LL |     check(&mut () as *mut ());
   |     ----- ^^^^^^^^^^^^^^^^^^ the trait `UnsizedConstParamTy` is not implemented for `*mut ()`
   |     |
   |     required by a bound introduced by this call
   |
   = help: the trait `UnsizedConstParamTy` is implemented for `()`
note: required by a bound in `check`
  --> $DIR/const_param_ty_bad.rs:4:18
   |
LL | fn check(_: impl std::marker::UnsizedConstParamTy) {}
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`

error[E0277]: `*const ()` can't be used as a const parameter type
  --> $DIR/const_param_ty_bad.rs:12:11
   |
LL |     check(&() as *const ());
   |     ----- ^^^^^^^^^^^^^^^^ the trait `UnsizedConstParamTy` is not implemented for `*const ()`
   |     |
   |     required by a bound introduced by this call
   |
   = help: the trait `UnsizedConstParamTy` is implemented for `()`
note: required by a bound in `check`
  --> $DIR/const_param_ty_bad.rs:4:18
   |
LL | fn check(_: impl std::marker::UnsizedConstParamTy) {}
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`

error: aborting due to 6 previous errors

For more information about this error, try `rustc --explain E0277`.