Commit graph

108 commits

Author SHA1 Message Date
Ed Page
db54c040ae fix(new): Print a 'Creating', rather than 'Created' status
This has bothered me about `cargo new` and `cargo init` for a while that
the output is read backwards, for example:
```diff
--- i/tests/testsuite/cargo_init/path_contains_separator/stderr.log
+++ w/tests/testsuite/cargo_init/path_contains_separator/stderr.log
@@ -1,3 +1,3 @@
+    Creating binary (application) package
 warning: the path `[ROOT]/case/test:ing/.` contains invalid PATH characters (usually `:`, `;`, or `"`)
 It is recommended to use a different name to avoid problems.
-     Created binary (application) package
```
2024-01-29 15:29:10 -06:00
Ed Page
675224b3a0 test(config): Shift to config.toml 2024-01-26 13:40:46 -06:00
Scott Schafer
0d62ae2fc3
feat: Add rustc style errors for manifest parsing 2023-12-15 13:30:10 -07:00
renovate[bot]
b4efcdbf32 chore(deps): update rust crate gix to 0.55.2 2023-11-01 00:12:37 +00:00
Weihang Lo
08c5e35f60
test(trim-paths): parsing in mainfest and config 2023-10-30 16:38:55 -04:00
David Tolnay
3871aecf3e
Improve deserialization errors of untagged enums 2023-08-27 16:27:08 -07:00
David Tolnay
58d042516e
Fill in more configuration deserialization and manifest deserialization tests 2023-08-27 16:14:29 -07:00
Ed Page
53dcd2f454 fix(manifest): Provide more context on sematic errors 2023-08-24 16:27:53 -05:00
Ed Page
511c17c961 fix(lock): Render source for serde errors
Before, we'd render the source for TOML syntax errors but not semantic errors.
Now we render for both.

Originally I changed `parse_document` to returned `T: DeserializeOwned`
but that adds an extra "could not parse TOML" which is both redundant
and makes it sound like its a syntax issue.
2023-08-24 16:27:37 -05:00
Ed Page
5cac7aa8c6 fix(toml): Remove redundant error messages 2023-08-24 16:19:48 -05:00
bors
b5177c6d46 Auto merge of #12001 - hi-rustin:rustin-patch-dep-empty, r=weihanglo
Improve error message for empty dep
2023-04-24 09:20:41 +00:00
hi-rustin
af0cd9fc5a Improve error message for empty dep
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-04-20 09:32:24 +08:00
jyn
8a9db7a020 Address review comments
- Update the documentation and doc-comments
- Improve the error message for parsing Cargo.toml
2023-04-12 12:05:14 -05:00
Joshua Nelson
d861dcf792 Allow named debuginfo options in Cargo.toml
Rustc supports these since rust-lang/rust#109808. It's technically
possible to set a named debuginfo level through `RUSTFLAGS`, but in
practice cargo always passes its own opinion of what the debuginfo level
is, so allow it to be configured through cargo too.
2023-04-11 15:06:02 -05:00
Sebastian Thiel
cfffda9ae5
add -Zgitoxide=fetch feature toggle and implementation.
This allows to use `gitoxide` for all fetch operations, boosting performance
for fetching the `crates.io` index by a factor of 2.2x, while being consistent
on all platforms.

For trying it, nightly builds of `cargo` can specify `-Zgitoxide=fetch`.
It's also possible to set the `__CARGO_USE_GITOXIDE_INSTEAD_OF_GIT2=1` environment
variable (value matters), which is when `-Zgitoxide=none` can be used
to use `git2` instead.

Limitations
-----------
Note that what follows are current shortcomings that will be addressed in future PRs.

- it's likely that authentication around the `ssh` protocol will work differently in practice
  as it uses the `ssh` program.
- clones from `file://` based crates indices will need the `git` binary to serve the locatl repository.
- the progress bar shown when fetching doesn't work like the orgiinal, but should already feel 'faster'.
2023-03-02 12:35:50 +01:00
bors
0c331721d9 Auto merge of #11725 - Muscraft:reduce-build-in-tests, r=ehuss
Switch some tests from `build` to `check`

#11341 brought up issues with cargo's `testsute` size and speed. One of the suggested fixes was switching most tests to `check` instead of `build`. This PR did that.

Before size on `nightly`: 4.4GB

After size on `nightly`: 4.2GB

Regex to find `build` in `tests/testsuite`: `cargo\(".*build.*\)`
Before: 1607
After: 626

Note I did not remove all `build` I only did the easy ones that required minimal changes. I also tried not to touch systems I was unsure about. There could be other uses of `build` I missed as well.

I still need to play around with `opt-level`, `debug=0`, and a few other tweaks, but there should be more time/memory to drop.

Each test file changed is in a commit of its own, so you should look commit by commit.
2023-02-21 23:27:36 +00:00
Scott Schafer
9708e6f62d refactor: Make two tests stderr not match their test name 2023-02-20 11:09:05 -06:00
Scott Schafer
9174c22744 chore: update build_config test to use check 2023-02-15 15:28:48 -06:00
Ed Page
6007f05a85 chore: Update to toml v0.6, toml_edit v0.18
`toml` replaces `toml_edit::easy`, using `toml_edit` as its parser.
2023-01-19 15:26:28 -06:00
Eric Huss
fab135885c Fix panic on ignored target dependency. 2023-01-04 18:44:51 -08:00
Arlo Siemsen
dd5134c7a5 Implement RFC 3289: source replacement ambiguity 2022-10-07 22:30:59 -05:00
Scott Schafer
ab18bd40d5 refactor(testsuite): Replace [project] with [package] 2022-09-26 09:51:16 -06:00
Weihang Lo
ef7a4ef062
Dont swallow errors when checking existence of a config key 2022-09-22 10:52:39 +01:00
Yerkebulan Tulibergenov
dc23d97d5b Merge branch 'master' into yerke/negative_jobs 2022-07-10 14:20:26 -07:00
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
Orson Peters
07cc897a4f Added support for negative --jobs parameter, counting backwards from max CPUs. 2021-03-01 17:05:22 +01: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