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

ices/68205.rs: fixed with errors #271

Merged
merged 1 commit into from
Jan 24, 2020
Merged

ices/68205.rs: fixed with errors #271

merged 1 commit into from
Jan 24, 2020

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#68205

#![allow(unused)]
#![feature(const_generics)]

trait Child {
    const N: usize;
}

struct C1;
impl Child for C1 {
    const N: usize = 2;
}

struct Main<C: Child> {
    c: C
}

impl<C: Child> Main<C> {
    fn test() -> [u8; C::N] {
        [0; C::N]
    }
}

// Doesn't crash without `fn main()` or `#![crate_type = "lib"]`
fn main() {}
=== stdout ===
=== stderr ===
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
 --> /home/runner/work/glacier/glacier/ices/68205.rs:2:12
  |
2 | #![feature(const_generics)]
  |            ^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default

error: constant expression depends on a generic parameter
  --> /home/runner/work/glacier/glacier/ices/68205.rs:18:5
   |
18 | /     fn test() -> [u8; C::N] {
19 | |         [0; C::N]
20 | |     }
   | |_____^
   |
   = 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/68205.rs:2:12
  |
2 | #![feature(const_generics)]
  |            ^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default

error: constant expression depends on a generic parameter
  --> /home/runner/work/glacier/glacier/ices/68205.rs:18:5
   |
18 | /     fn test() -> [u8; C::N] {
19 | |         [0; C::N]
20 | |     }
   | |_____^
   |
   = note: this may fail depending on what value the parameter takes

error: aborting due to previous error

==============
@Alexendoo Alexendoo merged commit 123bc46 into master Jan 24, 2020
@Alexendoo Alexendoo deleted the autofix/ices/68205.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