Conversation
This was referenced May 14, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is similar to #50, but determining to use
/vs\based on the host OS, not the target OS.From Maximum Path Length Limitation: File I/O functions in the Windows API convert "/" to "\" as part of converting the name to an NT-style name, except when using the "\\?\" prefix as detailed in the following sections. If the OUT_DIR directory for the current build on a Windows host is prefixed with "\\?\", then
include!(concat!(…, "/…"))does not work:couldn't read \\?\D:\a\tokio\tokio\target\debug\build\rustversion-2d44b26e828f2c8d\out/version.expr: The filename, directory name, or volume label syntax is incorrect. (os error 123)Rustc or cargo do not have any built-in way to handle including code from OUT_DIR robustly (rust-lang/rust#75075).
Specifically for a procedural macro crate, using
target_oslike in #50 sort of works, but only because Cargo does not support cross-compiling procedural macro crates (it just ignores--targetif--packagerefers to a macro). But other build systems definitely support cross-compiling proc macros, and would be broken by #50 iftarget_osis Windows but the host is not.Closes #50.