Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

ices/53092.rs: fixed with errors #687

Closed
wants to merge 1 commit into from

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#53092

#![feature(const_fn)]
#![feature(const_fn_union)]
#![feature(type_alias_impl_trait)]
#![feature(untagged_unions)]

const fn transmute<T, U>(from: T) -> U {
    use std::mem::ManuallyDrop;

    union Transform<FROM, INTO> {
        from: ManuallyDrop<FROM>,
        into: ManuallyDrop<INTO>,
    }

    let transformer = Transform {
        from: ManuallyDrop::new(from),
    };

    unsafe { ManuallyDrop::into_inner(transformer.into) }
}

type Bug<T, U> = impl Fn(T) -> U + Copy;

const CONST_BUG: Bug<u8, ()> = transmute(|_: u8| ());

fn make_bug<T, U: From<T>>() -> Bug<T, U> {
    |x| x.into()
}

fn main() {
    let x = CONST_BUG(0);
}
=== stdout ===
=== stderr ===
error[E0658]: `impl Trait` in type aliases is unstable
  --> /home/runner/work/glacier/glacier/ices/53092.rs:21:18
   |
21 | type Bug<T, U> = impl Fn(T) -> U + Copy;
   |                  ^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
   = help: add `#![feature(min_type_alias_impl_trait)]` to the crate attributes to enable

warning: the feature `type_alias_impl_trait` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /home/runner/work/glacier/glacier/ices/53092.rs:3:12
  |
3 | #![feature(type_alias_impl_trait)]
  |            ^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information

error[E0658]: type alias impl trait is not permitted here
  --> /home/runner/work/glacier/glacier/ices/53092.rs:23:32
   |
23 | const CONST_BUG: Bug<u8, ()> = transmute(|_: u8| ());
   |                                ^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
   = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable

error: concrete type differs from previous defining opaque type use
  --> /home/runner/work/glacier/glacier/ices/53092.rs:25:1
   |
25 | fn make_bug<T, U: From<T>>() -> Bug<T, U> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `[type error]`, got `[closure@/home/runner/work/glacier/glacier/ices/53092.rs:26:5: 26:17]`
   |
note: previous use here
  --> /home/runner/work/glacier/glacier/ices/53092.rs:23:1
   |
23 | const CONST_BUG: Bug<u8, ()> = transmute(|_: u8| ());
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 3 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0658`.
==============

=== stdout ===
=== stderr ===
error[E0658]: `impl Trait` in type aliases is unstable
  --> /home/runner/work/glacier/glacier/ices/53092.rs:21:18
   |
21 | type Bug<T, U> = impl Fn(T) -> U + Copy;
   |                  ^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #63063 <rust-lang/rust#63063> for more information
   = help: add `#![feature(min_type_alias_impl_trait)]` to the crate attributes to enable

warning: the feature `type_alias_impl_trait` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /home/runner/work/glacier/glacier/ices/53092.rs:3:12
  |
3 | #![feature(type_alias_impl_trait)]
  |            ^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #63063 <rust-lang/rust#63063> for more information

error[E0658]: type alias impl trait is not permitted here
  --> /home/runner/work/glacier/glacier/ices/53092.rs:23:32
   |
23 | const CONST_BUG: Bug<u8, ()> = transmute(|_: u8| ());
   |                                ^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #63065 <rust-lang/rust#63065> for more information
   = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable

error: concrete type differs from previous defining opaque type use
  --> /home/runner/work/glacier/glacier/ices/53092.rs:25:1
   |
25 | fn make_bug<T, U: From<T>>() -> Bug<T, U> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `[type error]`, got `[closure@/home/runner/work/glacier/glacier/ices/53092.rs:26:5: 26:17]`
   |
note: previous use here
  --> /home/runner/work/glacier/glacier/ices/53092.rs:23:1
   |
23 | const CONST_BUG: Bug<u8, ()> = transmute(|_: u8| ());
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 3 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0658`.
==============
@Alexendoo Alexendoo deleted the autofix/ices/53092.rs branch March 18, 2021 14:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant