cargo icon indicating copy to clipboard operation
cargo copied to clipboard

test(priv_dep): add test for `verify public is respected recursively`

Open linyihai opened this issue 6 months ago • 1 comments

What does this PR try to resolve?

This PR want to verify public is respected recursively by rustc.
The original idea came from here: https://github.com/rust-lang/rust/issues/44663#issuecomment-1851227083.

How should we test and review this PR?

you can review and test on per commit.

Additional information

linyihai avatar Dec 18 '23 12:12 linyihai

r? @ehuss

(rustbot has picked a reviewer for you, use r? to override)

rustbot avatar Dec 18 '23 12:12 rustbot

Thanks for doing this investigation!

Any thoughts on what test cases are worth merging now vs waiting on rust-lang/rust#119428?

epage avatar Dec 27 '23 23:12 epage

Thanks for doing this investigation!

Any thoughts on what test cases are worth merging now vs waiting on rust-lang/rust#119428?

I think both test cases make sense. IMO, the test case recursive_package_pub_no_warning verifies the recursively public API does not cause warnings. recursive_package_priv_warning It's also a use case and a reminder of our current processing logic. It's ok to be updated recursive_package_priv_warning when this issue https://github.com/rust-lang/rust/issues/119428 has any progress.

And now I have no plans to add more use cases. If there is nothing else missing, I suggest a combined submission

linyihai avatar Dec 28 '23 11:12 linyihai

In the commit I add a public field when publish a crate, but this is only for test.

We should also support upload the public field when publish crates to cratess-io and so on.

At least one public needs to be added here: https://github.com/rust-lang/cargo/blob/master/crates/crates-io/lib.rs#L67, and optional: dep.is_public() in https://github.com/rust-lang/cargo/blob/master/src/cargo/ops/registry/publish.rs#L353C45-L353C45

linyihai avatar Dec 28 '23 12:12 linyihai

r? epage

ehuss avatar Jan 02 '24 14:01 ehuss

In the commit I add a public field when publish a crate, but this is only for test.

We should also support upload the public field when publish crates to cratess-io and so on.

At least one public needs to be added here: https://github.com/rust-lang/cargo/blob/master/crates/crates-io/lib.rs#L67, and optional: dep.is_public() in https://github.com/rust-lang/cargo/blob/master/src/cargo/ops/registry/publish.rs#L353C45-L353C45

and what do you think this? Maybe this is not what you need to do now, because this will add a 'public' field to the user's local file

linyihai avatar Jan 03 '24 11:01 linyihai

and what do you think this? Maybe this is not what you need to do now, because this will add a 'public' field to the user's local file

Sorry, had overlooked that message. Yes, we need to add publish support. Looking at bindeps and artifacts, it looks like we do that for unstable features today.

We will also need to make sure the crates.io side is implemented.

epage avatar Jan 03 '24 15:01 epage

:umbrella: The latest upstream changes (presumably #13245) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Jan 03 '24 15:01 bors

Sorry, had overlooked that message. Yes, we need to add publish support. Looking at bindeps and artifacts, it looks like we do that for unstable features today.

We will also need to make sure the crates.io side is implemented.

After talking in t-crates-io channel, I've gathered the information as below:

  • the crates-io currently not suport public field.
  • if they plan to support that they may ignore the public in metadata carried with the publish api.

So is it deserves to make a PR to add public field when publish crates?

linyihai avatar Jan 08 '24 10:01 linyihai