diff --git a/library/std/src/sys/pal/unix/fs.rs b/library/std/src/sys/pal/unix/fs.rs
index abd32b819e0..5987996a3f1 100644
--- a/library/std/src/sys/pal/unix/fs.rs
+++ b/library/std/src/sys/pal/unix/fs.rs
@@ -893,6 +893,7 @@ impl Drop for Dir {
             target_os = "nto",
             target_os = "vita",
             target_os = "hurd",
+            target_os = "espidf",
         )))]
         {
             let fd = unsafe { libc::dirfd(self.0) };