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

ices/74634.rs: fixed with errors #470

Merged
merged 1 commit into from
Sep 23, 2020
Merged

ices/74634.rs: fixed with errors #470

merged 1 commit into from
Sep 23, 2020

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#74634

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

trait If<const COND: bool> {}
impl If<true> for () {}

trait IsZero<const N: u8> {
    type Answer;
}

struct True;
struct False;

impl<const N: u8> IsZero<N> for ()
where
    (): If<{ N == 0 }>,
{
    type Answer = True;
}

trait Foobar<const N: u8> {}

impl<const N: u8> Foobar<N> for () where (): IsZero<N, Answer = True> {}

impl<const N: u8> Foobar<N> for () where (): IsZero<N, Answer = False> {}

fn main() {}
=== stdout ===
=== stderr ===
error: constant expression depends on a generic parameter
  --> /home/runner/work/glacier/glacier/ices/74634.rs:16:9
   |
16 |     (): If<{ N == 0 }>,
   |         ^^^^^^^^^^^^^^
   |
   = note: this may fail depending on what value the parameter takes

error: aborting due to previous error

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

=== stdout ===
=== stderr ===
error: constant expression depends on a generic parameter
  --> /home/runner/work/glacier/glacier/ices/74634.rs:16:9
   |
16 |     (): If<{ N == 0 }>,
   |         ^^^^^^^^^^^^^^
   |
   = note: this may fail depending on what value the parameter takes

error: aborting due to previous error

==============
@JohnTitor JohnTitor merged commit fe40262 into master Sep 23, 2020
@JohnTitor JohnTitor deleted the autofix/ices/74634.rs branch September 23, 2020 16:17
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