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

ices/62504.rs: fixed with errors #224

Closed
wants to merge 1 commit into from

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Dec 5, 2019

Issue: rust-lang/rust#62504

#![feature(const_generics)]

trait HasSize {
    const SIZE: usize;
}

impl<const X: usize> HasSize for ArrayHolder<{X}> {
    const SIZE: usize = X;
}

struct ArrayHolder<const X: usize>([u32; X]);

impl<const X: usize> ArrayHolder<{X}> {
    pub const fn new() -> Self {
        ArrayHolder([0; Self::SIZE])
    }
}

fn main() {
    let mut array = ArrayHolder::new();
}
=== stdout ===
=== stderr ===
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
 --> /home/runner/work/glacier/glacier/ices/62504.rs:1:12
  |
1 | #![feature(const_generics)]
  |            ^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default

error[E0282]: type annotations needed for `ArrayHolder<_: usize>`
  --> /home/runner/work/glacier/glacier/ices/62504.rs:20:21
   |
20 |     let mut array = ArrayHolder::new();
   |         ---------   ^^^^^^^^^^^^^^^^^^ cannot infer type for `ArrayHolder<_: usize>`
   |         |
   |         consider giving `array` a type

error: aborting due to previous error

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

=== stdout ===
=== stderr ===
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
 --> /home/runner/work/glacier/glacier/ices/62504.rs:1:12
  |
1 | #![feature(const_generics)]
  |            ^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default

error[E0282]: type annotations needed for `ArrayHolder<_: usize>`
  --> /home/runner/work/glacier/glacier/ices/62504.rs:20:21
   |
20 |     let mut array = ArrayHolder::new();
   |         ---------   ^^^^^^^^^^^^^^^^^^ cannot infer type for `ArrayHolder<_: usize>`
   |         |
   |         consider giving `array` a type

error: aborting due to previous error

For more information about this error, try `rustc --explain E0282`.
==============
@Alexendoo Alexendoo deleted the autofix/ices/62504.rs branch December 6, 2019 12:16
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant