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

+1-1
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

+6-23
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

-11
This file was deleted.

tests/ui/consts/const-try.stderr

+2
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

+1-1
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

+16-22
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

+2
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

+1
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

+1
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

+1
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

tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-pass.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | a.plus(b)
55
| ^^^^^^^
66
|
77
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
8+
= help: add `#![feature(effects)]` to the crate attributes to enable
89

910
error[E0015]: cannot call non-const operator in constants
1011
--> $DIR/call-const-trait-method-pass.rs:39:22
@@ -18,6 +19,7 @@ note: impl defined here, but it is not `const`
1819
LL | impl const std::ops::Add for Int {
1920
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2021
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
22+
= help: add `#![feature(effects)]` to the crate attributes to enable
2123

2224
error: aborting due to 2 previous errors
2325

tests/ui/rfcs/rfc-2632-const-trait-impl/call.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// check-pass
22

3-
#![feature(const_closures, const_trait_impl)]
3+
#![feature(const_closures, const_trait_impl, effects)]
44
#![allow(incomplete_features)]
55

66
pub const _: () = {

tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate-default-method-body-is-const.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//
44
// check-pass
55

6-
#![feature(const_trait_impl)]
6+
#![feature(const_trait_impl, effects)]
77

88
// aux-build: cross-crate.rs
99
extern crate cross_crate;

tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// check-pass
2+
// FIXME(effects) this shouldn't pass
13
#![feature(const_closures, const_trait_impl, effects)]
24
#![allow(incomplete_features)]
35

@@ -11,5 +13,5 @@ impl Foo for () {
1113

1214
fn main() {
1315
(const || { (()).foo() })();
14-
//~^ ERROR: cannot call non-const fn
16+
// FIXME(effects) ~^ ERROR: cannot call non-const fn
1517
}

tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.stderr

-11
This file was deleted.

tests/ui/rfcs/rfc-2632-const-trait-impl/generic-bound.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ note: impl defined here, but it is not `const`
1010
LL | impl<T> const std::ops::Add for S<T> {
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: aborting due to 1 previous error
1516

tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102985.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ error[E0015]: cannot call non-const closure in constants
44
LL | n => n(),
55
| ^^^
66
|
7+
= note: closures need an RFC before allowed to be called in constants
78
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
9+
= help: add `#![feature(effects)]` to the crate attributes to enable
810

911
error: aborting due to 1 previous error
1012

tests/ui/rfcs/rfc-2632-const-trait-impl/issue-79450.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![feature(const_fmt_arguments_new)]
2-
#![feature(const_trait_impl)]
2+
#![feature(const_trait_impl, effects)]
33

44
#[const_trait]
55
trait Tr {

tests/ui/rfcs/rfc-2632-const-trait-impl/issue-88155.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | T::assoc()
55
| ^^^^^^^^^^
66
|
77
= note: calls in constant functions 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

tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.gated.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LL | "a" => (), //FIXME [gated]~ ERROR can't compare `str` with `str` in
66
|
77
= note: `str` cannot be compared in compile-time, and therefore cannot be used in `match`es
88
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
9+
= help: add `#![feature(effects)]` to the crate attributes to enable
910

1011
error: aborting due to 1 previous error
1112

tests/ui/rfcs/rfc-2632-const-trait-impl/non-const-op-const-closure-non-const-outer.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | (const || { (()).foo() })();
55
| ^^^^^
66
|
77
= note: calls in constant functions 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

tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(const_trait_impl, min_specialization, rustc_attrs)]
1+
#![feature(const_trait_impl, effects, min_specialization, rustc_attrs)]
22
// known-bug: #110395
33
#[rustc_specialization_trait]
44
#[const_trait]
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
error[E0015]: cannot call non-const fn `<T as A>::a` in constant functions
2-
--> $DIR/specializing-constness-2.rs:27:5
1+
error[E0119]: conflicting implementations of trait `A`
2+
--> $DIR/specializing-constness-2.rs:20:1
33
|
4-
LL | <T as A>::a();
5-
| ^^^^^^^^^^^^^
6-
|
7-
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
4+
LL | impl<T: Default> A for T {
5+
| ------------------------ first implementation here
6+
...
7+
LL | impl<T: Default + ~const Sup> const A for T {
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
89

910
error: aborting due to 1 previous error
1011

11-
For more information about this error, try `rustc --explain E0015`.
12+
For more information about this error, try `rustc --explain E0119`.

tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
error: `~const` is not allowed here
2-
--> $DIR/super-traits-fail-2.rs:11:12
2+
--> $DIR/super-traits-fail-2.rs:10:12
33
|
44
LL | trait Bar: ~const Foo {}
55
| ^^^^^^
66
|
77
note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
8-
--> $DIR/super-traits-fail-2.rs:11:1
8+
--> $DIR/super-traits-fail-2.rs:10:1
99
|
1010
LL | trait Bar: ~const Foo {}
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^
1212

1313
error: ~const can only be applied to `#[const_trait]` traits
14-
--> $DIR/super-traits-fail-2.rs:11:19
14+
--> $DIR/super-traits-fail-2.rs:10:19
1515
|
1616
LL | trait Bar: ~const Foo {}
1717
| ^^^
1818

1919
error: ~const can only be applied to `#[const_trait]` traits
20-
--> $DIR/super-traits-fail-2.rs:11:19
20+
--> $DIR/super-traits-fail-2.rs:10:19
2121
|
2222
LL | trait Bar: ~const Foo {}
2323
| ^^^

tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: ~const can only be applied to `#[const_trait]` traits
2-
--> $DIR/super-traits-fail-2.rs:11:19
2+
--> $DIR/super-traits-fail-2.rs:10:19
33
|
44
LL | trait Bar: ~const Foo {}
55
| ^^^
66

77
error: ~const can only be applied to `#[const_trait]` traits
8-
--> $DIR/super-traits-fail-2.rs:11:19
8+
--> $DIR/super-traits-fail-2.rs:10:19
99
|
1010
LL | trait Bar: ~const Foo {}
1111
| ^^^
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#![feature(const_trait_impl)]
2-
// known-bug: #110395
1+
#![feature(const_trait_impl, effects)]
32
// revisions: yy yn ny nn
43

54
#[cfg_attr(any(yy, yn), const_trait)]
@@ -9,12 +8,14 @@ trait Foo {
98

109
#[cfg_attr(any(yy, ny), const_trait)]
1110
trait Bar: ~const Foo {}
12-
// FIXME [ny,nn]~^ ERROR: ~const can only be applied to `#[const_trait]`
13-
// FIXME [ny,nn]~| ERROR: ~const can only be applied to `#[const_trait]`
11+
//[ny,nn]~^ ERROR: ~const can only be applied to `#[const_trait]`
12+
//[ny,nn]~| ERROR: ~const can only be applied to `#[const_trait]`
13+
//[yn,nn]~^^^ ERROR: `~const` is not allowed here
1414

1515
const fn foo<T: Bar>(x: &T) {
1616
x.a();
17-
// FIXME [yn,yy]~^ ERROR the trait bound
17+
//[yy,yn]~^ ERROR mismatched types
18+
// FIXME(effects) diagnostic
1819
}
1920

2021
fn main() {}

0 commit comments

Comments
 (0)