Commit graph

16381 commits

Author SHA1 Message Date
Ed Page 9de03cd1fd fix(add): Catch empty dep name early 2023-12-13 10:43:55 -06:00
Ed Page 1791353689 fix!: Disallow empty registry names
This was allowed when switching from `toml` v0.5 to `toml_edit` which
started allowing empty keys when parsing TOML.
This mirrors the change
we made for disallowing empty feature names in #12928.
2023-12-13 10:38:37 -06:00
Ed Page 7200646a97 test: Demonstrate existing empty name errors 2023-12-13 10:38:34 -06:00
bors 8412d30873 Auto merge of #13152 - hi-rustin:rustin-patch-empty-name, r=epage
Do not allow empty name in package ID spec
2023-12-13 01:22:37 +00:00
bors 0e18edfb82 Auto merge of #13159 - heiher:bump-openssl, r=weihanglo
chore(deps): update rust crate openssl to 0.10.61

### What does this PR try to resolve?

Bump rust crate `openssl` to `0.10.61`.

This is a major bump that Cargo starts depending on OpenSSL v3 via [openssl-src@300.1.2+3.1.1](https://crates.io/crates/openssl-src/300.1.2+3.1.1)

Some other notes:

* OpenSSL 3.1.1 was released on [2023-05-30](https://github.com/openssl/openssl/blob/master/CHANGES.md#changes-between-310-and-311-30-may-2023).
* Starting from 1.6 [libgit2 supports OpenSSL v3](https://github.com/libgit2/libgit2/blob/main/docs/changelog.md#v16)
* Starting from 1.10.0 [libssh2 supports OpenSSL v3](https://libssh2.org/changes.html#1.10.0)
* OpenSSL 1.1.1 [is EOL](https://www.openssl.org/blog/blog/2023/03/28/1.1.1-EOL/).
* curl seems to support OpenSSL v3 before it got released.

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

Build test.

### Additional information

The openssl build issue for loongarch is resolved.
2023-12-12 18:58:15 +00:00
bors 7c722f76ed Auto merge of #13134 - arlosi:vendor-libgit2, r=ehuss
`all-static` feature should include `vendored-libgit2`

Cargo has an `all-static` feature which is supposed to statically link dependencies for distributing.

However, it doesn't include `libgit2`. If the system has a compatible version of `libgit2` and `pkg-config` installed, then the `all-static` build will still use the system `libgit2`.
2023-12-12 17:50:31 +00:00
bors 73eeb849e2 Auto merge of #13160 - Turbo87:crates-io-status-codes, r=weihanglo
doc/registry-web-api: Adjust success response code documentation

see #13158 :)
2023-12-12 17:13:31 +00:00
Tobias Bieniek 9cb5eed6ce
doc/registry-web-api: Adjust success response code documentation 2023-12-12 17:54:56 +01:00
bors 1aa9df1a5b Auto merge of #13158 - Turbo87:crates-io-status-codes, r=epage
crates-io: Add support for other 2xx HTTP status codes

Replying with `201 Created` of `202 Accepted` should not result in showing errors.

Related:

- https://github.com/rust-lang/cargo/issues/3995
- https://github.com/rust-lang/cargo/pull/6771
2023-12-12 14:52:31 +00:00
WANG Rui 8e9a62d51e chore(deps): update rust crate openssl to 0.10.61 2023-12-12 21:29:45 +08:00
Tobias Bieniek 32d4c0fd80
crates-io: Add support for other 2xx HTTP status codes
Replying with `201 Created` of `202 Accepted` should not result in showing errors.
2023-12-12 13:33:03 +01:00
bors 5dc5118c53 Auto merge of #13156 - hi-rustin:rustin-patch-fix-nightly-test, r=epage
Remove the deleted feature test_2018_feature from the test
2023-12-12 03:04:52 +00:00
hi-rustin e540c66e09 Remove the deleted feature test_2018_feature from the test
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-12-12 10:54:29 +08:00
bors 489f93f4f1 Auto merge of #13154 - epage:schema, r=weihanglo
refactor(schema): Remove reliance on cargo types

### What does this PR try to resolve?

This is another step towards #12801.

The only thing left is `validate_package_name` which I left out because I want to explore ways of handing that and don't want this commit blocked on it

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

### Additional information
2023-12-11 23:16:07 +00:00
bors a0339b0ae3 Auto merge of #13155 - epage:lint, r=weihanglo
fix(toml)!: Disallow `[lints]` in virtual workspaces

This was missed with the initial `[lints]` implementation.

While this is a breaking change, this is aligned with ones we've done in the past.  A lot of times, we warn first.  My hope is that isn't needed this time because
- It only exists virtual workspaces so they aren't published
- It is a nop to have this which is likely to be caught
- This is so new that the number of people using it, and likely running into this case, is quite low.
2023-12-11 20:30:22 +00:00
Ed Page 48c72b9aa7 docs(schema): Raise awareness of validation when updating 2023-12-11 14:18:10 -06:00
Ed Page 66ce16c72b fix(toml)!: Disallow [lints] in virtual workspaces
This was missed with the initial `[lints]` implementation.

While this is a breaking change, this is aligned with ones we've done in
the past.  A lot of times, we warn first.  My hope is that isn't needed
this time because
- It only exists virtual workspaces so they aren't published
- It is a nop to have this which is likely to be caught
- This is so new that the number of people using it, and likely running
  into this case, is quite low.
2023-12-11 14:10:01 -06:00
Ed Page 808e2a174f refactor(schema): Adopt RustVersion 2023-12-11 13:44:14 -06:00
Ed Page 085d860f54 refactor(schema): Remove reliance on CargoResult 2023-12-11 13:37:01 -06:00
Ed Page 0c81f7a293 refactor(schema): Remove reliance on IntoUrl 2023-12-11 13:36:01 -06:00
bors 7688d896a8 Auto merge of #13135 - linyihai:limit-priv-to-library, r=epage
Limit exported-private-dependencies lints to libraries

### What does this PR try to resolve?
Completed https://github.com/rust-lang/cargo/issues/13039.

This PR limit `exported-private-dependencies`  lint in libraray `Target`.

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

Your can checkout out 2348ac2a20edf772495349d7911938251e343bf1 and run test, it will failed and then it will be passed in the commit 2348ac2a20edf772495349d7911938251e343bf1

### Additional information
2023-12-11 17:22:22 +00:00
bors 991ad8c0dd Auto merge of #13148 - weihanglo:bump-gix-index, r=epage
chore: update to gix-index@0.27.1

This is for fixing build failure in
https://github.com/rust-lang/rust/pull/118765#issuecomment-1848579803
2023-12-11 15:23:48 +00:00
Ed Page 6ad58cd672 refactor(schema): Remove unused function
I think a bad merge conflict resolution brought this back.
2023-12-11 09:05:25 -06:00
hi-rustin 1248522eb2 fix: validate package name from URL
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-12-11 10:11:29 +08:00
hi-rustin 4dc1178281 test: add a case for bad package URLs starting with numbers
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-12-11 10:10:54 +08:00
hi-rustin 442636b949 test: add a case for parsing URL spec without name
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-12-11 10:10:21 +08:00
hi-rustin b1642b51a5 fix: validate if name is empty
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-12-11 10:09:35 +08:00
hi-rustin a7ff31fbfe test: add a case for parsing empty names
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-12-11 10:08:38 +08:00
Weihang Lo 36f37006c1
chore: update to gix-index@0.27.1
This is for fixing build failure in
https://github.com/rust-lang/rust/pull/118765#issuecomment-1848579803
2023-12-10 09:42:53 -05:00
bors a092469d46 Auto merge of #13147 - ehuss:update-curl, r=epage
Update curl-sys to bring in curl 8.5.0

This is a routine update for curl.
The security issues don't appear to affect cargo.
https://daniel.haxx.se/blog/2023/12/06/curl-8-5-0/
Changelog: https://curl.se/changes.html#8_5_0
2023-12-10 00:11:43 +00:00
Eric Huss 4e17e02cb9 Update curl-sys to bring in curl 8.5.0 2023-12-09 15:58:23 -08:00
bors 66ad359b40 Auto merge of #13144 - weihanglo:openssl1.1.1, r=epage
chore: downgrade to openssl v1.1.1

See <https://github.com/rust-lang/cargo/pull/13101>

> `openssl@0.10.160` switches to OpenSSL v3,
> which causes Cargo build failure on loongarch64.

I overlooked lockfile change in <https://github.com/rust-lang/cargo/pull/13117>.
2023-12-09 12:30:01 +00:00
Lin Yihai 58c673d040 test(pub_priv): covering build.rs test 2023-12-09 17:14:10 +08:00
Lin Yihai ab13b10066 feat: limit -extern priv: to libraries 2023-12-09 16:11:05 +08:00
Lin Yihai db0c5c1d72 test(priv_dep): verify -extern priv: do not limit in lib target. 2023-12-09 16:00:35 +08:00
Weihang Lo 3d4cc51e05
chore: downgrade to openssl v1.1.1 2023-12-08 23:13:06 -05:00
Ed Page bf1837ce9b refactor(schemas): Reference types directly 2023-12-08 16:58:56 -06:00
bors 6feabf9477 Auto merge of #13114 - weihanglo:trim-paths-explicit-cwd, r=epage
fix: explicitly remap current dir by using `.`
2023-12-08 22:38:37 +00:00
bors 047dc187da Auto merge of #13143 - ChrisDenton:test-changes, r=weihanglo
Don't rely on mtime to test changes

### What does this PR try to resolve?

Fixes #13139 by making sure tests aren't relying on changing the mtime alone

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

The pattern to watch out for is when a file is created with empty contents, e.g. `.file("foo", "")`, then later the same file updated with empty contents, e.g. `.change_file("foo", "")`. Tests should be making an actual change to the contents.
2023-12-08 21:37:50 +00:00
Weihang Lo fcd4221c5a
test(trim-paths): don't follow links to separate debuginfo files
For refeference:
https://sourceware.org/binutils/docs/binutils/readelf.html
2023-12-08 16:34:00 -05:00
bors a1449eeb3e Auto merge of #13128 - epage:schema, r=weihanglo
refactor: Pull PackageIdSpec into schema

### What does this PR try to resolve?

This removes one of the remaining ties `util_schemas` has on the rest of cargo as part of #12801.

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

This is broken up into small commits

### Additional information
2023-12-08 20:55:30 +00:00
Weihang Lo bb86adfff7
fix(trim-paths): explicit remap to current dir .
In https://github.com/rust-lang/rust/blob/87e1447aa/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs#L856
when the remap result of `work_dir` is an empty string,
LLVM won't generate some symbols for root debuginfo node.
For example, `N_SO` and `N_OSO` on macOS,
or `DW_AT_comp_dir` on Linux when debuginfo is splitted.
Precisely, it is observed that when the `DIFile` of compile unit was
provied with an empty compilation `Directory` string,
LLVM would not emit those symbols for the root DI node.

This behavior is not desired,
resulting in corrupted debuginfo and degrading debugging experience.

This is might not be a bug of `--remap-path-prefix` in rustc,
since `-fdebug-prefix-map` in clang 16 could have the same result
(`DW_AT_comp_dir` is gone when `work_dir` is remapped to an empty string).
However, in gcc 12 `fdebug-prefix-map` will return an absolute work_dir
when an empty string occurs.

To not bother whether this needs to be fixed in rustc or not,
let's fix it by always appending an explicit `.`
when `--remap-path-prefix` remaps to relative workspace root
a.k.a. where rustc is invoking.

For more on gcc/clang remap options, see
https://reproducible-builds.org/docs/build-path/
2023-12-08 15:52:06 -05:00
Weihang Lo 7cb7b47fe7
test(trim-paths): add test for each split-debuginfo options
Also demonstarte that on Linux with split-debuginfo on the remap is broken
2023-12-08 15:51:55 -05:00
Chris Denton 4ef503fc2d
Don't rely on mtime to test changes 2023-12-08 20:32:28 +00:00
bors 72b3eb5375 Auto merge of #13140 - epage:wincon, r=weihanglo
fix: Print rustc messages colored on wincon

### What does this PR try to resolve?

The real fix is over in rust-cli/anstyle#150; this just upgrades to it

Fixes #13104

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

I hacked vt console support off, ran a build before and rustc messages weren't colored.  Now with this change, rustc messages are colored.

### Additional information

This still doesn't address why wincon is being used on their system
2023-12-08 20:11:33 +00:00
Weihang Lo 985d49b916
test(trim-paths): use --config CLI to change options 2023-12-08 13:57:45 -05:00
bors 232f91368f Auto merge of #13131 - ChrisDenton:windows-manifest, r=ehuss
Add a windows manifest file

This adds a Windows [application manifest file](https://docs.microsoft.com/en-us/windows/win32/sbscs/application-manifests) to the built `cargo.exe` for windows msvc. This manifest file is used to enable modern features of Windows. [`rustc`](7df0c211ac/compiler/rustc) has been using a similar manifest for about a year now.

The manifest file does the following:

* States our compatibility with Windows versions 7, 8, 8.1, 10 and 11. This allows avoiding unnecessary compatibility shims.
* Sets the code page to UTF-8. This should have no real impact on existing code (which should work with any code page). That said it may avoid issues if dependencies do use the local code page because conversions to/from Unicode are lossy so if a Unicode code point has no local code page equivalent, information is lost.
* Enable long path awareness. Mostly rust itself side-steps long path issues by using `\\?\` paths internally. However, this doesn't work for the current directory whereas using this option does.

You can test that a manifest file has been embedded by extracting it to a new file:

    mt -nologo -inputresource:cargo.exe -out:embedded.manifest

You can also examine the `.rsrc` (aka resource) section using `dumpbin`

    dumpbin /SECTION:.rsrc /ALL cargo.exe

### Additional info

This also sets the [`/Wx` linker option](https://learn.microsoft.com/en-us/cpp/build/reference/wx-treat-linker-warnings-as-errors?view=msvc-170) which turns linker warnings into errors. When setting linker options manually, I prefer to also set this because, unless there are also linker errors, `rustc` will not show linker warnings by default. Linker warnings should be rare and usually do indicate an actual problem so not ignoring them should be fine.
2023-12-08 18:19:15 +00:00
Ed Page ad2643d8e2 fix: Print rustc messages colored on wincon
Fixes #13104
2023-12-08 11:49:05 -06:00
Arlo Siemsen 1a90797c0a all-static feature includes vendored-libgit2 2023-12-07 19:23:33 -06:00
bors 749654c5fd Auto merge of #13132 - arlosi:cachedir, r=epage
Avoid writing CACHEDIR.TAG if it already exists

Cargo currently unconditionally writes `CACHEDIR.TAG` files even if they already exist.

This practice causes problems for build systems that disallow multiple writes to the same file.
2023-12-07 22:37:55 +00:00