83 Commits

Author SHA1 Message Date
Ed Page
320c279f43 Port cargo from toml-rs to toml_edit
Benefits:
- A TOML 1.0 compliant parser
- Unblock future work
  - Have `cargo init` add the current crate to the workspace, rather
    than error
  - #5586: Upstream `cargo-add`
2022-01-13 09:27:27 -06:00
Ed Page
2fdb7100cc Remove TOML incompatibility hacks
- `set_require_newline_after_table` was added in #2680 back in 2016
- `set_allow_duplicate_after_longer_table` was added in #6761 in 2019

Several years later, this PR is turning these warnings into errors.

The function and documentation was kept so we can add additional hacks
in the future, like if we switch TOML parsers.
2021-09-21 14:48:18 -05:00
Eric Huss
d4e504ca85
Revert "When a dependency does not have a version, git or path, fails directly" 2021-09-14 13:04:03 -07:00
Weihang Lo
8c75e2ffa0
Update tests to use registry names 2021-07-22 00:50:30 +08:00
bors
4e143fd131 Auto merge of #9685 - ehuss:named-profile-updates, r=alexcrichton
Named profile updates

A few updates for named profiles to push them closer to stabilization:

- Disable the `dir-name` profile setting. `dir-name` primarily exists for translating the built-in profiles or sharing artifacts between profiles. In order to simplify the UI, we would like to not expose it to the user for the initial stabilization. The code to support it is kept in case we want to add it in the future.
- Reserve some profile names. Just to give a little flexibility in the future in case we want to use these, or that they could cause confusion. Also updated the error text a little.
- Add support for custom profiles to legacy commands. Their old behavior is still retained for backwards compatibility. That is:
    * `cargo check`
        * `--profile=test`: This forces the test mode. For example, `cargo check --lib --profile=test` will check the library as a unit test (with `--test`).
    * `cargo fix`
        * `--profile=test`: Forces test mode, same as above.
    * `cargo rustc`
        * `--profile=test`: Forces test mode, same as above.
        * `--profile=bench`: Forces bench mode.
        * `--profile=check`: Forces check mode.
    - These commands also allow mixing the above options with `--release`, which is normally not allowed.
- Fix `cargo bench` to support the `--profile` option. I think it was just forgotten.
2021-07-20 21:55:45 +00:00
hi-rustin
6f214ac752 Make ignored key in config be an error
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-07-15 14:35:10 +08:00
hi-rustin
85ba14c68d Make the dependency specification ambiguous be an error
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-07-15 14:29:11 +08:00
hi-rustin
5c66070803 When a dependency does not have a version, git or path, fails directly
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-07-14 14:09:45 +08:00
Eric Huss
51dc5db4e2 Reserve some names for named profiles.
Just to give a little flexibility in the future in case we want to use
these, or that they could cause confusion. Also updated the error text a
little.
2021-07-13 11:59:15 -07:00
Eric Huss
205148e645 Only normalize paths on windows.
I don't trust that all these transformations won't have unintended
consequences on other platforms. It is nice to verify there aren't any
backslash shenanigans on other platforms.
2021-06-16 10:35:26 -07:00
Eric Huss
96a5642217 Add cargo config subcommand. 2021-03-25 13:52:31 -07:00
Jade
b09988649a Restore the tests that could be reused 2021-03-22 13:39:18 -07:00
lf-
47347de87e Delete redundant broken tests 2021-03-22 13:39:18 -07:00
Mukund Lakshman
54742ce726 Use serde's error message option to avoid implementing Deserialize. 2021-03-19 23:22:39 +00:00
Eric Huss
d65a714493 Reject ambiguous git dependency declaration. 2020-12-16 13:10:11 -08:00
Eric Huss
6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07: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
mjarkk
91f6617457 Add test 2020-06-01 19:50:33 +02:00
Eric Huss
1eca786d7f Add path to the failure to load a dependency. 2020-02-27 08:17:18 -08:00
Eric Huss
a07fec1b7b Provide extra context on a query failure. 2020-02-25 10:17:11 -08:00
Eric Huss
fd258634c9 Improvements to StringList config handling. 2020-02-16 15:29:59 -08:00
Alex Crichton
d7b45f9992 Use context to create a chain of errors
There's an existing bug (#7782) in Cargo which exacerbates the issue
here but in general having a stack of errors is a bit easier to read and
work with than having a big long error message.
2020-01-09 10:29:22 -08:00
bors
5cca88f0c6 Auto merge of #7763 - ehuss:fix-target-cfg-env, r=alexcrichton
Fix CARGO_TARGET_triple_LINKER environment variable.

#7649 caused an unfortunate regression where the `CARGO_TARGET_triple_LINKER` environment variable stopped working. I did not realize `serde(flatten)` caused serde to switch to `deserialize_map` which does not support environment variables.

The solution here is to essentially revert back to how the `[target]` table used to be loaded by loading each key individually.

This also removes the `ar` field which is not used by `rustc`.
2020-01-06 17:18:52 +00:00
Eric Huss
35b924db5a Fix CARGO_TARGET_triple_LINKER environment variable. 2020-01-02 11:50:00 -08:00
Eric Huss
30cc7cebfc Check for a source defined multiple times. 2019-12-28 12:51:56 -08:00
Eric Huss
381251aa1f Config refactoring. 2019-12-19 09:44:01 -08:00
Takayuki Nakata
4956d3e778 Add and move tests for jobs of cargo build
A test when argument is negative is added. In addition,
`default_cargo_config_jobs` and `good_cargo_config_jobs` is moved from
`testsuite/bad_config.rs` to `testsuite/build.rs` because these tests
are not for `bad config`.
2019-12-11 18:01:01 +09:00
Eric Huss
83571aee56 Minor testsuite organization. 2019-11-24 18:42:45 -08:00
Alex Crichton
37ace8886a Finish implementing Value, use it in helpers
Rewrite helpers like `get_bool` to use `get::<Option<Value<bool>>>`
instead of duplicating the logic that's already with the typed access of
configuration. This is more along the effort to centralize all
deserialization of configuration into typed values instead of using
ad-hoc accessors in a number of locations.
2019-10-07 17:12:03 -07:00
Dan Aloni
375a46f18b Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-09-18 08:56:13 +03: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
Dan Aloni
80cc7c8170 Reinstate warning regarding 'debug' profile
The previous warning was detected at the decoding level, with the test
removed in an earlier commit. Here it is brought back, in the custom
profile processing level.

Keeping this warning will serve to prevent confusion, when people expect
to affect the 'debug' directory via the 'debug' profile to no effect,
where in fact the 'dev' profile is the profile that they opted to
change.
2019-09-12 08:22:20 +03:00
Dan Aloni
f0896975be Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-09-08 21:43:41 +03:00
k-nasa
7176df01d6 Change --all to --workspace 2019-09-03 17:14:34 -07:00
Eric Huss
b41c209af3 Bump toml 0.5.3 2019-08-13 14:56:22 -07:00
Dan Aloni
27da33c67d Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-07-28 09:24:31 +03:00
Eric Huss
a4e9611453 Fix some formatting for some strings. 2019-07-13 16:00:47 -07:00
Dan Aloni
2f81adb115 named-profiles: feature gate exemptions
To preserve old `profile` behavior, some cases of `--profile`
should not trigger an error. Plus, the 'check' profile should be
allowed for profile selection tests and `rustc --profile=check`.
2019-06-20 18:32:29 +03:00
Dan Aloni
87183146d9 Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-06-20 16:18:42 +03: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
Dan Aloni
a72c405fe5 tests: we now allow a profile.debug 2019-06-01 13:49:51 +03:00
Eric Huss
70e4e87c17 Warn on version req with metadata. 2019-03-31 18:53:54 -07:00
Jonathan Claudius
46b2b78754
Merge branch 'master' into https_all_the_things 2019-02-22 14:21:53 -05:00
Alexander Regueiro
f7c91ba622
Various cosmetic improvements. 2019-02-20 10:58:27 +00:00
Jonathan Claudius
a9480edbc2
Try to get build to fix 2019-01-31 14:52:28 -05:00
Jonathan Claudius
0c3851c017
HTTPS all the things 2019-01-30 15:34:37 -05:00
Alex Crichton
fecb724643 Format with cargo fmt 2018-12-08 03:19:47 -08:00
Dale Wijnand
04ddd4d0fc
Upgrade to Rust 2018 2018-12-06 20:18:35 +01:00
Eric Huss
6ad7794027 Include path to manifest in workspace warnings. 2018-11-07 11:17:29 -08:00
Zach Lute
3492a3905c Replace 'project' with 'package' in many strings and comments. 2018-09-20 23:47:09 -07:00