Print native-static-libs to stdout

Currently, rustc flag --print native-static-libs prints the list of libs to stderr as a diagnostics note. It makes it harder to use for e.g. other build systems, and is inconsistent with other print flags (like target-list).

I think it should print list of libraries to stdout, separated by newlines, just like --print target-list.

This would probably be a breaking change, so I don't we can change it.

We can still introduce a new flag that behaves more consistently. Proposal: something along the lines of needs-link.

In general, though, imho --print should integrate better with --message-format (well, it's currently --error-format,) and with e.g. --message-format=json --format-version=2 we can give structured output rather than the current output.

This can even apply to the current --print options. Or it could be a separate flag, e.g. --print-format=json (the current is e.g. --print-format=compat)

1 Like