Commit graph

12313 commits

Author SHA1 Message Date
Weihang Lo f691a3865a
doc: add **Note**: to make quote block like a note 2022-06-04 21:28:03 +08:00
Weihang Lo dd8841f6f3
Rephrase wordings in testing docs
- Rephrase doctest exec model as "not guranteed and may change" instead
- Mention `#[bench]` in what cargo-bench automatically runs
- Make it clear for build/rustc when mentioning bin targets auto-built
2022-06-04 08:24:08 +08:00
Weihang Lo fc6b3cc3b6
doc: execution model of doctest
NOTE: This is an undocumented implementation details.
2022-06-03 20:50:02 +08:00
Weihang Lo af0fbf4277
doc: mention cargo test runs test targets serially 2022-06-03 20:28:46 +08:00
Weihang Lo 2c9cfd6485
doc: add more link references for tests guide
- Mention that in `src/` Cargo also collect doc tests.
- Remove outdated statement: Cargo no longer tests examples by default.
- Add a link to "Cargo Targets: Tests" to help people learn about it.
2022-06-03 19:50:23 +08:00
Weihang Lo 370a481b43
doc: mention binary auto-built for build,bench,test,rustc 2022-06-03 19:49:15 +08:00
Weihang Lo 7860458149
doc: highlight --doc only applied on lib target 2022-06-03 19:47:23 +08:00
bors af491f39a0 Auto merge of #10720 - JohnTitor:use-latest-tar, r=ehuss
Enforce to use tar v0.4.38

The latest version of `tar` crate includes https://github.com/alexcrichton/tar-rs/pull/262, which uses a bit recent timestamp when archiving.
However, [it seems rust-lang/rust uses v0.4.37](e094492200/Cargo.lock (L5124-L5132)). This PR enforces to use v0.4.38 and it would _fix_ https://github.com/rust-lang/crates.io/issues/3859 eventually.
2022-06-01 13:32:11 +00:00
Yuki Okushi 819f7a5cff
Enforce to use tar v0.4.38 2022-06-01 19:17:15 +09:00
bors 38472bc19f Auto merge of #10701 - danilhendrasr:master, r=weihanglo
Emit warning upon encountering multiple packages with the same name

Fixes: #10669
2022-05-31 02:03:24 +00:00
bors ca4edabb28 Auto merge of #10706 - merelymyself:master, r=epage
Guide new users to add use `super::*;` to `mod test`

### What does this PR try to resolve?

Currently, `cargo init --lib` produces examples for unit tests. However, new users will find that they are unable to use functions they defined above. This should resolve the confusion.

Fixes #10559

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

This PR does not create new features. Test this PR using the already-existing tests.

### Additional information

I didn't think this was a major change, so I did not open a RFC for it. Please let me know if I should have!
2022-05-29 02:13:39 +00:00
Danil Hendra Suryawan e903f7dfc0 Emit warning upon encountering ambiguous deps 2022-05-28 03:32:04 +00:00
merelymyself 754a5bfbaa whitespace 2 2022-05-28 00:17:57 +08:00
merelymyself 684a338693 whitespace 2022-05-28 00:14:30 +08:00
merelymyself 3d21b14323 Guide new users to add use super::*; to mod test 2022-05-27 23:41:37 +08:00
bors e0e1df99f6 Auto merge of #10708 - svenstaro:patch-1, r=weihanglo
Document how to debug change detection events

### What does this PR try to resolve?

I noticed that my build would sometimes seemingly randomly rebuild other crates. I figured this must be the build script detecting a change in some external files. In order to debug this, I figured I'd look at the Cargo sources whether something like this was already being logged. Thankfully, the logging for this was already in place but I didn't find it documented anyway so I thought it might be rather helpful in such scenarios.

I believe it's a common enough scenario that inclusion into the official documentation on this topic should be considered.

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

Build/view documentation.

### Additional information
2022-05-27 12:35:25 +00:00
Sven-Hendrik Haase 16e4c29587
Document how to debug change detection events
This merely links to the FAQ which already explains this
topic very well.
2022-05-27 14:20:03 +02:00
bors e23cf4393f Auto merge of #10677 - likzn:fix_publish_p, r=ehuss
fix(publish): add more check when use `publish -p <SPEC>`

### Main issue
As issue say #10536 , we need add more check when user use `cargo publish -p <SPEC>`

>`@ehuss` point outs:
>From a behavior standpoint, here are some things to check:
> - In the root of a virtual workspace, it should be an error to run without -p.
>- It should be an error to pass -p for a non-workspace member.
>- It should be an error for -p to match multiple packages.
>- When using -p, it should publish that package, not the one in the current directory (which can be different).
2022-05-27 00:43:33 +00:00
bors 8f5500bb5a Auto merge of #10705 - Muscraft:workspace-source-fmt-key, r=epage
fix key formatting when switching to a dotted `WorkspaceSource`

This fell out of #10697 see [this comment](https://github.com/rust-lang/cargo/pull/10697#discussion_r882691624)

There was a small issue where changing the source of a `cargo_add::Dependency` to a `WorkspaceSource` would cause the dotted version to have extra space.

```toml
dep .workspace = true
dep.workspace = true
```

This makes sure the key is formatted as well as adds a unit test to make sure this doesn't come back up in the future.

r? `@epage`
2022-05-26 23:53:56 +00:00
Scott Schafer 706e5b25c9 fix key formatting when switching to a dotted WorkspaceSource 2022-05-26 14:02:00 -05:00
likzn b486ada19f clean err msg 2022-05-26 08:49:06 +08:00
likzn 52165e8c2d update 2022-05-25 18:17:08 +08:00
bors 39ad1039d9 Auto merge of #10600 - tmfink:doc-build-script-link-order, r=ehuss
doc: discuss build script instruction order

### What does this PR try to resolve?

It is currently not documented that the order of build script `cargo:` instructions may be relevant to linking.

This has caused issues such as: https://github.com/rust-lang/rust/issues/96328

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

Build/view documentation.

### Additional information

- Cargo maintainers should fact check my wording.
- We may need to discuss if this should also be documented for `rustc`
- Maintainers should ensure that this change does not prevent a change in what is currently unspecified behavior. Perhaps `cargo` will want to rearrange link arguments itself to resolve issues in the future?
2022-05-25 00:50:02 +00:00
Travis Finkenauer 43ce1e7a98 Test that link argument order is maintained
Patch provided by @ehuss
2022-05-24 12:45:20 -07:00
Travis Finkenauer 10cf701de7 doc: discuss build script instruction order 2022-05-24 12:45:20 -07:00
bors e7c8ba7753 Auto merge of #10698 - arlosi:http-slash, r=Eh2406
Require http-registry URLs to end with a '/'

The `url` crate normalizes URLs with no path component to end in a trailing slash. This causes the current implementation to use urls containing two slashes for registries without a path component (such as `https://index.crates.io//config.json`).

This PR resolves the issue by requiring http registry URLs to end in a slash and generating paths by concatenating. A new error message is emitted for http registry URLs that do not end in a slash.

r? `@Eh2406`
2022-05-24 15:23:47 +00:00
bors bf824127cc Auto merge of #10691 - danilhendrasr:master, r=weihanglo
No printing executable names when running tests and benchmarks with json message format

Fixes: #10684
I added a new test for this, though I'm not sure if it's necessary. Let me know if I should delete it.
2022-05-24 14:42:56 +00:00
Danil Hendra Suryawan e04d7772e4 No printing executable names when running benches with json message format 2022-05-24 20:44:54 +07:00
merelymyself 8401ef16f6 fixed issue with formats_source 2022-05-24 20:42:26 +08:00
merelymyself 73aa070687 Guide new users to add use super::*; 2022-05-24 20:27:58 +08:00
Arlo Siemsen 2622074d43 Require http-registry URLs to end with a '/' 2022-05-23 21:39:23 -05:00
likzn 72d6c5411a cargo fmt 2022-05-24 09:15:44 +08:00
likzn ddd5c83b8c rust fmt 2022-05-24 09:15:02 +08:00
likzn 72457ef462 fix test stderr 2022-05-24 09:09:57 +08:00
bors 11d4599d32 Auto merge of #10683 - jonhoo:fix-10682, r=Eh2406
Restore proper error for crate not in local reg

Fixes #10682.
2022-05-23 17:34:13 +00:00
likzn d8280951eb
Update src/cargo/ops/registry.rs with err msg
Co-authored-by: Eric Huss <eric@huss.org>
2022-05-24 00:58:33 +08:00
bors d98628848c Auto merge of #10696 - ehuss:update-curl, r=epage
Update libcurl

This updates to the latest libcurl.

Changes in curl:
* 0.4.42: https://github.com/alexcrichton/curl-rust/releases/tag/0.4.42
* 0.4.43: https://github.com/alexcrichton/curl-rust/releases/tag/0.4.43

Changes in libcurl:
* From 7.80.0 to 7.83.1: https://curl.se/changes.html

There were several security issues addressed recently (https://curl.se/docs/security.html), however, I don't think any of them are particularly concerning for us.
2022-05-23 16:50:11 +00:00
Eric Huss 1bfb897485 Update libcurl 2022-05-23 08:21:50 -07:00
likzn 1179e7ef6b cargo fmt 2022-05-23 21:06:34 +08:00
likzn 89c24bf811 refactor logic 2022-05-23 21:01:55 +08:00
bors 9bc91ff2a8 Auto merge of #10693 - alex-semenyuk:typos_cargo, r=ehuss
Fixed small typos

Fixed small typos
2022-05-23 02:35:39 +00:00
alexey semenyuk d48a773696
Reverted option 2022-05-22 22:15:41 +00:00
alexey semenyuk 9dc393e15b
Update faq.md 2022-05-22 15:25:55 +00:00
alexey semenyuk acbb3ca753
Update faq.md 2022-05-22 15:19:49 +00:00
alexey semenyuk aa771595a9
Update cargo-run.md 2022-05-22 14:00:01 +00:00
alexey semenyuk 14154d17e7
Update semver.md 2022-05-22 13:03:25 +00:00
alexey semenyuk c6c5face62
Typos 2022-05-21 17:56:22 +00:00
Danil Hendra Suryawan 7952680d8d No printing executable names when running tests with json message format 2022-05-21 23:18:46 +07:00
bors 83a7983ec1 Auto merge of #10685 - Muscraft:cargo-add-workspace-source, r=epage
fix bugs with `workspace` key and `update_toml`

### Motivations and Context

When working on an external subcommand to help with the switch to workspace inheritance, I found issues with the output `Cargo.toml` it was creating. When a `cargo_add::Dependency` would change its source to a `WorkspsaceSource`, `workspace = true` would not show up. This lead me to discover that the `default-features` key was not being removed when the `workspace` key was set.

This fixes those issues but brought up questions about how to deal with removing keys and clearing conflicting fields in a `Dependency`. After talking with `@epage,` it was decided that this was the minimal set of changes to make while the changes to fix the other issues is workshopped.

### Changes
- add `default-features` to the list of keys to remove when the source is a `WorkspaceSource`
- insert a `workspace` key when the source is a `WorkspaceSource`
2022-05-20 22:41:12 +00:00
bors 7524ccdc03 Auto merge of #10687 - ehuss:version-bump, r=epage
Bump to 0.64.0, update changelog
2022-05-20 21:52:59 +00:00