Skip to content

Warning added when dependency crate has async drop types, and the feature is disabled #141253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

azhogin
Copy link
Contributor

@azhogin azhogin commented May 19, 2025

In continue of #141031.

When dependency crate has non-empty adt_async_destructor table in metadata, and async_drop feature is disabled for local crate, warning will be emitted.

Test dependency-dropped has two revisions - with and without feature enabled. With feature enabled, async drop for dropee is executed ("Async drop" printed). Without the feature enabled, sync drop is executed ("Sync drop" printed) and warning is emitted.

Warning example:

warning: found async drop types in dependecy `async_drop_dep`, but async_drop feature is disabled for `dependency_dropped`
  --> $DIR/dependency-dropped.rs:7:1
   |
LL | #![cfg_attr(with_feature, feature(async_drop))]
   | ^
   |
   = help: if async drop type will be dropped in a crate without `feature(async_drop)`, sync Drop will be used

@rustbot
Copy link
Collaborator

rustbot commented May 19, 2025

r? @nnethercote

rustbot has assigned @nnethercote.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 19, 2025
@azhogin
Copy link
Contributor Author

azhogin commented May 19, 2025

r? oli-obk

@rustbot rustbot assigned oli-obk and unassigned nnethercote May 19, 2025
@azhogin azhogin force-pushed the azhogin/async-drop-feature-inconsistency-warning branch from f2b3e74 to 6105928 Compare May 19, 2025 14:38
@oli-obk
Copy link
Contributor

oli-obk commented May 19, 2025

oh nice, that's even more precise than just a feature gate check, as you are specifically inspecting the async drop impls in crate metadata

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 19, 2025

📌 Commit 6105928 has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 19, 2025
Copy link
Contributor

@Rageking8 Rageking8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple typos of the word "dependency".

@@ -1,6 +1,10 @@
metadata_as_needed_compatibility =
linking modifier `as-needed` is only compatible with `dylib` and `framework` linking kinds

metadata_async_drop_types_in_dependency =
found async drop types in dependecy `{$extern_crate}`, but async_drop feature is disabled for `{$local_crate}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
found async drop types in dependecy `{$extern_crate}`, but async_drop feature is disabled for `{$local_crate}`
found async drop types in dependency `{$extern_crate}`, but async_drop feature is disabled for `{$local_crate}`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed.

//@ aux-build:async-drop-dep.rs
//@ edition:2021

#![feature(async_drop)]
#![cfg_attr(with_feature, feature(async_drop))]
//[without_feature]~^ WARN found async drop types in dependecy `async_drop_dep`, but async_drop feature is disabled for `dependency_dropped`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//[without_feature]~^ WARN found async drop types in dependecy `async_drop_dep`, but async_drop feature is disabled for `dependency_dropped`
//[without_feature]~^ WARN found async drop types in dependency `async_drop_dep`, but async_drop feature is disabled for `dependency_dropped`

@@ -0,0 +1,10 @@
warning: found async drop types in dependecy `async_drop_dep`, but async_drop feature is disabled for `dependency_dropped`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
warning: found async drop types in dependecy `async_drop_dep`, but async_drop feature is disabled for `dependency_dropped`
warning: found async drop types in dependency `async_drop_dep`, but async_drop feature is disabled for `dependency_dropped`

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 19, 2025
…-inconsistency-warning, r=oli-obk

Warning added when dependency crate has async drop types, and the feature is disabled

In continue of rust-lang#141031.

When dependency crate has non-empty `adt_async_destructor` table in metadata, and `async_drop` feature is disabled for local crate, warning will be emitted.

Test `dependency-dropped` has two revisions - with and without feature enabled. With feature enabled, async drop for dropee is executed ("Async drop" printed). Without the feature enabled, sync drop is executed ("Sync drop" printed) and warning is emitted.

Warning example:
```
warning: found async drop types in dependecy `async_drop_dep`, but async_drop feature is disabled for `dependency_dropped`
  --> $DIR/dependency-dropped.rs:7:1
   |
LL | #![cfg_attr(with_feature, feature(async_drop))]
   | ^
   |
   = help: if async drop type will be dropped in a crate without `feature(async_drop)`, sync Drop will be used
```
bors added a commit to rust-lang-ci/rust that referenced this pull request May 19, 2025
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#131200 (Handle `rustc_query_system` cases of `rustc::potential_query_instability` lint)
 - rust-lang#141244 (windows: document that we rely on an undocumented property of GetUserProfileDirectoryW)
 - rust-lang#141247 (skip compiler tools sanity checks on certain commands)
 - rust-lang#141248 (fix data race in ReentrantLock fallback for targets without 64bit atomics)
 - rust-lang#141249 (introduce common macro for `MutVisitor` and `Visitor` to dedup code)
 - rust-lang#141253 (Warning added when dependency crate has async drop types, and the feature is disabled)

r? `@ghost`
`@rustbot` modify labels: rollup
@oli-obk
Copy link
Contributor

oli-obk commented May 19, 2025

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 19, 2025
@azhogin azhogin force-pushed the azhogin/async-drop-feature-inconsistency-warning branch from 6105928 to e192953 Compare May 19, 2025 18:06
@oli-obk
Copy link
Contributor

oli-obk commented May 19, 2025

@bors r+

In case the rollup succeeds, there will be conflicts and you'll have to rebase. At that point this PR will only contain the typo fix

@bors
Copy link
Collaborator

bors commented May 19, 2025

📌 Commit e192953 has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 19, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 19, 2025
Rollup merge of rust-lang#141253 - azhogin:azhogin/async-drop-feature-inconsistency-warning, r=oli-obk

Warning added when dependency crate has async drop types, and the feature is disabled

In continue of rust-lang#141031.

When dependency crate has non-empty `adt_async_destructor` table in metadata, and `async_drop` feature is disabled for local crate, warning will be emitted.

Test `dependency-dropped` has two revisions - with and without feature enabled. With feature enabled, async drop for dropee is executed ("Async drop" printed). Without the feature enabled, sync drop is executed ("Sync drop" printed) and warning is emitted.

Warning example:
```
warning: found async drop types in dependecy `async_drop_dep`, but async_drop feature is disabled for `dependency_dropped`
  --> $DIR/dependency-dropped.rs:7:1
   |
LL | #![cfg_attr(with_feature, feature(async_drop))]
   | ^
   |
   = help: if async drop type will be dropped in a crate without `feature(async_drop)`, sync Drop will be used
```
@bors
Copy link
Collaborator

bors commented May 19, 2025

☔ The latest upstream changes (presumably #141255) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 19, 2025
@azhogin azhogin force-pushed the azhogin/async-drop-feature-inconsistency-warning branch from e192953 to 4a99cbb Compare May 19, 2025 21:37
@oli-obk
Copy link
Contributor

oli-obk commented May 20, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 20, 2025

📌 Commit 4a99cbb has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 20, 2025
@klensy
Copy link
Contributor

klensy commented May 20, 2025

Bors didn't go crazy if it merges the same pr second time?

@oli-obk
Copy link
Contributor

oli-obk commented May 20, 2025

Bors merges commits 😅 github automatically closes PRs whose commits are in the branch they target. So I think everything just works out

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 20, 2025
…-inconsistency-warning, r=oli-obk

Warning added when dependency crate has async drop types, and the feature is disabled

In continue of rust-lang#141031.

When dependency crate has non-empty `adt_async_destructor` table in metadata, and `async_drop` feature is disabled for local crate, warning will be emitted.

Test `dependency-dropped` has two revisions - with and without feature enabled. With feature enabled, async drop for dropee is executed ("Async drop" printed). Without the feature enabled, sync drop is executed ("Sync drop" printed) and warning is emitted.

Warning example:
```
warning: found async drop types in dependecy `async_drop_dep`, but async_drop feature is disabled for `dependency_dropped`
  --> $DIR/dependency-dropped.rs:7:1
   |
LL | #![cfg_attr(with_feature, feature(async_drop))]
   | ^
   |
   = help: if async drop type will be dropped in a crate without `feature(async_drop)`, sync Drop will be used
```
bors added a commit to rust-lang-ci/rust that referenced this pull request May 20, 2025
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#139419 (Error on recursive opaque ty in HIR typeck)
 - rust-lang#141236 (Resolved issue with mismatched types triggering ICE in certain scenarios)
 - rust-lang#141253 (Warning added when dependency crate has async drop types, and the feature is disabled)
 - rust-lang#141269 (rustc-dev-guide subtree update)
 - rust-lang#141275 (`gather_locals`: only visit guard pattern guards when checking the guard)
 - rust-lang#141279 (`lower_to_hir` cleanups)
 - rust-lang#141285 (Add tick to `RePlaceholder` debug output)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants