Support more of Cargo's debug levels with Build::debug_str #1624
+105
−12
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.
...at least when using GCC or Clang. (MSVC doesn't seem to have a
-g1equivalent from a cursory search, and I'm not an MSVC expert. This can always be improved later.)I modeled this after the handling for optimization levels, making sure not to break the existing
debugandget_debugfunctionality.There are two cases where this will behave differently from before (besides the cases that now produce
-g1):"none"is now treated as "no debug info" in addition to"0"and"false"and"", for consistency with CargoDEBUGenvironment variable is set, but its contents are not valid UTF-8, we now produce "no debug info". Previously that would count as "include debug info" for being non-empty. I don't expect this to break anyone in practice; it certainly won't ever happen from a Cargo build script.I could not figure out how to test the special case of
-gline-directives-only, which is supported by Clang and not GCC; the test utility'sgnumode doesn't have a way to force one or the other. It seems unlikely to be a problem, but if someone can describe the right test incantation I can add it!Fixes #1622.