-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Fix crate-version with rustdoc in bootstrap. #75539
Fix crate-version with rustdoc in bootstrap. #75539
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
Hm, so I completely forgot that the non-dev version string has a space in it, which won't work with RUSTDOCFLAGS. That's...unfortunate. I'm trying to decide how to deal with this. Some options I'm considering:
Do any of those options sound reasonable? Or any other ideas? I would probably lean towards advanced-env. |
The version string is 1.47.0-nightly (81dc88f 2020-08-13), right? Could we swap the space for An other option is to pass a fake version via RUSTDOCFLAGS and then swap it out in our wrapper... Do you have some sense of how stable we expect the toml environment stuff to be? If it's pretty likely to not change (much) then I think that's probably our best bet. I wouldn't mind the (simpler?) fix of not using a real space though. |
Yes.
I had the same idea. Rustdoc escapes the With nbsp, it gets a little too wide for the sidebar, particularly with the nightly/beta strings. Of course Unicode has a million other spaces to choose from. en-space (
Unfortunately I don't. It was an experiment that we haven't really pursued too much. |
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.
r=me either way - I think a new line might be a bit better, but I don't care much either way.
// does not support arguments with regular spaces. Hopefully someday | ||
// Cargo will have space support. | ||
let rust_version = self.rust_version().replace(' ', "\u{2002}"); | ||
rustdocflags.arg("--crate-version").arg(&rust_version); |
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.
This might be a bit out there, but should work more uniformly across platforms I think. If cargo is splitting by regular ASCII space only, we could use a new line here.
That said, thinking some more about this it seems really error prone - anyone can replace that splitting with split_whitespace which would break us here. But I feel like that's not too big a deal, we can fix it as needed. Would you be up for adding a Cargo test as well so that the (potential) breakage is detected earlier?
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.
Ah, I like newline better.
I'll put it on my todo list to add a regression test in cargo.
2593736
to
85a9cfa
Compare
@bors r=Mark-Simulacrum |
📌 Commit 85a9cfa has been approved by |
☀️ Test successful - checks-actions, checks-azure |
Cargo will now automatically use the
--crate-version
flag (see rust-lang/cargo#8509). Cargo has special handling to avoid passing the flag if it is passed in via RUSTDOCFLAGS, but therustdoc
wrapper circumvents that check. This causes a problem because rustdoc will fail if the flag is passed in twice. Fix this by using RUSTDOCFLAGS.This will be necessary when 1.47 is promoted to beta, but should be safe to do now.