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

ices/68130.rs: fixed with errors #270

Merged
merged 1 commit into from
Jan 24, 2020
Merged

ices/68130.rs: fixed with errors #270

merged 1 commit into from
Jan 24, 2020

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#68130

#![feature(const_generics)]

pub type MatrixArray<T, const N : usize, const M : usize> = [T; N * M];

pub struct Matrix<T, const N : usize, const M : usize>
    where T : Copy + Sized
{
    store : MatrixArray<T, N, M>,
}

impl<T, const N : usize, const M : usize> Default for Matrix<T, N, M>
    where T : Copy + Sized + Default
{
    fn default() -> Self {
        let zero_comps = unsafe {
            let mut comps = std::mem::MaybeUninit::< MatrixArray<T, N, M> >::uninit().assume_init();
            for comp in comps.iter_mut() {
                *comp = T::default();
            }
            comps
        };
        Self {
            store : zero_comps
        }
    }
}

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

error: constant expression depends on a generic parameter
 --> /home/runner/work/glacier/glacier/ices/68130.rs:8:5
  |
8 |     store : MatrixArray<T, N, M>,
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: this may fail depending on what value the parameter takes

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/68130.rs:1:12
  |
1 | #![feature(const_generics)]
  |            ^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default

error: constant expression depends on a generic parameter
 --> /home/runner/work/glacier/glacier/ices/68130.rs:8:5
  |
8 |     store : MatrixArray<T, N, M>,
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: this may fail depending on what value the parameter takes

error: aborting due to previous error

==============
@Alexendoo Alexendoo merged commit 367528f into master Jan 24, 2020
@Alexendoo Alexendoo deleted the autofix/ices/68130.rs branch January 24, 2020 12:10
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