mirror of
https://github.com/rust-lang/rust
synced 2024-10-14 12:33:57 +00:00
bless tests
This commit is contained in:
parent
02aaea1803
commit
a6a83d3d4e
|
@ -1,10 +0,0 @@
|
|||
//@ known-bug: #120503
|
||||
#![feature(effects)]
|
||||
|
||||
trait MyTrait {}
|
||||
|
||||
impl MyTrait for i32 {
|
||||
async const fn bar(&self) {
|
||||
main8().await;
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
//@ known-bug: #121536
|
||||
#![feature(effects)]
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct Vec3 {
|
||||
pub x: f32,
|
||||
pub y: f32,
|
||||
pub z: f32,
|
||||
}
|
||||
|
||||
impl std::ops::Add<Vec3> for Vec3 {
|
||||
type Output = Vec3;
|
||||
const fn add(self, b: Vec3) -> Self::Output {
|
||||
Vec3 {
|
||||
x: self.x + b.x,
|
||||
y: self.y + b.y,
|
||||
z: self.z + b.z,
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
||||
|
@ -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`.
|
||||
|
|
|
@ -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)]
|
||||
|
|
214
tests/ui/consts/const-float-classify.stderr
Normal file
214
tests/ui/consts/const-float-classify.stderr
Normal file
|
@ -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`.
|
|
@ -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: aborting due to 2 previous errors
|
||||
|
||||
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
|
||||
|
||||
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`.
|
||||
|
|
|
@ -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
|
||||
|
|
||||
|
@ -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
|
||||
|
|
||||
|
@ -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
|
||||
|
|
||||
|
@ -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
|
||||
|
|
||||
|
@ -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`.
|
||||
|
|
|
@ -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
|
||||
|
|
||||
|
@ -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`.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! Check that intrinsics that do not get overridden, but are marked as such,
|
||||
//! cause an error instead of silently invoking the body.
|
||||
#![feature(rustc_attrs, effects)]
|
||||
#![feature(rustc_attrs/* , effects*/)] // FIXME(effects)
|
||||
//@ build-fail
|
||||
//@ failure-status:101
|
||||
//@ normalize-stderr-test ".*note: .*\n\n" -> ""
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![feature(intrinsics)]
|
||||
#![feature(rustc_attrs)]
|
||||
#![feature(effects)]
|
||||
// FIXME(effects) do this with revisions #![feature(effects)]
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn size_of<T>() -> usize; //~ ERROR intrinsic safety mismatch
|
||||
|
@ -19,7 +19,7 @@ const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
|
|||
mod foo {
|
||||
#[rustc_intrinsic]
|
||||
unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
|
||||
//~^ ERROR wrong number of const parameters
|
||||
// FIXME(effects) ~^ ERROR wrong number of const parameters
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -42,13 +42,6 @@ LL | const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
|
|||
= note: expected signature `unsafe fn(_, _, _)`
|
||||
found signature `fn(_, _, _)`
|
||||
|
||||
error[E0094]: intrinsic has wrong number of const parameters: found 0, expected 1
|
||||
--> $DIR/safe-intrinsic-mismatch.rs:21:31
|
||||
|
|
||||
LL | unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
|
||||
| ^ expected 1 const parameter
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0094, E0308.
|
||||
For more information about an error, try `rustc --explain E0094`.
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//@ check-pass
|
||||
//@ known-bug: #110395
|
||||
// FIXME(effects) check-pass
|
||||
#![feature(const_trait_impl)]
|
||||
|
||||
#[const_trait]
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-in-impl.rs:10:16
|
||||
|
|
||||
LL | impl<T: ~const PartialEq> const MyPartialEq for T {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
//! Basic test for calling methods on generic type parameters in `const fn`.
|
||||
|
||||
//@ check-pass
|
||||
//@ known-bug: #110395
|
||||
// FIXME(effects) check-pass
|
||||
|
||||
#![feature(const_trait_impl, effects)]
|
||||
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
|
||||
--> $DIR/call-generic-method-chain.rs:10:12
|
||||
|
|
||||
LL | impl const PartialEq for S {
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= 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/call-generic-method-chain.rs:10:6
|
||||
|
|
||||
LL | impl const PartialEq for S {
|
||||
| ^^^^^ 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: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-method-chain.rs:19:32
|
||||
|
|
||||
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-method-chain.rs:23:40
|
||||
|
|
||||
LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/call-generic-method-chain.rs:27:22
|
||||
|
|
||||
LL | pub const EQ: bool = equals_self_wrapper(&S);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
||||
|
|
||||
note: required for `S` to implement `PartialEq`
|
||||
--> $DIR/call-generic-method-chain.rs:10:12
|
||||
|
|
||||
LL | impl const PartialEq for S {
|
||||
| ----- ^^^^^^^^^ ^
|
||||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/call-generic-method-chain.rs:15:10
|
||||
|
|
||||
LL | !self.eq(other)
|
||||
| ^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
||||
|
|
||||
note: required for `S` to implement `PartialEq`
|
||||
--> $DIR/call-generic-method-chain.rs:10:12
|
||||
|
|
||||
LL | impl const PartialEq for S {
|
||||
| ----- ^^^^^^^^^ ^
|
||||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0207, E0284.
|
||||
For more information about an error, try `rustc --explain E0207`.
|
|
@ -1,4 +1,5 @@
|
|||
//@ check-pass
|
||||
//@ known-bug: #110395
|
||||
// FIXME(effects) check-pass
|
||||
|
||||
#![feature(const_trait_impl, effects)]
|
||||
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
|
||||
--> $DIR/call-generic-method-dup-bound.rs:8:12
|
||||
|
|
||||
LL | impl const PartialEq for S {
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= 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/call-generic-method-dup-bound.rs:8:6
|
||||
|
|
||||
LL | impl const PartialEq for S {
|
||||
| ^^^^^ 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: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-method-dup-bound.rs:19:44
|
||||
|
|
||||
LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-method-dup-bound.rs:26:37
|
||||
|
|
||||
LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/call-generic-method-dup-bound.rs:30:22
|
||||
|
|
||||
LL | pub const EQ: bool = equals_self(&S) && equals_self2(&S);
|
||||
| ^^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
||||
|
|
||||
note: required for `S` to implement `PartialEq`
|
||||
--> $DIR/call-generic-method-dup-bound.rs:8:12
|
||||
|
|
||||
LL | impl const PartialEq for S {
|
||||
| ----- ^^^^^^^^^ ^
|
||||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/call-generic-method-dup-bound.rs:30:41
|
||||
|
|
||||
LL | pub const EQ: bool = equals_self(&S) && equals_self2(&S);
|
||||
| ^^^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
||||
|
|
||||
note: required for `S` to implement `PartialEq`
|
||||
--> $DIR/call-generic-method-dup-bound.rs:8:12
|
||||
|
|
||||
LL | impl const PartialEq for S {
|
||||
| ----- ^^^^^^^^^ ^
|
||||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/call-generic-method-dup-bound.rs:13:10
|
||||
|
|
||||
LL | !self.eq(other)
|
||||
| ^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
||||
|
|
||||
note: required for `S` to implement `PartialEq`
|
||||
--> $DIR/call-generic-method-dup-bound.rs:8:12
|
||||
|
|
||||
LL | impl const PartialEq for S {
|
||||
| ----- ^^^^^^^^^ ^
|
||||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0207, E0284.
|
||||
For more information about an error, try `rustc --explain E0207`.
|
|
@ -1,8 +1,10 @@
|
|||
//@ check-pass
|
||||
|
||||
#![feature(const_trait_impl, effects)]
|
||||
|
||||
pub const fn equals_self<T: PartialEq>(t: &T) -> bool {
|
||||
*t == *t
|
||||
//~^ ERROR mismatched types
|
||||
// FIXME(effects) ~^ ERROR mismatched types
|
||||
// FIXME(effects): diagnostic
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/call-generic-method-fail.rs:4:5
|
||||
|
|
||||
LL | *t == *t
|
||||
| ^^^^^^^^ expected `host`, found `true`
|
||||
|
|
||||
= note: expected constant `host`
|
||||
found constant `true`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
|
@ -1,6 +1,7 @@
|
|||
//! Basic test for calling methods on generic type parameters in `const fn`.
|
||||
|
||||
//@ check-pass
|
||||
//@ known-bug: #110395
|
||||
// FIXME(effects) check-pass
|
||||
|
||||
#![feature(const_trait_impl, effects)]
|
||||
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
|
||||
--> $DIR/call-generic-method-pass.rs:10:12
|
||||
|
|
||||
LL | impl const PartialEq for S {
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= 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/call-generic-method-pass.rs:10:6
|
||||
|
|
||||
LL | impl const PartialEq for S {
|
||||
| ^^^^^ 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: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-method-pass.rs:19:32
|
||||
|
|
||||
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/call-generic-method-pass.rs:23:22
|
||||
|
|
||||
LL | pub const EQ: bool = equals_self(&S);
|
||||
| ^^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
||||
|
|
||||
note: required for `S` to implement `PartialEq`
|
||||
--> $DIR/call-generic-method-pass.rs:10:12
|
||||
|
|
||||
LL | impl const PartialEq for S {
|
||||
| ----- ^^^^^^^^^ ^
|
||||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/call-generic-method-pass.rs:15:10
|
||||
|
|
||||
LL | !self.eq(other)
|
||||
| ^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
||||
|
|
||||
note: required for `S` to implement `PartialEq`
|
||||
--> $DIR/call-generic-method-pass.rs:10:12
|
||||
|
|
||||
LL | impl const PartialEq for S {
|
||||
| ----- ^^^^^^^^^ ^
|
||||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0207, E0284.
|
||||
For more information about an error, try `rustc --explain E0207`.
|
|
@ -1,3 +1,12 @@
|
|||
error[E0119]: conflicting implementations of trait `Add` for type `Int`
|
||||
--> $DIR/const-and-non-const-impl.rs:23:1
|
||||
|
|
||||
LL | impl std::ops::Add for Int {
|
||||
| -------------------------- first implementation here
|
||||
...
|
||||
LL | impl const std::ops::Add for Int {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Int`
|
||||
|
||||
error[E0117]: only traits defined in the current crate can be implemented for primitive types
|
||||
--> $DIR/const-and-non-const-impl.rs:7:1
|
||||
|
|
||||
|
@ -10,15 +19,6 @@ LL | impl const std::ops::Add for i32 {
|
|||
|
|
||||
= note: define and implement a trait or new type instead
|
||||
|
||||
error[E0119]: conflicting implementations of trait `Add` for type `Int`
|
||||
--> $DIR/const-and-non-const-impl.rs:23:1
|
||||
|
|
||||
LL | impl std::ops::Add for Int {
|
||||
| -------------------------- first implementation here
|
||||
...
|
||||
LL | impl const std::ops::Add for Int {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Int`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0117, E0119.
|
||||
|
|
|
@ -1,9 +1,27 @@
|
|||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-bound.rs:9:68
|
||||
|
|
||||
LL | const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Destruct {
|
||||
| ^^^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-bound.rs:20:15
|
||||
|
|
||||
LL | T: ~const Destruct,
|
||||
| ^^^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-bound.rs:21:15
|
||||
|
|
||||
LL | E: ~const Destruct,
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0493]: destructor of `E` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop-bound.rs:12:13
|
||||
|
|
||||
LL | Err(_e) => None,
|
||||
| ^^ the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0493`.
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-fail-2.rs:21:26
|
||||
|
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop-fail-2.rs:21:36
|
||||
|
|
||||
|
@ -6,6 +12,6 @@ LL | const fn check<T: ~const Destruct>(_: 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`.
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-fail.rs:24:26
|
||||
|
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop-fail.rs:24:36
|
||||
|
|
||||
|
@ -54,7 +60,7 @@ LL | | }
|
|||
| |_- in this macro invocation
|
||||
= note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0080, E0493.
|
||||
For more information about an error, try `rustc --explain E0080`.
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-fail.rs:24:26
|
||||
|
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop-fail.rs:24:36
|
||||
|
|
||||
|
@ -6,6 +12,6 @@ LL | const fn check<T: ~const Destruct>(_: 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`.
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop.rs:19:22
|
||||
|
|
||||
LL | const fn a<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0493]: destructor of `S<'_>` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop.rs:24:13
|
||||
|
|
||||
|
@ -86,7 +92,7 @@ LL | | }
|
|||
| |_- in this macro invocation
|
||||
= note: this error originates in the macro `implements_const_drop` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0080, E0493.
|
||||
For more information about an error, try `rustc --explain E0080`.
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop.rs:19:22
|
||||
|
|
||||
LL | const fn a<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0493]: destructor of `S<'_>` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop.rs:24:13
|
||||
|
|
||||
|
@ -14,6 +20,6 @@ LL | const fn a<T: ~const Destruct>(_: T) {}
|
|||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0493`.
|
||||
|
|
|
@ -1,28 +1,244 @@
|
|||
error[E0277]: can't compare `()` with `()`
|
||||
--> $DIR/const-impl-trait.rs:36:17
|
||||
error[E0635]: unknown feature `const_cmp`
|
||||
--> $DIR/const-impl-trait.rs:8:5
|
||||
|
|
||||
LL | assert!(cmp(&()));
|
||||
| --- ^^^ no implementation for `() == ()`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `const PartialEq` is not implemented for `()`
|
||||
= help: the trait `PartialEq` is implemented for `()`
|
||||
note: required by a bound in `cmp`
|
||||
--> $DIR/const-impl-trait.rs:13:23
|
||||
LL | const_cmp,
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:13:30
|
||||
|
|
||||
LL | const fn cmp(a: &impl ~const PartialEq) -> bool {
|
||||
| ^^^^^^^^^^^^^^^^ required by this bound in `cmp`
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0369]: binary operation `==` cannot be applied to type `&impl ~const PartialEq`
|
||||
--> $DIR/const-impl-trait.rs:14:7
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:17:30
|
||||
|
|
||||
LL | a == a
|
||||
| - ^^ - &impl ~const PartialEq
|
||||
| |
|
||||
| &impl ~const PartialEq
|
||||
LL | const fn wrap(x: impl ~const PartialEq + ~const Destruct)
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:17:49
|
||||
|
|
||||
LL | const fn wrap(x: impl ~const PartialEq + ~const Destruct)
|
||||
| ^^^^^^^^
|
||||
|
||||
Some errors have detailed explanations: E0277, E0369.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:18:20
|
||||
|
|
||||
LL | -> impl ~const PartialEq + ~const Destruct
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:18:39
|
||||
|
|
||||
LL | -> impl ~const PartialEq + ~const Destruct
|
||||
| ^^^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:18:20
|
||||
|
|
||||
LL | -> impl ~const PartialEq + ~const Destruct
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:18:39
|
||||
|
|
||||
LL | -> impl ~const PartialEq + ~const Destruct
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:25:29
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:25:48
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:25:29
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:25:48
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:25:29
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:25:48
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:29:29
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:29:48
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy {
|
||||
| ^^^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:29:29
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy {
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:29:48
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy {
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:50:41
|
||||
|
|
||||
LL | const fn apit(_: impl ~const T + ~const Destruct) {}
|
||||
| ^^^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:54:73
|
||||
|
|
||||
LL | const fn apit_assoc_bound(_: impl IntoIterator<Item: ~const T> + ~const Destruct) {}
|
||||
| ^^^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:25:29
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:25:48
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
|
||||
--> $DIR/const-impl-trait.rs:37:26
|
||||
|
|
||||
LL | assert!(wrap(123) == wrap(123));
|
||||
| ^^^^^^^^^- value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constants
|
||||
|
||||
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
|
||||
--> $DIR/const-impl-trait.rs:37:26
|
||||
|
|
||||
LL | assert!(wrap(123) == wrap(123));
|
||||
| ^^^^^^^^^- value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constants
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
|
||||
--> $DIR/const-impl-trait.rs:37:13
|
||||
|
|
||||
LL | assert!(wrap(123) == wrap(123));
|
||||
| ^^^^^^^^^ - value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constants
|
||||
|
||||
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
|
||||
--> $DIR/const-impl-trait.rs:37:13
|
||||
|
|
||||
LL | assert!(wrap(123) == wrap(123));
|
||||
| ^^^^^^^^^ - value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constants
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
|
||||
--> $DIR/const-impl-trait.rs:38:26
|
||||
|
|
||||
LL | assert!(wrap(123) != wrap(456));
|
||||
| ^^^^^^^^^- value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constants
|
||||
|
||||
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
|
||||
--> $DIR/const-impl-trait.rs:38:26
|
||||
|
|
||||
LL | assert!(wrap(123) != wrap(456));
|
||||
| ^^^^^^^^^- value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constants
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
|
||||
--> $DIR/const-impl-trait.rs:38:13
|
||||
|
|
||||
LL | assert!(wrap(123) != wrap(456));
|
||||
| ^^^^^^^^^ - value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constants
|
||||
|
||||
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
|
||||
--> $DIR/const-impl-trait.rs:38:13
|
||||
|
|
||||
LL | assert!(wrap(123) != wrap(456));
|
||||
| ^^^^^^^^^ - value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constants
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0493]: destructor of `impl ~const T + ~const Destruct` cannot be evaluated at compile-time
|
||||
--> $DIR/const-impl-trait.rs:50:15
|
||||
|
|
||||
LL | const fn apit(_: impl ~const T + ~const Destruct) {}
|
||||
| ^ - value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error[E0493]: destructor of `impl IntoIterator<Item : ~const T> + ~const Destruct` cannot be evaluated at compile-time
|
||||
--> $DIR/const-impl-trait.rs:54:27
|
||||
|
|
||||
LL | const fn apit_assoc_bound(_: impl IntoIterator<Item: ~const T> + ~const Destruct) {}
|
||||
| ^ - value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error: aborting due to 32 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0493, E0635.
|
||||
For more information about an error, try `rustc --explain E0493`.
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
error[E0635]: unknown feature `const_cmp`
|
||||
--> $DIR/derive-const-use.rs:3:30
|
||||
|
|
||||
LL | #![feature(const_trait_impl, const_cmp, const_default_impls, derive_const, effects)]
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0635]: unknown feature `const_default_impls`
|
||||
--> $DIR/derive-const-use.rs:3:41
|
||||
|
|
||||
|
@ -22,6 +28,24 @@ LL | impl const Default for A {
|
|||
= 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: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
|
||||
--> $DIR/derive-const-use.rs:11:12
|
||||
|
|
||||
LL | impl const PartialEq for A {
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= 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/derive-const-use.rs:11:6
|
||||
|
|
||||
LL | impl const PartialEq for A {
|
||||
| ^^^^^ 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: const `impl` for trait `Default` which is not marked with `#[const_trait]`
|
||||
--> $DIR/derive-const-use.rs:15:16
|
||||
|
|
||||
|
@ -37,6 +61,22 @@ error[E0207]: the const parameter `host` is not constrained by the impl trait, s
|
|||
= 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: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
|
||||
--> $DIR/derive-const-use.rs:15:25
|
||||
|
|
||||
LL | #[derive_const(Default, PartialEq)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= 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
|
||||
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
|
||||
|
|
||||
= 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
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/derive-const-use.rs:18:35
|
||||
|
|
||||
|
@ -50,16 +90,17 @@ LL | #[derive_const(Default, PartialEq)]
|
|||
| ^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/derive-const-use.rs:16:14
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/derive-const-use.rs:18:23
|
||||
|
|
||||
LL | const _: () = assert!(S((), A) == S::default());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
||||
|
|
||||
note: required for `S` to implement `PartialEq`
|
||||
--> $DIR/derive-const-use.rs:15:25
|
||||
|
|
||||
LL | #[derive_const(Default, PartialEq)]
|
||||
| --------- in this derive macro expansion
|
||||
LL | pub struct S((), A);
|
||||
| ^^ expected `host`, found `true`
|
||||
|
|
||||
= note: expected constant `host`
|
||||
found constant `true`
|
||||
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
|
@ -79,7 +120,24 @@ LL | impl const Default for A {
|
|||
| unsatisfied trait bound introduced here
|
||||
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/derive-const-use.rs:16:18
|
||||
|
|
||||
LL | #[derive_const(Default, PartialEq)]
|
||||
| --------- in this derive macro expansion
|
||||
LL | pub struct S((), A);
|
||||
| ^ cannot infer the value of the constant `_`
|
||||
|
|
||||
note: required for `A` to implement `PartialEq`
|
||||
--> $DIR/derive-const-use.rs:11:12
|
||||
|
|
||||
LL | impl const PartialEq for A {
|
||||
| ----- ^^^^^^^^^ ^
|
||||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
Some errors have detailed explanations: E0207, E0284, E0308, E0635.
|
||||
error: aborting due to 14 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0207, E0284, E0635.
|
||||
For more information about an error, try `rustc --explain E0207`.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//@ check-pass
|
||||
//@ known-bug: #110395
|
||||
// FIXME(effects) check-pass
|
||||
|
||||
#![feature(derive_const)]
|
||||
#![feature(const_trait_impl, effects)]
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
|
||||
--> $DIR/derive-const-with-params.rs:7:16
|
||||
|
|
||||
LL | #[derive_const(PartialEq)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= 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
|
||||
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/derive-const-with-params.rs:7:16
|
||||
|
|
||||
LL | #[derive_const(PartialEq)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
|
||||
|
|
||||
= 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/derive-const-with-params.rs:11:5
|
||||
|
|
||||
LL | a == b
|
||||
| ^^^^^^ cannot infer the value of the constant `_`
|
||||
|
|
||||
note: required for `Reverse<i32>` to implement `PartialEq`
|
||||
--> $DIR/derive-const-with-params.rs:7:16
|
||||
|
|
||||
LL | #[derive_const(PartialEq)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0207, E0284.
|
||||
For more information about an error, try `rustc --explain E0207`.
|
|
@ -3,14 +3,13 @@
|
|||
const fn test() -> impl ~const Fn() {
|
||||
//~^ ERROR `~const` can only be applied to `#[const_trait]` traits
|
||||
//~| ERROR `~const` can only be applied to `#[const_trait]` traits
|
||||
//~| ERROR cycle detected
|
||||
const move || { //~ ERROR const closures are experimental
|
||||
let sl: &[u8] = b"foo";
|
||||
|
||||
match sl {
|
||||
[first, remainder @ ..] => {
|
||||
assert_eq!(first, &b'f');
|
||||
//~^ ERROR can't compare `&u8` with `&u8`
|
||||
//~^ ERROR cannot call non-const fn
|
||||
}
|
||||
[] => panic!(),
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0658]: const closures are experimental
|
||||
--> $DIR/ice-112822-expected-type-for-param.rs:7:5
|
||||
--> $DIR/ice-112822-expected-type-for-param.rs:6:5
|
||||
|
|
||||
LL | const move || {
|
||||
| ^^^^^
|
||||
|
@ -22,47 +22,16 @@ LL | const fn test() -> impl ~const Fn() {
|
|||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0277]: can't compare `&u8` with `&u8`
|
||||
--> $DIR/ice-112822-expected-type-for-param.rs:12:17
|
||||
error[E0015]: cannot call non-const fn `core::panicking::assert_failed::<&u8, &u8>` in constant functions
|
||||
--> $DIR/ice-112822-expected-type-for-param.rs:11:17
|
||||
|
|
||||
LL | assert_eq!(first, &b'f');
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `&u8 == &u8`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: the trait `~const PartialEq<&u8>` is not implemented for `&u8`
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0391]: cycle detected when computing type of opaque `test::{opaque#0}`
|
||||
--> $DIR/ice-112822-expected-type-for-param.rs:3:20
|
||||
|
|
||||
LL | const fn test() -> impl ~const Fn() {
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: ...which requires borrow-checking `test`...
|
||||
--> $DIR/ice-112822-expected-type-for-param.rs:3:1
|
||||
|
|
||||
LL | const fn test() -> impl ~const Fn() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: ...which requires promoting constants in MIR for `test`...
|
||||
--> $DIR/ice-112822-expected-type-for-param.rs:3:1
|
||||
|
|
||||
LL | const fn test() -> impl ~const Fn() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: ...which requires const checking `test`...
|
||||
--> $DIR/ice-112822-expected-type-for-param.rs:3:1
|
||||
|
|
||||
LL | const fn test() -> impl ~const Fn() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: ...which requires computing whether `test::{opaque#0}` is freeze...
|
||||
= note: ...which requires evaluating trait selection obligation `test::{opaque#0}: core::marker::Freeze`...
|
||||
= note: ...which again requires computing type of opaque `test::{opaque#0}`, completing the cycle
|
||||
note: cycle used when computing type of `test::{opaque#0}`
|
||||
--> $DIR/ice-112822-expected-type-for-param.rs:3:20
|
||||
|
|
||||
LL | const fn test() -> impl ~const Fn() {
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0391, E0658.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
Some errors have detailed explanations: E0015, E0658.
|
||||
For more information about an error, try `rustc --explain E0015`.
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
//@ check-pass
|
||||
//@ known-bug: #110395
|
||||
// FIXME(effects) check-pass
|
||||
// FIXME(effects) fix intrinsics const parameter counting
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(no_core, lang_items, unboxed_closures, auto_traits, intrinsics, rustc_attrs, staged_api)]
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
error[E0094]: intrinsic has wrong number of const parameters: found 1, expected 0
|
||||
--> $DIR/minicore.rs:517:27
|
||||
|
|
||||
LL | const fn const_eval_select<ARG: Tuple, F, G, RET>(
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ expected 0 const parameters
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0094`.
|
|
@ -0,0 +1,18 @@
|
|||
//@ edition: 2021
|
||||
#![feature(effects)]
|
||||
|
||||
trait MyTrait {}
|
||||
|
||||
impl MyTrait for i32 {
|
||||
async const fn bar(&self) {
|
||||
//~^ ERROR expected one of `extern`
|
||||
//~| ERROR functions in trait impls cannot be declared const
|
||||
//~| ERROR functions cannot be both `const` and `async`
|
||||
//~| ERROR method `bar` is not a member
|
||||
//~| ERROR cycle detected when computing type
|
||||
main8().await;
|
||||
//~^ ERROR cannot find function
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,92 @@
|
|||
error: expected one of `extern`, `fn`, `safe`, or `unsafe`, found keyword `const`
|
||||
--> $DIR/ice-120503-async-const-method.rs:7:11
|
||||
|
|
||||
LL | async const fn bar(&self) {
|
||||
| ------^^^^^
|
||||
| | |
|
||||
| | expected one of `extern`, `fn`, `safe`, or `unsafe`
|
||||
| help: `const` must come before `async`: `const async`
|
||||
|
|
||||
= note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
|
||||
|
||||
error[E0379]: functions in trait impls cannot be declared const
|
||||
--> $DIR/ice-120503-async-const-method.rs:7:11
|
||||
|
|
||||
LL | async const fn bar(&self) {
|
||||
| ^^^^^-
|
||||
| |
|
||||
| functions in trait impls cannot be const
|
||||
| help: remove the `const`
|
||||
|
||||
error: functions cannot be both `const` and `async`
|
||||
--> $DIR/ice-120503-async-const-method.rs:7:5
|
||||
|
|
||||
LL | async const fn bar(&self) {
|
||||
| -^^^^ ^^^^^ `const` because of this
|
||||
| |
|
||||
| _____`async` because of this
|
||||
| |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
... |
|
||||
LL | |
|
||||
LL | | }
|
||||
| |_____-
|
||||
|
||||
error[E0407]: method `bar` is not a member of trait `MyTrait`
|
||||
--> $DIR/ice-120503-async-const-method.rs:7:5
|
||||
|
|
||||
LL | / async const fn bar(&self) {
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
... |
|
||||
LL | |
|
||||
LL | | }
|
||||
| |_____^ not a member of trait `MyTrait`
|
||||
|
||||
error[E0425]: cannot find function `main8` in this scope
|
||||
--> $DIR/ice-120503-async-const-method.rs:13:9
|
||||
|
|
||||
LL | main8().await;
|
||||
| ^^^^^ help: a function with a similar name exists: `main`
|
||||
...
|
||||
LL | fn main() {}
|
||||
| --------- similarly named function `main` defined here
|
||||
|
||||
error[E0391]: cycle detected when computing type of opaque `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar::{opaque#0}`
|
||||
--> $DIR/ice-120503-async-const-method.rs:7:5
|
||||
|
|
||||
LL | async const fn bar(&self) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: ...which requires borrow-checking `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar`...
|
||||
--> $DIR/ice-120503-async-const-method.rs:7:5
|
||||
|
|
||||
LL | async const fn bar(&self) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: ...which requires promoting constants in MIR for `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar`...
|
||||
--> $DIR/ice-120503-async-const-method.rs:7:5
|
||||
|
|
||||
LL | async const fn bar(&self) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: ...which requires const checking `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar`...
|
||||
--> $DIR/ice-120503-async-const-method.rs:7:5
|
||||
|
|
||||
LL | async const fn bar(&self) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: ...which requires computing whether `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar::{opaque#0}` is freeze...
|
||||
= note: ...which requires evaluating trait selection obligation `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar::{opaque#0}: core::marker::Freeze`...
|
||||
= note: ...which again requires computing type of opaque `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar::{opaque#0}`, completing the cycle
|
||||
note: cycle used when computing type of `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar::{opaque#0}`
|
||||
--> $DIR/ice-120503-async-const-method.rs:7:5
|
||||
|
|
||||
LL | async const fn bar(&self) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0379, E0391, E0407, E0425.
|
||||
For more information about an error, try `rustc --explain E0379`.
|
|
@ -0,0 +1,17 @@
|
|||
#![feature(const_trait_impl, effects)]
|
||||
|
||||
pub struct Vec3;
|
||||
|
||||
#[const_trait]
|
||||
pub trait Add {
|
||||
fn add(self) -> Vec3;
|
||||
}
|
||||
|
||||
impl Add for Vec3 {
|
||||
const fn add(self) -> Vec3 {
|
||||
//~^ ERROR functions in trait impls cannot be declared const
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,19 @@
|
|||
error[E0379]: functions in trait impls cannot be declared const
|
||||
--> $DIR/ice-121536-const-method.rs:11:5
|
||||
|
|
||||
LL | const fn add(self) -> Vec3 {
|
||||
| ^^^^^ functions in trait impls cannot be const
|
||||
|
|
||||
help: remove the `const` ...
|
||||
|
|
||||
LL - const fn add(self) -> Vec3 {
|
||||
LL + fn add(self) -> Vec3 {
|
||||
|
|
||||
help: ... and declare the impl to be const instead
|
||||
|
|
||||
LL | impl const Add for Vec3 {
|
||||
| +++++
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0379`.
|
|
@ -1,3 +1,9 @@
|
|||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/issue-92111.rs:20:22
|
||||
|
|
||||
LL | const fn a<T: ~const Destruct>(t: T) {}
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/issue-92111.rs:20:32
|
||||
|
|
||||
|
@ -6,6 +12,6 @@ LL | const fn a<T: ~const Destruct>(t: 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`.
|
||||
|
|
|
@ -11,19 +11,6 @@ LL | <i32 as Add<u32>>::add(1, 2);
|
|||
`i32` implements `Add<&i32>`
|
||||
`i32` implements `Add`
|
||||
|
||||
error[E0277]: cannot add `u32` to `i32`
|
||||
--> $DIR/ufcs-qpath-self-mismatch.rs:4:5
|
||||
|
|
||||
LL | <i32 as Add<u32>>::add(1, 2);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `i32 + u32`
|
||||
|
|
||||
= help: the trait `Add<u32>` is not implemented for `i32`
|
||||
= help: the following other types implement trait `Add<Rhs>`:
|
||||
`&'a i32` implements `Add<i32>`
|
||||
`&i32` implements `Add<&i32>`
|
||||
`i32` implements `Add<&i32>`
|
||||
`i32` implements `Add`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/ufcs-qpath-self-mismatch.rs:7:28
|
||||
|
|
||||
|
@ -68,6 +55,19 @@ help: change the type of the numeric literal from `u32` to `i32`
|
|||
LL | <i32 as Add<i32>>::add(1, 2i32);
|
||||
| ~~~
|
||||
|
||||
error[E0277]: cannot add `u32` to `i32`
|
||||
--> $DIR/ufcs-qpath-self-mismatch.rs:4:5
|
||||
|
|
||||
LL | <i32 as Add<u32>>::add(1, 2);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `i32 + u32`
|
||||
|
|
||||
= help: the trait `Add<u32>` is not implemented for `i32`
|
||||
= help: the following other types implement trait `Add<Rhs>`:
|
||||
`&'a i32` implements `Add<i32>`
|
||||
`&i32` implements `Add<&i32>`
|
||||
`i32` implements `Add<&i32>`
|
||||
`i32` implements `Add`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0308.
|
||||
|
|
Loading…
Reference in a new issue