rust/tests/ui/drop
Stuart Cook f478bec907
Rollup merge of #143672 - beepster4096:box_drop_flags_again, r=oli-obk
Fix Box allocator drop elaboration

New version of rust-lang/rust#131146.

Clearing Box's drop flag after running its destructor can cause it to skip dropping its allocator, so just don't. Its cleared by the drop ladder code afterwards already.

Unlike the last PR this also handles other types with destructors properly, in the event that we can have open drops on them in the future (by partial initialization or DerefMove or something).

Finally, I also added tests for the interaction with async drop here but I discovered rust-lang/rust#143658, so one of the tests has a `knownbug` annotation. Not sure if it should be in this PR at all though.

Fixes rust-lang/rust#131082

r? wesleywiser - prev. reviewer
2025-07-31 15:41:59 +10:00
..
auxiliary Stabilize the 2024 edition 2024-11-22 11:12:15 -08:00
box-conditional-drop-allocator.rs fix box destructor generation 2025-07-25 13:19:43 -07:00
box-drop-unused-value-statement-regression.rs cleaned up some tests 2025-07-10 18:50:35 +05:00
conditional-drop-10734.rs comments 2025-07-25 20:38:54 +05:00
drop-foreign-fundamental.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
drop-foreign-fundamental.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
drop-if-let-binding.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
drop-immediate-non-box-ty-9446.rs Rehome tests/ui/issues/ tests [1/?] 2025-07-24 17:01:44 -04:00
drop-on-empty-block-exit.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
drop-on-ret.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
drop-once-on-move.rs cleaned up some tests 2025-07-05 01:54:04 +05:00
drop-order-comparisons-let-chains.rs Remove let_chains feature 2025-06-30 07:49:20 -05:00
drop-order-comparisons.e2021.fixed Remove let_chains feature 2025-06-30 07:49:20 -05:00
drop-order-comparisons.e2021.stderr future-incompat lints: don't link to the nightly edition-guide version 2025-07-16 01:44:02 -07:00
drop-order-comparisons.rs Remove let_chains feature 2025-06-30 07:49:20 -05:00
drop-scope-exit.rs cleaned up some tests 2025-07-05 01:54:04 +05:00
drop-struct-as-object.rs Update tests for hidden references to mutable static 2024-09-13 14:10:56 +03:00
drop-struct-as-object.stderr Update tests for hidden references to mutable static 2024-09-13 14:10:56 +03:00
drop-trait-enum.rs tests: use needs-threads instead of ignore-emscripten 2025-01-23 20:51:29 +08:00
drop-trait-generic.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
drop-trait.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
drop-uninhabited-enum.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
drop-with-type-ascription-1.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
drop-with-type-ascription-2.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
drop_elaboration_with_errors.rs Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
drop_elaboration_with_errors.stderr Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
drop_elaboration_with_errors2.rs Use delayed bug for normalization errors in drop elaboration 2025-04-11 16:31:28 +00:00
drop_elaboration_with_errors2.stderr Use delayed bug for normalization errors in drop elaboration 2025-04-11 16:31:28 +00:00
drop_elaboration_with_errors3.rs Use delayed bug for normalization errors in drop elaboration 2025-04-11 16:31:28 +00:00
drop_elaboration_with_errors3.stderr Use delayed bug for normalization errors in drop elaboration 2025-04-11 16:31:28 +00:00
drop_order.rs Remove let_chains feature 2025-06-30 07:49:20 -05:00
drop_order_if_let_rescope.rs Replace elided_named_lifetimes with mismatched_lifetime_syntaxes 2025-06-04 10:40:04 -04:00
drop_order_let_chain.rs Remove let_chains feature 2025-06-30 07:49:20 -05:00
dropck-eyepatch-extern-crate.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
dropck-eyepatch-manuallydrop.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
dropck-eyepatch-reorder.rs Allow newly added non_local_definitions lint in tests 2024-02-17 13:59:45 +01:00
dropck-eyepatch.rs Allow newly added non_local_definitions lint in tests 2024-02-17 13:59:45 +01:00
dropck-normalize-errors.rs Flush errors before deep normalize in dropck_outlives 2025-05-12 21:04:38 +00:00
dropck-normalize-errors.stderr Flush errors before deep normalize in dropck_outlives 2025-05-12 21:04:38 +00:00
dropck_legal_cycles.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
dynamic-drop-async.rs Add ignore-backends annotations in failing GCC backend ui tests 2025-07-23 13:48:04 +02:00
dynamic-drop.rs Add ignore-backends annotations in failing GCC backend ui tests 2025-07-23 13:48:04 +02:00
explicit-drop-call-error.fixed cleaned up some tests 2025-06-11 20:51:49 +05:00
explicit-drop-call-error.rs cleaned up some tests 2025-06-11 20:51:49 +05:00
explicit-drop-call-error.stderr cleaned up some tests 2025-06-11 20:51:49 +05:00
field-replace-in-struct-with-drop.rs cleaned up some tests 2025-07-01 15:16:56 +05:00
for-expr-temporary-drop-scope.rs cleaned up some tests 2025-06-04 19:32:06 +05:00
if-let-rescope-borrowck-suggestions.rs Stabilize the 2024 edition 2024-11-22 11:12:15 -08:00
if-let-rescope-borrowck-suggestions.stderr Show diff suggestion format on verbose replacement 2025-02-10 20:21:39 +00:00
issue-979.rs Reduce confusion of some drop order tests 2025-06-06 08:30:47 -04:00
issue-2734.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
issue-2735-2.rs Reduce confusion of some drop order tests 2025-06-06 08:30:47 -04:00
issue-2735-3.rs Reduce confusion of some drop order tests 2025-06-06 08:30:47 -04:00
issue-2735.rs Reduce confusion of some drop order tests 2025-06-06 08:30:47 -04:00
issue-10028.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
issue-17718-const-destructors.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-21486.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-23338-ensure-param-drop-order.rs Use non-2015 edition paths in tests that do not test for their resolution 2025-06-03 10:13:33 +02:00
issue-23611-enum-swap-in-drop.rs Use non-2015 edition paths in tests that do not test for their resolution 2025-06-03 10:13:33 +02:00
issue-30018-nopanic.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-35546.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-48962.rs Update tests for hidden references to mutable static 2024-09-13 14:10:56 +03:00
issue-90752-raw-ptr-shenanigans.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-90752.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-100276.rs Remove let_chains feature 2025-06-30 07:49:20 -05:00
issue-103107.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-110682.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
lint-if-let-rescope-false-positives.rs Consider lvalues of field and index as possibly temporary places 2025-02-24 18:31:50 +00:00
lint-if-let-rescope-gated.edition2021.stderr future-incompat lints: don't link to the nightly edition-guide version 2025-07-16 01:44:02 -07:00
lint-if-let-rescope-gated.rs Update more 2024 tests to remove -Zunstable-options 2024-11-28 14:32:45 -08:00
lint-if-let-rescope-with-macro.rs stabilize if_let_rescope 2024-10-24 04:33:14 +08:00
lint-if-let-rescope-with-macro.stderr future-incompat lints: don't link to the nightly edition-guide version 2025-07-16 01:44:02 -07:00
lint-if-let-rescope.fixed Consider lvalues of field and index as possibly temporary places 2025-02-24 18:31:50 +00:00
lint-if-let-rescope.rs Consider lvalues of field and index as possibly temporary places 2025-02-24 18:31:50 +00:00
lint-if-let-rescope.stderr future-incompat lints: don't link to the nightly edition-guide version 2025-07-16 01:44:02 -07:00
lint-tail-expr-drop-order-borrowck.rs UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
lint-tail-expr-drop-order-borrowck.stderr future-incompat lints: don't link to the nightly edition-guide version 2025-07-16 01:44:02 -07:00
lint-tail-expr-drop-order-gated.rs Stabilize the 2024 edition 2024-11-22 11:12:15 -08:00
lint-tail-expr-drop-order.rs Don't create cycles by normalizing opaques defined in the body we're checking 2025-01-08 15:58:10 +00:00
lint-tail-expr-drop-order.stderr future-incompat lints: don't link to the nightly edition-guide version 2025-07-16 01:44:02 -07:00
missing-drop-method.rs Convert bugs back to delayed_bugs. 2024-02-21 10:35:54 +11:00
missing-drop-method.stderr Convert bugs back to delayed_bugs. 2024-02-21 10:35:54 +11:00
no-drop-flag-size.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
nondrop-cycle.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
nonsense-drop-impl-issue-139278.rs adt_destructor: sanity-check returned item 2025-04-04 05:18:48 +02:00
nonsense-drop-impl-issue-139278.stderr adt_destructor: sanity-check returned item 2025-04-04 05:18:48 +02:00
norm-ice-106444.rs add test for ICE #106444 2024-03-23 12:38:50 +01:00
or-pattern-drop-order.rs add tests for pattern binding drop order edge cases 2025-06-08 06:18:38 -07:00
recursion-check-on-erroneous-impl.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
recursion-check-on-erroneous-impl.stderr Avoid ICE in drop recursion check in case of invalid drop impls 2024-02-08 17:33:04 +00:00
repeat-drop-2.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
repeat-drop-2.stderr Handle more cases of value suggestions 2024-04-10 20:36:14 +00:00
repeat-drop.rs Update tests for hidden references to mutable static 2024-09-13 14:10:56 +03:00
static-issue-17302.rs Update tests for hidden references to mutable static 2024-09-13 14:10:56 +03:00
tail-expr-drop-order-negative.edition2024.stderr Update more 2024 tests to remove -Zunstable-options 2024-11-28 14:32:45 -08:00
tail-expr-drop-order-negative.rs Update more 2024 tests to remove -Zunstable-options 2024-11-28 14:32:45 -08:00
tail-expr-drop-order.rs Replace elided_named_lifetimes with mismatched_lifetime_syntaxes 2025-06-04 10:40:04 -04:00
tail_expr_drop_order-on-coroutine-unwind.rs Always run tail_expr_drop_order lint on promoted MIR 2024-12-23 20:25:41 +00:00
tail_expr_drop_order-on-coroutine-unwind.stderr future-incompat lints: don't link to the nightly edition-guide version 2025-07-16 01:44:02 -07:00
tail_expr_drop_order-on-recursive-boxed-fut.rs Don't create cycles by normalizing opaques defined in the body we're checking 2025-01-08 15:58:10 +00:00
tail_expr_drop_order-on-thread-local.rs Don't do AccessDepth::Drop for types with no drop impl 2025-01-08 15:58:10 +00:00
terminate-in-initializer.rs tests: use needs-threads instead of ignore-emscripten 2025-01-23 20:51:29 +08:00
trait-object-drop-10802.rs comments 2025-07-25 20:38:54 +05:00
use_inline_dtor.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00