Skip to content

Commit c8cd8f1

Browse files
authored
Unrolled build for #145057
Rollup merge of #145057 - ShoyuVanilla:const-trait-tests-cleanup, r=petrochenkov Clean up some resolved test regressions of const trait removals in std cc #143871
2 parents 67d45f4 + 34e5820 commit c8cd8f1

File tree

8 files changed

+6
-14
lines changed

8 files changed

+6
-14
lines changed

library/coretests/tests/char.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ fn test_convert() {
2121
assert!(char::try_from(0xFFFF_FFFF_u32).is_err());
2222
}
2323

24-
/* FIXME(#110395)
2524
#[test]
2625
const fn test_convert_const() {
2726
assert!(u32::from('a') == 0x61);
@@ -31,7 +30,6 @@ const fn test_convert_const() {
3130
assert!(char::from(b'a') == 'a');
3231
assert!(char::from(b'\xFF') == '\u{FF}');
3332
}
34-
*/
3533

3634
#[test]
3735
fn test_from_str() {

library/coretests/tests/convert.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* FIXME(#110395)
21
#[test]
32
fn convert() {
43
const fn from(x: i32) -> i32 {
@@ -15,4 +14,3 @@ fn convert() {
1514
const BAR: Vec<String> = into(Vec::new());
1615
assert_eq!(BAR, Vec::<String>::new());
1716
}
18-
*/

library/coretests/tests/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
#![feature(const_deref)]
1919
#![feature(const_destruct)]
2020
#![feature(const_eval_select)]
21+
#![feature(const_from)]
2122
#![feature(const_ops)]
23+
#![feature(const_option_ops)]
2224
#![feature(const_ref_cell)]
2325
#![feature(const_result_trait_fn)]
2426
#![feature(const_trait_impl)]

library/coretests/tests/nonzero.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,11 @@ fn nonzero_const() {
214214
const ONE: Option<NonZero<u8>> = NonZero::new(1);
215215
assert!(ONE.is_some());
216216

217-
/* FIXME(#110395)
218217
const FROM_NONZERO_U8: u8 = u8::from(NONZERO_U8);
219218
assert_eq!(FROM_NONZERO_U8, 5);
220219

221220
const NONZERO_CONVERT: NonZero<u32> = NonZero::<u32>::from(NONZERO_U8);
222221
assert_eq!(NONZERO_CONVERT.get(), 5);
223-
*/
224222
}
225223

226224
#[test]

library/coretests/tests/num/const_from.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* FIXME(#110395)
21
#[test]
32
fn from() {
43
use core::convert::TryFrom;
@@ -24,4 +23,3 @@ fn from() {
2423
const I16_FROM_U16: Result<i16, TryFromIntError> = i16::try_from(1u16);
2524
assert_eq!(I16_FROM_U16, Ok(1i16));
2625
}
27-
*/

library/coretests/tests/option.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ fn test_and() {
8787
assert_eq!(x.and(Some(2)), None);
8888
assert_eq!(x.and(None::<isize>), None);
8989

90-
/* FIXME(#110395)
9190
const FOO: Option<isize> = Some(1);
9291
const A: Option<isize> = FOO.and(Some(2));
9392
const B: Option<isize> = FOO.and(None);
@@ -99,7 +98,6 @@ fn test_and() {
9998
const D: Option<isize> = BAR.and(None);
10099
assert_eq!(C, None);
101100
assert_eq!(D, None);
102-
*/
103101
}
104102

105103
#[test]

tests/ui/traits/const-traits/const-and-non-const-impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
//@ known-bug: #110395
2-
31
#![feature(const_trait_impl, const_ops)]
42

53
pub struct Int(i32);
64

75
impl const std::ops::Add for i32 {
6+
//~^ ERROR only traits defined in the current crate can be implemented for primitive types
87
type Output = Self;
98

109
fn add(self, rhs: Self) -> Self {
@@ -21,6 +20,7 @@ impl std::ops::Add for Int {
2120
}
2221

2322
impl const std::ops::Add for Int {
23+
//~^ ERROR conflicting implementations of trait
2424
type Output = Self;
2525

2626
fn add(self, rhs: Self) -> Self {

tests/ui/traits/const-traits/const-and-non-const-impl.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
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
33
|
44
LL | impl std::ops::Add for Int {
55
| -------------------------- first implementation here
@@ -8,7 +8,7 @@ LL | impl const std::ops::Add for Int {
88
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Int`
99

1010
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
1212
|
1313
LL | impl const std::ops::Add for i32 {
1414
| ^^^^^^^^^^^-------------^^^^^---

0 commit comments

Comments
 (0)