13386 Commits

Author SHA1 Message Date
Lucio Franco
6a1a9edd40 Merge branch 'homemerge' into lucio/home-crate 2022-12-12 13:46:59 -05:00
Lucio Franco
dbb8dada19 Add crate 2022-12-12 13:46:41 -05:00
Kyle Matsuda
70dc9c0ea4 replace call to resolve_ws with resolve_with_previous 2022-12-12 11:19:23 -07:00
Kyle Matsuda
4cda74a1a3 add test with current behavior 2022-12-12 11:07:43 -07:00
Jacob Finkelman
ccd69bcf2c Send Asymmetric Tokens to read endpoints 2022-12-12 17:53:05 +00:00
Jacob Finkelman
40325c4d4a generate and check secret_key 2022-12-12 17:52:49 +00:00
Jacob Finkelman
b907a7f7ea Add test for wrighting keys 2022-12-12 17:51:47 +00:00
Jacob Finkelman
a917fa0d4e login/out 2022-12-12 17:51:29 +00:00
Jacob Finkelman
d8df1425ea unstable_cli_options 2022-12-12 17:51:21 +00:00
Jacob Finkelman
5939ed0d4f clap for new login args 2022-12-12 17:49:22 +00:00
bors
0409e398bb Auto merge of #11474 - psumbera:master, r=ehuss
Fixes flock(fd, LOCK_UN) emulation on Solaris.

Follow up fix for #11421.
2022-12-12 13:04:02 +00:00
Chocobo1
ce174d4efc
Use proper git URL for GitHub repos
It can be seen in the following link that a git repo URL from GitHub should end with ".git":
https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#about-remote-repositories
2022-12-12 17:56:49 +08:00
Petr Sumbera
f28b77c4ad Fixes flock(fd, LOCK_UN) emulation on Solaris.
Follow up fix for #11421.
2022-12-12 08:03:07 +01:00
bors
4a8d17e236 Auto merge of #11450 - willcrichton:example-analyzer, r=weihanglo
Allow Check targets needed for optional doc-scraping to fail without killing the build

### What does this PR try to resolve?

In doing a Crater run of -Zrustdoc-scrape-examples, I found that the only remaining regressions are cases where:
* A library does not type-check
* The library has examples
* Cargo tries to scrape the examples, which requires checking the library
* The Check unit for the library fails, crashing the build

The core issue is that the Check unit should be able to fail without killing the build. This PR fixes this issue by checking for this condition, and then allowing the unit to fail.

Specifically, I added a new method `BuildContext::unit_can_fail_for_docscraping` that determines the conditions for whether a unit is allowed to fail. This method is used both in `JobQueue` to interpret process failure, and in the `rustc`/`rustdoc` functions to emit a warning upon failure. I modified `rustc` to handle the case of failure similar to `rustdoc`, but with a slightly different diagnostic.

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

The unit test `no_fail_bad_lib` has been extended with example files to test this case.

r? `@weihanglo`
2022-12-11 22:27:21 +00:00
bors
9c8e8a9abb Auto merge of #11323 - weihanglo:issue/11310, r=ehuss
fix: gleaning rustdocflags from `target.cfg(…)` is not supported

### What does this PR try to resolve?

Fixes #11310

The bug was `rustflags_from_target` trying to learn rustdocflags from
`target.cfg(…).rustflags`, which is definitely wrong.

As of this writing, either `target.cfg(…).rustdocflags` or
`target.<triple>.rustdocflags` is not supported.

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

See f8d1b30ad3fe1d5fa0f172031de7c937b235f3ba as an example.
<!-- homu-ignore:end -->
2022-12-11 16:52:06 +00:00
bors
f3905fa5b3 Auto merge of #11470 - DominicBurkart:patch-1, r=ehuss
Fix typo

### What does this PR try to resolve?

one-word typo in docs, no associated issue
2022-12-11 13:36:19 +00:00
Dominic Burkart
709ecf5eae
fix typo 2022-12-11 11:51:45 +01:00
bors
c6c69cde0d Auto merge of #11469 - nilclass:patch-1, r=weihanglo
resolver.md: Fix naming in example

### What does this PR try to resolve?

It fixes what I believe to be a typo in the documentation.

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

Adding the example as it was to a `Cargo.toml` prints this warning:
```
warning: unused manifest key: dependency
```

With the corrected version it does not.
2022-12-10 11:02:26 +00:00
Niklas Cathor
439fde9bec
resolver version 2: Fix naming in example 2022-12-10 11:16:42 +01:00
Will Crichton
29407d0631 Only compute failed_scrape_diagnostic when needed 2022-12-09 10:37:47 -08:00
bors
70898e5221 Auto merge of #11458 - weihanglo:doc/unit-generator, r=epage
Rename `generate_units` -> `generate_root_units`
2022-12-05 19:43:44 +00:00
Weihang Lo
6683e39621
doc(cargo_compile): generate_units -> generate_root_units 2022-12-05 19:19:07 +00:00
Weihang Lo
5b8985a470
fix(bindeps): assumed host target and optional = true coexist
`{ …, artifact = "bin", target = "target" }` should also be considered
to being built for `FeaturesFor::ArtifactDep` instead of `NormalOrDev`.

[This line][1] requests for `ArtifactDep` but [here][2] Cargo ignore
assumed host target of artifact dep.

Change it to explicit set host target triple when

- `{ …, target = "target" }`, and
- `--target` is not presented, meaning it would be build on host platform.

[1]: 1382b44e43/src/cargo/core/compiler/unit_dependencies.rs (L887)
[2]: 1382b44e43/src/cargo/core/resolver/features.rs (L857)
2022-12-04 11:43:50 +00:00
Weihang Lo
bf56587e26
fix(bindeps): target field specified and optional = true coexist
> Adapted from #11183

Previously, `is_dep_activated` depends on `activated_dependencies`,
which is a map of `PackageFeaturesKey` to its own activated `DepFeature`s.
`PackageFeaturesKey` in feature resolver is always comprised of

* A `PackageId` of a given dependency, and
* A enum value that helps decoupling activated features for that dependency.
  Currently depending on the type of given dependency.

Looking into issue 10526, it has an `activated_dependencies` of

```
{
    (mycrate, NormalOrDev) -> [dep:mybindep]
}
```

However, this [line][1] accidentally use a parent's `pkgid`
and a dependency's `FeaturesFor` to compose a key:

```
(mycrate, ArtifactDep("x86_64-unknown-linux-gnu"))
```

That is never a valid key to query features for artifacts dependency.
A valid key should be comprised of components both from the parent:

```
(mycrate, NormalOrDev)
```

Or both from the dependency itself:

```
(mybindep, ArtifactDep("x86_64-unknown-linux-gnu"))
```

This `unit_for` is from parent and should already contain its own
artifact dep information inside `artifact_target_for_features`,
so we don't need to map any dependency artifact from `dep.artifact()`.

[1]: a2ea66bea6/src/cargo/core/compiler/unit_dependencies.rs (L1106-L1107)
2022-12-04 11:41:49 +00:00
Weihang Lo
7dcb6daa7d
test(bindeps): assumed host target and optional = true coexist 2022-12-04 11:41:49 +00:00
Weihang Lo
437bed069a
test(bindeps): target field specified and optional = true coexist 2022-12-04 11:41:49 +00:00
bors
7bdb96929d Auto merge of #11439 - psumbera:master, r=ehuss
Implements cargo file locking using fcntl on Solaris.

Fixes #11421.
2022-12-03 20:41:32 +00:00
Will Crichton
de34d60076 Allow Check targets needed for optional doc-scraping to fail without killing the build 2022-12-03 10:13:33 -08:00
bors
f6e737b1e3 Auto merge of #11445 - willcrichton:refactor-target-generator, r=weihanglo
Refactor generate_targets into separate module

### What does this PR try to resolve?

The `generate_targets` function is fairly complicated with an absurd number of parameters. This PR refactors the function into a `TargetGenerator` struct that represents the state of the generator, and reduces the amount of parameter-passing between the relevant functions. Additionally, the `generate_targets` function has been refactored into two smaller functions `create_proposals` and `proposals_to_units`. The docscrape-specific functionality from #11430 has been pulled out into a separate function, as promised.

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

This PR does not change any functionality, so no new tests are added. It should be reviewed for code style.

r? `@weihanglo`
2022-12-02 20:21:24 +00:00
Will Crichton
ad201bc69a Fix unit_generator links in architecture docs, move resolve_all_features to cargo_compile top-level module 2022-12-02 11:52:26 -08:00
Petr Sumbera
acd9aa3cbd Implements cargo file locking using fcntl on Solaris.
Fixes #11421.
2022-12-02 13:55:25 +01:00
bors
324a935e04 Auto merge of #11299 - hi-rustin:rustin-patch-target-warn, r=weihanglo
Improve file found in multiple build targets warning

### What does this PR try to resolve?

close https://github.com/rust-lang/cargo/issues/11248.
Improve file found in multiple build targets warning. This PR tries to print the target name and kind in the warning message.

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

- [x] Unit Test
2022-12-02 10:25:49 +00:00
Will Crichton
2a26aefc43 Rename "target" to "unit" in code related to generate_targets 2022-12-01 19:24:41 -08:00
hi-rustin
7eadd58eef Update duplicate build targets test
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-12-01 08:58:52 +08:00
hi-rustin
494e29dcd3 Improve file found in multiple build targets warning
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-12-01 08:58:43 +08:00
Will Crichton
cb97d0690e Refactor generate_targets into separate module with state consolidated into new TargetGenerator struct 2022-11-30 12:33:45 -08:00
bors
7b9069e8f9 Auto merge of #11349 - hi-rustin:rustin-patch-error-cli, r=weihanglo
Error when precise without -p flag

### What does this PR try to resolve?

close https://github.com/rust-lang/cargo/issues/10919

Follow up https://github.com/rust-lang/cargo/pull/10988, see https://github.com/rust-lang/cargo/issues/10919#issuecomment-1214464756

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

You can manually build and test it. You can try `cargo update --precise xxx` without -p flag.

### Additional information
It has already been released on stable. `rustc 1.65.0 (897e37553 2022-11-02)`
2022-11-30 09:46:05 +00:00
hi-rustin
c51f8ad083 Remove warning for aggressive flag without -p flag
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-11-30 09:08:03 +08:00
bors
d28c9b8bc1 Auto merge of #11430 - willcrichton:example-analyzer, r=weihanglo
Improve strategy for selecting targets to be scraped for examples

### What does this PR try to resolve?

After #10343, we have identified a clear set of conditions for whether a particular target should be considered by `-Zrustdoc-scrape-examples`. These conditions are described more clearly in #11425.

However, after some testing with complex Cargo workspaces (e.g. [wasmtime](https://github.com/bytecodealliance/wasmtime/)), I realized that the current approach of modifying the `CompileFilter` did not correctly implement this new specification. For example, a target with `doc = false` should not be scraped by default since it is not a documented unit, but the current approach would potentially include such a target for scraping.

This PR provides a new approach which I believe correctly implements the specification:
1. `generate_targets` is called with the same parameters except the `mode` which becomes `CompileMode::Docscrape` instead of `CompileMode::Doc`. `filter_default_targets` generates the same targets for `Docscrape` as for `Doc`.
2. Inside `generate_targets`, an initial set of `Proposal`s are created. This set of proposals is extended with further proposals based on targets identified as `doc-scrape-examples = true`, or Example targets where possible.

This PR subsumes #11423, and also fixes #10571.

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

I have added another test `docscrape::only_scrape_documented_targets` to verify that only documented or explicitly-enabled targets are included for scraping.

r? `@weihanglo`
2022-11-29 19:59:48 +00:00
bors
0460192d1a Auto merge of #11337 - weihanglo:compression-ratio, r=ehuss
Aware of compression ratio for unpack size limit
2022-11-29 19:10:00 +00:00
bors
861110c58b Auto merge of #11403 - calebfletcher:master, r=weihanglo
Add test for rustdoc-map generation when using sparse registries

Fixes #11402.

Adds an explicit check for sparse registries when generating the mappings for `-Zrustdoc-map`, so that the `sparse+` qualifier is removed before the comparison.
2022-11-29 11:59:38 +00:00
Caleb Fletcher
f54cd332e2 Add test for rustdoc map usage with sparse alternative registries 2022-11-29 19:28:03 +11:00
bors
a2ea66bea6 Auto merge of #11400 - hi-rustin:rustin-patch-fix-error, r=epage
Add error message when `cargo fix` on an empty repo

### What does this PR try to resolve?

close https://github.com/rust-lang/cargo/issues/11380

Add error message when `cargo fix` on an empty repo.

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

- [x] unit test

```sh
set -eux

cargo +nightly new repro
cd repro
echo "fn main() { let _ = 0.clone(); }" > src/main.rs
cargo fix
```
2022-11-28 13:01:15 +00:00
Will Crichton
968caae025 Remove outdated check on scrape units, add test for doc = false 2022-11-27 11:57:56 -06:00
bors
a004f94c48 Auto merge of #11387 - arlosi:sparse-url, r=weihanglo
Store the sparse+ prefix in the SourceId for sparse registries

#11209 added a new `SourceKind::SparseRegistry` and removed the `sparse+` prefix from the URLs stored in the `SourceId`.

The removal of the `sparse+` prefix from the URLs in the `SourceId` has led to several bugs, since registry URLs no longer round-trip through a `SourceId`. The most recent one I found was that the example configuration generated by `cargo vendor` did not include the `sparse+` prefix. Any place that calls the `.url()` method on a `SourceId` potentially has this bug.

This change puts the `sparse+` prefix back in the URL stored in the `SourceId`, but keeps the new `SourceKind::SparseRegistry`.

A test is added for doing `cargo vendor` on an alternative registry using the sparse protocol.
2022-11-27 16:00:17 +00:00
Weihang Lo
37d9b5c49a
Use struct shorthand syntax 2022-11-27 23:33:25 +08:00
Will Crichton
125c6b4ccd Move scrape-examples target filtering from CompileFilter into generate_targets 2022-11-26 10:49:41 -06:00
hi-rustin
21b2fe98a4 Fix fix_in_existing_repo_weird_ignore broken test
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-11-26 20:15:36 +08:00
hi-rustin
3189dc3b06 Include untracked files
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-11-26 20:15:36 +08:00
hi-rustin
25f7d4b09a Remove new_repo_without_add_and_commit
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-11-26 20:15:36 +08:00