13434 Commits

Author SHA1 Message Date
Rémy Rakic
3be6c93a22 update optional_build_dep_and_required_normal_dep test expectations
This test dynamically enables a shared build/runtime dependency, and
therefore doesn't trigger the build/runtime sharing reuse optimization,
as the build dep is initially built without debuginfo for optimization
purposes.
2023-01-31 22:36:20 +00:00
Rémy Rakic
49bd6acb31 use UnitFor::is_for_host to detect build deps
Although `CompileKind::is_host` is currently used for build dependencies prior
to unit graph sharing, it's not a guarantee. So we use `UnitFor::is_for_host`
to make detection more future-proof.
2023-01-31 22:36:20 +00:00
Rémy Rakic
d7732e4d1a don't optimize debuginfo for artifact dependencies 2023-01-31 22:36:20 +00:00
Rémy Rakic
6c4305355b derive Serialize for DebugInfo 2023-01-31 22:36:20 +00:00
Rémy Rakic
facdb30c03 add assertions checking the absence of debuginfo
Add some assertions to ensure that debuginfo is not used to compile
build dependencies, in a way that differs between the old and new
defaults: some of the assert elision could match the previous defaults
with debuginfo. These new assertions break if `-C debuginfo` is present
in the commands cargo ran.
2023-01-31 22:36:20 +00:00
Rémy Rakic
4362b1b7aa update build dependencies profiles documentation
This describes the new defaults for build-overrides, and how to make sure backtraces have the usual debug info, when needed.
2023-01-31 22:36:20 +00:00
Rémy Rakic
7dfabdc681 add build script failure test when requesting backtraces
it displays an additional message on how to improve these backtraces, now that
debuginfo is turned off most of the time in `dev.build-override`.
2023-01-31 20:12:52 +00:00
Rémy Rakic
881533b590 display note to increase debuginfo level when build deps fail
it's only displayed when backtraces are requested
2023-01-31 20:12:52 +00:00
Rémy Rakic
937a08cabf improve comments 2023-01-31 20:12:52 +00:00
Rémy Rakic
cec12456c8 slightly clarify unit graph sharing 2023-01-31 20:12:52 +00:00
Rémy Rakic
7fb97c5160 clean up destructuring assignment
Removes a fixme
2023-01-31 20:12:52 +00:00
Rémy Rakic
6848006cbe update tests for build deps debuginfo optimization 2023-01-31 20:12:52 +00:00
Rémy Rakic
75af7a41fa optimize build dependency debuginfo level
When a build dependency unit is not within the runtime dependency
subgraph, we don't ask for debuginfo to be emitted by default.
2023-01-31 20:12:42 +00:00
Rémy Rakic
79dd5117da introduce dedicated DebugInfo enum in Profiles
This enum will be used to model the current Option<u32> value in
profiles, as the explicitly set value, and also allow to model a
deferred value: one that can be ignored for optimization purposes,
and used in all other cases.

This allows to have a default debuginfo for build dependencies, that can
change:
- if a dependency is shared between the build and runtime subgraphs, the
  default value will be used, to that re-use between units will
  continue.
- otherwise, a build dependency is only used in a context where
  debuginfo is not very useful. We can optimize build times in this
  situation by not asking rustc to emit debuginfo.
2023-01-31 19:05:20 +00:00
bors
4ae3576c42 Auto merge of #11655 - ehuss:triagebot-branch, r=weihanglo
Warn on commits to non-default branches.

This will make triagebot post a warning when a PR is opened against a non-master branch.
2023-01-30 21:24:53 +00:00
Eric Huss
620f383a52 Warn on commits to non-default branches. 2023-01-30 12:41:53 -08:00
bors
0de0e80548 Auto merge of #11648 - peterallin:peterallin/11594, r=epage
Avoid saving the same future_incompat warning multiple times

### What does this PR try to resolve?

Each time a build, that causes future_incompat warnings, is run, a report about each
warning is created and saved to disk with a new id quicky filling up the JSON file. This PR
adds a check if the report is already on disk and avoids saving a new instance of it.

Fixes #11594.

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

Perform a build that gives one or more future_incompat warnings, and see that they
are added to the  JSON file only once when the build is repeated.
2023-01-30 14:52:41 +00:00
bors
524430074f Auto merge of #11652 - hi-rustin:rustin-patch-docs, r=epage
Mention current default value in `publish.timeout` docs

I think it would help if we mention the default value in the docs.
2023-01-30 13:40:37 +00:00
hi-rustin
cd6cbe4d52 Mention current default value in publish.timeout docs
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-01-30 21:28:25 +08:00
bors
99b13692dd Auto merge of #11572 - khuey:dwp, r=weihanglo
Make cargo aware of dwp files.

When using -Csplit-debuginfo=packed on Linux, rustc will produce a dwp file. Unlike the dwo files, whose paths are embedded into the binary, there's no information in the binary to help a debugger locate a dwp file. By convention, the dwp file for `<EXE>` is given the name `<EXE>.dwp` and placed next to `<EXE>`.

When cargo hardlinks the executable file rustc put in target/debug/deps into target/debug, it also needs to hardlink the dwp file along with it. Failing to do this prevents the debugger from finding the dwp file when the binary is executed from target/debug, as there's no way for the debugger to know to look in the deps subdirectory.

The split_debuginfo option is passed down into file_types to make this possible. For cargo clean manual handling is added to match the other split_debuginfo files. bin_link_for_target also passes in None because it won't care about the dwp file.
2023-01-30 12:00:19 +00:00
Peter Allin
87ce527c30 Avoid saving the same future_incompat warning multiple times
Fixes #11594.
2023-01-29 12:58:39 +01:00
bors
f6cf5ab718 Auto merge of #11633 - weihanglo:reduce-rustc-query-calls, r=ehuss
Reduce target info rustc query calls
2023-01-28 20:03:00 +00:00
bors
97b707335d Auto merge of #11640 - weihanglo:version-bump, r=ehuss
Bump to 0.70.0; update changelog
2023-01-28 15:14:58 +00:00
Weihang Lo
d5610ae6aa
Update changelog for 1.69 2023-01-28 00:59:39 +00:00
Weihang Lo
5a7554c54f
Update changelog for 1.68 2023-01-28 00:59:39 +00:00
Weihang Lo
03dfbb97ba
Bump to 0.70.0 2023-01-27 21:55:20 +00:00
Weihang Lo
1cef6d7675
refactor: reuse error_missing_print_output on similar errors 2023-01-27 02:45:05 +00:00
Weihang Lo
036ed3a2dd
test(cfg): parse rustc --print=split-debuginfo 2023-01-27 02:45:04 +00:00
Weihang Lo
30fe923ca2
perf: reduce target info rustc query call to one
This is kinda a hack since we abuse `--print=crate-name`
where the crate name is `___` and used as a delimiter.
2023-01-27 02:45:01 +00:00
bors
9d1e2480bf Auto merge of #11632 - ehuss:dogfood-sparse, r=weihanglo
Enable sparse protocol in CI

This enables the sparse protocol in CI in order to exercise and dogfood it. This is intended test the production server in a real-world situation.
2023-01-27 02:25:54 +00:00
bors
c03cc59809 Auto merge of #11347 - kamirr:fix-split-debuginfo-windows, r=weihanglo
Fix split-debuginfo support detection

### What does this PR try to resolve?
cargo assumed that if `-Csplit-debuginfo=packed` worked, all values would be correct. This however is not the case -- as of Rust 1.65.0, rustc supports `packed`, but not `unpacked` or `off` on Windows. Because of this, having `split-debuginfo="unpacked`" on Windows has caused builds to fail, as cargo assumed that the option is fine (`split-debuginfo=packed` worked), but rustc then failed when being passed `-Csplit-debuginfo=unpacked`.

### How should we test and review this PR?
Consider an empty project with the following change to `Cargo.toml`:
```toml
[profile.dev]
split-debuginfo="unpacked"
```
`cargo +1.64.0 build` will work, but `cargo +1.65.0 build` will fail with the following error message:

```
PS C:\REDACTED> cargo build
   Compiling tmp v0.1.0 (C:\REDACTED)
error: `-Csplit-debuginfo=unpacked` is unstable on this platform

error: could not compile `tmp` due to previous error
```

With this patch and 1.65.0 rustc, cargo will ignore all `split-debuginfo` settings, but with https://github.com/rust-lang/rust/pull/104104 rustc (approved, awaiting merge), it will properly detect supported values for `split-debuginfo` and only ignore those that are unsupported.
2023-01-26 18:14:08 +00:00
Eric Huss
7b2343e597 Enable sparse protocol in CI 2023-01-26 07:13:42 -08:00
bors
2ccd95097e Auto merge of #11565 - Muscraft:rework-toml-dependency, r=weihanglo
refactor(toml): Move `TomlWorkspaceDependency` out of `TomlDependency`

**This should not be merged until after #11409**

In #11523 it was noted that you could use `{}.workspace = true` in `[patch.{}]`, but it would cause a panic. This panic was caused by an oversight on my part when implementing [workspace inheritance](https://github.com/rust-lang/rfcs/blob/master/text/2906-cargo-workspace-deduplicate.md). Before this PR any field that had the type `TomlDependency` could specify `{}.workspace = true` and `cargo` would allow it to be a `TomlWorkspaceDependency`. While it could be `TomlWorkspaceDependency` it would never be resolved since only:

> Dependencies in the `[dependencies]`, `[dev-dependencies]`, [`build-dependencies]`, and `[target."...".dependencies]` sections will support the ability to reference the `[workspace.dependencies]` definition of dependencies.[^1]

This PR makes it so that only those fields can pull from `[workspace.dependencies]`, while still sharing `TomlDependency` everywhere it is needed. It does this by making `MaybeWorkspace` generic over both `Defined` and `Workspace`, then moving `TomlWorkspaceDependency` out of `TomlDependency` and into a `MaybeWorkspace` that the correct fields can use.

[^1]: [rfc2906-new-dependency-directives](https://github.com/rust-lang/rfcs/blob/master/text/2906-cargo-workspace-deduplicate.md#new-dependency-directives)

Closes: #11523
2023-01-25 23:51:25 +00:00
bors
4a2ebfbbf3 Auto merge of #11604 - pkgw:resolver-unification-docs, r=ehuss
book: describe how the current resolver sometimes duplicates deps

### What does this PR try to resolve?

This updates the book to document the behavior described in #9029, where sometimes Cargo will duplicate a dep when it doesn't have to.

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

Doc-only change; someone with knowledge of the resolver should read and assess.
2023-01-25 19:31:56 +00:00
Scott Schafer
712b327f32 refactor(toml): Move TomlWorkspaceDependency out of TomlDependency 2023-01-25 10:50:55 -06:00
bors
04519ad831 Auto merge of #11612 - hi-rustin:rustin-patch-cargo-add, r=epage
`cargo add` check `[dependencies]` order without considering the dotted item

### What does this PR try to resolve?

Try to close https://github.com/rust-lang/cargo/issues/11584

`cargo check` check `[dependencies]` order without considering the dotted item.

### How should we test and review this PR?
See the unit test.
2023-01-25 15:44:23 +00:00
bors
3fee600039 Auto merge of #11622 - weihanglo:coc, r=ehuss
Link CoC to  www.rust-lang.org/conduct.html

Just noticed that Cargo is missing a CoC file while browsing its open source project metrics.

This PR effectively does what `rust-lang/rust` and others projects do.
2023-01-25 14:55:24 +00:00
hi-rustin
1d67d0fc25 Use remove to get first key
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-01-25 22:03:10 +08:00
Weihang Lo
145fc72c4a
Add CoC 2023-01-25 10:18:15 +00:00
bors
e0910d8004 Auto merge of #11621 - ehuss:triagebot-more-labels, r=weihanglo
Add more labels to triagebot

This adds some more labels to the allowed triagebot list.
2023-01-25 09:35:55 +00:00
Eric Huss
2c1ba23748 Add more labels to triagebot 2023-01-24 17:51:28 -08:00
bors
3c5af6bed9 Auto merge of #11620 - emilyselwood:patch-1, r=Eh2406
Add a note about verifying your email address on crates.io

crates.io requires you to verify your email address. This is not picked up by `cargo publish --dry-run`
2023-01-24 15:48:15 +00:00
bors
99f841c083 Auto merge of #11613 - arriven:fix/11083-rerun-if-changed-published-sources-dir, r=epage
Improve CI caching by skipping mtime checks for paths in $CARGO_HOME

Skip mtime checks for paths pointing into `$CARGO_HOME` to avoid rebuilds when only caching $CARGO_HOME/registry/{index, cache} and $CARGO_HOME/git/db and some of the dependencies have `rerun-if-changed=directory` in their `build.rs`

I considered skipping mtime checking only on `$CARGO_HOME/registry/src` but it looks like other functionality (like downloading a newer version of dependency) is unaffected by this and this way we also cover the same issue with git based dependencies (except the part where `cargo` is forced to re-fetch submodules if `$CARGO_HOME/git/checkouts` is missing) and it is more in line with the discussion in #9455

Fix #11083

Credit `@weihanglo` for the test (I did add a case of checking that dependency update still triggers a rebuild but they are the original author of the rest of the test)
2023-01-24 13:31:37 +00:00
Emily Selwood
0a9d5207e2
Add a note about verifying your email address on crates.io
crates.io requires you to verify your email address. This is not picked up by `cargo publish --dry-run`
2023-01-24 09:01:29 +00:00
arriven
9e01c8bbcf skip mtime checks for paths in $CARGO_HOME 2023-01-24 08:27:33 +00:00
bors
b862c6df16 Auto merge of #11619 - epage:test, r=ehuss
test: Update for clap 4.1.3

The latest clap release fixed a bug with the algorithm for providing suggestions, leading this suggestion to change.
2023-01-24 04:52:00 +00:00
Ed Page
8fb9effcae test: Update for clap 4.1.3
The latest clap release fixed a bug with the algorithm for providing
suggestions, leading this suggestion to change.
2023-01-23 21:19:48 -06:00
Peter Williams
50588a9ee3 docs(ref): revise resolver duplication edits based on feedback 2023-01-23 19:37:59 -05:00
bors
ca0557ae39 Auto merge of #11614 - ehuss:fix-unused-attr-warn, r=weihanglo
Fix unused attribute on Windows.

The change introduced in #11610 is causing unused_attribute warnings on Windows because there are two `ignore` attributes when CARGO_PUBLIC_NETWORK_TESTS is not set. The solution here is to make `cargo_test` support a hard-coded option for an additional reason to ignore a test.

Ideally I think this would use something like a `cfg()` expression, but those can't really be evaluated within the proc-macro (without pulling in `cargo_platform`). Could also just `allow(unused_attributes)`, but that felt a little icky.
2023-01-22 22:25:28 +00:00
Eric Huss
9247e8155f Fix unused attribute on Windows. 2023-01-22 14:02:23 -08:00