Uh oh!
There was an error while loading. Please reload this page.
rustc: add a --print targets command - #31358
Conversation
There was a problem hiding this comment.
Would it be possible to not duplicate this list with the one below? Could the macro somehow use something like stringify! to build a vector, or could an iterator macro be used?
There was a problem hiding this comment.
It seems tricky to handle mixture of hyphens and an underscore...
There was a problem hiding this comment.
I think "x86_64-w64-mingw32" is an alias for "x86_64-pc-windows-gnu" and should be included in the list as a valid target.
There was a problem hiding this comment.
Would it be possible to not duplicate this list with the one below? Could the macro somehow use something like stringify! to build a vector, or could an iterator macro be used?
As @nodakai said, the mixture of hyphens and underscores makes it tricky.
I think "x86_64-w64-mingw32" is an alias for "x86_64-pc-windows-gnu" and should be included in the list as a valid target.
That's what the logic of this function seems to indicate. But, rustc --target=x86_64-w64-mingw32 ... returns error: Error loading target specification: Could not find specification for target "x86_64-w64-mingw32".
There was a problem hiding this comment.
I think "x86_64-w64-mingw32" is an alias for "x86_64-pc-windows-gnu" and should be included in the list as a valid target.
The former is deprecated and I don't think we should be promoting it.
There was a problem hiding this comment.
I agree with @brson that we shouldn't be handling aliases, and this also probably isn't the right place to discuss it regardless (e.g. an issue would be more appropriate).
@japaric sure it's trick but that doesn't mean it's not possible! I'd be personally much happier with something like:
load!{(x86_64_pc_windows_gnu,"x86_64-pc-windows-gnu"),// ...}It's basically just much easier if there doesn't need to exist a comment of "modify this other location as well" as they will invariably get out of sync.
There was a problem hiding this comment.
sure it's trick but that doesn't mean it's not possible!
Well, I was thinking about a macro that didn't need to specify the triple twice in different formats (hyphenated and underscored).
I'd be personally much happier with something like:
Yeah, that looks less prone to errors. I'll look into it.
alexcrichton
commented
Feb 2, 2016
This can in theory have some form of interaction with custom target specifications where we probe for I'm pretty ok with the option here, though. We may want to rename |
alexcrichton
commented
Feb 2, 2016
cc @rust-lang/tools |
japaric
commented
Feb 2, 2016
Wait RUST_TARGET_PATH is a thing? TIL
Yeah I don't think it should. The other --print commands don't do that kind of probing. Also it seems the command would have to look at all the *.json files and check that they are valid target specification files.
Happy to rename |
alexcrichton
commented
Feb 2, 2016
That's ok, if you unlearn it right now I'd be fine with that. |
nagisa
commented
Feb 3, 2016
This should probably also print the target passed in to rust through |
japaric
commented
Feb 3, 2016
Pushed two commits. The first one generates the TARGETS constant from the existing macro as @alexcrichton suggested. The second commit makes the rmake test simpler.
This seems doable and makes sense, but I wasn't expecting it to come up in practice. @alexcrichton thoughts? |
There was a problem hiding this comment.
While copy pasting this code, I noticed these last two else-if branches are effectively unreachable (because of the let target = target.replace("-", "_"); a few lines above).
Not sure if I should fix them or just remove them. Probably the latter because @brson said these targets are deprecated.
There was a problem hiding this comment.
Ah for now I'd just leave out these targets entirely, we've generally tried to remove them as much as possible
nrc
commented
Feb 3, 2016
Can we have |
bors
commented
Feb 4, 2016
☔ The latest upstream changes (presumably #31078) made this pull request unmergeable. Please resolve the merge conflicts. |
vi
commented
Feb 6, 2016
Can there be |
japaric
commented
Feb 6, 2016
That's what I proposed on IRC because of the |
vi
commented
Feb 6, 2016
Alternatively, error message for unknown/malformed target like |
alexcrichton
commented
Feb 6, 2016
Yeah right now |
alexcrichton
commented
Feb 11, 2016
Ok, the tools team had a chance to talk about this today during triage, and we all agreed that this is good to add, but none of us felt too too strongly about the name. Some possibilities were:
I think that I may lean a bit in favor of |
japaric
commented
Feb 11, 2016
I like the sound of |
alexcrichton
commented
Feb 11, 2016
Ah I was just thinking in terms of there being a difference between targets we can generate code for and targets we can generate things like rlibs/binaries for. The latter case would require a standard library and/or libcore, but as I write this down it sounds weird. Anyway |
japaric
commented
Feb 12, 2016
removed the deprecated mingw aliases, renamed print targets to print target-list, rebased and squashed. r? @alexcrichton |
alexcrichton
commented
Feb 12, 2016
bors
commented
Feb 13, 2016
that prints a list of all the triples supported by the `--target` flag r? @alexcrichton
that prints a list of all the triples supported by the
--targetflagr? @alexcrichton