Add ignored test for associated types in const impl
This commit is contained in:
parent
4992eb2c6f
commit
c8f0abb51c
1 changed files with 28 additions and 0 deletions
28
src/test/ui/rfc-2632-const-trait-impl/assoc-type.rs
Normal file
28
src/test/ui/rfc-2632-const-trait-impl/assoc-type.rs
Normal file
|
@ -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() {}
|
Loading…
Add table
Add a link
Reference in a new issue