36 Commits

Author SHA1 Message Date
Ed Page
f80fc018a6 test: Ensure we don't rely on unit return values
This will allow changing `Execs::run` return type
2024-11-18 20:52:53 -06:00
Ed Page
1c8509b219 fix(toml): Don't require MSRV bump for pub/priv
In #13308, we decided to make the feature gate for public/private
dependencies non-blocking.
Generally, people opt-in to a feature that is non-blocking through `-Z`
but some nightly users want an "always on" mode for this, so we offered
both in #13340.
In #13340, we made both feature gates work but we did not make them
non-blocking for stable, only nightly.

This change makes the feature gate non-blocking on stable.
2024-09-06 14:49:43 -05:00
Ed Page
d2ec764995 fix(resolve): Dont show locking workspace members
This is for `cargo generate-lockfile` and when syncing the lockfile with
the manifest.
We still show it for `cargo update` because of `cargo update
--workspace`.

We hacked around this previously by filtering out the `num_pkgs==1` case
for single packages but this didn't help with workspaces.
2024-08-22 16:57:06 -05:00
Lin Yihai
485c88c8aa test: Migrate pub_priv.rs to snapshot 2024-06-19 16:23:36 +08:00
Ed Page
dc5ac62cab fix(test): Deprecate non-snapbox assertions
While this is noisy and hides other deprecations, I figured deprecations would
make it easier for people to discover what tasks remain and allow us to
divide and conquer this work rather than doing a heroic PR.
In theory, this will be short lived and we'll go back to seeing
deprecations in our tests.
2024-06-10 10:20:52 -05:00
Ed Page
1876326b6b feat(resolve): Tell the user the style of resovle done
This is to help with #9930

Example changes:
```diff
-[LOCKING] 4 packages
+[LOCKING] 4 packages to latest version
-[LOCKING] 2 packages
+[LOCKING] 2 packages to latest Rust 1.60.0 compatible versions
-[LOCKING] 2 packages
+[LOCKING] 2 packages to earliest versions
```

Benefits
- The package count is of "added" packages and this makes that more
  logically clear
- This gives users transparency into what is happening, especially with
  - what rust-version is use
  - the transition to this feature in the new edition
  - whether the planned config was applied or not (as I don't want it to
    require an MSRV bump)
- Will make it easier in tests to show what changed
- Provides more motiviation to show this message in `cargo update` and
  `cargo install` (that will be explored in a follow up PR)

This does come at the cost of more verbose output but hopefully not too
verbose.  This is why I left off other factors, like avoid-dev-deps.
2024-04-13 20:39:59 -05:00
Ed Page
4ab2797f36 feat(lock): Print lockfile changes on all commands 2024-03-12 13:39:56 -05:00
Lin Yihai
759c3adbc4 chore: Optimize log display about -Zpublic-dependency 2024-03-07 22:01:21 +08:00
Ed Page
14646e6af6 test: Make edition explicit on packages 2024-02-22 11:37:03 -06:00
Lin Yihai
01de3e0fe7 feat: Add "-Zpublic-dependency" for public-dependency feature 2024-02-27 05:10:17 +08:00
Ed Page
e7e8d8748a fix(compiler): Clarify we're showing a profile name 2024-02-08 14:01:39 -06:00
Lin Yihai
35d5fae5b6 test: support publish package with a public field. 2024-01-03 04:08:59 +08:00
bors
7688d896a8 Auto merge of #13135 - linyihai:limit-priv-to-library, r=epage
Limit exported-private-dependencies lints to libraries

### What does this PR try to resolve?
Completed https://github.com/rust-lang/cargo/issues/13039.

This PR limit `exported-private-dependencies`  lint in libraray `Target`.

### How should we test and review this PR?

Your can checkout out 2348ac2a20edf772495349d7911938251e343bf1 and run test, it will failed and then it will be passed in the commit 2348ac2a20edf772495349d7911938251e343bf1

### Additional information
2023-12-11 17:22:22 +00:00
Lin Yihai
58c673d040 test(pub_priv): covering build.rs test 2023-12-09 17:14:10 +08:00
Lin Yihai
ab13b10066 feat: limit -extern priv: to libraries 2023-12-09 16:11:05 +08:00
Lin Yihai
db0c5c1d72 test(priv_dep): verify -extern priv: do not limit in lib target. 2023-12-09 16:00:35 +08:00
Ed Page
00557a2a77 fix(toml): Disallow inheriting of dependency public status
This is a step towards #44663.  When discussing inheriting this field
for #13046, we realized that we should probably start by disallowing
inheritance.  We can always add it later.  imo the principle of what should
be inherited is what is truely common among dependencies.  For example,
we don't allow removing features.  Public should not be universally
applied and likely should be explicit so its not over-done, especially
since we can't (atm) lint for when a public dependency could be
non-public.

This reverts parts of #12817
2023-12-05 17:00:01 -06:00
Alex Crichton
756fc4084e Support public dependency configuration with workspace deps
This commit updates the processing of `workspace = true` dependencies in
the `[dependencies]` section to process the `public` field. Previously
this field was ignored and didn't get plumbed through as configured.
2023-10-13 00:32:05 -07:00
Scott Schafer
1b9af485c1 chore: update pub_priv tests to use check 2023-02-20 12:22:24 -06:00
Eric Huss
1c3640e05c Add requirements to cargo_test. 2022-07-30 19:36:58 -07:00
Scott Schafer
c239e407e7 add a reason to masquerade_as_nightly_cargo so it is searchable 2022-07-15 21:32:23 -05:00
Eric Huss
2c99f654c9 Update nightly failure notification. 2021-07-05 16:08:36 -07:00
Eric Huss
7bbef3defe Rework cargo-features a little.
* Add `removed` support.
* Include the version where it is stabilized.
* Include a links to the documentation in the error/warning messages.
2021-01-21 12:16:35 -08:00
Eric Huss
9b590d0dd4 Bump to 0.51.0 2020-11-23 17:34:18 -08:00
Eric Huss
6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07:00
Eric Huss
fd25718660 Fix nightly exported_priv_warning test. 2020-09-05 10:31:04 -07:00
Alex Crichton
6514c289d2 Improve git error messages a bit
This commit is targeted at further improving the error messages
generated from git errors. For authentication errors the actual URL
fetched is now printed out as well if it's different from the original
URL. This should help handle `insteadOf` logic where SSH urls are used
instead of HTTPS urls and users can know to track that down.

Otherwise the logic about recommending `net.git-fetch-with-cli` was
tweaked a bit and moved to the same location as the rest of our error
reporting.

Note that a change piggy-backed here as well is that `Caused by:` errors
are now automatically all tabbed over a bit instead of only having the
first line tabbed over. This required a good number of tests to be
updated, but it's just an updated in renderings.
2020-06-25 08:47:15 -07:00
Eric Huss
75e7b41823 Fix nightly test matching rustc "warning" output. 2020-04-12 21:09:39 -07:00
Eric Huss
83571aee56 Minor testsuite organization. 2019-11-24 18:42:45 -08:00
Alex Crichton
9115b2c326 Extract support directory to its own crate
Extract out all our test support code to its own standalone crate so it
can be shared between multiple test suites if necessary.
2019-09-16 11:47:09 -07:00
Jethro Beekman
0e0d968825 Update #[test] attribute on all tests in the testsuite
sed -i 's/^#\[test\]/#[cargo_test]/' $(rg -l '^#\[test\]')

Manual fixes:
* proc_macro::proc_macro_doctest
2019-06-07 12:41:26 -07:00
k-nasa
63a9c7aa6d $cargo fmt --all 2019-05-02 06:39:15 +09:00
Aaron Hill
df4d2095ac
Prevent 'public' specifier from being used on non-Normal dependencies 2019-04-25 22:42:19 -04:00
Aaron Hill
8a45e5c0b0
Format pub_priv test 2019-04-25 22:42:19 -04:00
Aaron Hill
be9ae5e547
Fix error message on stable 2019-04-25 22:42:18 -04:00
Aaron Hill
87f1a4b217
Implement the 'frontend' of public-private dependencies
This is part of https://github.com/rust-lang/rust/issues/44663

This implements the 'frontend' portion of RFC 1977. Once PRs
https://github.com/rust-lang/rust/pull/59335 and
https://github.com/rust-lang/crates.io/pull/1685 are merged,
it will be possible to test the full public-private dependency feature:
marking a dependency a public, seeing exported_private_dependencies
warnings from rustc, and seeing pub-dep-reachability errors from Cargo.

Everything in this commit should be fully backwards-compatible - users
who don't enable the 'public-dependency' cargo feature won't notice any
changes.

Note that this commit does *not* implement the remaining two features of
the RFC:

* Choosing smallest versions when 'cargo publish' is run
* Turning exported_private_dependencies warnings into hard errors when
'cargo publish' is run

The former is a major change to Cargo's behavior, and should be done
in a separate PR with some kind of rollout plan.

The latter is described by the RFC as being enabled at 'some point in
the future'. This can be done via a follow-up PR.
2019-04-25 22:42:18 -04:00