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

ices/51892.rs: fixed with errors #574

Closed
wants to merge 1 commit into from

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#51892

#![feature(specialization)]

pub trait Trait {
  type Type;
}

impl<T: ?Sized> Trait for T {
  default type Type = [u8; 1];
}

impl<T: Trait> Trait for *const T {
  type Type = [u8; std::mem::size_of::<<T as Trait>::Type>()];
}
=== stdout ===
=== stderr ===
error: generic parameters may not be used in const operations
  --> /home/runner/work/glacier/glacier/ices/51892.rs:12:41
   |
12 |   type Type = [u8; std::mem::size_of::<<T as Trait>::Type>()];
   |                                         ^ cannot perform const operation using `T`
   |
   = note: type parameters may not be used in const expressions
   = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /home/runner/work/glacier/glacier/ices/51892.rs:1:12
  |
1 | #![feature(specialization)]
  |            ^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
  = help: consider using `min_specialization` instead, which is more stable and complete

error[E0601]: `main` function not found in crate `51892`
  --> /home/runner/work/glacier/glacier/ices/51892.rs:1:1
   |
1  | / #![feature(specialization)]
2  | |
3  | | pub trait Trait {
4  | |   type Type;
...  |
12 | |   type Type = [u8; std::mem::size_of::<<T as Trait>::Type>()];
13 | | }
   | |_^ consider adding a `main` function to `/home/runner/work/glacier/glacier/ices/51892.rs`

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

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

=== stdout ===
=== stderr ===
error: generic parameters may not be used in const operations
  --> /home/runner/work/glacier/glacier/ices/51892.rs:12:41
   |
12 |   type Type = [u8; std::mem::size_of::<<T as Trait>::Type>()];
   |                                         ^ cannot perform const operation using `T`
   |
   = note: type parameters may not be used in const expressions
   = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /home/runner/work/glacier/glacier/ices/51892.rs:1:12
  |
1 | #![feature(specialization)]
  |            ^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #31844 <rust-lang/rust#31844> for more information
  = help: consider using `min_specialization` instead, which is more stable and complete

error[E0601]: `main` function not found in crate `51892`
  --> /home/runner/work/glacier/glacier/ices/51892.rs:1:1
   |
1  | / #![feature(specialization)]
2  | |
3  | | pub trait Trait {
4  | |   type Type;
...  |
12 | |   type Type = [u8; std::mem::size_of::<<T as Trait>::Type>()];
13 | | }
   | |_^ consider adding a `main` function to `/home/runner/work/glacier/glacier/ices/51892.rs`

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

For more information about this error, try `rustc --explain E0601`.
==============
@Alexendoo Alexendoo deleted the autofix/ices/51892.rs branch January 2, 2021 14:08
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.

2 participants