diff options
| author | Michael Goulet <michael@errs.io> | 2023-04-26 18:22:32 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-04-27 17:02:17 +0000 |
| commit | bd146c72ac2faf6bbf189ad92d06e0bcd6cc92fc (patch) | |
| tree | 3dd93051ad801fdc2d4a61ee2944480f7c401772 /tests/ui/consts | |
| parent | 6ce22733b973355573efd1e6294e585460e90e17 (diff) | |
| download | rust-bd146c72ac2faf6bbf189ad92d06e0bcd6cc92fc.tar.gz rust-bd146c72ac2faf6bbf189ad92d06e0bcd6cc92fc.zip | |
Explicitly reject negative and reservation drop impls
Diffstat (limited to 'tests/ui/consts')
| -rw-r--r-- | tests/ui/consts/const-block-const-bound.rs | 6 | ||||
| -rw-r--r-- | tests/ui/consts/const-block-const-bound.stderr | 18 |
2 files changed, 2 insertions, 22 deletions
diff --git a/tests/ui/consts/const-block-const-bound.rs b/tests/ui/consts/const-block-const-bound.rs index 42aa0216b87..3704a1a5a39 100644 --- a/tests/ui/consts/const-block-const-bound.rs +++ b/tests/ui/consts/const-block-const-bound.rs @@ -11,15 +11,9 @@ impl Drop for UnconstDrop { fn drop(&mut self) {} } -struct NonDrop; - -impl !Drop for NonDrop {} - fn main() { const { f(UnconstDrop); //~^ ERROR can't drop - f(NonDrop); - //~^ ERROR can't drop } } diff --git a/tests/ui/consts/const-block-const-bound.stderr b/tests/ui/consts/const-block-const-bound.stderr index fef4914fad5..caf24e7afcf 100644 --- a/tests/ui/consts/const-block-const-bound.stderr +++ b/tests/ui/consts/const-block-const-bound.stderr @@ -1,5 +1,5 @@ error[E0277]: can't drop `UnconstDrop` in const contexts - --> $DIR/const-block-const-bound.rs:20:9 + --> $DIR/const-block-const-bound.rs:16:9 | LL | f(UnconstDrop); | ^^^^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `UnconstDrop` @@ -12,20 +12,6 @@ LL | &f(UnconstDrop); LL | &mut f(UnconstDrop); | ++++ -error[E0277]: can't drop `NonDrop` in const contexts - --> $DIR/const-block-const-bound.rs:22:9 - | -LL | f(NonDrop); - | ^^^^^^^^^^ the trait `~const Destruct` is not implemented for `NonDrop` - | - = note: the trait bound `NonDrop: ~const Destruct` is not satisfied -help: consider borrowing here - | -LL | &f(NonDrop); - | + -LL | &mut f(NonDrop); - | ++++ - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. |
