Skip to content

Commit

Permalink
Add ignored test for associated types in const impl
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstatic-morse committed Feb 19, 2020
1 parent 4992eb2 commit c8f0abb
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/test/ui/rfc-2632-const-trait-impl/assoc-type.rs
@@ -0,0 +1,28 @@
// ignore-test

// FIXME: This test should fail since, within a const impl of `Foo`, the bound on `Foo::Bar` should
// require a const impl of `Add` for the associated type.

#![allow(incomplete_features)]
#![feature(const_trait_impl)]
#![feature(const_fn)]

struct NonConstAdd(i32);

impl std::ops::Add for NonConstAdd {
type Output = Self;

fn add(self, rhs: Self) -> Self {
NonConstAdd(self.0 + rhs.0)
}
}

trait Foo {
type Bar: std::ops::Add;
}

impl const Foo for NonConstAdd {
type Bar = NonConstAdd;
}

fn main() {}

0 comments on commit c8f0abb

Please sign in to comment.