Skip to content

Commit 8114474

Browse files
Add next-solver to more effects tests
1 parent e2abe9e commit 8114474

23 files changed

+102
-104
lines changed

tests/ui/consts/const-try.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ known-bug: #110395
1+
//@ compile-flags: -Znext-solver
22

33
// Demonstrates what's needed to make use of `?` in const contexts.
44

@@ -14,12 +14,14 @@ struct TryMe;
1414
struct Error;
1515

1616
impl const FromResidual<Error> for TryMe {
17+
//~^ ERROR const `impl` for trait `FromResidual` which is not marked with `#[const_trait]`
1718
fn from_residual(residual: Error) -> Self {
1819
TryMe
1920
}
2021
}
2122

2223
impl const Try for TryMe {
24+
//~^ ERROR const `impl` for trait `Try` which is not marked with `#[const_trait]`
2325
type Output = ();
2426
type Residual = Error;
2527
fn from_output(output: Self::Output) -> Self {

tests/ui/consts/const-try.stderr

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
error: using `#![feature(effects)]` without enabling next trait solver globally
2-
|
3-
= note: the next trait solver must be enabled globally for the effects feature to work correctly
4-
= help: use `-Znext-solver` to enable
5-
61
error: const `impl` for trait `FromResidual` which is not marked with `#[const_trait]`
72
--> $DIR/const-try.rs:16:12
83
|
@@ -13,13 +8,13 @@ LL | impl const FromResidual<Error> for TryMe {
138
= note: adding a non-const method body in the future would be a breaking change
149

1510
error: const `impl` for trait `Try` which is not marked with `#[const_trait]`
16-
--> $DIR/const-try.rs:22:12
11+
--> $DIR/const-try.rs:23:12
1712
|
1813
LL | impl const Try for TryMe {
1914
| ^^^
2015
|
2116
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
2217
= note: adding a non-const method body in the future would be a breaking change
2318

24-
error: aborting due to 3 previous errors
19+
error: aborting due to 2 previous errors
2520

tests/ui/traits/const-traits/assoc-type-const-bound-usage-0.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ compile-flags: -Znext-solver
12
//@ known-bug: unknown
23

34
#![allow(incomplete_features)]
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
error: using `#![feature(effects)]` without enabling next trait solver globally
1+
error[E0271]: type mismatch resolving `<T as Trait>::Assoc == T`
2+
--> $DIR/assoc-type-const-bound-usage-0.rs:14:5
23
|
3-
= note: the next trait solver must be enabled globally for the effects feature to work correctly
4-
= help: use `-Znext-solver` to enable
4+
LL | T::Assoc::func()
5+
| ^^^^^^^^^^^^^^^^ types differ
56

6-
error: aborting due to 1 previous error
7+
error[E0271]: type mismatch resolving `<T as Trait>::Assoc == T`
8+
--> $DIR/assoc-type-const-bound-usage-0.rs:18:5
9+
|
10+
LL | <T as Trait>::Assoc::func()
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
12+
13+
error: aborting due to 2 previous errors
714

15+
For more information about this error, try `rustc --explain E0271`.

tests/ui/traits/const-traits/assoc-type-const-bound-usage-1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
//@ compile-flags: -Znext-solver
12
//@ known-bug: unknown
2-
// FIXME(effects)
33

44
#![feature(const_trait_impl, effects, generic_const_exprs)]
55
#![allow(incomplete_features)]
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
1-
error: using `#![feature(effects)]` without enabling next trait solver globally
1+
error: `-Znext-solver=globally` and `generic_const_exprs` are incompatible, using them at the same time is not allowed
2+
--> $DIR/assoc-type-const-bound-usage-1.rs:4:39
23
|
3-
= note: the next trait solver must be enabled globally for the effects feature to work correctly
4-
= help: use `-Znext-solver` to enable
4+
LL | #![feature(const_trait_impl, effects, generic_const_exprs)]
5+
| ^^^^^^^^^^^^^^^^^^^
6+
|
7+
= help: remove one of these features
8+
9+
error[E0271]: type mismatch resolving `<T as Trait>::Assoc == T`
10+
--> $DIR/assoc-type-const-bound-usage-1.rs:15:44
11+
|
12+
LL | fn unqualified<T: const Trait>() -> Type<{ T::Assoc::func() }> {
13+
| ^^^^^^^^^^^^^^^^ types differ
14+
15+
error[E0271]: type mismatch resolving `<T as Trait>::Assoc == T`
16+
--> $DIR/assoc-type-const-bound-usage-1.rs:19:42
17+
|
18+
LL | fn qualified<T: const Trait>() -> Type<{ <T as Trait>::Assoc::func() }> {
19+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
520

6-
error: aborting due to 1 previous error
21+
error: aborting due to 3 previous errors
722

23+
For more information about this error, try `rustc --explain E0271`.

tests/ui/traits/const-traits/assoc-type.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// FIXME(effects): Replace `Add` with `std::ops::Add` once the latter a `#[const_trait]` again.
1+
//@ compile-flags: -Znext-solver
2+
23
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
34

45
#[const_trait]
@@ -33,7 +34,7 @@ trait Foo {
3334

3435
impl const Foo for NonConstAdd {
3536
type Bar = NonConstAdd;
36-
// FIXME(effects) ERROR the trait bound `NonConstAdd: ~const Add` is not satisfied
37+
//~^ ERROR the trait bound `NonConstAdd: ~const Add` is not satisfied
3738
}
3839

3940
#[const_trait]
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/assoc-type.rs:2:30
2+
--> $DIR/assoc-type.rs:3:30
33
|
44
LL | #![feature(const_trait_impl, effects)]
55
| ^^^^^^^
66
|
77
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
88
= note: `#[warn(incomplete_features)]` on by default
99

10-
error: using `#![feature(effects)]` without enabling next trait solver globally
10+
error[E0277]: the trait bound `NonConstAdd: ~const Add` is not satisfied
11+
--> $DIR/assoc-type.rs:36:16
1112
|
12-
= note: the next trait solver must be enabled globally for the effects feature to work correctly
13-
= help: use `-Znext-solver` to enable
13+
LL | type Bar = NonConstAdd;
14+
| ^^^^^^^^^^^
15+
|
16+
note: required by a bound in `Foo::Bar`
17+
--> $DIR/assoc-type.rs:32:15
18+
|
19+
LL | type Bar: ~const Add;
20+
| ^^^^^^^^^^ required by this bound in `Foo::Bar`
1421

1522
error: aborting due to 1 previous error; 1 warning emitted
1623

24+
For more information about this error, try `rustc --explain E0277`.

tests/ui/traits/const-traits/call-generic-method-chain.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Basic test for calling methods on generic type parameters in `const fn`.
22
33
//@ known-bug: #110395
4+
//@ compile-flags: -Znext-solver
45
// FIXME(effects) check-pass
56

67
#![feature(const_trait_impl, effects)]
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/call-generic-method-chain.rs:6:30
2+
--> $DIR/call-generic-method-chain.rs:7:30
33
|
44
LL | #![feature(const_trait_impl, effects)]
55
| ^^^^^^^
66
|
77
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
88
= note: `#[warn(incomplete_features)]` on by default
99

10-
error: using `#![feature(effects)]` without enabling next trait solver globally
11-
|
12-
= note: the next trait solver must be enabled globally for the effects feature to work correctly
13-
= help: use `-Znext-solver` to enable
14-
1510
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
16-
--> $DIR/call-generic-method-chain.rs:10:12
11+
--> $DIR/call-generic-method-chain.rs:11:12
1712
|
1813
LL | impl const PartialEq for S {
1914
| ^^^^^^^^^
@@ -22,32 +17,32 @@ LL | impl const PartialEq for S {
2217
= note: adding a non-const method body in the future would be a breaking change
2318

2419
error: `~const` can only be applied to `#[const_trait]` traits
25-
--> $DIR/call-generic-method-chain.rs:19:32
20+
--> $DIR/call-generic-method-chain.rs:20:32
2621
|
2722
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
2823
| ^^^^^^^^^
2924

3025
error: `~const` can only be applied to `#[const_trait]` traits
31-
--> $DIR/call-generic-method-chain.rs:19:32
26+
--> $DIR/call-generic-method-chain.rs:20:32
3227
|
3328
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
3429
| ^^^^^^^^^
3530
|
3631
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
3732

3833
error: `~const` can only be applied to `#[const_trait]` traits
39-
--> $DIR/call-generic-method-chain.rs:23:40
34+
--> $DIR/call-generic-method-chain.rs:24:40
4035
|
4136
LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool {
4237
| ^^^^^^^^^
4338

4439
error: `~const` can only be applied to `#[const_trait]` traits
45-
--> $DIR/call-generic-method-chain.rs:23:40
40+
--> $DIR/call-generic-method-chain.rs:24:40
4641
|
4742
LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool {
4843
| ^^^^^^^^^
4944
|
5045
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
5146

52-
error: aborting due to 6 previous errors; 1 warning emitted
47+
error: aborting due to 5 previous errors; 1 warning emitted
5348

tests/ui/traits/const-traits/call-generic-method-dup-bound.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ compile-flags: -Znext-solver
12
//@ known-bug: #110395
23
// FIXME(effects) check-pass
34

Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/call-generic-method-dup-bound.rs:4:30
2+
--> $DIR/call-generic-method-dup-bound.rs:5:30
33
|
44
LL | #![feature(const_trait_impl, effects)]
55
| ^^^^^^^
66
|
77
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
88
= note: `#[warn(incomplete_features)]` on by default
99

10-
error: using `#![feature(effects)]` without enabling next trait solver globally
11-
|
12-
= note: the next trait solver must be enabled globally for the effects feature to work correctly
13-
= help: use `-Znext-solver` to enable
14-
1510
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
16-
--> $DIR/call-generic-method-dup-bound.rs:8:12
11+
--> $DIR/call-generic-method-dup-bound.rs:9:12
1712
|
1813
LL | impl const PartialEq for S {
1914
| ^^^^^^^^^
@@ -22,32 +17,32 @@ LL | impl const PartialEq for S {
2217
= note: adding a non-const method body in the future would be a breaking change
2318

2419
error: `~const` can only be applied to `#[const_trait]` traits
25-
--> $DIR/call-generic-method-dup-bound.rs:19:44
20+
--> $DIR/call-generic-method-dup-bound.rs:20:44
2621
|
2722
LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool {
2823
| ^^^^^^^^^
2924

3025
error: `~const` can only be applied to `#[const_trait]` traits
31-
--> $DIR/call-generic-method-dup-bound.rs:19:44
26+
--> $DIR/call-generic-method-dup-bound.rs:20:44
3227
|
3328
LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool {
3429
| ^^^^^^^^^
3530
|
3631
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
3732

3833
error: `~const` can only be applied to `#[const_trait]` traits
39-
--> $DIR/call-generic-method-dup-bound.rs:26:37
34+
--> $DIR/call-generic-method-dup-bound.rs:27:37
4035
|
4136
LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool {
4237
| ^^^^^^^^^
4338

4439
error: `~const` can only be applied to `#[const_trait]` traits
45-
--> $DIR/call-generic-method-dup-bound.rs:26:37
40+
--> $DIR/call-generic-method-dup-bound.rs:27:37
4641
|
4742
LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool {
4843
| ^^^^^^^^^
4944
|
5045
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
5146

52-
error: aborting due to 6 previous errors; 1 warning emitted
47+
error: aborting due to 5 previous errors; 1 warning emitted
5348

tests/ui/traits/const-traits/call-generic-method-pass.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! Basic test for calling methods on generic type parameters in `const fn`.
22
3+
//@ compile-flags: -Znext-solver
34
//@ known-bug: #110395
45
// FIXME(effects) check-pass
56

Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/call-generic-method-pass.rs:6:30
2+
--> $DIR/call-generic-method-pass.rs:7:30
33
|
44
LL | #![feature(const_trait_impl, effects)]
55
| ^^^^^^^
66
|
77
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
88
= note: `#[warn(incomplete_features)]` on by default
99

10-
error: using `#![feature(effects)]` without enabling next trait solver globally
11-
|
12-
= note: the next trait solver must be enabled globally for the effects feature to work correctly
13-
= help: use `-Znext-solver` to enable
14-
1510
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
16-
--> $DIR/call-generic-method-pass.rs:10:12
11+
--> $DIR/call-generic-method-pass.rs:11:12
1712
|
1813
LL | impl const PartialEq for S {
1914
| ^^^^^^^^^
@@ -22,18 +17,18 @@ LL | impl const PartialEq for S {
2217
= note: adding a non-const method body in the future would be a breaking change
2318

2419
error: `~const` can only be applied to `#[const_trait]` traits
25-
--> $DIR/call-generic-method-pass.rs:19:32
20+
--> $DIR/call-generic-method-pass.rs:20:32
2621
|
2722
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
2823
| ^^^^^^^^^
2924

3025
error: `~const` can only be applied to `#[const_trait]` traits
31-
--> $DIR/call-generic-method-pass.rs:19:32
26+
--> $DIR/call-generic-method-pass.rs:20:32
3227
|
3328
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
3429
| ^^^^^^^^^
3530
|
3631
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
3732

38-
error: aborting due to 4 previous errors; 1 warning emitted
33+
error: aborting due to 3 previous errors; 1 warning emitted
3934

tests/ui/traits/const-traits/const-bound-on-not-const-associated-fn.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ compile-flags: -Znext-solver
2+
13
#![allow(incomplete_features)]
24
#![feature(const_trait_impl, effects)]
35

Original file line numberDiff line numberDiff line change
@@ -1,31 +1,26 @@
11
error: `~const` is not allowed here
2-
--> $DIR/const-bound-on-not-const-associated-fn.rs:10:40
2+
--> $DIR/const-bound-on-not-const-associated-fn.rs:12:40
33
|
44
LL | fn do_something_else() where Self: ~const MyTrait;
55
| ^^^^^^
66
|
77
note: this function is not `const`, so it cannot have `~const` trait bounds
8-
--> $DIR/const-bound-on-not-const-associated-fn.rs:10:8
8+
--> $DIR/const-bound-on-not-const-associated-fn.rs:12:8
99
|
1010
LL | fn do_something_else() where Self: ~const MyTrait;
1111
| ^^^^^^^^^^^^^^^^^
1212

1313
error: `~const` is not allowed here
14-
--> $DIR/const-bound-on-not-const-associated-fn.rs:21:32
14+
--> $DIR/const-bound-on-not-const-associated-fn.rs:23:32
1515
|
1616
LL | pub fn foo(&self) where T: ~const MyTrait {
1717
| ^^^^^^
1818
|
1919
note: this function is not `const`, so it cannot have `~const` trait bounds
20-
--> $DIR/const-bound-on-not-const-associated-fn.rs:21:12
20+
--> $DIR/const-bound-on-not-const-associated-fn.rs:23:12
2121
|
2222
LL | pub fn foo(&self) where T: ~const MyTrait {
2323
| ^^^
2424

25-
error: using `#![feature(effects)]` without enabling next trait solver globally
26-
|
27-
= note: the next trait solver must be enabled globally for the effects feature to work correctly
28-
= help: use `-Znext-solver` to enable
29-
30-
error: aborting due to 3 previous errors
25+
error: aborting due to 2 previous errors
3126

tests/ui/traits/const-traits/const-check-fns-in-const-impl.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ compile-flags: -Znext-solver
2+
13
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
24

35
struct S;

0 commit comments

Comments
 (0)