14464 Commits

Author SHA1 Message Date
Weihang Lo
7c0add0ec0
refactor: extract logout to its own module 2023-06-20 19:23:20 +01:00
Weihang Lo
048267934b
refactor: extract login to its own module 2023-06-20 15:52:52 +01:00
Weihang Lo
d39c6504fa
refactor: extract search to its own module 2023-06-20 15:52:51 +01:00
Weihang Lo
e5382fcbf7
refactor: extract publish to its own module 2023-06-20 15:52:51 +01:00
Weihang Lo
81948a6e43
refactor: rename registry module to registry/mod.rs 2023-06-20 13:48:43 +01:00
Weihang Lo
71654316f3
refactor: extract asymmetric to its own module 2023-06-20 13:36:04 +01:00
Weihang Lo
ea2aecef59
refactor: rename registry auth module to auth/mod.rs
To be honest I don't even feel like they belong here.
Maybe we should have a dedicated directory for registry-related code.
2023-06-20 00:24:48 +01:00
bors
b81b251d2c Auto merge of #12285 - weihanglo:remove-jobserver-per-rustc, r=ehuss
fix: remove `-Zjobserver-per-rustc` again

It was accidentally added back in rust-lang/cargo@cfffda9ae5
2023-06-19 01:08:57 +00:00
bors
1fa8da2619 Auto merge of #12288 - weihanglo:doc-tweak, r=ehuss
docs: some tweaks around `cargo test`
2023-06-19 00:18:43 +00:00
Weihang Lo
132057306d
docs(unstable): remove tracking for -Zdoctest-in-workspace 2023-06-18 20:48:10 +01:00
Weihang Lo
b630ac16a9
docs(cargo-test): clarify the cwd is for running tests 2023-06-18 20:48:10 +01:00
Weihang Lo
c4312a4aa0
docs(cargo-test): missing apostrophe for possessive nouns 2023-06-18 20:32:13 +01:00
Weihang Lo
51326c8e4b
fix: remove -Zjobserver-per-rustc again
It was accidentally added back in
rust-lang/cargo@cfffda9ae5
2023-06-18 01:28:28 +01:00
bors
2cf2c32c1a Auto merge of #12221 - Swatinem:enable-doctest-in-workspace, r=weihanglo
Enable `doctest-in-workspace` by default

This stabilizes and enables the `-Z doctest-in-workspace` flag by default.

Also adds another testcase to make sure that the `include!()` and `file!()` macros interact well together.

fixes #9427
fixes https://github.com/rust-lang/rust/issues/46372
2023-06-17 20:37:43 +00:00
Arpad Borsos
18e290c0e4
Enable doctest-in-workspace by default
This stabilizes and enables the `-Z doctest-in-workspace` flag by default.

Also adds another testcase to make sure that the `include!()` and `file!()` macros interact well together.
2023-06-17 19:34:34 +02:00
bors
e518f7c45e Auto merge of #12283 - epage:build, r=weihanglo
fix(embedded): Don't auto-discover build.rs files

With #12268, we moved the manifest root to be the scripts parent
directory, making it so auto-discovery might pick some things up.

We previously ensured `auto*` don't pick things up but missed `build.rs`
This is now addressed.
2023-06-17 17:06:00 +00:00
bors
81a73926b3 Auto merge of #12282 - epage:target, r=weihanglo
fix(embeded): Don't pollute the scripts dir with `target/`

### What does this PR try to resolve?

This PR is part of #12207.

This specific behavior was broken in #12268 when we stopped using an intermediate
`Cargo.toml` file.

Unlike pre-#12268,
- We are hashing the path, rather than the content, with the assumption
  that people change content more frequently than the path
- We are using a simpler hash than `blake3` in the hopes that we can get
  away with it

Unlike the Pre-RFC demo
- We are not forcing a single target dir for all scripts in the hopes
  that we get #5931

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

A new test was added specifically to show the target dir behavior, rather than overloading an existing test or making all tests sensitive to changes in this behavior.

### Additional information

In the future, we might want to resolve symlinks before we get to this point
2023-06-17 16:15:20 +00:00
Ed Page
3f93030614 fix(embedded): Don't auto-discover build.rs files
With #12268, we moved the manifest root to be the scripts parent
directory, making it so auto-discovery might pick some things up.

We previously ensured `auto*` don't pick things up but missed `build.rs`
This is now addressed.
2023-06-17 11:01:02 -05:00
Ed Page
4427cfe619 test(script): Verify existing build.rs behavior 2023-06-17 10:59:54 -05:00
bors
424362a74c Auto merge of #12279 - weihanglo:next-lockfile-bump, r=epage
feat: prepare for the next lockfile bump
2023-06-17 13:45:57 +00:00
Weihang Lo
03556056d4
feat: prepare for the next lockfile bump
The `-Znext-lockfile-bump` is added, so we can prepare for all
lockfile format changes and then stabilize then all at once.

`-Znext-lockfile-bump` is not intended for using outside our test
suite and development. Hence it's hidden.
2023-06-17 10:24:53 +01:00
bors
0d5370a9ae Auto merge of #12268 - epage:direct, r=weihanglo
fix(embedded): Don't create an intermediate manifest

### What does this PR try to resolve?

More immediately, this is to unblock rust-lang/rust#112601

More generally, this gets us away from hackily writing out an out-of-line manifest from an embedded manifest.  To parse the manifest, we have to write it out so our regular manifest
loading code could handle it.  This updates the manifest parsing code to
handle it.

This doesn't mean this will work everywhere in all cases though.  For
example, ephemeral workspaces parses a manifest from the SourceId and
these won't have valid SourceIds.

As a consequence, `Cargo.lock` and `CARGO_TARGET_DIR` are changing from being next to
the temp manifest to being next to the script.  This still isn't the
desired behavior but stepping stones.

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

A Commit at a time

### Additional information

In production code, this does not conflict with #12255 (due to #12262) but in test code, it does.
2023-06-17 08:08:50 +00:00
bors
a581ca202d Auto merge of #12258 - epage:syn, r=weihanglo
refactor(embedded): Switch to `syn` for parsing doc comments

This is a follow up to #12245 which is working to resolve #12207

The hope is this will result in more resilient comment handling, being more consistent with rustdoc.

I also hoped for less code but `syn` is doing less than I had expected, requiring us to copy code over from other parts of rust.  It seems every proc macro has to do this but there is no guide to it, so they all do it differently, only covering the cases they thought to test for.

Note that this still won't support `include_str!()`.
2023-06-17 07:21:35 +00:00
Ed Page
aca7b08405 fix(embedded): Keep target dir in cargo home
This was broken in #12268 when we stopped using an intermediate
`Cargo.toml` file.

Unlike pre-#12268,
- We are hashing the path, rather than the content, with the assumption
  that people change content more frequently than the path
- We are using a simpler hash than `blake3` in the hopes that we can get
  away with it

Unlike the Pre-RFC demo
- We are not forcing a single target dir for all scripts in the hopes
  that we get #5931
2023-06-16 21:37:55 -05:00
Ed Page
282a3e7324 refactor(core): Split out target-dir defaulting 2023-06-16 21:17:54 -05:00
Ed Page
224d2e688d fix(cli): Make 'cargo foo.rs' behave like --manifest-path
This mirrors the logic `ArgMatchesExt::root_manifest`
2023-06-16 21:08:48 -05:00
Ed Page
5ed07925cc fix(embedded): Ensure we don't auto-discover any targets 2023-06-16 21:08:48 -05:00
Ed Page
575b9ac934 fix(embedded): Don't create an intermediate manifest
To parse the manifest, we have to write it out so our regular manifest
loading code could handle it.  This updates the manifest parsing code to
handle it.

This doesn't mean this will work everywhere in all cases though.  For
example, ephemeral workspaces parses a manifest from the SourceId and
these won't have valid SourceIds.

As a consequence, `Cargo.lock` and `CARGO_TARGET_DIR` are changing from being next to
the temp manifest to being next to the script.  This still isn't the
desired behavior but stepping stones.

This also exposes the fact that we didn't disable `autobins` like the
documentation says we should.
2023-06-16 21:08:47 -05:00
Ed Page
2c70983e8d test(embedded): Verify no autobin behavior is running 2023-06-16 21:06:01 -05:00
Ed Page
fc0bb8bf00 fix(toml)!: Prevent people parsing manifests from strings 2023-06-16 21:06:01 -05:00
Ed Page
4fe39e88c2 refactor(embedded): Be accurate in variable name 2023-06-16 21:06:00 -05:00
bors
3b5fac59a3 Auto merge of #12255 - epage:sanitize, r=weihanglo
fix(embedded): Align package name sanitization with cargo-new

### What does this PR try to resolve?

This is a follow up to #12245 which is working to resolve the tracking issue #12207

This first aligns sanitization of package names with the central package name validation logic, putting the code next to each other so they can more easily stay in sync.

Oddly enough, cargo-new is stricter than our normal package-name validation.  I went ahead and sanitized along with that as well.

In working on this, I was bothered by
- the mix of `-` and `_` in file names because of sanitization, so I made it more consistent by detecting which the user is using
- -using `_` in bins, so I switched the default to `-`

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

One existing test covers a variety of sanitization needs

Another existing test hit one of the other cases (`test` being reserved)

### Additional information

For implementation convenience, I changed the directory we write the manifest to.  The impact of this should be minimal since
- We reuse the full file name, so if it worked for the user it should work for us
- We should be moving away from the temp manifest in future commits
2023-06-17 01:10:59 +00:00
Ed Page
667ff78d69 refactor(embedded): Centralize placeholder
This was originally split out because before #12269, it was needed
elsewhere.
2023-06-16 19:51:54 -05:00
Ed Page
f4abdbe5f5 fix(embedded): Extend sanitization rules to cover cargo-new validation 2023-06-16 19:51:19 -05:00
bors
d93b018c20 Auto merge of #12276 - dimo414:patch-1, r=weihanglo
Clarify the default behavior of cargo-install.

The man page for `cargo install` is not explicit about what the default behavior is. This is important to clarify because `examples/` are typically unneeded and may not be maintained with the same care as "real" binaries, so it should be clear to users that example binaries won't be installed without directly asking for them.

Small doc-only update, hopefully this is acceptable. Please let me know if I need to seek further approval first (and, if so, apologies for the noise).
2023-06-16 10:08:08 +00:00
Michael Diamond
9624861730 Clarify the default behavior of cargo-install. 2023-06-16 00:56:29 -07:00
Ed Page
8186282f28 fix(embedded): Sanitize like we validate package names 2023-06-15 19:09:29 -05:00
Ed Page
5fd3d2d230 refactor(embedded): Centralize package name rules 2023-06-15 19:09:29 -05:00
Ed Page
b116864d79 fix(embedded): Be consistent with existing style when sanitizing 2023-06-15 19:09:28 -05:00
Ed Page
4e0ac38b52 refactor(embedded): Switch to syn for parsing doc comments
The hope is this will result in more resilient comment handling, being
more consistent with rustdoc.

I also hoped for less code but `syn` is doing less than I had expected,
requiring us to copy code over from other parts of rust.  It seems every
proc macro has to do this but there is no guide to it, so they all do it
differently, only covering the cases they thought to test for.

Note that this still won't support `include_str!()`.
2023-06-14 14:43:35 -05:00
bors
0c14026aa8 Auto merge of #12269 - epage:bin, r=weihanglo
fix(embedded): Don't append hash to bin names

### What does this PR try to resolve?

More immediately, this is to unblock rust-lang/rust#112601

The hash existed for sharing a target directory.  That code isn't
implemented yet and a per-user build cache might remove the need for it,
so let's remove it for now and more carefully weigh adding it back in.

In general, this is also the more appropriate way for a feature that would be first class.

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

This originally built on #12268 but now stands alone as the other PR has windows issues to work out

### Additional information
2023-06-14 18:43:05 +00:00
Ed Page
56b2812a85 fix(embedded): Don't append hash to bin names
Background: the hash existed for sharing a target directory.  That code isn't
implemented yet and a per-user build cache might remove the need for it,
so let's remove it for now and more carefully weigh adding it back in.

Immediate: This reduces the chance of hitting file length issues on Windows.

Generally: This is a bit hacky and for an official solution, we should
probably try to find a better way.  This could become more important as
single-file packages are allowed in workspaces.
2023-06-14 12:25:59 -05:00
bors
c1ccde196b Auto merge of #12267 - tokarevart:patch-1, r=ehuss
Fix version requirement example in Dependency Resolution, SemVer compatibility section

I additionally verified with `dtolnay/semver` crate (which it seems cargo itself uses) that version `1.2.0` really matches `>=1.2, <1.5` version requirement.
2023-06-14 02:53:52 +00:00
Artem Tokarev
6c450bd579
Fix version requirement syntax example 2023-06-14 07:39:32 +05:00
bors
028077394a Auto merge of #12265 - ehuss:triagebot-links, r=weihanglo
Update triagebot links.

The triagebot documentation has moved as part of https://github.com/rust-lang/rust-forge/pull/687. This updates the links to the new location.
2023-06-13 19:56:57 +00:00
bors
1356e7cddd Auto merge of #12264 - ehuss:container-poison-error, r=weihanglo
Show a better error when container tests fail.

This adds a better error message when a container test fails to build a container.

Previously the output would look something like:

```
---- ssh::ssh_key_in_config stdout ----
SSH_AGENT_PID=69284
thread 'ssh::ssh_key_in_config' panicked at 'called `Result::unwrap()` on an `Err` value: PoisonError { .. }', crates/cargo-test-support/src/containers.rs:97:39
```

Now it looks like:

```
---- ssh::ssh_key_in_config stdout ----
SSH_AGENT_PID=44281
thread 'ssh::ssh_key_in_config' panicked at 'previous docker build failed, unable to run test', crates/cargo-test-support/src/containers.rs:97:51
```
2023-06-13 19:08:28 +00:00
Eric Huss
3d3168b6c2 Update triagebot links. 2023-06-13 11:44:03 -07:00
Eric Huss
75bcada1eb Show a better error when container tests fail. 2023-06-13 11:15:39 -07:00
bors
1703e06fa2 Auto merge of #12261 - weihanglo:dep-update, r=ehuss
chore: update dependencies

Hand-picked some dependencies to update. Looks pretty safe?

- `anyhow` 1.0.70 -> 1.0.71
- `base64` 0.21.0 -> 0.21.2
- `clap@4.2.1` 4.2.1 -> 4.3.3
- `flate2` 1.0.25 -> 1.0.26
- `git2` 0.17.1 -> 0.17.2
- `libgit2-sys` 0.15.1+1.6.4 -> 0.15.2+1.6.4
- `log` 0.4.17 -> 0.4.19
- `openssl` 111.25.3+1.1.1t -> 111.26.0+1.1.1u
- `pkg-config` 0.3.26 -> 0.3.27
- `proptest` 1.1.0 -> 1.2.0
- `pulldown-cmark` 0.9.2 -> 0.9.3
- `serde` 1.0.160 -> 1.0.164
- `serde_json` 1.0.95 -> 1.0.96
- `snapbox` 0.4.10 -> 0.4.11
- `tempfile` 3.5.0 -> 3.6.0
- `time` 0.3.20 -> 0.3.22
- `toml` 0.7.3 -> 0.7.4
- `toml_edit` 0.19.8 -> 0.19.10
- `url` 2.3.4 -> 2.4.0

### Additional information

This is a bit painful, shall we introduce some bot (dependant/renovate) to help this process.

In addition, we should have a job of `cargo update && cargo test` in our CI pipeline.
2023-06-13 18:15:01 +00:00
bors
fdc29046a2 Auto merge of #12262 - epage:flatten, r=weihanglo
refactor(embedded)

### What does this PR try to resolve?

This is trying to make it easier to have multiple active PRs touching `embedded.rs` by separating out the parts of the code that will be touched in each PR.  This is done by making the code roughly follow how the future code will be structured.

e.g. see #12255

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

Commit at a time.  This is just a refactor, so no tests are changed.
2023-06-13 14:40:30 +00:00