Skip to content

Conversation

@zhangli-pear
Copy link

Add support for *-win7-windows-msvc.

@Fenex
Copy link

Fenex commented Jan 22, 2025

I've tried to compile a modern rustc as host compiler for running on win7 and facing with the same error.

However I think its will be better to skip checks for target_components()[1] (known as target_vendor) at all due vendors can be various, but this all is msvc actually. Earlier we have "pc" only, right now we want to add "win7". Perhaps, in the future we need to add something else. At least for now there is a "rust9x" target vendor to compile for Windows Vista and older (down to 9x/ME).

tldr, my proposal to use this function:

fn is_windows_msvc() -> bool {
    // Some targets are only two components long, so check in steps.
    target_components().len() > 2
        && target_components()[2] == "windows"
        && target_components()[3] == "msvc"
}

or maybe even (it's required to deeper research for correctness):

fn is_windows_msvc() -> bool {
    // Some targets are only two components long, so check for length before access to ABI target component.
    target_components().len() == 4 && target_components()[3] == "msvc"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants