about summary refs log tree commit diff
path: root/tests/ui/traits/const-traits/span-bug-issue-121418.stderr
blob: 92cfecd054049b658fa760e3ca4596cb09dd7b18 (plain)
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
error: inherent impls cannot be `const`
  --> $DIR/span-bug-issue-121418.rs:6:12
   |
LL | impl const dyn T {
   |      ----- ^^^^^ inherent impl for this type
   |      |
   |      `const` because of this
   |
   = note: only trait implementations may be annotated with `const`

error[E0277]: the size for values of type `(dyn T + 'static)` cannot be known at compilation time
  --> $DIR/span-bug-issue-121418.rs:8:27
   |
LL |     pub const fn new() -> std::sync::Mutex<dyn T> {}
   |                           ^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
   |
   = help: within `Mutex<(dyn T + 'static)>`, the trait `Sized` is not implemented for `(dyn T + 'static)`
note: required because it appears within the type `Mutex<(dyn T + 'static)>`
  --> $SRC_DIR/std/src/sync/poison/mutex.rs:LL:COL
   = note: the return type of a function must have a statically known size

error[E0308]: mismatched types
  --> $DIR/span-bug-issue-121418.rs:8:27
   |
LL |     pub const fn new() -> std::sync::Mutex<dyn T> {}
   |                  ---      ^^^^^^^^^^^^^^^^^^^^^^^ expected `Mutex<dyn T>`, found `()`
   |                  |
   |                  implicitly returns `()` as its body has no tail or `return` expression
   |
   = note: expected struct `Mutex<(dyn T + 'static)>`
           found unit type `()`

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.