diff options
| author | Michael Goulet <michael@errs.io> | 2022-01-18 01:42:35 -0800 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-01-18 01:46:17 -0800 |
| commit | 33e5efbd586cbdc683cb54949fe163755c57e9e8 (patch) | |
| tree | 9a9cf8d012fa0eb379937f0ca436c8db8b06d48d | |
| parent | 6ed42a7ca48f11c6d2e381af033ccbf0f9523a64 (diff) | |
| download | rust-33e5efbd586cbdc683cb54949fe163755c57e9e8.tar.gz rust-33e5efbd586cbdc683cb54949fe163755c57e9e8.zip | |
adjust tests
4 files changed, 67 insertions, 67 deletions
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 04c21101e75..721636e0743 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,13 +1,5 @@ -error: `~const` is not allowed here - --> $DIR/const-drop-fail.rs:27:35 - | -LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>); - | ^^^^^^^^ - | - = note: only allowed on bounds on traits' associated types and functions, const fns, const impls and its associated functions - error[E0277]: the trait bound `NonTrivialDrop: Drop` is not satisfied - --> $DIR/const-drop-fail.rs:45:5 + --> $DIR/const-drop-fail.rs:44:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -16,50 +8,51 @@ LL | NonTrivialDrop, | ^^^^^^^^^^^^^^ the trait `Drop` is not implemented for `NonTrivialDrop` | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:36:19 + --> $DIR/const-drop-fail.rs:35:19 | LL | const fn check<T: ~const Drop>(_: T) {} | ^^^^^^^^^^^ required by this bound in `check` -error[E0277]: the trait bound `ConstImplWithDropGlue: Drop` is not satisfied - --> $DIR/const-drop-fail.rs:47:5 +error[E0277]: the trait bound `NonTrivialDrop: 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), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Drop` is not implemented for `ConstImplWithDropGlue` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `ConstImplWithDropGlue`, the trait `Drop` is not implemented for `NonTrivialDrop` | +note: required because it appears within the type `ConstImplWithDropGlue` + --> $DIR/const-drop-fail.rs:17:8 + | +LL | struct ConstImplWithDropGlue(NonTrivialDrop); + | ^^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:36:19 + --> $DIR/const-drop-fail.rs:35:19 | LL | const fn check<T: ~const Drop>(_: T) {} | ^^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied - --> $DIR/const-drop-fail.rs:49:5 - | -LL | ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `A` is not implemented for `NonTrivialDrop` - | -note: required by a bound in `ConstDropImplWithBounds` - --> $DIR/const-drop-fail.rs:27:35 - | -LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>); - | ^^^^^^^^ required by this bound in `ConstDropImplWithBounds` - -error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied - --> $DIR/const-drop-fail.rs:49:5 + --> $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` | -note: required by a bound in `ConstDropImplWithBounds` - --> $DIR/const-drop-fail.rs:27:35 +note: required because of the requirements on the impl of `Drop` for `ConstDropImplWithBounds<NonTrivialDrop>` + --> $DIR/const-drop-fail.rs:29:25 | -LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>); - | ^^^^^^^^ required by this bound in `ConstDropImplWithBounds` +LL | impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> { + | ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +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` -error: aborting due to 5 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.rs b/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.rs index 3d4de088f55..4622723c189 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.rs @@ -24,8 +24,7 @@ trait A { fn a() { println!("A"); } } impl A for NonTrivialDrop {} -struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>); -//~^ ERROR `~const` is not allowed +struct ConstDropImplWithBounds<T: A>(PhantomData<T>); impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> { fn drop(&mut self) { @@ -48,7 +47,6 @@ check_all! { //~^ ERROR the trait bound ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData), //~^ ERROR the trait bound - //~| ERROR the trait bound } fn main() {} 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 04c21101e75..721636e0743 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,13 +1,5 @@ -error: `~const` is not allowed here - --> $DIR/const-drop-fail.rs:27:35 - | -LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>); - | ^^^^^^^^ - | - = note: only allowed on bounds on traits' associated types and functions, const fns, const impls and its associated functions - error[E0277]: the trait bound `NonTrivialDrop: Drop` is not satisfied - --> $DIR/const-drop-fail.rs:45:5 + --> $DIR/const-drop-fail.rs:44:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -16,50 +8,51 @@ LL | NonTrivialDrop, | ^^^^^^^^^^^^^^ the trait `Drop` is not implemented for `NonTrivialDrop` | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:36:19 + --> $DIR/const-drop-fail.rs:35:19 | LL | const fn check<T: ~const Drop>(_: T) {} | ^^^^^^^^^^^ required by this bound in `check` -error[E0277]: the trait bound `ConstImplWithDropGlue: Drop` is not satisfied - --> $DIR/const-drop-fail.rs:47:5 +error[E0277]: the trait bound `NonTrivialDrop: 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), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Drop` is not implemented for `ConstImplWithDropGlue` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `ConstImplWithDropGlue`, the trait `Drop` is not implemented for `NonTrivialDrop` | +note: required because it appears within the type `ConstImplWithDropGlue` + --> $DIR/const-drop-fail.rs:17:8 + | +LL | struct ConstImplWithDropGlue(NonTrivialDrop); + | ^^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:36:19 + --> $DIR/const-drop-fail.rs:35:19 | LL | const fn check<T: ~const Drop>(_: T) {} | ^^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied - --> $DIR/const-drop-fail.rs:49:5 - | -LL | ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `A` is not implemented for `NonTrivialDrop` - | -note: required by a bound in `ConstDropImplWithBounds` - --> $DIR/const-drop-fail.rs:27:35 - | -LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>); - | ^^^^^^^^ required by this bound in `ConstDropImplWithBounds` - -error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied - --> $DIR/const-drop-fail.rs:49:5 + --> $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` | -note: required by a bound in `ConstDropImplWithBounds` - --> $DIR/const-drop-fail.rs:27:35 +note: required because of the requirements on the impl of `Drop` for `ConstDropImplWithBounds<NonTrivialDrop>` + --> $DIR/const-drop-fail.rs:29:25 | -LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>); - | ^^^^^^^^ required by this bound in `ConstDropImplWithBounds` +LL | impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> { + | ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +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` -error: aborting due to 5 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-drop.rs b/src/test/ui/rfc-2632-const-trait-impl/const-drop.rs index 292017a1de2..d244f75ed36 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-drop.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/const-drop.rs @@ -45,6 +45,21 @@ mod t { pub struct HasConstDrop(pub ConstDrop); pub struct TrivialFields(pub u8, pub i8, pub usize, pub isize); + + pub trait SomeTrait { + fn foo(); + } + impl const SomeTrait for () { + fn foo() {} + } + + pub struct ConstDropWithBound<T: SomeTrait>(pub core::marker::PhantomData<T>); + + impl<T: ~const SomeTrait> const Drop for ConstDropWithBound<T> { + fn drop(&mut self) { + T::foo(); + } + } } use t::*; @@ -61,6 +76,7 @@ implements_const_drop! { TrivialFields(1, 2, 3, 4), &1, &1 as *const i32, + ConstDropWithBound::<()>, } fn main() { |
