-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Make it possible to construct TargetInfo without Context #5355
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
Changes from all commits
90954d7
c2cd786
0edcbc9
3d39ae3
eb45a62
3ec14e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,6 +89,12 @@ impl BuildConfig { | |
| ..Default::default() | ||
| }) | ||
| } | ||
|
|
||
| pub fn target_triple(&self) -> &str { | ||
| self.requested_target | ||
| .as_ref() | ||
| .unwrap_or_else(|| &self.host_triple) | ||
| } | ||
| } | ||
|
|
||
| /// Information required to build for a target | ||
|
|
@@ -601,7 +607,7 @@ fn rustdoc<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) -> CargoResult | |
| add_path_args(cx, unit, &mut rustdoc); | ||
|
|
||
| if unit.kind != Kind::Host { | ||
| if let Some(target) = cx.requested_target() { | ||
| if let Some(ref target) = cx.build_config.requested_target { | ||
| rustdoc.arg("--target").arg(target); | ||
| } | ||
| } | ||
|
|
@@ -862,7 +868,10 @@ fn build_base_args<'a, 'cfg>( | |
| cmd, | ||
| "--target", | ||
| "", | ||
| cx.requested_target().map(|s| s.as_ref()), | ||
| cx.build_config | ||
| .requested_target | ||
| .as_ref() | ||
| .map(|s| s.as_ref()), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we make some of this fields into methods of
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no strong opinions about this, but to me "using only fields" or "using only methods" seems slightly superior to "use fields for some stuff and methods for some other stuff", Code like seems slightly funny, and makes you pause for a split second. And looks like after #5354 we might need less public access to fields? But, as I've said, it's an ultra minor issue :)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you want to go all or none I would leave it as none. :) After replacing all instances of |
||
| ); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move this into
Compilation::newas well?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I definitely thought about it. I decided against it for now mostly on style (passing around long names is kind of ugly). I just looked into how the rest of
Compilationgets initialized, and it looks like pretty much everything gets initialized after the fact from throughoutContext, so passing these two in atnew()is not a win for consistency. What do you think?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, let's leave it as is