Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow tweaking of the compiler artifacts to emit in the profile. #1027

Closed
wants to merge 2 commits into from

Conversation

cgaebel
Copy link

@cgaebel cgaebel commented Dec 11, 2014

It's really frustrating being unable to easily dump the assembly
and llvm ir generated by rustc through cargo. This patch provides
a way.

It's really frustrating being unable to easily dump the assembly
and llvm ir generated by rustc through cargo. This patch provides
a way.
@alexcrichton
Copy link
Member

I'm somewhat wary of doing this as this is breaching into the territory of invoking unintended behavior out of the compiler. Extreme level of customization in running the compiler is definitely something that falls under Cargo's umbrella, but this falls more under a subcommand than configuration in a profile.

Profiles are largely intended for long-term configuration for a project whereas this is quite often a temporary configuration desired, in which case there should be no need to edit a file to quickly get the disassembly.

As an implementation, I think that this may be buggy because if any of my dependencies have an emit key then they won't actually emit rlibs but rather whatever that emit key entails.

@cgaebel
Copy link
Author

cgaebel commented Dec 11, 2014

Good point. I've added this as flags passed to the various subcommands where it makes sense, instead of via the manifest.

I've also decreased the level of customization. When you want to emit one extra build artifact, it's usually no big deal to emit a few extras. There's also less that can go wrong. Therefore, it's now just one flag passed to cargo build: --emit-intermediate

@alexcrichton
Copy link
Member

Ah sorry I meant more that any use of --emit should be going through an entirely new subcommand instead of moving out into each of the separate commands that cargo has. Unfortunately this means that at this time we won't be able to add the --emit flags to rustc because the cargo rustc subcommand doesn't exist, but I would hate to start bubbling many of rustc's flags up to the level of cargo for each subcommand.

@cgaebel
Copy link
Author

cgaebel commented Dec 12, 2014

When more flags are requested and/or implemented and it becomes a problem, it can be factored out into a separate subcommand pretty easily.

It'd be a shame to block having this feature on a generic cargo rustc command. It's very ergonomic in its current form and doesn't add much complexity.

@alexcrichton
Copy link
Member

One of the problems with a strategy like that, however, is that it's a breaking change to remove flags from commands. We're thinking pretty seriously about the stability of the compiler and Cargo now, and this isn't a flag we'd want to commit to until the end of time which is why I'd like to hold off on it for now.

I'm sorry cargo rustc doesn't exist just yet, and I agree that this is quite simple and doesn't add much, but it's a slippery slope to start including all other flags from the compiler to top-level flags in Cargo. The unambiguous location for this to live is in cargo rustc, and we can always add new subcommands backwards-compatibly, so I'd like to hold off on this until we have a good place to put it.

In the meantime though I'm going to close this, but feel free to reach out to me on IRC if you're interested in working on cargo rustc!

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