Commit graph

1897 commits

Author SHA1 Message Date
Markus Reiter 5976d53add Fix test on Windows. 2020-11-09 15:16:32 +01:00
Markus Reiter a8ee4778e8 Remove unneeded verbose flag. 2020-11-09 15:16:32 +01:00
Markus Reiter b4243dc0cc Rename tests for -Zextra-link-arg. 2020-11-09 15:16:32 +01:00
Markus Reiter d3454cb14b Add tests and warnings for -Zextra-link-arg. 2020-11-09 15:16:32 +01:00
Steven Joruk 05a8127c10 Skip extracting .cargo-ok files from packages
This fixes the case where a package contained an empty .cargo-ok file
and was mounted in a read only file system. This lead to attempting to
download the package again, which failed due to write permissions.
2020-11-07 17:01:21 +00:00
Charlie Ozinga 9589d2cbc2 fix: change to update -w per feedback 2020-11-06 14:44:06 -07:00
Charlie Ozinga 5b928438b5 Fix for testsuite 2020-11-06 13:40:31 -07:00
Charlie Ozinga 4ed0537fc3 Add sync-lockfile command 2020-11-06 13:40:31 -07:00
Eric Huss 9ffcf69093 Implement weak dependency features. 2020-11-04 14:19:27 -08:00
bors 862df61799 Auto merge of #8823 - ehuss:minimal-download, r=alexcrichton
Avoid some extra downloads with new feature resolver.

There are some edge cases with the new feature resolver where it can erroneously trigger a download of a package that is not needed. This is due to the call `is_proc_macro` which has to downloaded the manifest to check if it is a proc-macro. The main change here is to defer calling `is_proc_macro` until after dependencies have been filtered. It also avoids calling `is_proc_macro` if the new feature resolver is enabled, but `decouple_host_deps` and `ignore_inactive_targets` are disabled (such as with `-Z weak-dep-features`), in which case it doesn't matter if it is a proc-macro or not.

Fixes #8776
2020-11-03 15:05:18 +00:00
Eric Huss d88ed1cb6c Normalize SourceID in cargo metadata. 2020-11-01 10:48:21 -08:00
Eric Huss 3d5a908393 Avoid some extra downloads with new feature resolver. 2020-10-31 16:49:22 -07:00
bors 7197c66b36 Auto merge of #8819 - EmbarkStudios:target-root-path, r=ehuss
Make host_root return host.root(), not host.dest()

Also create host_dest function to let other callsites retain their old functionality. Fixes #8817, verified it works on the original problem reported in the `rust-gpu` repo.

I did two things here:

1) Rename `host_root` (which returns `self.host.dest()`) to be `host_dest`. This has three callsites. I did this to make it more clear that it returns dest, not root.
2) For the callsite that's relevant in #8817, I created a "new" `host_root` function (that returns `self.host.root()`). This means that the callsite that this PR is actually fixing doesn't show up in this diff :/ - but I thought it was more clear this way.

(Also copied the example path docs over from `layout.rs` to hopefully avoid this mistake again in the future)

I tried to look into if the other two callsites should actually be calling `host.root()` instead of `dest`, because I imagine the same mistake could have been made again, but it quickly grew out of my understanding (this is my first time in the cargo codebase). Feel free to let me know if they should also call `host.root()` too, and I can update them.

Thanks! (oh gosh I have no idea what I'm doing, I hope this is right)

r? `@alexcrichton`
2020-10-29 02:30:19 +00:00
khyperia 628f701dd9 Fix test path on windows 2020-10-28 20:45:50 +01:00
khyperia 29b0817b87 Add test for dep within target having right path 2020-10-28 20:22:41 +01:00
bors becb4c282b Auto merge of #8808 - weihanglo:fix/8591, r=ehuss
List available packages if providing `--package` with an empty value

May resolves #8591

## How

First we need to take the responsibility of check command line arguments from claps. I've examine all 10 build commands and all of them call [`ArgMatchesExt::compile_options`](2f115a76e5/src/cargo/util/command_prelude.rs (L389-L395)) directly or indirectly. And `compile_options` [calls `check_optional_opts`](2f115a76e5/src/cargo/util/command_prelude.rs (L499-L501)) to check if target selection options given an empty value. So we can do the same logic there.

I've also add a error message for an edge case though that one would never trigger at this moment.
2020-10-28 16:41:55 +00:00
Eric Huss b731190daa Add a future-compatibility warning on allowed feature name characters. 2020-10-27 14:23:35 -07:00
Weihang Lo b9554f37ab
rustfmt 2020-10-28 02:57:22 +08:00
Weihang Lo 9d9c321c27
test: check cargo uninstall package opt with empty value 2020-10-28 02:46:20 +08:00
Weihang Lo c347745613
test: list availables for clean,tree,update 2020-10-28 02:46:20 +08:00
Weihang Lo d91be5a36f
test: list availables for rustc,rustdoc,run,pkgid 2020-10-28 02:46:19 +08:00
Weihang Lo fa522ccec1
fix: more information when -p value is absent 2020-10-27 22:03:54 +08:00
Eric Huss f4ac82a0f5 Rename crate: to dep: 2020-10-25 12:51:27 -07:00
Weihang Lo 4d5a56d7d0
test: suggest available packages 2020-10-26 02:55:15 +08:00
Eric Huss 8ff130bb28 Rename "explicit" to "crate_prefix". 2020-10-23 16:32:15 -07:00
Eric Huss b2cceaf76e Expose implicit features in cargo metadata. 2020-10-23 16:04:41 -07:00
Eric Huss bcfdf9fbad New namespaced features implementation. 2020-10-23 16:04:41 -07:00
Eric Huss 2611f5c73c Move namespaced features tests to a separate file. 2020-10-23 16:04:41 -07:00
Weihang Lo d613cd66c7
Merge branch 'master' into feat/glob-pattern 2020-10-18 08:48:30 +08:00
Eduardo Broto fb02ade261 Rework tests to avoid using -vv
Environment variables are represented differently in differents OSes in
the output.

Add tests checking if the variable is set instead.
2020-10-15 00:44:04 +02:00
Eduardo Broto c12aed2fe4 Add tests for CARGO_PRIMARY_PACKAGE (workspaces) 2020-10-14 23:35:00 +02:00
Eduardo Broto 0f20b2e478 Add test for CARGO_PRIMARY_PACKAGE 2020-10-14 23:35:00 +02:00
bors 655e122bd1 Auto merge of #8773 - pickfire:patch-1, r=ehuss
Add actionable help message for --features

Fix #8770
2020-10-14 16:57:12 +00:00
bors 40b7793fa2 Auto merge of #8777 - ehuss:fix-doc-itarget, r=alexcrichton
Fix panic in `cargo doc` with -Zfeatures=itarget

There are some situations where `cargo doc -Zfeatures=itarget` can panic where an optional shared dependency is part of an inactive target. The issue is that the filtering logic in `compute_deps` should have been shared with `compute_deps_doc`.  I moved the common filtering into `State` to try to share the code.

Fixes #8774
2020-10-14 16:33:46 +00:00
Ivan Tham fd5902c6ca
Fix help message in features.rs test 2020-10-14 10:21:37 +08:00
Ivan Tham 894dbbc997
Suggest manifest for --features help
Suggested by ehuss
2020-10-14 10:00:02 +08:00
Eric Huss 0be75d2edc Update git2. 2020-10-13 18:13:25 -07:00
Eric Huss 7f02a671a5 Fix panic in cargo doc with -Zfeatures=itarget 2020-10-13 15:39:46 -07:00
Ivan Tham ca91c5db5c
Fix test for package_features for help 2020-10-14 01:06:16 +08:00
Eric Huss ad34852f39 Update toml dependency 2020-10-12 11:22:45 -07:00
Kitsu d17311df6c Update tree tests 2020-10-10 11:38:52 +03:00
Weihang Lo e4a1794b41
fix: emit errors instead of warnings when glob patterns not found 2020-10-10 09:50:36 +08:00
Weihang Lo e5007de6e9
test: use with_stderr_unordered 2020-10-10 08:43:38 +08:00
Weihang Lo 8f0664f02a
test: normalize raw string indentation. 2020-10-10 07:44:57 +08:00
Weihang Lo 5e3dc46753
test: be consistent on error message styles 2020-10-10 06:58:06 +08:00
Eric Huss a2e48fdc03 Add LTO to the metadata filename hash. 2020-10-05 11:29:01 -07:00
Eric Huss 90e286da07 Fix dylib+rlib with LTO. 2020-10-05 10:18:07 -07:00
Weihang Lo 6fb6b94a33
test(test): glob support for package selection 2020-10-05 01:24:43 +08:00
Weihang Lo 8d5e11a520
test(check): glob support for package selection 2020-10-05 01:24:43 +08:00
Weihang Lo 667a5aedfb
test(build): glob support for package selection 2020-10-05 01:24:42 +08:00
Weihang Lo 33d883c425
test(run): glob support for package selection 2020-10-05 01:24:42 +08:00
Weihang Lo a06ec889f4
test(bench): glob support for package selection 2020-10-05 01:24:42 +08:00
Weihang Lo f1de239450
test(doc): glob support for package selection 2020-10-05 01:24:42 +08:00
Weihang Lo 570aea75ea
test(rustdoc): glob support for package selection 2020-10-05 01:24:42 +08:00
Weihang Lo db313e54a2
test(rustc): glob support for package selection 2020-10-05 01:24:41 +08:00
Weihang Lo ab88c48480
test(tree): glob support for package selection 2020-10-05 01:24:41 +08:00
Weihang Lo 633e5f0048
test: glob support for target selection 2020-10-05 01:24:39 +08:00
roblabla 435117a821 Test that homepage/documentation values are properly propagated 2020-10-01 09:40:32 +00:00
roblabla 72694e8015 Fix tests 2020-10-01 09:40:32 +00:00
Eric Huss 6fe6595c17 Properly set for_host for proc-macro tests. 2020-09-28 16:21:55 -07:00
Eric Huss 6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07:00
David Tolnay 17053fc980
--workspace flag for locate-project to find the workspace root 2020-09-23 18:39:21 -04:00
bors a9d694770d Auto merge of #8707 - dtolnay:plain, r=ehuss
Add plain message format for locate-project

Supersedes #8683, as recommended in https://github.com/rust-lang/cargo/pull/8683#issuecomment-692921559. This PR adds a flag `--message-format` to `cargo locate-project` with possible values `json` (default) and `plain`.

```console
$ cargo locate-project --message-format json
{"root":"/git/cargo/Cargo.toml"}

$ cargo locate-project --message-format plain
/git/cargo/Cargo.toml
```

Closes #8009.
2020-09-23 21:51:43 +00:00
bors c369b8c8d8 Auto merge of #8165 - mchernyavsky:force-progress, r=ehuss
Add a term option to configure the progress bar

Closes https://github.com/rust-lang/cargo/issues/7587.
2020-09-23 21:28:14 +00:00
Eric Huss 8ee908d40f Add cross check to filters_target test. 2020-09-18 12:28:33 -07:00
David Tolnay 9ecf5e96b9
Add plain message format for locate-project 2020-09-16 20:26:13 -04:00
mchernyavsky d649c66191 Add a term option to configure the progress bar 2020-09-16 22:32:31 +03:00
Eric Huss 157ed9f79a Add test for whitespace behavior in env flags. 2020-09-15 14:22:19 -07:00
bors 8777a6b1e8 Auto merge of #8697 - Mikastiv:pr-8695, r=ehuss
updated yank error message

Fixes #8695
2020-09-15 19:11:03 +00:00
Eric Huss 9efa0d5526 Fix non-determinism with new feature resolver. 2020-09-13 10:06:19 -07:00
Mikastiv 51fa3a4d28 --vers arg now required for yank cmd 2020-09-12 17:13:13 -04:00
bors 2c10f2611f Auto merge of #8675 - weihanglo:fix/name-help, r=Eh2406
Add --name suggestion for cargo new

Resolves #8613

Since `check_name` have already got a parameter to show name help, I reuse the logic and sync the behavior between `cargo init` and `cargo new`. The divergence seems to be intentionally made in #7959:

_...Only print the --name suggestion for `cargo init`._

Feel free to discuss.
2020-09-10 19:06:19 +00:00
bors f110fd9fc1 Auto merge of #8681 - weihanglo:fix/redundant-messsage-local-crate-install, r=ehuss
Sweep unrelated message from unnecessary workspace infromation

Resolves #8619

Only pass workspace information when the source is from a local crate installation.
2020-09-10 18:40:48 +00:00
Weihang Lo c6fcb0e2ef
Fix unintenional newline in stderr assertion 2020-09-11 01:02:59 +08:00
Weihang Lo 2fbce89dd6
Rephrase message of restricted crate name 2020-09-11 00:39:51 +08:00
Weihang Lo a527caa248
test: check stderr containment explicitly 2020-09-10 07:57:57 +08:00
Weihang Lo 45cfd0cd12
Fix formatting 2020-09-10 00:26:30 +08:00
Weihang Lo 71cae39de0
Test for crate installation without emitting messages from cwd 2020-09-10 00:20:35 +08:00
bors 875e012325 Auto merge of #8655 - camelid:patch-1, r=ehuss
Lowercase and remove periods in error messages for consistency
2020-09-08 20:17:21 +00:00
Camelid 82c834cec2 Update tests 2020-09-07 10:57:00 -07:00
Eric Huss fd25718660 Fix nightly exported_priv_warning test. 2020-09-05 10:31:04 -07:00
Weihang Lo c00ad7922d
Fix test for windows reserved filename error message 2020-09-04 09:18:47 +08:00
Weihang Lo 9cda385ab3
Test for --name hint 2020-09-04 08:39:13 +08:00
Alex Crichton bf10871c32 Fix flakiness in close_output test
It looks like stdout/stderr can race as to which gets printed first, but
both are valid for this test.

Closes #8665
2020-08-31 13:15:30 -07:00
bors d6b5b53772 Auto merge of #8656 - phil-opp:fix-8512, r=ehuss
Reload unstable table from config file in `reload_rooted_at`

Fixes #8512

cc @ehuss
2020-08-31 15:01:14 +00:00
Eric Huss f2f12ba6a2 Bump to 0.49.0 2020-08-28 10:17:49 -07:00
Eric Huss 5bbad10a8c Fix LTO with doctests. 2020-08-27 16:41:43 -07:00
Philipp Oppermann c5d8dcb323 Reload unstable table from config file in reload_rooted_at 2020-08-27 11:07:53 +02:00
bors 888ae7266a Auto merge of #8648 - Fogapod:rustc-args, r=ehuss
Add spaces after -C and -Z flags for consistency

Most other options have a space after flag name.
This commit makes verbose output of rustc invocations a little bit cleaner.
2020-08-26 21:38:52 +00:00
Eric Huss 10426acb54 Fix cache_messages::rustdoc test broken on beta. 2020-08-26 11:17:57 -07:00
Eugene 8164c1df3a Add spaces after -C and -Z flags for consistency
Most other options have a space after flag name.
This commit makes verbose output of rustc invocations a little bit cleaner.
2020-08-25 16:06:16 +03:00
bors f03698b3f9 Auto merge of #8629 - EmbarkStudios:master, r=ehuss
Fix bug with PathAndArg config values

This fixes an issue I noticed when trying to specify a target runner via the [`CARGO_TARGET_{triplet}_RUNNER`](https://doc.rust-lang.org/cargo/reference/config.html#targettriplerunner) environment variable, expecting it to override the value in our `.cargo/config.toml` file, which was giving quite strange errors until I figured out that cargo was actually merging the config file's values with the environment's values.

This change adds a small hack to use and `UnmergedStringList` from `PathAndArgs` instead of just plain `StringList`, which uses the type in the deserializer to determine if `Config::get_list_or_string` should merge the values from the config file(s) with the environment as it was doing before, or else only use the environment to the exclusion of the config file(s) if the key was set in the environment.

I also added a test for this to confirm both the bug and the fix.
2020-08-18 16:52:45 +00:00
Jake Shadle ddc7090f49 Remove debug only code 2020-08-17 19:53:16 +02:00
Jake Shadle a9a154f783 Fix bug with PathAndArg config values 2020-08-17 19:23:49 +02:00
Eric Huss 18bc90cd0e Show full error context on cargo run error. 2020-08-17 08:55:37 -07:00
Eric Huss 5305a3def6
Fix typo
Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
2020-08-09 11:43:52 -07:00
Alex Crichton 02fc16aece Fix jobserver_exists test on single-cpu systems
Closes #8595
2020-08-07 12:50:25 -07:00
Nazım Can Altınova 32449a70db
Add a test case for new publish behavior change 2020-08-06 13:01:15 +02:00
bishtpawan 3952fdb223 Refactor code and resolve PR comments 2020-08-05 17:46:33 +05:30
bishtpawan dd654d5576 Add pattern match for yank check and updated corresponding test cases 2020-08-05 17:31:56 +05:30