mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
37 lines
1.5 KiB
Plaintext
37 lines
1.5 KiB
Plaintext
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[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[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: aborting due to 3 previous errors
|
|
|
|
Some errors have detailed explanations: E0277, E0308.
|
|
For more information about an error, try `rustc --explain E0277`.
|