Auto merge of #118661 - fee1-dead-contrib:restore-const-partialEq, r=compiler-errors
Restore `const PartialEq` And thus fixes a number of tests. There is a bug that still needs to be fixed, so WIP for now. r? `@compiler-errors`
This commit is contained in:
commit
6f40082313
38 changed files with 154 additions and 199 deletions
|
|
@ -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:8:12
|
||||
|
|
||||
LL | #![feature(const_cmp)]
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: ~const can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:15:15
|
||||
|
|
||||
|
|
@ -80,6 +74,6 @@ LL | T: ~const FnMut<()> + ~const Destruct,
|
|||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: aborting due to 12 previous errors
|
||||
error: aborting due to 11 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0635`.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// known-bug: #110395
|
||||
// check-pass
|
||||
#![feature(const_trait_impl)]
|
||||
|
||||
#[const_trait]
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
error: ~const can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-in-impl.rs:9:16
|
||||
|
|
||||
LL | impl<T: ~const PartialEq> const MyPartialEq for T {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
//! Basic test for calling methods on generic type parameters in `const fn`.
|
||||
|
||||
// known-bug: #110395
|
||||
// check-pass
|
||||
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_trait_impl, effects)]
|
||||
|
||||
struct S;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
error: ~const can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-method-chain.rs:18: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:22:40
|
||||
|
|
||||
LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// known-bug: #110395
|
||||
// check-pass
|
||||
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_trait_impl, effects)]
|
||||
|
||||
struct S;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
error: ~const can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-method-dup-bound.rs:18: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:25:37
|
||||
|
|
||||
LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
@ -1,10 +1,9 @@
|
|||
// FIXME(effects)
|
||||
// check-pass
|
||||
#![feature(const_trait_impl, effects)]
|
||||
|
||||
pub const fn equals_self<T: PartialEq>(t: &T) -> bool {
|
||||
*t == *t
|
||||
// (remove this) ~^ ERROR can't compare
|
||||
//~^ ERROR mismatched types
|
||||
// FIXME(effects): diagnostic
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
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`.
|
||||
|
|
@ -21,7 +21,6 @@ const fn equals_self<T: ~const Foo>(t: &T) -> bool {
|
|||
// it not using the impl.
|
||||
|
||||
pub const EQ: bool = equals_self(&S);
|
||||
//~^ ERROR
|
||||
// FIXME(effects) the diagnostics here isn't ideal, we shouldn't get `<false>`
|
||||
//~^ ERROR: the trait bound `S: ~const Foo` is not satisfied
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
//! Basic test for calling methods on generic type parameters in `const fn`.
|
||||
|
||||
// known-bug: #110395
|
||||
// check-pass
|
||||
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_trait_impl, effects)]
|
||||
|
||||
struct S;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
error: ~const can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/call-generic-method-pass.rs:18:32
|
||||
|
|
||||
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
#![feature(
|
||||
associated_type_bounds,
|
||||
const_trait_impl,
|
||||
effects,
|
||||
const_cmp,
|
||||
)]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,39 +1,28 @@
|
|||
error[E0635]: unknown feature `const_cmp`
|
||||
--> $DIR/const-impl-trait.rs:6:5
|
||||
|
|
||||
LL | const_cmp,
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: ~const can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:11:30
|
||||
|
|
||||
LL | const fn cmp(a: &impl ~const PartialEq) -> bool {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: ~const can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:15:30
|
||||
|
|
||||
LL | const fn wrap(x: impl ~const PartialEq + ~const Destruct)
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: ~const can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:16:20
|
||||
|
|
||||
LL | -> impl ~const PartialEq + ~const Destruct
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: ~const can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-impl-trait.rs:23: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:27:29
|
||||
error[E0277]: can't compare `impl PartialEq + Destruct + Copy` with `impl PartialEq + Destruct + Copy`
|
||||
--> $DIR/const-impl-trait.rs:28:17
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy {
|
||||
| ^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `impl PartialEq + Destruct + Copy == impl PartialEq + Destruct + Copy`
|
||||
|
|
||||
= help: the trait `~const PartialEq` is not implemented for `impl PartialEq + Destruct + Copy`
|
||||
note: required by a bound in `Foo::{opaque#0}`
|
||||
--> $DIR/const-impl-trait.rs:24:22
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
|
||||
| ^^^^^^^^^^^^^^^^ required by this bound in `Foo::{opaque#0}`
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
error[E0277]: can't drop `impl PartialEq + Destruct + Copy`
|
||||
--> $DIR/const-impl-trait.rs:28:17
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `impl PartialEq + Destruct + Copy`
|
||||
|
|
||||
note: required by a bound in `Foo::{opaque#0}`
|
||||
--> $DIR/const-impl-trait.rs:24:41
|
||||
|
|
||||
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
|
||||
| ^^^^^^^^^^^^^^^ required by this bound in `Foo::{opaque#0}`
|
||||
|
||||
For more information about this error, try `rustc --explain E0635`.
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
// known-bug: #110395
|
||||
#![feature(const_trait_impl, const_cmp, const_default_impls, derive_const)]
|
||||
|
||||
#![feature(const_trait_impl, const_cmp, const_default_impls, derive_const, effects)]
|
||||
|
||||
pub struct A;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,28 @@
|
|||
error[E0635]: unknown feature `const_cmp`
|
||||
--> $DIR/derive-const-use.rs:2: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:2:41
|
||||
--> $DIR/derive-const-use.rs:3:41
|
||||
|
|
||||
LL | #![feature(const_trait_impl, const_cmp, const_default_impls, derive_const)]
|
||||
LL | #![feature(const_trait_impl, const_cmp, const_default_impls, derive_const, effects)]
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: const `impl` for trait `Default` which is not marked with `#[const_trait]`
|
||||
--> $DIR/derive-const-use.rs:7:12
|
||||
|
|
||||
LL | impl const Default 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: const `impl` for trait `Default` which is not marked with `#[const_trait]`
|
||||
--> $DIR/derive-const-use.rs:15:16
|
||||
|
|
||||
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 `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0635`.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// known-bug: #110395
|
||||
// check-pass
|
||||
|
||||
#![feature(derive_const)]
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_trait_impl, effects)]
|
||||
|
||||
#[derive_const(PartialEq)]
|
||||
pub struct Reverse<T>(T);
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
error: ~const can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/derive-const-with-params.rs:6: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: aborting due to 1 previous error
|
||||
|
||||
|
|
@ -16,10 +16,6 @@ help: consider annotating `S<T>` with `#[derive(PartialEq)]`
|
|||
LL + #[derive(PartialEq)]
|
||||
LL | struct S<T>(T);
|
||||
|
|
||||
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
||||
|
|
||||
LL | pub fn foo<T>(s: S<T>, t: S<T>) where S<T>: PartialEq {
|
||||
| +++++++++++++++++++++
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue