Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ignored test for associated types in const impl
- Loading branch information
1 parent
4992eb2
commit c8f0abb
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |