Skip to content

Commit

Permalink
bless tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fee1-dead committed Jun 21, 2024
1 parent 02aaea1 commit a6a83d3
Show file tree
Hide file tree
Showing 42 changed files with 1,077 additions and 185 deletions.
10 changes: 0 additions & 10 deletions tests/crashes/120503.rs

This file was deleted.

20 changes: 0 additions & 20 deletions tests/crashes/121536.rs

This file was deleted.

8 changes: 7 additions & 1 deletion tests/ui/consts/const-block-const-bound.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-block-const-bound.rs:8:22
|
LL | const fn f<T: ~const Destruct>(x: T) {}
| ^^^^^^^^

error[E0493]: destructor of `T` cannot be evaluated at compile-time
--> $DIR/const-block-const-bound.rs:8:32
|
Expand All @@ -6,6 +12,6 @@ LL | const fn f<T: ~const Destruct>(x: T) {}
| |
| the destructor for this type cannot be evaluated in constant functions

error: aborting due to 1 previous error
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0493`.
3 changes: 2 additions & 1 deletion tests/ui/consts/const-float-classify.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ compile-flags: -Zmir-opt-level=0
//@ run-pass
//@ known-bug: #110395
// FIXME(effects) run-pass

#![feature(const_float_bits_conv)]
#![feature(const_float_classify)]
Expand Down
214 changes: 214 additions & 0 deletions tests/ui/consts/const-float-classify.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ^^^^^^^^^^^^^^^^^
|
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change

error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
--> $DIR/const-float-classify.rs:12:6
|
LL | impl const PartialEq<NonDet> for bool {
| ^^^^^ unconstrained const parameter
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported

error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 10 previous errors

Some errors have detailed explanations: E0207, E0284.
For more information about an error, try `rustc --explain E0207`.
22 changes: 2 additions & 20 deletions tests/ui/consts/const_cmp_type_id.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,7 @@ error[E0080]: evaluation of constant value failed
LL | const _A: bool = TypeId::of::<u8>() < TypeId::of::<u16>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `<TypeId as PartialOrd>::lt`

error[E0308]: mismatched types
--> $DIR/const_cmp_type_id.rs:8:13
|
LL | assert!(TypeId::of::<u8>() == TypeId::of::<u8>());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `host`, found `true`
|
= note: expected constant `host`
found constant `true`

error[E0308]: mismatched types
--> $DIR/const_cmp_type_id.rs:9:13
|
LL | assert!(TypeId::of::<()>() != TypeId::of::<u8>());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `host`, found `true`
|
= note: expected constant `host`
found constant `true`

error: aborting due to 4 previous errors
error: aborting due to 2 previous errors

Some errors have detailed explanations: E0080, E0131, E0308.
Some errors have detailed explanations: E0080, E0131.
For more information about an error, try `rustc --explain E0080`.
32 changes: 31 additions & 1 deletion tests/ui/consts/fn_trait_refs.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,24 @@ error[E0635]: unknown feature `const_fn_trait_ref_impls`
LL | #![feature(const_fn_trait_ref_impls)]
| ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0635]: unknown feature `const_cmp`
--> $DIR/fn_trait_refs.rs:8:12
|
LL | #![feature(const_cmp)]
| ^^^^^^^^^

error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:15:15
|
LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^

error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:15:31
|
LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^^^

error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:15:15
|
Expand All @@ -24,6 +36,12 @@ error: `~const` can only be applied to `#[const_trait]` traits
LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^

error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:22:34
|
LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^

error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:22:15
|
Expand Down Expand Up @@ -52,6 +70,12 @@ error: `~const` can only be applied to `#[const_trait]` traits
LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^

error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:36:31
|
LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^^^

error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:36:15
|
Expand All @@ -66,6 +90,12 @@ error: `~const` can only be applied to `#[const_trait]` traits
LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^

error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:50:34
|
LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^

error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:50:15
|
Expand Down Expand Up @@ -182,7 +212,7 @@ LL | const fn test_fn_mut<T>(mut f: T) -> (T::Output, T::Output)
LL | }
| - value is dropped here

error: aborting due to 20 previous errors
error: aborting due to 25 previous errors

Some errors have detailed explanations: E0015, E0493, E0635.
For more information about an error, try `rustc --explain E0015`.
8 changes: 7 additions & 1 deletion tests/ui/impl-trait/normalize-tait-in-const.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ error: `~const` can only be applied to `#[const_trait]` traits
LL | const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
| ^^^^^^^^^^^^^^^^^

error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/normalize-tait-in-const.rs:27:69
|
LL | const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
| ^^^^^^^^

error[E0015]: cannot call non-const closure in constant functions
--> $DIR/normalize-tait-in-const.rs:28:5
|
Expand All @@ -29,7 +35,7 @@ LL | fun(filter_positive());
LL | }
| - value is dropped here

error: aborting due to 3 previous errors
error: aborting due to 4 previous errors

Some errors have detailed explanations: E0015, E0493.
For more information about an error, try `rustc --explain E0015`.
Loading

0 comments on commit a6a83d3

Please sign in to comment.