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

ices/90654.rs: fixed with errors #1046

Merged
merged 1 commit into from
Dec 6, 2021
Merged

ices/90654.rs: fixed with errors #1046

merged 1 commit into from
Dec 6, 2021

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Dec 6, 2021

Issue: rust-lang/rust#90654

#![feature(generic_const_exprs)]

trait TyNum {
    const VAL: usize;
}

fn make_array<T: TyNum>() -> [i32; T::VAL + 1] {
    panic!()
}

trait SmallArray {}
impl SmallArray for [i32; 1] {}
impl SmallArray for [i32; 2] {}

fn consume<T: SmallArray>(t: T) {}

fn foo<T>()
where
    T: TyNum,
    [(); T::VAL + 1]: ,
{
    consume(make_array::<T>());
}
=== stdout ===
=== stderr ===
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /home/runner/work/glacier/glacier/ices/90654.rs:1:12
  |
1 | #![feature(generic_const_exprs)]
  |            ^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information

error[E0601]: `main` function not found in crate `90654`
  --> /home/runner/work/glacier/glacier/ices/90654.rs:1:1
   |
1  | / #![feature(generic_const_exprs)]
2  | |
3  | | trait TyNum {
4  | |     const VAL: usize;
...  |
22 | |     consume(make_array::<T>());
23 | | }
   | |_^ consider adding a `main` function to `/home/runner/work/glacier/glacier/ices/90654.rs`

error[E0277]: the trait bound `[i32; _]: SmallArray` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/90654.rs:22:13
   |
22 |     consume(make_array::<T>());
   |     ------- ^^^^^^^^^^^^^^^^^ the trait `SmallArray` is not implemented for `[i32; _]`
   |     |
   |     required by a bound introduced by this call
   |
note: required by a bound in `consume`
  --> /home/runner/work/glacier/glacier/ices/90654.rs:15:15
   |
15 | fn consume<T: SmallArray>(t: T) {}
   |               ^^^^^^^^^^ required by this bound in `consume`
help: consider extending the `where` bound, but there might be an alternative better way to express this requirement
   |
20 |     [(); T::VAL + 1]:, [i32; _]: SmallArray
   |                      ~~~~~~~~~~~~~~~~~~~~~~

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

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

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

error[E0601]: `main` function not found in crate `90654`
  --> /home/runner/work/glacier/glacier/ices/90654.rs:1:1
   |
1  | / #![feature(generic_const_exprs)]
2  | |
3  | | trait TyNum {
4  | |     const VAL: usize;
...  |
22 | |     consume(make_array::<T>());
23 | | }
   | |_^ consider adding a `main` function to `/home/runner/work/glacier/glacier/ices/90654.rs`

error[E0277]: the trait bound `[i32; _]: SmallArray` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/90654.rs:22:13
   |
22 |     consume(make_array::<T>());
   |     ------- ^^^^^^^^^^^^^^^^^ the trait `SmallArray` is not implemented for `[i32; _]`
   |     |
   |     required by a bound introduced by this call
   |
note: required by a bound in `consume`
  --> /home/runner/work/glacier/glacier/ices/90654.rs:15:15
   |
15 | fn consume<T: SmallArray>(t: T) {}
   |               ^^^^^^^^^^ required by this bound in `consume`
help: consider extending the `where` bound, but there might be an alternative better way to express this requirement
   |
20 |     [(); T::VAL + 1]:, [i32; _]: SmallArray
   |                      ~~~~~~~~~~~~~~~~~~~~~~

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

Some errors have detailed explanations: E0277, E0601.
For more information about an error, try `rustc --explain E0277`.
==============
@Alexendoo Alexendoo merged commit ac8fefe into master Dec 6, 2021
@Alexendoo Alexendoo deleted the autofix/ices/90654.rs branch December 6, 2021 13:42
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