Skip to content

Commit d60ebe3

Browse files
committed
bless tests, remove nonexistent E0395
1 parent a6f9826 commit d60ebe3

24 files changed

+182
-194
lines changed

Diff for: src/test/ui/const-generics/issues/issue-90318.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,14 @@ impl True for If<true> {}
1212
fn consume<T: 'static>(_val: T)
1313
where
1414
If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True,
15-
//~^ ERROR: overly complex generic constant
16-
//~| ERROR: cannot call non-const operator in constants
15+
//~^ ERROR: can't compare
1716
{
1817
}
1918

2019
fn test<T: 'static>()
2120
where
2221
If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True,
23-
//~^ ERROR: overly complex generic constant
24-
//~| ERROR: cannot call non-const operator in constants
22+
//~^ ERROR: can't compare
2523
{
2624
}
2725

Diff for: src/test/ui/const-generics/issues/issue-90318.stderr

+18-40
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,31 @@
1-
error: overly complex generic constant
2-
--> $DIR/issue-90318.rs:14:8
1+
error[E0277]: can't compare `TypeId` with `_` in const contexts
2+
--> $DIR/issue-90318.rs:14:28
33
|
44
LL | If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True,
5-
| ^^-----------------^^^^^^^^^^^^^^^^^^^^^^^^
6-
| |
7-
| borrowing is not supported in generic constants
5+
| ^^ no implementation for `TypeId == _`
86
|
9-
= help: consider moving this anonymous constant into a `const` function
10-
= note: this operation may be supported in the future
11-
12-
error[E0015]: cannot call non-const operator in constants
13-
--> $DIR/issue-90318.rs:14:10
7+
= help: the trait `~const PartialEq<_>` is not implemented for `TypeId`
8+
note: the trait `PartialEq<_>` is implemented for `TypeId`, but that implementation is not `const`
9+
--> $DIR/issue-90318.rs:14:28
1410
|
1511
LL | If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True,
16-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17-
|
18-
note: impl defined here, but it is not `const`
19-
--> $SRC_DIR/core/src/any.rs:LL:COL
20-
|
21-
LL | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
22-
| ^^^^^^^^^
23-
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
24-
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
12+
| ^^
13+
= help: the trait `PartialEq` is implemented for `TypeId`
2514

26-
error: overly complex generic constant
27-
--> $DIR/issue-90318.rs:22:8
15+
error[E0277]: can't compare `TypeId` with `_` in const contexts
16+
--> $DIR/issue-90318.rs:21:28
2817
|
2918
LL | If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True,
30-
| ^^-----------------^^^^^^^^^^^^^^^^^^^^^^^^
31-
| |
32-
| borrowing is not supported in generic constants
19+
| ^^ no implementation for `TypeId == _`
3320
|
34-
= help: consider moving this anonymous constant into a `const` function
35-
= note: this operation may be supported in the future
36-
37-
error[E0015]: cannot call non-const operator in constants
38-
--> $DIR/issue-90318.rs:22:10
21+
= help: the trait `~const PartialEq<_>` is not implemented for `TypeId`
22+
note: the trait `PartialEq<_>` is implemented for `TypeId`, but that implementation is not `const`
23+
--> $DIR/issue-90318.rs:21:28
3924
|
4025
LL | If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True,
41-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42-
|
43-
note: impl defined here, but it is not `const`
44-
--> $SRC_DIR/core/src/any.rs:LL:COL
45-
|
46-
LL | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
47-
| ^^^^^^^^^
48-
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
49-
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
26+
| ^^
27+
= help: the trait `PartialEq` is implemented for `TypeId`
5028

51-
error: aborting due to 4 previous errors
29+
error: aborting due to 2 previous errors
5230

53-
For more information about this error, try `rustc --explain E0015`.
31+
For more information about this error, try `rustc --explain E0277`.

Diff for: src/test/ui/consts/const-eval/const_raw_ptr_ops.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
fn main() {}
22

33
// unconst and bad, will thus error in miri
4-
const X: bool = unsafe { &1 as *const i32 == &2 as *const i32 }; //~ ERROR cannot be reliably
4+
const X: bool = unsafe { &1 as *const i32 == &2 as *const i32 }; //~ ERROR can't compare
55
// unconst and bad, will thus error in miri
6-
const X2: bool = unsafe { 42 as *const i32 == 43 as *const i32 }; //~ ERROR cannot be reliably
6+
const X2: bool = unsafe { 42 as *const i32 == 43 as *const i32 }; //~ ERROR can't compare
+39-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,49 @@
1-
error: pointers cannot be reliably compared during const eval
2-
--> $DIR/const_raw_ptr_ops.rs:4:26
1+
error[E0277]: can't compare `*const i32` with `_` in const contexts
2+
--> $DIR/const_raw_ptr_ops.rs:4:43
33
|
44
LL | const X: bool = unsafe { &1 as *const i32 == &2 as *const i32 };
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5+
| ^^ no implementation for `*const i32 == _`
66
|
7-
= note: see issue #53020 <https://github.com/rust-lang/rust/issues/53020> for more information
7+
= help: the trait `~const PartialEq<_>` is not implemented for `*const i32`
8+
note: the trait `PartialEq<_>` is implemented for `*const i32`, but that implementation is not `const`
9+
--> $DIR/const_raw_ptr_ops.rs:4:43
10+
|
11+
LL | const X: bool = unsafe { &1 as *const i32 == &2 as *const i32 };
12+
| ^^
13+
= help: the following other types implement trait `PartialEq<Rhs>`:
14+
f32
15+
f64
16+
i128
17+
i16
18+
i32
19+
i64
20+
i8
21+
isize
22+
and 6 others
823

9-
error: pointers cannot be reliably compared during const eval
10-
--> $DIR/const_raw_ptr_ops.rs:6:27
24+
error[E0277]: can't compare `*const i32` with `_` in const contexts
25+
--> $DIR/const_raw_ptr_ops.rs:6:44
1126
|
1227
LL | const X2: bool = unsafe { 42 as *const i32 == 43 as *const i32 };
13-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
28+
| ^^ no implementation for `*const i32 == _`
1429
|
15-
= note: see issue #53020 <https://github.com/rust-lang/rust/issues/53020> for more information
30+
= help: the trait `~const PartialEq<_>` is not implemented for `*const i32`
31+
note: the trait `PartialEq<_>` is implemented for `*const i32`, but that implementation is not `const`
32+
--> $DIR/const_raw_ptr_ops.rs:6:44
33+
|
34+
LL | const X2: bool = unsafe { 42 as *const i32 == 43 as *const i32 };
35+
| ^^
36+
= help: the following other types implement trait `PartialEq<Rhs>`:
37+
f32
38+
f64
39+
i128
40+
i16
41+
i32
42+
i64
43+
i8
44+
isize
45+
and 6 others
1646

1747
error: aborting due to 2 previous errors
1848

49+
For more information about this error, try `rustc --explain E0277`.

Diff for: src/test/ui/consts/issue-25826.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
fn id<T>(t: T) -> T { t }
22
fn main() {
33
const A: bool = unsafe { id::<u8> as *const () < id::<u16> as *const () };
4-
//~^ ERROR pointers cannot be reliably compared during const eval
4+
//~^ ERROR can't compare
55
println!("{}", A);
66
}

Diff for: src/test/ui/consts/issue-25826.stderr

+14-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
error: pointers cannot be reliably compared during const eval
2-
--> $DIR/issue-25826.rs:3:30
1+
error[E0277]: can't compare `*const ()` with `*const ()` in const contexts
2+
--> $DIR/issue-25826.rs:3:52
33
|
44
LL | const A: bool = unsafe { id::<u8> as *const () < id::<u16> as *const () };
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5+
| ^ no implementation for `*const () < *const ()` and `*const () > *const ()`
66
|
7-
= note: see issue #53020 <https://github.com/rust-lang/rust/issues/53020> for more information
7+
= help: the trait `~const PartialOrd` is not implemented for `*const ()`
8+
note: the trait `PartialOrd` is implemented for `*const ()`, but that implementation is not `const`
9+
--> $DIR/issue-25826.rs:3:52
10+
|
11+
LL | const A: bool = unsafe { id::<u8> as *const () < id::<u16> as *const () };
12+
| ^
13+
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
14+
|
15+
LL | fn main() where *const (): ~const PartialOrd {
16+
| ++++++++++++++++++++++++++++++++++
817

918
error: aborting due to previous error
1019

20+
For more information about this error, try `rustc --explain E0277`.

Diff for: src/test/ui/consts/min_const_fn/cmp_fn_pointers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const fn cmp(x: fn(), y: fn()) -> bool {
22
unsafe { x == y }
3-
//~^ ERROR pointers cannot be reliably compared
3+
//~^ ERROR can't compare
44
}
55

66
fn main() {}
+20-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
1-
error: pointers cannot be reliably compared during const eval
2-
--> $DIR/cmp_fn_pointers.rs:2:14
1+
error[E0277]: can't compare `fn()` with `_` in const contexts
2+
--> $DIR/cmp_fn_pointers.rs:2:16
33
|
44
LL | unsafe { x == y }
5-
| ^^^^^^
5+
| ^^ no implementation for `fn() == _`
66
|
7-
= note: see issue #53020 <https://github.com/rust-lang/rust/issues/53020> for more information
7+
= help: the trait `~const PartialEq<_>` is not implemented for `fn()`
8+
note: the trait `PartialEq<_>` is implemented for `fn()`, but that implementation is not `const`
9+
--> $DIR/cmp_fn_pointers.rs:2:16
10+
|
11+
LL | unsafe { x == y }
12+
| ^^
13+
= help: the following other types implement trait `PartialEq<Rhs>`:
14+
extern "C" fn() -> Ret
15+
extern "C" fn(A, B) -> Ret
16+
extern "C" fn(A, B, ...) -> Ret
17+
extern "C" fn(A, B, C) -> Ret
18+
extern "C" fn(A, B, C, ...) -> Ret
19+
extern "C" fn(A, B, C, D) -> Ret
20+
extern "C" fn(A, B, C, D, ...) -> Ret
21+
extern "C" fn(A, B, C, D, E) -> Ret
22+
and 68 others
823

924
error: aborting due to previous error
1025

26+
For more information about this error, try `rustc --explain E0277`.

Diff for: src/test/ui/consts/miri_unleashed/ptr_arith.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@
22
#![feature(core_intrinsics)]
33
#![allow(const_err)]
44

5-
// During CTFE, we prevent pointer comparison and pointer-to-int casts.
6-
7-
static CMP: () = {
8-
let x = &0 as *const _;
9-
let _v = x == x;
10-
//~^ ERROR could not evaluate static initializer
11-
//~| "pointer arithmetic or comparison" needs an rfc before being allowed inside constants
12-
};
5+
// During CTFE, we prevent pointer-to-int casts.
6+
// Pointer comparisons are prevented in the trait system.
137

148
static PTR_INT_CAST: () = {
159
let x = &0 as *const _ as usize;

Diff for: src/test/ui/consts/miri_unleashed/ptr_arith.stderr

+4-15
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,23 @@
11
error[E0080]: could not evaluate static initializer
2-
--> $DIR/ptr_arith.rs:9:14
3-
|
4-
LL | let _v = x == x;
5-
| ^^^^^^ "pointer arithmetic or comparison" needs an rfc before being allowed inside constants
6-
7-
error[E0080]: could not evaluate static initializer
8-
--> $DIR/ptr_arith.rs:15:13
2+
--> $DIR/ptr_arith.rs:9:13
93
|
104
LL | let x = &0 as *const _ as usize;
115
| ^^^^^^^^^^^^^^^^^^^^^^^ "exposing pointers" needs an rfc before being allowed inside constants
126

137
error[E0080]: could not evaluate static initializer
14-
--> $DIR/ptr_arith.rs:23:14
8+
--> $DIR/ptr_arith.rs:17:14
159
|
1610
LL | let _v = x + 0;
1711
| ^ unable to turn pointer into raw bytes
1812

1913
warning: skipping const checks
2014
|
2115
help: skipping check that does not even have a feature gate
22-
--> $DIR/ptr_arith.rs:9:14
23-
|
24-
LL | let _v = x == x;
25-
| ^^^^^^
26-
help: skipping check that does not even have a feature gate
27-
--> $DIR/ptr_arith.rs:15:13
16+
--> $DIR/ptr_arith.rs:9:13
2817
|
2918
LL | let x = &0 as *const _ as usize;
3019
| ^^^^^^^^^^^^^^^^^^^^^^^
3120

32-
error: aborting due to 3 previous errors; 1 warning emitted
21+
error: aborting due to 2 previous errors; 1 warning emitted
3322

3423
For more information about this error, try `rustc --explain E0080`.

Diff for: src/test/ui/error-codes/E0395.rs

-8
This file was deleted.

Diff for: src/test/ui/error-codes/E0395.stderr

-10
This file was deleted.

Diff for: src/test/ui/intrinsics/const-eval-select-bad.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0277]: the trait bound `[closure@$DIR/const-eval-select-bad.rs:7:27: 7:29]: ~const FnOnce<()>` is not satisfied
1+
error[E0277]: the trait bound `[closure@$DIR/const-eval-select-bad.rs:7:27: 7:29]: FnOnce<()>` is not satisfied
22
--> $DIR/const-eval-select-bad.rs:7:27
33
|
44
LL | const_eval_select((), || {}, || {});
@@ -19,7 +19,7 @@ note: required by a bound in `const_eval_select`
1919
LL | F: ~const FnOnce<ARG, Output = RET>,
2020
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select`
2121

22-
error[E0277]: the trait bound `{integer}: ~const FnOnce<()>` is not satisfied
22+
error[E0277]: the trait bound `{integer}: FnOnce<()>` is not satisfied
2323
--> $DIR/const-eval-select-bad.rs:9:27
2424
|
2525
LL | const_eval_select((), 42, 0xDEADBEEF);

Diff for: src/test/ui/rfc-2632-const-trait-impl/call-generic-method-fail.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
pub const fn equals_self<T: PartialEq>(t: &T) -> bool {
44
*t == *t
55
//~^ ERROR can't compare
6-
//~| ERROR cannot call non-const
76
}
87

98
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
1-
error[E0277]: can't compare `T` with `T` in const contexts
2-
--> $DIR/call-generic-method-fail.rs:4:5
1+
error[E0277]: can't compare `T` with `_` in const contexts
2+
--> $DIR/call-generic-method-fail.rs:4:8
33
|
44
LL | *t == *t
5-
| ^^^^^^^^ no implementation for `T == T`
5+
| ^^ no implementation for `T == _`
66
|
7-
note: the trait `PartialEq` is implemented for `T`, but that implementation is not `const`
8-
--> $DIR/call-generic-method-fail.rs:4:5
7+
note: the trait `PartialEq<_>` is implemented for `T`, but that implementation is not `const`
8+
--> $DIR/call-generic-method-fail.rs:4:8
99
|
1010
LL | *t == *t
11-
| ^^^^^^^^
11+
| ^^
12+
= help: the following other types implement trait `PartialEq<Rhs>`:
13+
<&A as PartialEq<&B>>
14+
<&A as PartialEq<&mut B>>
15+
<&mut A as PartialEq<&B>>
16+
<&mut A as PartialEq<&mut B>>
17+
<*const T as PartialEq>
18+
<*mut T as PartialEq>
1219

13-
error[E0015]: cannot call non-const operator in constant functions
14-
--> $DIR/call-generic-method-fail.rs:4:5
15-
|
16-
LL | *t == *t
17-
| ^^^^^^^^
18-
|
19-
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
20-
help: consider further restricting this bound
21-
|
22-
LL | pub const fn equals_self<T: PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool {
23-
| ++++++++++++++++++++++++++++
24-
25-
error: aborting due to 2 previous errors
20+
error: aborting due to previous error
2621

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

Diff for: src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.rs

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ impl const ConstDefaultFn for ConstImpl {
2323
const fn test() {
2424
NonConstImpl.a();
2525
//~^ ERROR the trait bound
26-
//~| ERROR cannot call non-const fn
2726
ConstImpl.a();
2827
}
2928

0 commit comments

Comments
 (0)