about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-05-17 10:33:09 +0200
committerGitHub <noreply@github.com>2025-05-17 10:33:09 +0200
commit04bc9d13caa5231facfb28ddf02ba6b148ee25fb (patch)
tree0184594c8c608a4ab929662135bd00af37f879fa /compiler/rustc_middle/src
parent642cd65ab256fe70e4e185def0816ab39077f5c6 (diff)
parent7b2dcf298909f1493a57387be564fc2f07a3c6ad (diff)
downloadrust-04bc9d13caa5231facfb28ddf02ba6b148ee25fb.tar.gz
rust-04bc9d13caa5231facfb28ddf02ba6b148ee25fb.zip
Rollup merge of #141031 - azhogin:azhogin/async-drop-dependency-fix, r=oli-obk
Async drop fix for dropee from another crate (#140858)

Fixes https://github.com/rust-lang/rust/issues/140858.

For `AsyncDestructor` impl def id was wrongly kept as a LocalDefId, which causes crash when dropee is declared in another crate.

Also, potential problem found:
when user crate drops type with async drop in dependency crate, and user crate doesn't enable `feature(async_drop)`, then sync drop version will be used.

Is it a problem? Do we need some notification about such situations?
Diffstat (limited to 'compiler/rustc_middle/src')
-rw-r--r--compiler/rustc_middle/src/ty/mod.rs2
-rw-r--r--compiler/rustc_middle/src/ty/util.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs
index 83b318435f9..657bda23bc4 100644
--- a/compiler/rustc_middle/src/ty/mod.rs
+++ b/compiler/rustc_middle/src/ty/mod.rs
@@ -1185,7 +1185,7 @@ pub struct Destructor {
 #[derive(Copy, Clone, Debug, HashStable, Encodable, Decodable)]
 pub struct AsyncDestructor {
     /// The `DefId` of the `impl AsyncDrop`
-    pub impl_did: LocalDefId,
+    pub impl_did: DefId,
 }
 
 #[derive(Clone, Copy, PartialEq, Eq, HashStable, TyEncodable, TyDecodable)]
diff --git a/compiler/rustc_middle/src/ty/util.rs b/compiler/rustc_middle/src/ty/util.rs
index 6fe5927c29f..9676aa40448 100644
--- a/compiler/rustc_middle/src/ty/util.rs
+++ b/compiler/rustc_middle/src/ty/util.rs
@@ -465,7 +465,7 @@ impl<'tcx> TyCtxt<'tcx> {
             dtor_candidate = Some(impl_did);
         }
 
-        Some(ty::AsyncDestructor { impl_did: dtor_candidate? })
+        Some(ty::AsyncDestructor { impl_did: dtor_candidate?.into() })
     }
 
     /// Returns the set of types that are required to be alive in