diff options
Diffstat (limited to 'src')
12 files changed, 82 insertions, 50 deletions
diff --git a/src/test/ui/consts/const-block-const-bound.rs b/src/test/ui/consts/const-block-const-bound.rs index 3d7e171f18c..f3c82c5f968 100644 --- a/src/test/ui/consts/const-block-const-bound.rs +++ b/src/test/ui/consts/const-block-const-bound.rs @@ -16,8 +16,8 @@ impl !Drop for NonDrop {} fn main() { const { f(UnconstDrop); - //~^ ERROR the trait bound `UnconstDrop: Drop` is not satisfied + //~^ ERROR the trait bound `UnconstDrop: ~const Drop` is not satisfied f(NonDrop); - //~^ ERROR the trait bound `NonDrop: Drop` is not satisfied + //~^ ERROR the trait bound `NonDrop: ~const Drop` is not satisfied } } diff --git a/src/test/ui/consts/const-block-const-bound.stderr b/src/test/ui/consts/const-block-const-bound.stderr index 5f912c66bb9..b5f5694ba83 100644 --- a/src/test/ui/consts/const-block-const-bound.stderr +++ b/src/test/ui/consts/const-block-const-bound.stderr @@ -1,8 +1,8 @@ -error[E0277]: the trait bound `UnconstDrop: Drop` is not satisfied +error[E0277]: the trait bound `UnconstDrop: ~const Drop` is not satisfied --> $DIR/const-block-const-bound.rs:18:11 | LL | f(UnconstDrop); - | - ^^^^^^^^^^^ the trait `Drop` is not implemented for `UnconstDrop` + | - ^^^^^^^^^^^ expected an implementor of trait `~const Drop` | | | required by a bound introduced by this call | @@ -11,16 +11,18 @@ note: required by a bound in `f` | LL | const fn f<T: ~const Drop>(x: T) {} | ^^^^^^^^^^^ required by this bound in `f` -help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement +help: consider borrowing here | -LL | fn main() where UnconstDrop: Drop { - | +++++++++++++++++++++++ +LL | f(&UnconstDrop); + | + +LL | f(&mut UnconstDrop); + | ++++ -error[E0277]: the trait bound `NonDrop: Drop` is not satisfied +error[E0277]: the trait bound `NonDrop: ~const Drop` is not satisfied --> $DIR/const-block-const-bound.rs:20:11 | LL | f(NonDrop); - | - ^^^^^^^ the trait `Drop` is not implemented for `NonDrop` + | - ^^^^^^^ expected an implementor of trait `~const Drop` | | | required by a bound introduced by this call | @@ -29,6 +31,12 @@ note: required by a bound in `f` | LL | const fn f<T: ~const Drop>(x: T) {} | ^^^^^^^^^^^ required by this bound in `f` +help: consider borrowing here + | +LL | f(&NonDrop); + | + +LL | f(&mut NonDrop); + | ++++ error: aborting due to 2 previous errors diff --git a/src/test/ui/intrinsics/const-eval-select-bad.rs b/src/test/ui/intrinsics/const-eval-select-bad.rs index a3171187e69..7d924e2b7f3 100644 --- a/src/test/ui/intrinsics/const-eval-select-bad.rs +++ b/src/test/ui/intrinsics/const-eval-select-bad.rs @@ -4,9 +4,9 @@ use std::intrinsics::const_eval_select; const fn not_fn_items() { const_eval_select((), || {}, || {}); - //~^ ERROR expected a `FnOnce<()>` closure + //~^ ERROR the trait bound const_eval_select((), 42, 0xDEADBEEF); - //~^ ERROR expected a `FnOnce<()>` closure + //~^ ERROR the trait bound //~| ERROR expected a `FnOnce<()>` closure } diff --git a/src/test/ui/intrinsics/const-eval-select-bad.stderr b/src/test/ui/intrinsics/const-eval-select-bad.stderr index 5e1ab584d80..083b0064538 100644 --- a/src/test/ui/intrinsics/const-eval-select-bad.stderr +++ b/src/test/ui/intrinsics/const-eval-select-bad.stderr @@ -1,4 +1,4 @@ -error[E0277]: expected a `FnOnce<()>` closure, found `[closure@$DIR/const-eval-select-bad.rs:6:27: 6:32]` +error[E0277]: the trait bound `[closure@$DIR/const-eval-select-bad.rs:6:27: 6:32]: ~const FnOnce<()>` is not satisfied --> $DIR/const-eval-select-bad.rs:6:27 | LL | const_eval_select((), || {}, || {}); @@ -6,7 +6,7 @@ LL | const_eval_select((), || {}, || {}); | | | required by a bound introduced by this call | - = help: the trait `FnOnce<()>` is not implemented for `[closure@$DIR/const-eval-select-bad.rs:6:27: 6:32]` + = help: the trait `~const FnOnce<()>` is not implemented for `[closure@$DIR/const-eval-select-bad.rs:6:27: 6:32]` = note: wrap the `[closure@$DIR/const-eval-select-bad.rs:6:27: 6:32]` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `const_eval_select` --> $SRC_DIR/core/src/intrinsics.rs:LL:COL @@ -14,7 +14,7 @@ note: required by a bound in `const_eval_select` LL | F: ~const FnOnce<ARG, Output = RET>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select` -error[E0277]: expected a `FnOnce<()>` closure, found `{integer}` +error[E0277]: the trait bound `{integer}: ~const FnOnce<()>` is not satisfied --> $DIR/const-eval-select-bad.rs:8:27 | LL | const_eval_select((), 42, 0xDEADBEEF); @@ -22,7 +22,7 @@ LL | const_eval_select((), 42, 0xDEADBEEF); | | | required by a bound introduced by this call | - = help: the trait `FnOnce<()>` is not implemented for `{integer}` + = help: the trait `~const FnOnce<()>` is not implemented for `{integer}` = note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `const_eval_select` --> $SRC_DIR/core/src/intrinsics.rs:LL:COL diff --git a/src/test/ui/rfc-2632-const-trait-impl/assoc-type.rs b/src/test/ui/rfc-2632-const-trait-impl/assoc-type.rs index 7b012083c5a..99eacaa837f 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/assoc-type.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/assoc-type.rs @@ -1,5 +1,5 @@ -// FIXME(fee1-dead): this should have a better error message #![feature(const_trait_impl)] + struct NonConstAdd(i32); impl std::ops::Add for NonConstAdd { @@ -16,7 +16,7 @@ trait Foo { impl const Foo for NonConstAdd { type Bar = NonConstAdd; - //~^ ERROR + //~^ ERROR: cannot add `NonConstAdd` to `NonConstAdd` in const contexts } trait Baz { diff --git a/src/test/ui/rfc-2632-const-trait-impl/assoc-type.stderr b/src/test/ui/rfc-2632-const-trait-impl/assoc-type.stderr index 4a4b4de4758..429b9f3364b 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/assoc-type.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/assoc-type.stderr @@ -1,10 +1,10 @@ -error[E0277]: cannot add `NonConstAdd` to `NonConstAdd` +error[E0277]: cannot add `NonConstAdd` to `NonConstAdd` in const contexts --> $DIR/assoc-type.rs:18:16 | LL | type Bar = NonConstAdd; | ^^^^^^^^^^^ no implementation for `NonConstAdd + NonConstAdd` | - = help: the trait `Add` is not implemented for `NonConstAdd` + = help: the trait `~const Add` is not implemented for `NonConstAdd` note: required by a bound in `Foo::Bar` --> $DIR/assoc-type.rs:14:15 | @@ -12,8 +12,8 @@ LL | type Bar: ~const std::ops::Add; | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `Foo::Bar` help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement | -LL | impl const Foo for NonConstAdd where NonConstAdd: Add { - | ++++++++++++++++++++++ +LL | impl const Foo for NonConstAdd where NonConstAdd: ~const Add { + | +++++++++++++++++++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-nonconst.stderr b/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-nonconst.stderr index 0440f17a704..13cffaba91a 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-nonconst.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-nonconst.stderr @@ -1,4 +1,4 @@ -error[E0277]: can't compare `S` with `S` +error[E0277]: can't compare `S` with `S` in const contexts --> $DIR/call-generic-method-nonconst.rs:19:34 | LL | pub const EQ: bool = equals_self(&S); @@ -6,7 +6,7 @@ LL | pub const EQ: bool = equals_self(&S); | | | required by a bound introduced by this call | - = help: the trait `PartialEq` is not implemented for `S` + = help: the trait `~const PartialEq` is not implemented for `S` note: required by a bound in `equals_self` --> $DIR/call-generic-method-nonconst.rs:12:25 | diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr b/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr index 721636e0743..df776908a03 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr @@ -1,26 +1,32 @@ -error[E0277]: the trait bound `NonTrivialDrop: Drop` is not satisfied +error[E0277]: the trait bound `NonTrivialDrop: ~const Drop` is not satisfied --> $DIR/const-drop-fail.rs:44:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call ... LL | NonTrivialDrop, - | ^^^^^^^^^^^^^^ the trait `Drop` is not implemented for `NonTrivialDrop` + | ^^^^^^^^^^^^^^ expected an implementor of trait `~const Drop` | note: required by a bound in `check` --> $DIR/const-drop-fail.rs:35:19 | LL | const fn check<T: ~const Drop>(_: T) {} | ^^^^^^^^^^^ required by this bound in `check` +help: consider borrowing here + | +LL | &NonTrivialDrop, + | + +LL | &mut NonTrivialDrop, + | ++++ -error[E0277]: the trait bound `NonTrivialDrop: Drop` is not satisfied in `ConstImplWithDropGlue` +error[E0277]: the trait bound `NonTrivialDrop: ~const Drop` is not satisfied in `ConstImplWithDropGlue` --> $DIR/const-drop-fail.rs:46:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call ... LL | ConstImplWithDropGlue(NonTrivialDrop), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `ConstImplWithDropGlue`, the trait `Drop` is not implemented for `NonTrivialDrop` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `ConstImplWithDropGlue`, the trait `~const Drop` is not implemented for `NonTrivialDrop` | note: required because it appears within the type `ConstImplWithDropGlue` --> $DIR/const-drop-fail.rs:17:8 @@ -33,16 +39,16 @@ note: required by a bound in `check` LL | const fn check<T: ~const Drop>(_: T) {} | ^^^^^^^^^^^ required by this bound in `check` -error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied +error[E0277]: the trait bound `ConstDropImplWithBounds<NonTrivialDrop>: ~const Drop` is not satisfied --> $DIR/const-drop-fail.rs:48:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call ... LL | ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `A` is not implemented for `NonTrivialDrop` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an implementor of trait `~const Drop` | -note: required because of the requirements on the impl of `Drop` for `ConstDropImplWithBounds<NonTrivialDrop>` +note: required because of the requirements on the impl of `~const Drop` for `ConstDropImplWithBounds<NonTrivialDrop>` --> $DIR/const-drop-fail.rs:29:25 | LL | impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> { @@ -52,6 +58,12 @@ note: required by a bound in `check` | LL | const fn check<T: ~const Drop>(_: T) {} | ^^^^^^^^^^^ required by this bound in `check` +help: consider borrowing here + | +LL | &ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData), + | + +LL | &mut ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData), + | ++++ error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr b/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr index 721636e0743..df776908a03 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr @@ -1,26 +1,32 @@ -error[E0277]: the trait bound `NonTrivialDrop: Drop` is not satisfied +error[E0277]: the trait bound `NonTrivialDrop: ~const Drop` is not satisfied --> $DIR/const-drop-fail.rs:44:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call ... LL | NonTrivialDrop, - | ^^^^^^^^^^^^^^ the trait `Drop` is not implemented for `NonTrivialDrop` + | ^^^^^^^^^^^^^^ expected an implementor of trait `~const Drop` | note: required by a bound in `check` --> $DIR/const-drop-fail.rs:35:19 | LL | const fn check<T: ~const Drop>(_: T) {} | ^^^^^^^^^^^ required by this bound in `check` +help: consider borrowing here + | +LL | &NonTrivialDrop, + | + +LL | &mut NonTrivialDrop, + | ++++ -error[E0277]: the trait bound `NonTrivialDrop: Drop` is not satisfied in `ConstImplWithDropGlue` +error[E0277]: the trait bound `NonTrivialDrop: ~const Drop` is not satisfied in `ConstImplWithDropGlue` --> $DIR/const-drop-fail.rs:46:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call ... LL | ConstImplWithDropGlue(NonTrivialDrop), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `ConstImplWithDropGlue`, the trait `Drop` is not implemented for `NonTrivialDrop` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `ConstImplWithDropGlue`, the trait `~const Drop` is not implemented for `NonTrivialDrop` | note: required because it appears within the type `ConstImplWithDropGlue` --> $DIR/const-drop-fail.rs:17:8 @@ -33,16 +39,16 @@ note: required by a bound in `check` LL | const fn check<T: ~const Drop>(_: T) {} | ^^^^^^^^^^^ required by this bound in `check` -error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied +error[E0277]: the trait bound `ConstDropImplWithBounds<NonTrivialDrop>: ~const Drop` is not satisfied --> $DIR/const-drop-fail.rs:48:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call ... LL | ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `A` is not implemented for `NonTrivialDrop` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an implementor of trait `~const Drop` | -note: required because of the requirements on the impl of `Drop` for `ConstDropImplWithBounds<NonTrivialDrop>` +note: required because of the requirements on the impl of `~const Drop` for `ConstDropImplWithBounds<NonTrivialDrop>` --> $DIR/const-drop-fail.rs:29:25 | LL | impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> { @@ -52,6 +58,12 @@ note: required by a bound in `check` | LL | const fn check<T: ~const Drop>(_: T) {} | ^^^^^^^^^^^ required by this bound in `check` +help: consider borrowing here + | +LL | &ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData), + | + +LL | &mut ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData), + | ++++ error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.rs b/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.rs index 7db04fe1ac3..76ea17159ac 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.rs @@ -10,7 +10,7 @@ pub trait Foo { #[default_method_body_is_const] fn foo() { foo::<()>(); - //~^ ERROR the trait bound `(): Tr` is not satisfied + //~^ ERROR the trait bound `(): ~const Tr` is not satisfied } } diff --git a/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.stderr b/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.stderr index 6e7e4b3a472..05a74757b94 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.stderr @@ -1,8 +1,8 @@ -error[E0277]: the trait bound `(): Tr` is not satisfied +error[E0277]: the trait bound `(): ~const Tr` is not satisfied --> $DIR/default-method-body-is-const-body-checking.rs:12:15 | LL | foo::<()>(); - | ^^ the trait `Tr` is not implemented for `()` + | ^^ the trait `~const Tr` is not implemented for `()` | note: required by a bound in `foo` --> $DIR/default-method-body-is-const-body-checking.rs:7:28 @@ -11,8 +11,8 @@ LL | const fn foo<T>() where T: ~const Tr {} | ^^^^^^^^^ required by this bound in `foo` help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement | -LL | pub trait Foo where (): Tr { - | ++++++++++++ +LL | pub trait Foo where (): ~const Tr { + | +++++++++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr b/src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr index 08d91d7daf8..903cd924ca5 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr @@ -1,8 +1,8 @@ -error[E0277]: the trait bound `T: Bar` is not satisfied +error[E0277]: the trait bound `T: ~const Bar` is not satisfied --> $DIR/trait-where-clause.rs:14:5 | LL | T::b(); - | ^^^^ the trait `Bar` is not implemented for `T` + | ^^^^ the trait `~const Bar` is not implemented for `T` | note: required by a bound in `Foo::b` --> $DIR/trait-where-clause.rs:8:24 @@ -11,14 +11,14 @@ LL | fn b() where Self: ~const Bar; | ^^^^^^^^^^ required by this bound in `Foo::b` help: consider further restricting this bound | -LL | const fn test1<T: ~const Foo + Bar + Bar>() { - | +++++ +LL | const fn test1<T: ~const Foo + Bar + ~const Bar>() { + | ++++++++++++ -error[E0277]: the trait bound `T: Bar` is not satisfied +error[E0277]: the trait bound `T: ~const Bar` is not satisfied --> $DIR/trait-where-clause.rs:16:5 | LL | T::c::<T>(); - | ^^^^^^^^^ the trait `Bar` is not implemented for `T` + | ^^^^^^^^^ the trait `~const Bar` is not implemented for `T` | note: required by a bound in `Foo::c` --> $DIR/trait-where-clause.rs:9:13 @@ -27,8 +27,8 @@ LL | fn c<T: ~const Bar>(); | ^^^^^^^^^^ required by this bound in `Foo::c` help: consider further restricting this bound | -LL | const fn test1<T: ~const Foo + Bar + Bar>() { - | +++++ +LL | const fn test1<T: ~const Foo + Bar + ~const Bar>() { + | ++++++++++++ error[E0277]: the trait bound `T: Bar` is not satisfied --> $DIR/trait-where-clause.rs:28:5 |
