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

ices/86850.rs: fixed with errors #958

Closed
wants to merge 1 commit into from

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 1, 2021

Issue: rust-lang/rust#86850

#![feature(const_generics)]
#![feature(const_evaluatable_checked)]
#![allow(incomplete_features)]
use core::marker::PhantomData;

pub trait Foo {
    const SIZE: usize;
}

pub struct Bar<T>(PhantomData<T>);
impl<T: Foo> Bar<T> {
    pub fn new(array: [(); T::SIZE]) -> Self {
        Self(PhantomData)
    }
    pub fn bar(self) -> Bar<T>
    where
        [(); T::SIZE]: ,
    {
        Bar::new([(); T::SIZE])
    }
}
=== stdout ===
=== stderr ===
error[E0557]: feature has been removed
 --> /home/runner/work/glacier/glacier/ices/86850.rs:1:12
  |
1 | #![feature(const_generics)]
  |            ^^^^^^^^^^^^^^ feature has been removed
  |
  = note: removed in favor of `#![feature(adt_const_params]` and `#![feature(generic_const_exprs)]`

error[E0557]: feature has been removed
 --> /home/runner/work/glacier/glacier/ices/86850.rs:2:12
  |
2 | #![feature(const_evaluatable_checked)]
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^ feature has been removed
  |
  = note: renamed to `generic_const_exprs`

error: generic parameters may not be used in const operations
  --> /home/runner/work/glacier/glacier/ices/86850.rs:12:28
   |
12 |     pub fn new(array: [(); T::SIZE]) -> Self {
   |                            ^^^^^^^ cannot perform const operation using `T`
   |
   = note: type parameters may not be used in const expressions
   = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions

error: generic parameters may not be used in const operations
  --> /home/runner/work/glacier/glacier/ices/86850.rs:17:14
   |
17 |         [(); T::SIZE]: ,
   |              ^^^^^^^ cannot perform const operation using `T`
   |
   = note: type parameters may not be used in const expressions
   = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions

error[E0601]: `main` function not found in crate `86850`
  --> /home/runner/work/glacier/glacier/ices/86850.rs:1:1
   |
1  | / #![feature(const_generics)]
2  | | #![feature(const_evaluatable_checked)]
3  | | #![allow(incomplete_features)]
4  | | use core::marker::PhantomData;
...  |
20 | |     }
21 | | }
   | |_^ consider adding a `main` function to `/home/runner/work/glacier/glacier/ices/86850.rs`

error: constant expression depends on a generic parameter
  --> /home/runner/work/glacier/glacier/ices/86850.rs:19:23
   |
19 |         Bar::new([(); T::SIZE])
   |                       ^^^^^^^
   |
   = note: this may fail depending on what value the parameter takes

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0557, E0601.
For more information about an error, try `rustc --explain E0557`.
==============

=== stdout ===
=== stderr ===
error[E0557]: feature has been removed
 --> /home/runner/work/glacier/glacier/ices/86850.rs:1:12
  |
1 | #![feature(const_generics)]
  |            ^^^^^^^^^^^^^^ feature has been removed
  |
  = note: removed in favor of `#![feature(adt_const_params]` and `#![feature(generic_const_exprs)]`

error[E0557]: feature has been removed
 --> /home/runner/work/glacier/glacier/ices/86850.rs:2:12
  |
2 | #![feature(const_evaluatable_checked)]
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^ feature has been removed
  |
  = note: renamed to `generic_const_exprs`

error: generic parameters may not be used in const operations
  --> /home/runner/work/glacier/glacier/ices/86850.rs:12:28
   |
12 |     pub fn new(array: [(); T::SIZE]) -> Self {
   |                            ^^^^^^^ cannot perform const operation using `T`
   |
   = note: type parameters may not be used in const expressions
   = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions

error: generic parameters may not be used in const operations
  --> /home/runner/work/glacier/glacier/ices/86850.rs:17:14
   |
17 |         [(); T::SIZE]: ,
   |              ^^^^^^^ cannot perform const operation using `T`
   |
   = note: type parameters may not be used in const expressions
   = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions

error[E0601]: `main` function not found in crate `86850`
  --> /home/runner/work/glacier/glacier/ices/86850.rs:1:1
   |
1  | / #![feature(const_generics)]
2  | | #![feature(const_evaluatable_checked)]
3  | | #![allow(incomplete_features)]
4  | | use core::marker::PhantomData;
...  |
20 | |     }
21 | | }
   | |_^ consider adding a `main` function to `/home/runner/work/glacier/glacier/ices/86850.rs`

error: constant expression depends on a generic parameter
  --> /home/runner/work/glacier/glacier/ices/86850.rs:19:23
   |
19 |         Bar::new([(); T::SIZE])
   |                       ^^^^^^^
   |
   = note: this may fail depending on what value the parameter takes

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0557, E0601.
For more information about an error, try `rustc --explain E0557`.
==============
@Alexendoo Alexendoo closed this Sep 1, 2021
@Alexendoo Alexendoo deleted the autofix/ices/86850.rs branch September 1, 2021 16:26
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