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 #309

Merged
merged 1 commit into from
Mar 12, 2020
Merged

ices/62504.rs: fixed with errors #309

merged 1 commit into from
Mar 12, 2020

Conversation

github-actions[bot]
Copy link
Contributor

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() {}
=== 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: array lengths can't depend on generic parameters
  --> /home/runner/work/glacier/glacier/ices/62504.rs:15:25
   |
15 |         ArrayHolder([0; Self::SIZE])
   |                         ^^^^^^^^^^

error: aborting due to previous error

==============

=== 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: array lengths can't depend on generic parameters
  --> /home/runner/work/glacier/glacier/ices/62504.rs:15:25
   |
15 |         ArrayHolder([0; Self::SIZE])
   |                         ^^^^^^^^^^

error: aborting due to previous error

==============
Copy link
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a comment to the issue, marked as fixed.

@JohnTitor JohnTitor merged commit 6b1fcca into master Mar 12, 2020
@JohnTitor JohnTitor deleted the autofix/ices/62504.rs branch March 12, 2020 12:18
# 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.

2 participants