summaryrefslogtreecommitdiffstats
path: root/src/test/ui/type-alias-impl-trait/issue-53092-2.stderr
blob: 1b89d55711dbd690c37f78b37af5a46e868d4cdc (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
error[E0391]: cycle detected when computing type of `Bug::{opaque#0}`
  --> $DIR/issue-53092-2.rs:4:18
   |
LL | type Bug<T, U> = impl Fn(T) -> U + Copy;
   |                  ^^^^^^^^^^^^^^^^^^^^^^
   |
note: ...which requires type-checking `CONST_BUG`...
  --> $DIR/issue-53092-2.rs:6:1
   |
LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) };
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: ...which requires computing layout of `Bug<u8, ()>`...
   = note: ...which requires normalizing `Bug<u8, ()>`...
   = note: ...which again requires computing type of `Bug::{opaque#0}`, completing the cycle
note: cycle used when checking item types in top-level module
  --> $DIR/issue-53092-2.rs:1:1
   |
LL | / #![feature(type_alias_impl_trait)]
LL | | #![allow(dead_code)]
LL | |
LL | | type Bug<T, U> = impl Fn(T) -> U + Copy;
...  |
LL | |     CONST_BUG(0);
LL | | }
   | |_^

error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
  --> $DIR/issue-53092-2.rs:6:41
   |
LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) };
   |                                         ^^^^^^^^^^^^^^^^^^^
   |
   = note: source type: `[closure@$DIR/issue-53092-2.rs:6:61: 6:68]` (0 bits)
   = note: target type: `Bug<u8, ()>` (size can vary because of [type error])

error[E0277]: the trait bound `U: From<T>` is not satisfied
  --> $DIR/issue-53092-2.rs:10:5
   |
LL |     |x| x.into()
   |     ^^^^^^^^^^^^ the trait `From<T>` is not implemented for `U`
   |
note: required by a bound in `make_bug`
  --> $DIR/issue-53092-2.rs:9:19
   |
LL | fn make_bug<T, U: From<T>>() -> Bug<T, U> {
   |                   ^^^^^^^ required by this bound in `make_bug`
help: consider restricting type parameter `U`
   |
LL | type Bug<T, U: std::convert::From<T>> = impl Fn(T) -> U + Copy;
   |              +++++++++++++++++++++++

error: aborting due to 3 previous errors

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