rust/tests/ui/type-alias-impl-trait/issue-53092-2.stderr

59 lines
2.3 KiB
Plaintext

error[E0792]: non-defining opaque type use in defining scope
--> $DIR/issue-53092-2.rs:6:18
|
LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) };
| ^^^^^^^^^^^ argument `u8` is not a generic parameter
|
note: for this opaque type
--> $DIR/issue-53092-2.rs:4:18
|
LL | type Bug<T, U> = impl Fn(T) -> U + Copy;
| ^^^^^^^^^^^^^^^^^^^^^^
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 computing type of opaque `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 that `Bug::{opaque#0}` is well-formed
--> $DIR/issue-53092-2.rs:4:18
|
LL | type Bug<T, U> = impl Fn(T) -> U + Copy;
| ^^^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
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, E0792.
For more information about an error, try `rustc --explain E0277`.