-
Notifications
You must be signed in to change notification settings - Fork 93
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 fallback on value package.rust-src if XARGO_RUST_SRC doesn't exist #288
Conversation
@jam1garner thanks for the PR! I have to say however, that this feels rather ad-hoc. Could you talk a bit about why you want this new feature, and why the |
The CI failure seems to also occur on master, but I haven't been able to reproduce it locally yet (still on it). It worked fine a few weeks ago when the last PR landed; might be a rustc regression. |
So my motivation for this is, admittedly, somewhat ad-hoc in nature. After having a lot of issues with git (primarily upstream issues from cargo and libgit2), I've found builds to be easier for users to reproduce through
I can't really set the Rust source path. Having a more permanent per-project means of configuring this felt appropriate. As far as why the
I'm open to any suggestions as to how to better integrate something that serves these needs while fitting the existing structure of the project, but if this style of change is just not a good fit for Xargo I certainly don't mind if I have to continuously maintain this soft fork for my users. Regardless, thanks for taking time to consider my PR! |
I am very confused... you are working around cargo issues by using xargo, but would not otherwise need xargo? Do you have a reference for where these upstream issues you mentioned are tracked? Seems better to fix them than to accumulate more hacks elsewhere in the ecosystem. ;) Also your example
Yeah and that is exactly why I am wary of adding one, in this stage of xargo (maintenance-only, I am here mostly because I care about xargo working for the sake of miri.) |
I am using xargo for providing an stdlib implementation for an otherwise unsupported platform. I was mentioning my motivation for this PR, not for using xargo in general.
Yes, not having shallow clones is actually the main issue that comes to mind -- rust-lang/cargo#1171
Y'know what? Fair. I'm afraid I don't quite have the time or motivation to try and make such large contributions to libgit2 (and then cargo) as would be required to push this along while the issue is still relevant to me. (Which, to be clear, is on me_
I mean yeah of course absolute paths aren't robust (admittedly the example I gave in the original comment was just the output of pwd that I had thrown into my toml for testing). What I actually use now is: [package]
rust-src = "../rust-std-skyline-squashed/src" The idea is that, for my use case, a user has a lot of projects linking against the same libstd and would like to ensure they are sharing the same copy (to save space and for control over updating). And, for other projects, including the rust source a submodule is reasonable. |
That is very useful information, thanks. Indeed it seems quite reasonable to not rely on xargo figuring out where the normal rust std source are as those are not very useful to you anyway. Suddenly it feels much less like a hack. ;) Is
Okay, so (for the cases where you don't use submodules) you are expecting the user to perform some setup steps to get a matching folder layout. Makes sense. Honestly the submodule case sounds even more convincing to me, that could then even be entirely self-contained: |
Yep! you can find it here: https://github.com/jam1garner/rust-std-skyline-squashed, it's a Github Actions squashed repo created from here: https://github.com/jam1garner/rust-std-skyline. Honestly it's nothing special, just a fork + squash of the rust-lang/rust repo.
Yep!
I certainly agree. If I didn't expect people to have a g good number of projects at once depending on my stdlib, I would absolutely have gone that route. |
Interesting. |
@@ -46,7 +46,7 @@ impl Rustflags { | |||
pub fn for_xargo(&self, home: &Home) -> String { | |||
let mut flags = self.flags.clone(); | |||
flags.push("--sysroot".to_owned()); | |||
flags.push(home.display().to_string()); | |||
flags.push(format!("\"{}\"", home.display())); |
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.
Isn't this RUSTFLAGS
? The quotes won't work there. There currently just is no way to pass arguments with spaces via RUSTFLAGS
. That is a cargo bug: rust-lang/cargo#6139
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.
Oh I'm sorry I forgot I never closed this PR, I was trying to fix some random person's issue and must've pushed to master, my bad! Thank you for the additional info!
To clarify: I've since moved from one xargo wrapper ( |
Wow I had no idea there are xargo wrappers out there, let alone several of them... I hope they all have appropriate warnings that they rely on a tool that's basically unmaintained.^^ |
This allows for including a
package
table in Xargo.toml, which optionally can contain arust-src
string specifying a rust source path in lieu of the existence of theXARGO_RUST_SRC
environment variable.Example
Xargo.toml
: