Skip to content

Commit e4f237d

Browse files
committed
bless ui tests
1 parent 43dcc9b commit e4f237d

35 files changed

+127
-144
lines changed

tests/ui/consts/auxiliary/closure-in-foreign-crate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![crate_type = "lib"]
2-
#![feature(const_closures, const_trait_impl)]
2+
#![feature(const_closures, const_trait_impl, effects)]
33
#![allow(incomplete_features)]
44

55
pub const fn test() {

tests/ui/consts/const-float-classify.rs

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,24 @@
11
// compile-flags: -Zmir-opt-level=0
2-
// known-bug: #110395
3-
// FIXME run-pass
2+
// run-pass
43

54
#![feature(const_float_bits_conv)]
65
#![feature(const_float_classify)]
7-
#![feature(const_trait_impl)]
6+
#![feature(const_trait_impl, effects)]
87

98
// Don't promote
109
const fn nop<T>(x: T) -> T { x }
1110

12-
// FIXME(const-hack): replace with PartialEq
13-
#[const_trait]
14-
trait MyEq<T> {
15-
fn eq(self, b: T) -> bool;
16-
}
17-
18-
impl const MyEq<bool> for bool {
19-
fn eq(self, b: bool) -> bool {
20-
self == b
21-
}
22-
}
23-
24-
impl const MyEq<NonDet> for bool {
25-
fn eq(self, _: NonDet) -> bool {
11+
impl const PartialEq<NonDet> for bool {
12+
fn eq(&self, _: &NonDet) -> bool {
2613
true
2714
}
2815
}
2916

30-
const fn eq<A: ~const MyEq<B>, B>(x: A, y: B) -> bool {
31-
x.eq(y)
32-
}
33-
3417
macro_rules! const_assert {
3518
($a:expr, $b:expr) => {
3619
{
37-
const _: () = assert!(eq($a, $b));
38-
assert!(eq(nop($a), nop($b)));
20+
const _: () = assert!($a == $b);
21+
assert!(nop($a) == nop($b));
3922
}
4023
};
4124
}

tests/ui/consts/const-float-classify.stderr

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/ui/consts/const-try.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ note: impl defined here, but it is not `const`
1010
LL | impl const Try for TryMe {
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^
1212
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
13+
= help: add `#![feature(effects)]` to the crate attributes to enable
1314

1415
error[E0015]: `?` cannot convert from residual of `TryMe` in constant functions
1516
--> $DIR/const-try.rs:33:5
@@ -23,6 +24,7 @@ note: impl defined here, but it is not `const`
2324
LL | impl const FromResidual<Error> for TryMe {
2425
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2526
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
27+
= help: add `#![feature(effects)]` to the crate attributes to enable
2628

2729
error: aborting due to 2 previous errors
2830

tests/ui/consts/const_cmp_type_id.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// known-bug: #110395
22
#![feature(const_type_id)]
3-
#![feature(const_trait_impl)]
3+
#![feature(const_trait_impl, effects)]
44

55
use std::any::TypeId;
66

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,28 @@
1-
error[E0015]: cannot call non-const operator in constant functions
1+
error[E0131]: `main` function is not allowed to have generic parameters
2+
--> $DIR/const_cmp_type_id.rs:7:14
3+
|
4+
LL | const fn main() {
5+
| ^ `main` cannot have generic parameters
6+
7+
error[E0308]: mismatched types
28
--> $DIR/const_cmp_type_id.rs:8:13
39
|
410
LL | assert!(TypeId::of::<u8>() == TypeId::of::<u8>());
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `host`, found `true`
612
|
7-
note: impl defined here, but it is not `const`
8-
--> $SRC_DIR/core/src/any.rs:LL:COL
9-
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
13+
= note: expected constant `host`
14+
found constant `true`
1015

11-
error[E0015]: cannot call non-const operator in constant functions
16+
error[E0308]: mismatched types
1217
--> $DIR/const_cmp_type_id.rs:9:13
1318
|
1419
LL | assert!(TypeId::of::<()>() != TypeId::of::<u8>());
15-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16-
|
17-
note: impl defined here, but it is not `const`
18-
--> $SRC_DIR/core/src/any.rs:LL:COL
19-
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
20-
21-
error[E0015]: cannot call non-const operator in constants
22-
--> $DIR/const_cmp_type_id.rs:10:22
23-
|
24-
LL | const _A: bool = TypeId::of::<u8>() < TypeId::of::<u16>();
25-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `host`, found `true`
2621
|
27-
note: impl defined here, but it is not `const`
28-
--> $SRC_DIR/core/src/any.rs:LL:COL
29-
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
30-
= note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
22+
= note: expected constant `host`
23+
found constant `true`
3124

3225
error: aborting due to 3 previous errors
3326

34-
For more information about this error, try `rustc --explain E0015`.
27+
Some errors have detailed explanations: E0131, E0308.
28+
For more information about an error, try `rustc --explain E0131`.

tests/ui/consts/constifconst-call-in-const-position.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ LL | [0; T::a()]
1414
| ^^^^^^
1515
|
1616
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
17+
= help: add `#![feature(effects)]` to the crate attributes to enable
1718

1819
error[E0015]: cannot call non-const fn `<T as Tr>::a` in constants
1920
--> $DIR/constifconst-call-in-const-position.rs:16:38
@@ -22,6 +23,7 @@ LL | const fn foo<T: ~const Tr>() -> [u8; T::a()] {
2223
| ^^^^^^
2324
|
2425
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
26+
= help: add `#![feature(effects)]` to the crate attributes to enable
2527

2628
error: aborting due to 2 previous errors; 1 warning emitted
2729

tests/ui/consts/issue-73976-monomorphic.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ LL | GetTypeId::<T>::VALUE == GetTypeId::<usize>::VALUE
77
note: impl defined here, but it is not `const`
88
--> $SRC_DIR/core/src/any.rs:LL:COL
99
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
10+
= help: add `#![feature(effects)]` to the crate attributes to enable
1011

1112
error: aborting due to 1 previous error
1213

tests/ui/consts/issue-94675.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ LL | self.bar[0] = baz.len();
1515
note: impl defined here, but it is not `const`
1616
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
1717
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
18+
= help: add `#![feature(effects)]` to the crate attributes to enable
1819

1920
error: aborting due to 2 previous errors
2021

tests/ui/generic-const-items/const-trait-impl.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | const CREATE<T: Create>: T = T::create();
55
| ^^^^^^^^^^^
66
|
77
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
8+
= help: add `#![feature(effects)]` to the crate attributes to enable
89

910
error: aborting due to 1 previous error
1011

0 commit comments

Comments
 (0)