File tree Expand file tree Collapse file tree 8 files changed +6
-14
lines changed
tests/ui/traits/const-traits Expand file tree Collapse file tree 8 files changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ fn test_convert() {
21
21
assert ! ( char :: try_from( 0xFFFF_FFFF_u32 ) . is_err( ) ) ;
22
22
}
23
23
24
- /* FIXME(#110395)
25
24
#[ test]
26
25
const fn test_convert_const ( ) {
27
26
assert ! ( u32 :: from( 'a' ) == 0x61 ) ;
@@ -31,7 +30,6 @@ const fn test_convert_const() {
31
30
assert ! ( char :: from( b'a' ) == 'a' ) ;
32
31
assert ! ( char :: from( b'\xFF' ) == '\u{FF}' ) ;
33
32
}
34
- */
35
33
36
34
#[ test]
37
35
fn test_from_str ( ) {
Original file line number Diff line number Diff line change 1
- /* FIXME(#110395)
2
1
#[ test]
3
2
fn convert ( ) {
4
3
const fn from ( x : i32 ) -> i32 {
@@ -15,4 +14,3 @@ fn convert() {
15
14
const BAR : Vec < String > = into ( Vec :: new ( ) ) ;
16
15
assert_eq ! ( BAR , Vec :: <String >:: new( ) ) ;
17
16
}
18
- */
Original file line number Diff line number Diff line change 18
18
#![ feature( const_deref) ]
19
19
#![ feature( const_destruct) ]
20
20
#![ feature( const_eval_select) ]
21
+ #![ feature( const_from) ]
21
22
#![ feature( const_ops) ]
23
+ #![ feature( const_option_ops) ]
22
24
#![ feature( const_ref_cell) ]
23
25
#![ feature( const_result_trait_fn) ]
24
26
#![ feature( const_trait_impl) ]
Original file line number Diff line number Diff line change @@ -214,13 +214,11 @@ fn nonzero_const() {
214
214
const ONE : Option < NonZero < u8 > > = NonZero :: new ( 1 ) ;
215
215
assert ! ( ONE . is_some( ) ) ;
216
216
217
- /* FIXME(#110395)
218
217
const FROM_NONZERO_U8 : u8 = u8:: from ( NONZERO_U8 ) ;
219
218
assert_eq ! ( FROM_NONZERO_U8 , 5 ) ;
220
219
221
220
const NONZERO_CONVERT : NonZero < u32 > = NonZero :: < u32 > :: from ( NONZERO_U8 ) ;
222
221
assert_eq ! ( NONZERO_CONVERT . get( ) , 5 ) ;
223
- */
224
222
}
225
223
226
224
#[ test]
Original file line number Diff line number Diff line change 1
- /* FIXME(#110395)
2
1
#[ test]
3
2
fn from ( ) {
4
3
use core:: convert:: TryFrom ;
@@ -24,4 +23,3 @@ fn from() {
24
23
const I16_FROM_U16 : Result < i16 , TryFromIntError > = i16:: try_from ( 1u16 ) ;
25
24
assert_eq ! ( I16_FROM_U16 , Ok ( 1i16 ) ) ;
26
25
}
27
- */
Original file line number Diff line number Diff line change @@ -87,7 +87,6 @@ fn test_and() {
87
87
assert_eq ! ( x. and( Some ( 2 ) ) , None ) ;
88
88
assert_eq ! ( x. and( None :: <isize >) , None ) ;
89
89
90
- /* FIXME(#110395)
91
90
const FOO : Option < isize > = Some ( 1 ) ;
92
91
const A : Option < isize > = FOO . and ( Some ( 2 ) ) ;
93
92
const B : Option < isize > = FOO . and ( None ) ;
@@ -99,7 +98,6 @@ fn test_and() {
99
98
const D : Option < isize > = BAR . and ( None ) ;
100
99
assert_eq ! ( C , None ) ;
101
100
assert_eq ! ( D , None ) ;
102
- */
103
101
}
104
102
105
103
#[ test]
Original file line number Diff line number Diff line change 1
- //@ known-bug: #110395
2
-
3
1
#![ feature( const_trait_impl, const_ops) ]
4
2
5
3
pub struct Int ( i32 ) ;
6
4
7
5
impl const std:: ops:: Add for i32 {
6
+ //~^ ERROR only traits defined in the current crate can be implemented for primitive types
8
7
type Output = Self ;
9
8
10
9
fn add ( self , rhs : Self ) -> Self {
@@ -21,6 +20,7 @@ impl std::ops::Add for Int {
21
20
}
22
21
23
22
impl const std:: ops:: Add for Int {
23
+ //~^ ERROR conflicting implementations of trait
24
24
type Output = Self ;
25
25
26
26
fn add ( self , rhs : Self ) -> Self {
Original file line number Diff line number Diff line change 1
1
error[E0119]: conflicting implementations of trait `Add` for type `Int`
2
- --> $DIR/const-and-non-const-impl.rs:23 :1
2
+ --> $DIR/const-and-non-const-impl.rs:22 :1
3
3
|
4
4
LL | impl std::ops::Add for Int {
5
5
| -------------------------- first implementation here
@@ -8,7 +8,7 @@ LL | impl const std::ops::Add for Int {
8
8
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Int`
9
9
10
10
error[E0117]: only traits defined in the current crate can be implemented for primitive types
11
- --> $DIR/const-and-non-const-impl.rs:7 :1
11
+ --> $DIR/const-and-non-const-impl.rs:5 :1
12
12
|
13
13
LL | impl const std::ops::Add for i32 {
14
14
| ^^^^^^^^^^^-------------^^^^^---
You can’t perform that action at this time.
0 commit comments