This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed
src/test/ui/rfc-2632-const-trait-impl Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change 11// check-pass
2- #![ feature( associated_type_bounds, const_trait_impl, const_cmp) ]
2+ #![ allow( incomplete_features) ]
3+ #![ feature(
4+ associated_type_bounds,
5+ const_trait_impl,
6+ const_cmp,
7+ return_position_impl_trait_in_trait,
8+ ) ]
39
410use std:: marker:: Destruct ;
511
612const fn cmp ( a : & impl ~const PartialEq ) -> bool {
713 a == a
814}
915
10- const fn wrap ( x : impl ~const PartialEq + ~const Destruct ) -> impl ~const PartialEq + ~const Destruct {
16+ const fn wrap ( x : impl ~const PartialEq + ~const Destruct )
17+ -> impl ~const PartialEq + ~const Destruct
18+ {
1119 x
1220}
1321
22+ #[ const_trait]
23+ trait Foo {
24+ fn huh ( ) -> impl ~const PartialEq + ~const Destruct + Copy ;
25+ }
26+
27+ impl const Foo for ( ) {
28+ fn huh ( ) -> impl ~const PartialEq + ~const Destruct + Copy {
29+ 123
30+ }
31+ }
32+
1433const _: ( ) = {
1534 assert ! ( cmp( & 0xDEADBEEFu32 ) ) ;
1635 assert ! ( cmp( & ( ) ) ) ;
1736 assert ! ( wrap( 123 ) == wrap( 123 ) ) ;
1837 assert ! ( wrap( 123 ) != wrap( 456 ) ) ;
38+ let x = <( ) as Foo >:: huh ( ) ;
39+ assert ! ( x == x) ;
1940} ;
2041
2142#[ const_trait]
You can’t perform that action at this time.
0 commit comments