Rollup merge of #142822 - oli-obk:const-partial-eq, r=fee1-dead
Make `PartialEq` a `const_trait` r? ``@fee1-dead`` or ``@compiler-errors`` something generally useful but also required for https://github.com/rust-lang/rust/pull/142789
This commit is contained in:
commit
c8df66f84c
25 changed files with 118 additions and 607 deletions
|
|
@ -247,6 +247,8 @@ use crate::ops::ControlFlow;
|
|||
append_const_msg
|
||||
)]
|
||||
#[rustc_diagnostic_item = "PartialEq"]
|
||||
#[const_trait]
|
||||
#[rustc_const_unstable(feature = "const_trait_impl", issue = "67792")]
|
||||
pub trait PartialEq<Rhs: PointeeSized = Self>: PointeeSized {
|
||||
/// Tests for `self` and `other` values to be equal, and is used by `==`.
|
||||
#[must_use]
|
||||
|
|
@ -1811,7 +1813,8 @@ mod impls {
|
|||
macro_rules! partial_eq_impl {
|
||||
($($t:ty)*) => ($(
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl PartialEq for $t {
|
||||
#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
|
||||
impl const PartialEq for $t {
|
||||
#[inline]
|
||||
fn eq(&self, other: &Self) -> bool { *self == *other }
|
||||
#[inline]
|
||||
|
|
@ -2018,9 +2021,10 @@ mod impls {
|
|||
// & pointers
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A: PointeeSized, B: PointeeSized> PartialEq<&B> for &A
|
||||
#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
|
||||
impl<A: PointeeSized, B: PointeeSized> const PartialEq<&B> for &A
|
||||
where
|
||||
A: PartialEq<B>,
|
||||
A: ~const PartialEq<B>,
|
||||
{
|
||||
#[inline]
|
||||
fn eq(&self, other: &&B) -> bool {
|
||||
|
|
@ -2089,9 +2093,10 @@ mod impls {
|
|||
// &mut pointers
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A: PointeeSized, B: PointeeSized> PartialEq<&mut B> for &mut A
|
||||
#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
|
||||
impl<A: PointeeSized, B: PointeeSized> const PartialEq<&mut B> for &mut A
|
||||
where
|
||||
A: PartialEq<B>,
|
||||
A: ~const PartialEq<B>,
|
||||
{
|
||||
#[inline]
|
||||
fn eq(&self, other: &&mut B) -> bool {
|
||||
|
|
@ -2158,9 +2163,10 @@ mod impls {
|
|||
impl<A: PointeeSized> Eq for &mut A where A: Eq {}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A: PointeeSized, B: PointeeSized> PartialEq<&mut B> for &A
|
||||
#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
|
||||
impl<A: PointeeSized, B: PointeeSized> const PartialEq<&mut B> for &A
|
||||
where
|
||||
A: PartialEq<B>,
|
||||
A: ~const PartialEq<B>,
|
||||
{
|
||||
#[inline]
|
||||
fn eq(&self, other: &&mut B) -> bool {
|
||||
|
|
@ -2173,9 +2179,10 @@ mod impls {
|
|||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A: PointeeSized, B: PointeeSized> PartialEq<&B> for &mut A
|
||||
#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
|
||||
impl<A: PointeeSized, B: PointeeSized> const PartialEq<&B> for &mut A
|
||||
where
|
||||
A: PartialEq<B>,
|
||||
A: ~const PartialEq<B>,
|
||||
{
|
||||
#[inline]
|
||||
fn eq(&self, other: &&B) -> bool {
|
||||
|
|
|
|||
|
|
@ -6,11 +6,10 @@ use std::any::TypeId;
|
|||
fn main() {
|
||||
const {
|
||||
assert!(TypeId::of::<u8>() == TypeId::of::<u8>());
|
||||
//~^ ERROR cannot call non-const operator in constants
|
||||
//~^ ERROR the trait bound `TypeId: const PartialEq` is not satisfied
|
||||
assert!(TypeId::of::<()>() != TypeId::of::<u8>());
|
||||
//~^ ERROR cannot call non-const operator in constants
|
||||
//~^ ERROR the trait bound `TypeId: const PartialEq` is not satisfied
|
||||
let _a = TypeId::of::<u8>() < TypeId::of::<u16>();
|
||||
//~^ ERROR cannot call non-const operator in constants
|
||||
// can't assert `_a` because it is not deterministic
|
||||
// FIXME(const_trait_impl) make it pass
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,33 +1,15 @@
|
|||
error[E0015]: cannot call non-const operator in constants
|
||||
error[E0277]: the trait bound `TypeId: const PartialEq` is not satisfied
|
||||
--> $DIR/const_cmp_type_id.rs:8:17
|
||||
|
|
||||
LL | assert!(TypeId::of::<u8>() == TypeId::of::<u8>());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: impl defined here, but it is not `const`
|
||||
--> $SRC_DIR/core/src/any.rs:LL:COL
|
||||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0015]: cannot call non-const operator in constants
|
||||
error[E0277]: the trait bound `TypeId: const PartialEq` is not satisfied
|
||||
--> $DIR/const_cmp_type_id.rs:10:17
|
||||
|
|
||||
LL | assert!(TypeId::of::<()>() != TypeId::of::<u8>());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: impl defined here, but it is not `const`
|
||||
--> $SRC_DIR/core/src/any.rs:LL:COL
|
||||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0015]: cannot call non-const operator in constants
|
||||
--> $DIR/const_cmp_type_id.rs:12:18
|
||||
|
|
||||
LL | let _a = TypeId::of::<u8>() < TypeId::of::<u16>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: impl defined here, but it is not `const`
|
||||
--> $SRC_DIR/core/src/any.rs:LL:COL
|
||||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
|
|||
|
|
@ -4,12 +4,6 @@ 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:7:12
|
||||
|
|
||||
LL | #![feature(const_cmp)]
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:14:8
|
||||
|
|
||||
|
|
@ -155,21 +149,17 @@ note: `FnMut` can't be used with `~const` because it isn't annotated with `#[con
|
|||
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0015]: cannot call non-const operator in constants
|
||||
error[E0277]: the trait bound `(i32, i32, i32): const PartialEq` is not satisfied
|
||||
--> $DIR/fn_trait_refs.rs:71:17
|
||||
|
|
||||
LL | assert!(test_one == (1, 1, 1));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0015]: cannot call non-const operator in constants
|
||||
error[E0277]: the trait bound `(i32, i32): const PartialEq` is not satisfied
|
||||
--> $DIR/fn_trait_refs.rs:74:17
|
||||
|
|
||||
LL | assert!(test_two == (2, 2));
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0015]: cannot call non-const closure in constant functions
|
||||
--> $DIR/fn_trait_refs.rs:16:5
|
||||
|
|
@ -195,7 +185,7 @@ LL | f()
|
|||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error: aborting due to 22 previous errors
|
||||
error: aborting due to 21 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0015, E0635.
|
||||
Some errors have detailed explanations: E0015, E0277, E0635.
|
||||
For more information about an error, try `rustc --explain E0015`.
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
error[E0015]: cannot call non-const operator in constant functions
|
||||
error[E0277]: the trait bound `TypeId: ~const PartialEq` is not satisfied
|
||||
--> $DIR/issue-73976-monomorphic.rs:21:5
|
||||
|
|
||||
LL | GetTypeId::<T>::VALUE == GetTypeId::<usize>::VALUE
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: impl defined here, but it is not `const`
|
||||
--> $SRC_DIR/core/src/any.rs:LL:COL
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
|
|||
|
|
@ -3,22 +3,31 @@
|
|||
#![allow(dead_code)]
|
||||
|
||||
const fn f(a: &u8, b: &u8) -> bool {
|
||||
//~^ HELP: add `#![feature(const_trait_impl)]` to the crate attributes to enable
|
||||
//~| HELP: add `#![feature(const_trait_impl)]` to the crate attributes to enable
|
||||
//~| HELP: add `#![feature(const_trait_impl)]` to the crate attributes to enable
|
||||
a == b
|
||||
//~^ ERROR: cannot call non-const operator in constant functions [E0015]
|
||||
//~^ ERROR: cannot call conditionally-const operator in constant functions
|
||||
//~| ERROR: `PartialEq` is not yet stable as a const trait
|
||||
//~| HELP: consider dereferencing here
|
||||
//~| HELP: add `#![feature(const_trait_impl)]` to the crate attributes to enable
|
||||
}
|
||||
|
||||
const fn g(a: &&&&i64, b: &&&&i64) -> bool {
|
||||
a == b
|
||||
//~^ ERROR: cannot call non-const operator in constant functions [E0015]
|
||||
//~^ ERROR: cannot call conditionally-const operator in constant functions
|
||||
//~| ERROR: `PartialEq` is not yet stable as a const trait
|
||||
//~| HELP: consider dereferencing here
|
||||
//~| HELP: add `#![feature(const_trait_impl)]` to the crate attributes to enable
|
||||
}
|
||||
|
||||
const fn h(mut a: &[u8], mut b: &[u8]) -> bool {
|
||||
while let ([l, at @ ..], [r, bt @ ..]) = (a, b) {
|
||||
if l == r {
|
||||
//~^ ERROR: cannot call non-const operator in constant functions [E0015]
|
||||
//~^ ERROR: cannot call conditionally-const operator in constant functions
|
||||
//~| ERROR: `PartialEq` is not yet stable as a const trait
|
||||
//~| HELP: consider dereferencing here
|
||||
//~| HELP: add `#![feature(const_trait_impl)]` to the crate attributes to enable
|
||||
a = at;
|
||||
b = bt;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,39 +1,81 @@
|
|||
error[E0015]: cannot call non-const operator in constant functions
|
||||
--> $DIR/issue-90870.rs:6:5
|
||||
error[E0658]: cannot call conditionally-const operator in constant functions
|
||||
--> $DIR/issue-90870.rs:9:5
|
||||
|
|
||||
LL | a == b
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
|
||||
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
help: consider dereferencing here
|
||||
|
|
||||
LL | *a == *b
|
||||
| + +
|
||||
|
||||
error[E0015]: cannot call non-const operator in constant functions
|
||||
--> $DIR/issue-90870.rs:12:5
|
||||
error: `PartialEq` is not yet stable as a const trait
|
||||
--> $DIR/issue-90870.rs:9:5
|
||||
|
|
||||
LL | a == b
|
||||
| ^^^^^^
|
||||
|
|
||||
help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
|
||||
|
|
||||
LL + #![feature(const_trait_impl)]
|
||||
|
|
||||
|
||||
error[E0658]: cannot call conditionally-const operator in constant functions
|
||||
--> $DIR/issue-90870.rs:17:5
|
||||
|
|
||||
LL | a == b
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
|
||||
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
help: consider dereferencing here
|
||||
|
|
||||
LL | ****a == ****b
|
||||
| ++++ ++++
|
||||
|
||||
error[E0015]: cannot call non-const operator in constant functions
|
||||
--> $DIR/issue-90870.rs:19:12
|
||||
error: `PartialEq` is not yet stable as a const trait
|
||||
--> $DIR/issue-90870.rs:17:5
|
||||
|
|
||||
LL | a == b
|
||||
| ^^^^^^
|
||||
|
|
||||
help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
|
||||
|
|
||||
LL + #![feature(const_trait_impl)]
|
||||
|
|
||||
|
||||
error[E0658]: cannot call conditionally-const operator in constant functions
|
||||
--> $DIR/issue-90870.rs:26:12
|
||||
|
|
||||
LL | if l == r {
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
|
||||
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
help: consider dereferencing here
|
||||
|
|
||||
LL | if *l == *r {
|
||||
| + +
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: `PartialEq` is not yet stable as a const trait
|
||||
--> $DIR/issue-90870.rs:26:12
|
||||
|
|
||||
LL | if l == r {
|
||||
| ^^^^^^
|
||||
|
|
||||
help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
|
||||
|
|
||||
LL + #![feature(const_trait_impl)]
|
||||
|
|
||||
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
//@ known-bug: #110395
|
||||
|
||||
#![feature(const_trait_impl, const_ops)]
|
||||
//@ check-pass
|
||||
|
||||
struct Int(i32);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
|
||||
--> $DIR/call-const-trait-method-pass.rs:15:12
|
||||
|
|
||||
LL | impl const PartialEq for Int {
|
||||
| ^^^^^^^^^ this trait is not `const`
|
||||
|
|
||||
= 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[E0015]: cannot call non-const method `<Int as PartialEq>::eq` in constant functions
|
||||
--> $DIR/call-const-trait-method-pass.rs:20:15
|
||||
|
|
||||
LL | !self.eq(other)
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
//@ known-bug: #110395
|
||||
// FIXME(const_trait_impl) check-pass
|
||||
//@ check-pass
|
||||
#![feature(const_trait_impl)]
|
||||
|
||||
#[const_trait]
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-in-impl.rs:10:9
|
||||
|
|
||||
LL | impl<T: ~const PartialEq> const MyPartialEq for T {
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-in-impl.rs:10:9
|
||||
|
|
||||
LL | impl<T: ~const PartialEq> const MyPartialEq for T {
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0015]: cannot call non-const method `<T as PartialEq>::eq` in constant functions
|
||||
--> $DIR/call-generic-in-impl.rs:12:9
|
||||
|
|
||||
LL | PartialEq::eq(self, other)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
//! Basic test for calling methods on generic type parameters in `const fn`.
|
||||
|
||||
//@ known-bug: #110395
|
||||
//@ compile-flags: -Znext-solver
|
||||
// FIXME(const_trait_impl) check-pass
|
||||
//@ check-pass
|
||||
|
||||
#![feature(const_trait_impl)]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,66 +0,0 @@
|
|||
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
|
||||
--> $DIR/call-generic-method-chain.rs:11:12
|
||||
|
|
||||
LL | impl const PartialEq for S {
|
||||
| ^^^^^^^^^ this trait is not `const`
|
||||
|
|
||||
= 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: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-method-chain.rs:20:25
|
||||
|
|
||||
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-method-chain.rs:20:25
|
||||
|
|
||||
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-method-chain.rs:24:33
|
||||
|
|
||||
LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool {
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-method-chain.rs:24:33
|
||||
|
|
||||
LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool {
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0015]: cannot call non-const operator in constant functions
|
||||
--> $DIR/call-generic-method-chain.rs:21:5
|
||||
|
|
||||
LL | *t == *t
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0015]: cannot call non-const method `<S as PartialEq>::eq` in constant functions
|
||||
--> $DIR/call-generic-method-chain.rs:16:15
|
||||
|
|
||||
LL | !self.eq(other)
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
//@ compile-flags: -Znext-solver
|
||||
//@ known-bug: #110395
|
||||
// FIXME(const_trait_impl) check-pass
|
||||
//@ check-pass
|
||||
|
||||
#![feature(const_trait_impl)]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,74 +0,0 @@
|
|||
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
|
||||
--> $DIR/call-generic-method-dup-bound.rs:9:12
|
||||
|
|
||||
LL | impl const PartialEq for S {
|
||||
| ^^^^^^^^^ this trait is not `const`
|
||||
|
|
||||
= 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: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-method-dup-bound.rs:20:37
|
||||
|
|
||||
LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool {
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-method-dup-bound.rs:20:37
|
||||
|
|
||||
LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool {
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-method-dup-bound.rs:27:30
|
||||
|
|
||||
LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool {
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-method-dup-bound.rs:27:30
|
||||
|
|
||||
LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool {
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0015]: cannot call non-const operator in constant functions
|
||||
--> $DIR/call-generic-method-dup-bound.rs:21:5
|
||||
|
|
||||
LL | *t == *t
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0015]: cannot call non-const method `<S as PartialEq>::eq` in constant functions
|
||||
--> $DIR/call-generic-method-dup-bound.rs:14:15
|
||||
|
|
||||
LL | !self.eq(other)
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0015]: cannot call non-const operator in constant functions
|
||||
--> $DIR/call-generic-method-dup-bound.rs:28:5
|
||||
|
|
||||
LL | *t == *t
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
pub const fn equals_self<T: PartialEq>(t: &T) -> bool {
|
||||
*t == *t
|
||||
//~^ ERROR cannot call non-const operator in constant functions
|
||||
//~^ ERROR the trait bound `T: ~const PartialEq` is not satisfied
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
error[E0015]: cannot call non-const operator in constant functions
|
||||
error[E0277]: the trait bound `T: ~const PartialEq` is not satisfied
|
||||
--> $DIR/call-generic-method-fail.rs:5:5
|
||||
|
|
||||
LL | *t == *t
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
//! Basic test for calling methods on generic type parameters in `const fn`.
|
||||
|
||||
//@ compile-flags: -Znext-solver
|
||||
//@ known-bug: #110395
|
||||
// FIXME(const_trait_impl) check-pass
|
||||
//@ check-pass
|
||||
|
||||
#![feature(const_trait_impl)]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
|
||||
--> $DIR/call-generic-method-pass.rs:11:12
|
||||
|
|
||||
LL | impl const PartialEq for S {
|
||||
| ^^^^^^^^^ this trait is not `const`
|
||||
|
|
||||
= 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: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-method-pass.rs:20:25
|
||||
|
|
||||
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-method-pass.rs:20:25
|
||||
|
|
||||
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0015]: cannot call non-const operator in constant functions
|
||||
--> $DIR/call-generic-method-pass.rs:21:5
|
||||
|
|
||||
LL | *t == *t
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0015]: cannot call non-const method `<S as PartialEq>::eq` in constant functions
|
||||
--> $DIR/call-generic-method-pass.rs:16:15
|
||||
|
|
||||
LL | !self.eq(other)
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
|
|
@ -1,197 +1,17 @@
|
|||
error[E0635]: unknown feature `const_cmp`
|
||||
--> $DIR/const-impl-trait.rs:7:30
|
||||
error[E0277]: the trait bound `(): const PartialEq` is not satisfied
|
||||
--> $DIR/const-impl-trait.rs:34:17
|
||||
|
|
||||
LL | #![feature(const_trait_impl, const_cmp, const_destruct)]
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
LL | assert!(cmp(&()));
|
||||
| --- ^^^
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: required by a bound in `cmp`
|
||||
--> $DIR/const-impl-trait.rs:11:23
|
||||
|
|
||||
LL | const fn cmp(a: &impl ~const PartialEq) -> bool {
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
| ^^^^^^^^^^^^^^^^ required by this bound in `cmp`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:11:23
|
||||
|
|
||||
LL | const fn cmp(a: &impl ~const PartialEq) -> bool {
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:16:13
|
||||
|
|
||||
LL | x: impl ~const PartialEq + ~const Destruct,
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:16:13
|
||||
|
|
||||
LL | x: impl ~const PartialEq + ~const Destruct,
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
= 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:17:11
|
||||
|
|
||||
LL | ) -> impl ~const PartialEq + ~const Destruct {
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:17:11
|
||||
|
|
||||
LL | ) -> impl ~const PartialEq + ~const Destruct {
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
= 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:23:22
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:27:22
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy {
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:17:11
|
||||
|
|
||||
LL | ) -> impl ~const PartialEq + ~const Destruct {
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
= 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:27:22
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy {
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
= 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:27:22
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy {
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
= 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:23:22
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
= 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:23:22
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
= 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:23:22
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
= 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:23:22
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
= 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:23:22
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
|
||||
| ^^^^^^ can't be applied to `PartialEq`
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0015]: cannot call non-const operator in constants
|
||||
--> $DIR/const-impl-trait.rs:35:13
|
||||
|
|
||||
LL | assert!(wrap(123) == wrap(123));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0015]: cannot call non-const operator in constants
|
||||
--> $DIR/const-impl-trait.rs:36:13
|
||||
|
|
||||
LL | assert!(wrap(123) != wrap(456));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0015]: cannot call non-const operator in constants
|
||||
--> $DIR/const-impl-trait.rs:38:13
|
||||
|
|
||||
LL | assert!(x == x);
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0015]: cannot call non-const operator in constant functions
|
||||
--> $DIR/const-impl-trait.rs:12:5
|
||||
|
|
||||
LL | a == a
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error: aborting due to 21 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0015, E0635.
|
||||
For more information about an error, try `rustc --explain E0015`.
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
|
|||
|
|
@ -1,9 +1,3 @@
|
|||
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)]
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0635]: unknown feature `const_default_impls`
|
||||
--> $DIR/derive-const-use.rs:3:41
|
||||
|
|
||||
|
|
@ -28,23 +22,13 @@ 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
|
||||
|
||||
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 {
|
||||
| ^^^^^^^^^ this trait is not `const`
|
||||
|
|
||||
= 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: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
|
||||
--> $DIR/derive-const-use.rs:15:25
|
||||
error[E0277]: the trait bound `(): ~const PartialEq` is not satisfied
|
||||
--> $DIR/derive-const-use.rs:16:14
|
||||
|
|
||||
LL | #[derive_const(Default, PartialEq)]
|
||||
| ^^^^^^^^^ this trait is not `const`
|
||||
|
|
||||
= 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
|
||||
| --------- in this derive macro expansion
|
||||
LL | pub struct S((), A);
|
||||
| ^^
|
||||
|
||||
error[E0015]: cannot call non-const associated function `<S as Default>::default` in constants
|
||||
--> $DIR/derive-const-use.rs:18:35
|
||||
|
|
@ -54,14 +38,6 @@ LL | const _: () = assert!(S((), A) == S::default());
|
|||
|
|
||||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0015]: cannot call non-const operator in constants
|
||||
--> $DIR/derive-const-use.rs:18:23
|
||||
|
|
||||
LL | const _: () = assert!(S((), A) == S::default());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0015]: cannot call non-const associated function `<() as Default>::default` in constant functions
|
||||
--> $DIR/derive-const-use.rs:16:14
|
||||
|
|
||||
|
|
@ -82,27 +58,7 @@ LL | pub struct S((), A);
|
|||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0015]: cannot call non-const operator in constant functions
|
||||
--> $DIR/derive-const-use.rs:16:14
|
||||
|
|
||||
LL | #[derive_const(Default, PartialEq)]
|
||||
| --------- in this derive macro expansion
|
||||
LL | pub struct S((), A);
|
||||
| ^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
error[E0015]: cannot call non-const operator in constant functions
|
||||
--> $DIR/derive-const-use.rs:16:18
|
||||
|
|
||||
LL | #[derive_const(Default, PartialEq)]
|
||||
| --------- in this derive macro expansion
|
||||
LL | pub struct S((), A);
|
||||
| ^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error: aborting due to 12 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0015, E0635.
|
||||
Some errors have detailed explanations: E0015, E0277, E0635.
|
||||
For more information about an error, try `rustc --explain E0015`.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
//@ known-bug: #110395
|
||||
// FIXME(const_trait_impl) check-pass
|
||||
//@ check-pass
|
||||
|
||||
#![feature(derive_const)]
|
||||
#![feature(const_trait_impl)]
|
||||
|
|
|
|||
|
|
@ -1,35 +0,0 @@
|
|||
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)]
|
||||
| ^^^^^^^^^ this trait is not `const`
|
||||
|
|
||||
= 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: `~const` can only be applied to `#[const_trait]` traits
|
||||
|
|
||||
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
|
||||
error[E0015]: cannot call non-const operator in constant functions
|
||||
--> $DIR/derive-const-with-params.rs:8:23
|
||||
|
|
||||
LL | #[derive_const(PartialEq)]
|
||||
| --------- in this derive macro expansion
|
||||
LL | pub struct Reverse<T>(T);
|
||||
| ^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0015]: cannot call non-const operator in constant functions
|
||||
--> $DIR/derive-const-with-params.rs:11:5
|
||||
|
|
||||
LL | a == b
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
|
|
@ -11,7 +11,6 @@ const fn test() -> impl ~const Fn() {
|
|||
[first, remainder @ ..] => {
|
||||
assert_eq!(first, &b'f');
|
||||
//~^ ERROR cannot call non-const function
|
||||
//~| ERROR cannot call non-const operator
|
||||
}
|
||||
[] => panic!(),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,15 +37,6 @@ note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_
|
|||
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0015]: cannot call non-const operator in constant functions
|
||||
--> $DIR/ice-112822-expected-type-for-param.rs:12:17
|
||||
|
|
||||
LL | assert_eq!(first, &b'f');
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= 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[E0015]: cannot call non-const function `core::panicking::assert_failed::<&u8, &u8>` in constant functions
|
||||
--> $DIR/ice-112822-expected-type-for-param.rs:12:17
|
||||
|
|
||||
|
|
@ -55,7 +46,7 @@ LL | assert_eq!(first, &b'f');
|
|||
= 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: aborting due to 6 previous errors
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0015, E0658.
|
||||
For more information about an error, try `rustc --explain E0015`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue