70 Commits

Author SHA1 Message Date
Eric Huss
85854b1884 Refactor feature handling, and improve error messages. 2021-03-19 14:59:53 -07:00
Eric Huss
d087aeb845 Stabilize -Zfeatures and -Zpackage-features. 2020-12-19 08:26:42 -08:00
Eric Huss
ea1a73a121 Add period to allowed feature name characters. 2020-12-02 07:56:44 -08:00
Eric Huss
b731190daa Add a future-compatibility warning on allowed feature name characters. 2020-10-27 14:23:35 -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
Ivan Tham
fd5902c6ca
Fix help message in features.rs test 2020-10-14 10:21:37 +08:00
Eric Huss
6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07:00
Alex Tokarev
19a9579031 Warn on missing required-features
Co-authored-by: Eric Huss <eric@huss.org>
2020-07-26 13:01:18 +03:00
Alex Crichton
6514c289d2 Improve git error messages a bit
This commit is targeted at further improving the error messages
generated from git errors. For authentication errors the actual URL
fetched is now printed out as well if it's different from the original
URL. This should help handle `insteadOf` logic where SSH urls are used
instead of HTTPS urls and users can know to track that down.

Otherwise the logic about recommending `net.git-fetch-with-cli` was
tweaked a bit and moved to the same location as the rest of our error
reporting.

Note that a change piggy-backed here as well is that `Caused by:` errors
are now automatically all tabbed over a bit instead of only having the
first line tabbed over. This required a good number of tests to be
updated, but it's just an updated in renderings.
2020-06-25 08:47:15 -07:00
Eric Huss
ab73b2c35c Fix order-dependent feature resolution. 2020-06-21 17:28:36 -07:00
Eric Huss
4ae79d2ffd Use fs helpers instead of File functions. 2020-04-17 07:56:16 -07:00
Eric Huss
54ace8af65 Merge -Zpackage-features2 and -Zpackage-features. 2020-04-08 14:06:09 -07:00
Eric Huss
7caa1612cf Add new feature resolver. 2020-02-20 12:04:28 -08:00
Jonas Platte
2166db8c49
Add a note to the error message for using --feature / --no-default-features in a virtual workspace 2019-12-24 14:46:16 +01:00
Eric Huss
83571aee56 Minor testsuite organization. 2019-11-24 18:42:45 -08:00
Eric Huss
4d524ea57b Allow --all-features in root of virtual workspace. 2019-10-18 09:39:58 -07:00
Eric Huss
bf474ba589 Reject feature flags in a virtual workspace. 2019-10-14 12:40:14 -07:00
Alex Crichton
1fa02e77b6 Fix interpretation of --features a b on the CLI
Fixes an accidental regression from #7084 where `--features a b` was
erroneously mistinterpreted as `--features "a b"`.

Closes #7418
2019-09-24 09:24:47 -07:00
Alex Crichton
9115b2c326 Extract support directory to its own crate
Extract out all our test support code to its own standalone crate so it
can be shared between multiple test suites if necessary.
2019-09-16 11:47:09 -07:00
Eric Huss
ecf824f7b2 Update additional uses of --all.
- man pages
- Slightly reword deprecation notice.
- Include --all in man pages.
- Update some additional usages in code and docs.
2019-09-03 17:51:07 -07:00
k-nasa
7176df01d6 Change --all to --workspace 2019-09-03 17:14:34 -07:00
Eric Huss
88d3b4ce42 Remove debug panic in package-features. 2019-08-05 08:44:13 -07:00
bors
10776bdde3 Auto merge of #7084 - scruffystuffs:invoke-feature-multi, r=alexcrichton
Add support for multiple --features options

Closes #7076

Pretty straightforward, but I added an extra test to make sure that space-separated features work in conjunction with multiple --features options.
2019-07-19 13:56:28 +00:00
Eric Huss
a4e9611453 Fix some formatting for some strings. 2019-07-13 16:00:47 -07:00
Wesley Van Melle
51c26b6776 Add support for multiple --features options 2019-07-01 15:29:38 -07:00
Jethro Beekman
0e0d968825 Update #[test] attribute on all tests in the testsuite
sed -i 's/^#\[test\]/#[cargo_test]/' $(rg -l '^#\[test\]')

Manual fixes:
* proc_macro::proc_macro_doctest
2019-06-07 12:41:26 -07:00
Alex Crichton
dbc2c2b57d Don't synthesize feature diretives for non-optional deps
Currently when Cargo is invoked on the command like `cargo build
--features foo/bar` then it will actually always compile the current
crate with `feature = "foo"` even if `foo` is a non-optional dependency.
This isn't intended because the crate doesn't actually have a `foo`
feature as so no directive should be emitted or passed to the compiler.

This was discovered in rust-lang/rust where Cargo is being built with
the `rustc-workspace-hack` feature but when the RLS depends on Cargo it
doesn't enable the same feature. This feature, however, doesn't actually
exist for Cargo!
2019-06-05 09:10:10 -07:00
Eh2406
35ff555b70 just give up and make it an error 2019-04-22 17:31:55 -04:00
Alexander Regueiro
f7c91ba622
Various cosmetic improvements. 2019-02-20 10:58:27 +00:00
Eric Huss
f58d107e7c testsuite: Require failing commands to check output. 2018-12-28 17:59:36 -08:00
Alex Crichton
fecb724643 Format with cargo fmt 2018-12-08 03:19:47 -08:00
bors
41a7e150fc Auto merge of #6387 - dwijnand:rust-2018, r=dwijnand
Upgrade to Rust 2018 & fix edition idioms

None
2018-12-07 16:37:19 +00:00
Dale Wijnand
04ddd4d0fc
Upgrade to Rust 2018 2018-12-06 20:18:35 +01:00
Fred Bunt
d522344f58 Clean up pattern string 2018-12-05 17:07:53 -07:00
Fred Bunt
86037b8ab6 Add failing test for issue #6370 2018-12-05 02:34:37 -07:00
Eric Huss
b29d4d4896 Fix dylib reuse with uplift. 2018-10-11 19:42:32 -07:00
Zach Lute
89f43938fe Print file paths instead of file:// URLs.
This change ensures cargo will output file paths in the expected format
(C:\foo\... on Windows, /foo/... elsewhere). Previously it would output
file:// URLs instead.

To support this change, additional changes were made to the test suite
string processing such that [ROOT] is now replaced with the appropriate
file path root for the platform.

The CWD template was also updated to use [CWD] like other replacement
templates and to do the replacement on the expected value rather than
the actual value to avoid replacing things we don't expect with CWD.
2018-09-07 19:42:59 -07:00
Matthias Krüger
2cd9cce6e3 clippy: resolve all warnings about useless format!() 2018-09-03 11:38:29 +02:00
Dale Wijnand
d5fc8dc3a7
Introduce the CWD macro in test output asserting
Avoids dealing with things like CWD changing.
2018-08-30 11:05:29 +02:00
Dale Wijnand
2554afe764
Make Project::process return Execs 2018-08-28 22:38:26 +02:00
Dale Wijnand
85984a8700
Migrate from tests fom assert_that/execs to .run() 2018-08-28 15:08:12 +02:00
Dale Wijnand
b5ee3635ef
Wrap ProcessBuilder in Execs & make .cargo return that 2018-08-28 09:24:37 +01:00
Dale Wijnand
c882b4e02e
Fix 3 corner tests where whitespaces are important 2018-08-19 10:16:08 +01:00
Dale Wijnand
511d4bc503
Collapse multiline ProcessBuilder::arg calls in tests
.. by calling this a bunch of times:

    fastmod --multiline '\.cargo\("([^"]+)"\).[ ]+\.arg\("([^"]+)"\)' '.cargo("${1} ${2}")' tests/testsuite/
2018-08-18 15:12:54 +01:00
Dale Wijnand
af4f1392f7
Collapse ProcessBuilder::arg calls in tests
.. with mutliple calls of:

    fastmod --accept-all '\.cargo\("([^"]+)"\)\.arg\("([^"]+)"\)' '.cargo("${1} ${2}")' tests/testsuite/

until no changes are left.
2018-08-18 15:05:45 +01:00
Dale Wijnand
16aeb0cd4f
Default test support's Execs to exit code 0 2018-08-03 07:44:42 +01:00
Dale Wijnand
ca7d9ee292
Declare one-line files on one line, in test projects 2018-07-25 09:58:50 +01:00
Dale Wijnand
ab19c48358
Dedup a bunch more manifest 2018-07-25 00:43:30 +01:00
Dale Wijnand
5659b78b76
Replace const BASIC_MANIFEST with basic_manifest("foo", "0.0.1") 2018-07-24 23:35:50 +01:00