-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
add a reason to masquerade_as_nightly_cargo
so it is searchable
#10868
Conversation
r? @ehuss (rust-highfive has picked a reviewer for you, use r? to override) |
src/doc/contrib/src/tests/writing.md
Outdated
@@ -192,12 +192,12 @@ Be sure to check the snapshots to make sure they make sense. | |||
#### Testing Nightly Features | |||
|
|||
If you are testing a Cargo feature that only works on "nightly" Cargo, then | |||
you need to call `masquerade_as_nightly_cargo` on the process builder like | |||
this: | |||
you need to call `masquerade_as_nightly_cargo` on the process builder nd pass |
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.
nd
-> and
tests/testsuite/cargo_config.rs
Outdated
@@ -273,7 +273,7 @@ target.\"cfg(target_os = \\\"linux\\\")\".runner = \"runme\" # [ROOT]/home/.carg | |||
|
|||
cargo_process("config get --show-origin build.rustflags -Zunstable-options") | |||
.cwd(&sub_folder.parent().unwrap()) | |||
.masquerade_as_nightly_cargo() | |||
.masquerade_as_nightly_cargo(&["cargo config"]) |
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.
Eh, guess its good enough
unstable-options
is an umbrella feature- nothing else really to specify
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.
cargo config
is unstable which is why I used it. The question I have is should we prefer dashes? as in cargo-config
? It might be slightly better
tests/testsuite/cargo_features.rs
Outdated
@@ -19,7 +19,7 @@ fn feature_required() { | |||
.file("src/lib.rs", "") | |||
.build(); | |||
p.cargo("build") | |||
.masquerade_as_nightly_cargo() | |||
.masquerade_as_nightly_cargo(&["cargo_features"]) |
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.
Hmm, unsure what communicates intent best here.
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 debated with im-a-teapot
or test-dummy-unstable
but those don't really cover why. always_nightly
or both might be better but I am unsure here as well
p.cargo("build -v -Zcheck-cfg=features") | ||
.masquerade_as_nightly_cargo() | ||
.masquerade_as_nightly_cargo(&["check-cfg"]) |
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.
Haven't dealt with this one before, unsure if we should do it as check-cfg
or check-cfg=features
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 think check-cfg
is better since that is that the unstable feature is called. If certain parts get stabilized before others (like features
), at that point it should become check-cfg=features
@@ -32,7 +32,7 @@ fn gated() { | |||
.build(); | |||
|
|||
p.cargo("publish --no-verify") | |||
.masquerade_as_nightly_cargo() | |||
.masquerade_as_nightly_cargo(&["credential-process"]) |
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.
Something is non-obvious here since the -Zcredential-process
is unspecified for this and the next test
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'll dig a bit but removing masquerade_as_nightly_cargo
allows it to work but the test is called gated
. Maybe it should have -Zcredential-process
?
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 updated everything but this. I honestly have no idea why masquerade_as_nightly_cargo
is here.
@ehuss it looks like you wrote this, do you have any ideas?
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.
There's not really a strong reason to have it one way or the other. Switching to nightly mode makes extra sure that it does not implicitly use the feature without the -Z
flag. There are some things that behave differently in nightly mode, and I was probably just trying to be extra paranoid here. But it is also unlikely for that to be a problem in practice.
@@ -2012,7 +2012,7 @@ fn minimal_download() { | |||
// none | |||
// Should be the same as `-Zfeatures=all` | |||
p.cargo("check -Zfeatures=compare") | |||
.masquerade_as_nightly_cargo() | |||
.masquerade_as_nightly_cargo(&["features=compare"]) |
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 this be always_nightly
?
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'm not sure what this should be. This makes it seem like it shouldn't be nightly forever, or that it should at least be moved to its own command. The correct decision might be to tag it with both I am unsure
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.
Either would be fine, this is a permanently unstable option. I'm fine with leaving it as-is.
3e4f94d
to
c239e40
Compare
☀️ Test successful - checks-actions |
Update cargo 9 commits in 8827baaa781b37872134c1ba692a6f0aeb37890e..d8d30a75376f78bb0fabe3d28ee9d87aa8035309 2022-07-14 02:56:51 +0000 to 2022-07-19 13:59:17 +0000 - docs: fixing minor error in the default timing report filename (rust-lang/cargo#10879) - Stabilize `--crate-type` flag for `cargo rustc` (rust-lang/cargo#10838) - Stabilize `-Zmultitarget` (rust-lang/cargo#10766) - Clean up leftover in unstable documentation (rust-lang/cargo#10874) - Normalize path for `cargo vendor` output (rust-lang/cargo#10668) - add a reason to `masquerade_as_nightly_cargo` so it is searchable (rust-lang/cargo#10868) - Allow '.' in workspace.default-members in non-virtual workspaces. (rust-lang/cargo#10784) - remove`.masquerade_as_nightly_cargo()` from various tests the no longer need it (rust-lang/cargo#10867) - remove `.masquerade_as_nightly_cargo()` from build_script_extra_link_arg.rs (rust-lang/cargo#10866)
When I was working on the stabilization for workspace inheritance, it was very tedious to find all of the places to remove
.masquerade_as_nightly_cargo()
. I suggested to add a reason to.masquerade_as_nightly_cargo()
so that it would be easier to find all of the places to remove it. By adding the reason it makes it easy to search for all places with the features name. This PR adds the reason(s) to all of the places.masquerade_as_nightly_cargo()
is called, as well as updates the documentation so it talks about adding a reason when making the call.