Skip to content

Commit c8f0abb

Browse files
Add ignored test for associated types in const impl
1 parent 4992eb2 commit c8f0abb

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// ignore-test
2+
3+
// FIXME: This test should fail since, within a const impl of `Foo`, the bound on `Foo::Bar` should
4+
// require a const impl of `Add` for the associated type.
5+
6+
#![allow(incomplete_features)]
7+
#![feature(const_trait_impl)]
8+
#![feature(const_fn)]
9+
10+
struct NonConstAdd(i32);
11+
12+
impl std::ops::Add for NonConstAdd {
13+
type Output = Self;
14+
15+
fn add(self, rhs: Self) -> Self {
16+
NonConstAdd(self.0 + rhs.0)
17+
}
18+
}
19+
20+
trait Foo {
21+
type Bar: std::ops::Add;
22+
}
23+
24+
impl const Foo for NonConstAdd {
25+
type Bar = NonConstAdd;
26+
}
27+
28+
fn main() {}

0 commit comments

Comments
 (0)