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

Minor refactoring and features in rustc driver for embedders #15820

Closed
wants to merge 5 commits into from

Conversation

brson
Copy link
Contributor

@brson brson commented Jul 20, 2014

This fixes some pain points I found while working on a tool that embeds rustc. These changes save me from copy-pasting 500 lines from rustc.

Two refactorings:

  • monitor is public. Need it to run the compiler properly.
  • Extracted parsing of the --crate-type argument.

Two minor features:

  • The session's Option type takes an alt_std_name that can be used to override the crate that is automatically linked as extern crate std = "name";. I'm using this for customization.
  • compile_input takes a Option<Plugins> to customize the compiler pipeline programmatically.

Neither of the two new features are exposed via command line flags since their general utility isn't obvious.

brson added 4 commits July 19, 2014 20:57
It's harder to run rustc correctly without it.
Helpful for users of rustc as a library.
This provides a way for clients of the rustc library to add
their own features to the pipeline.
This adds the alt_std_name field to the Session's Options type.
I'm using this in an external tool to control which libraries
a crate links to.
@@ -97,6 +97,7 @@ pub struct Options {
pub color: ColorConfig,
pub externs: HashMap<String, Vec<String>>,
pub crate_name: Option<String>,
pub alt_std_name: Option<String>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a doc-comment here?

@huonw
Copy link
Member

huonw commented Jul 20, 2014

r=me with the docs & make tidy-ing.

bjorn3 added a commit to bjorn3/rust that referenced this pull request Feb 11, 2022
This option introduced in rust-lang#15820 allows a custom crate to be imported in
the place of std, but with the name std. I don't think there is any
value to this. At most it is confusing users of a driver that uses this option. There are no users of
this option on github. If anyone still needs it, they can emulate it
injecting #![no_core] in addition to their own prelude.
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.

4 participants