Skip to content

Commit 62e17a3

Browse files
committed
Add a way to disable dll copying for users of proc_macro_srv library
1 parent cd6521e commit 62e17a3

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

crates/proc_macro_srv/Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ expect-test = "1.2.0-pre.1"
3030

3131
# used as proc macro test targets
3232
proc_macro_test = { path = "../proc_macro_test" }
33+
34+
[features]
35+
default = ["copy-dll-on-windows"]
36+
copy-dll-on-windows = [] # Please keep the feature (or another way to disable DLL copying) for intellij-rust

crates/proc_macro_srv/src/dylib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl Expander {
162162
}
163163

164164
/// Copy the dylib to temp directory to prevent locking in Windows
165-
#[cfg(windows)]
165+
#[cfg(all(windows, feature = "copy-dll-on-windows"))]
166166
fn ensure_file_with_lock_free_access(path: &Path) -> io::Result<PathBuf> {
167167
use std::collections::hash_map::RandomState;
168168
use std::ffi::OsString;
@@ -189,7 +189,7 @@ fn ensure_file_with_lock_free_access(path: &Path) -> io::Result<PathBuf> {
189189
Ok(to)
190190
}
191191

192-
#[cfg(unix)]
192+
#[cfg(any(unix, not(feature = "copy-dll-on-windows")))]
193193
fn ensure_file_with_lock_free_access(path: &Path) -> io::Result<PathBuf> {
194194
Ok(path.to_path_buf())
195195
}

0 commit comments

Comments
 (0)