]> git.lizzy.rs Git - rust.git/blob - tests/ui/type-alias-impl-trait/issue-53092-2.stderr
Rollup merge of #106766 - GuillaumeGomez:rm-stripper-dead-code, r=notriddle
[rust.git] / tests / ui / type-alias-impl-trait / issue-53092-2.stderr
1 error[E0391]: cycle detected when computing type of `Bug::{opaque#0}`
2   --> $DIR/issue-53092-2.rs:4:18
3    |
4 LL | type Bug<T, U> = impl Fn(T) -> U + Copy;
5    |                  ^^^^^^^^^^^^^^^^^^^^^^
6    |
7 note: ...which requires type-checking `CONST_BUG`...
8   --> $DIR/issue-53092-2.rs:6:1
9    |
10 LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) };
11    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12    = note: ...which requires computing layout of `Bug<u8, ()>`...
13    = note: ...which requires normalizing `Bug<u8, ()>`...
14    = note: ...which again requires computing type of `Bug::{opaque#0}`, completing the cycle
15 note: cycle used when checking item types in top-level module
16   --> $DIR/issue-53092-2.rs:1:1
17    |
18 LL | / #![feature(type_alias_impl_trait)]
19 LL | | #![allow(dead_code)]
20 LL | |
21 LL | | type Bug<T, U> = impl Fn(T) -> U + Copy;
22 ...  |
23 LL | |     CONST_BUG(0);
24 LL | | }
25    | |_^
26
27 error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
28   --> $DIR/issue-53092-2.rs:6:41
29    |
30 LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) };
31    |                                         ^^^^^^^^^^^^^^^^^^^
32    |
33    = note: source type: `[closure@$DIR/issue-53092-2.rs:6:61: 6:68]` (0 bits)
34    = note: target type: `Bug<u8, ()>` (size can vary because of [type error])
35
36 error[E0277]: the trait bound `U: From<T>` is not satisfied
37   --> $DIR/issue-53092-2.rs:10:5
38    |
39 LL |     |x| x.into()
40    |     ^^^^^^^^^^^^ the trait `From<T>` is not implemented for `U`
41    |
42 note: required by a bound in `make_bug`
43   --> $DIR/issue-53092-2.rs:9:19
44    |
45 LL | fn make_bug<T, U: From<T>>() -> Bug<T, U> {
46    |                   ^^^^^^^ required by this bound in `make_bug`
47 help: consider restricting type parameter `U`
48    |
49 LL | type Bug<T, U: std::convert::From<T>> = impl Fn(T) -> U + Copy;
50    |              +++++++++++++++++++++++
51
52 error: aborting due to 3 previous errors
53
54 Some errors have detailed explanations: E0277, E0391, E0512.
55 For more information about an error, try `rustc --explain E0277`.