Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from tokio-rs:master #9

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open

Conversation

pull[bot]
Copy link

@pull pull bot commented Apr 9, 2024

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

Use the helper function to replace repetitive expressions obtaining
prost library path from the configuration with fallback to "::prost".
@pull pull bot added the ⤵️ pull label Apr 9, 2024
MixusMinimax and others added 28 commits April 9, 2024 14:58
* Address #997: handle keyword `Self` after stripping enum type prefix

* create sanitize_identifier

* add to_snake back (i did it in two commits to not mess up the git blame)

* small fixes

* add test_sanitize_identifier

* remove unnecessary comment

* combine test_strip_enum_prefix and test_strip_enum_prefix_resulting_in_keyword

* update enum_keyword_variant.proto

* maybe improve docs of strip_enum_prefix?
* prost: clarify encoding test buffer copying:

fixes `noop_method_call` clippy lint warning.

* ci: add lint checking step:

* Makes that the entrire workspace is checked, but tests too.

* chore: fix `needless_borrow` lints

* chore: fix `needless_return` lints

* chore: remove noop clippy allows

* chore: fix `box_default` lints

* chore: fix `unnecessary_cast` lints

* chore: fix `slow_vector_initialization` lints

* chore: fix `assigning_clones` lints

* chore: fix `unused_import` lints

* chore: fix `single_match` lints
Instead of downloading a tarball, use a submodule to get the protobuf sources. Newer versions of protobuf require recursive submodules for its dependencies
* chore: Fix needless borrow

* ci: Clippy requires checking out submodules

* ci: Exclude `protobuf` project from clippy
…iles (#1020)

* build: split `Config` into a separate module

* build: split `Module` into a separate module
…1033)

Removes the need to always specify append `--workspace` in the common
cargo commands.

`rust-analyser` seems to get confused and locks the workspace longer
than needed under the previous structure. (Lots of `Blocking waiting
for file lock on build directory` waiting.) Unable to find an issue
mentioning this.

Goals it to then make repo to more easily managed. Examples:

* Consolidate crate package metadata, dependency versions and clippy
lints in the workspace `Cargo.toml`

* Placing all crates in a `crates/` for automatic workspace member
inclucion.
The dataset for these benchmarks are not distributed in upstream protobuf. Therefore they fail when running `cargo bench --workspace`.

Fixes #1005

Open question:
- Are these datasets available for download? If yes, we could add them to the repo.
Co-authored-by: Casper Meijn <casper@meijn.net>
Each published crate should have a unique description.
The published crates were already using edition 2021. Update all internal crates as well.

Also add a new tests-2018 crate that runs all tests using edition 2018.
Many tests from `prost-build` wrote to the same temporary directory. Therefore these tests overwrite each other files. Because `cargo test` runs multi threaded some tests failed sometimes.
* prost-build: consolidate message field data

When massaging field data in CodeGenerator::append_message,
move it into lists of Field and OneofField structs so that later
generation passes can operate on the data with less code duplication.

Subsidiary append_* methods are changed to take references to these
structs rather than moved data, as generation of lexical tokens
does not actually consume any owned data, and we will need more
passes over the same field lists for the upcoming builder code.

* prost-build: compute field tags in place

* prost-build: address comments on reuse of Field

Make rust_field into a method computing the name on the fly.
In OneofField, make the vector of fields to have Field members.
Don't play reference renaming tricks with field.descriptor.
* tests: Remove unused dependencies

Found these unused dependencies using: `cargo +nightly udeps && cargo +nightly udeps --all-targets`

* ci: Add cargo-udeps
the badge image has been incorrect and not reflective of CI status since august 2023 (9c877ce).
* prost-build: CodeGenerator::boxed method

A helper method to capture the logic of deciding whether a field
needs to be boxed. This follows the pattern with other methods like
`optional`, and will allow reusing the logic in the upcoming builder
codegen.

* prost-build: more reuse with CodeGenerator::boxed

The bit in CodeGenerator::append_oneof was pretty much the same,
except the configuration is looked up for the oneof name.

Rearrange the logic so that intermediate values are bound when needed.
If a repeated fields is configured to be boxed, a deprecation warning
will be emitted by the build script.

* prost-build: document CodeGenerator::boxed

* prost-build: only emit warning on repeated fields

Co-authored-by: Casper Meijn <casper@meijn.net>

---------

Co-authored-by: Casper Meijn <casper@meijn.net>
* fix #1001 and add tests

* add alloc:: imports

* rewrite write_includes to allow for empty modules.

* create test fixture for `write_includes`

* fix lints, remove line feeds

* fixes after merge master

* remove some duplicate tests and alter existing ones to test write_includes

* more test

* module.rs Module::starts_with visibility
_PROST!_ is a [Protocol Buffers](https://developers.google.com/protocol-buffers/) implementation for the [Rust Language](https://www.rust-lang.org/). `prost` generates simple, idiomatic Rust code from `proto2` and `proto3` files.

This patch update brings new fixes:

- fix: include_file should handle proto without package (#1002)
- Place Config::format behind the format feature flag
- Handle keyword `Self` after stripping enum type prefix (#998)

## Documentation
- fix(readme): fix the link and badge for CI (#1049)

## Internal
- style(codegen): `Syntax` to a separate file (#1029)
- chore(codegen): extract c string escaping to a separate file (#1028)
- style(prost-build): `CodeGenerator::boxed` method (#1019)
- style(prost-build): Consolidate field data into struct (#1017)
- style(prost-build): `BytesType and MapType` into a `collections` module. (#1030)
- style(prost-build): Split `Config` and `Module` into a separate module and files (#1020)
- style(prost-build): prost_path helper (#1018)
- style: Fix toml indent (#1048)
- style: Fix clippy warnings and enable clippy in CI (#1008)
- build: Use git submodule to download protobuf sources (#1014)
- ci: Add TOML validation with `taplo` (#1034)
- tests: Create a separate tempdir for each test (#1044)
- tests: Remove GoogleMessage3 and GoogleMessage4 benchmarks (#1037)
- chore: Update internal crates to Rust edition 2021 (#1039)
- chore: Update crate descriptions (#1038)
- chore: Fix clippy checks in CI (#1032)
- chore: Add Casper Meijn as author (#1025)
The release of version 0.12.5 is blocked because of a build error of the packed crate. prost/src/lib.rs refers to a README file that is outside of the published crate.

Duplicate the main README into the prost crate to unblock the release
…_from_env` & `protoc_include_from_env` (#1063)

fixes: #1062

I'm adding to fix a breaking change introduced in #1020
which moved these items.

Since `0.12.5` this is causing build failures after `cargo update`.

```
   Compiling grpc-build v6.1.0
error[E0432]: unresolved imports `prost_build::protoc_from_env`, `prost_build::protoc_include_from_env`
 --> /Users/ethan.brierley/.cargo/registry/src/index.crates.io-6f17d22bba15001f/grpc-build-6.1.0/src/lib.rs:3:19
  |
3 | use prost_build::{protoc_from_env, protoc_include_from_env, Module};
  |                   ^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^ no `protoc_include_from_env` in the root
  |                   |
  |                   no `protoc_from_env` in the root
```
_PROST!_ is a [Protocol Buffers](https://developers.google.com/protocol-buffers/) implementation for the [Rust Language](https://www.rust-lang.org/). `prost` generates simple, idiomatic Rust code from `proto2` and `proto3` files.

This patch update fixes a regression:

- fix(prost-build): re-export `error_message_protoc_not_found`, `protoc_from_env` & `protoc_include_from_env` (#1063)
* feat: derive Copy trait for messages where possible

Rust primitive types can be copied by simply copying the bits. Rust structs can also have this property by deriving the Copy trait.

Automatically derive Copy for:
- messages that only have fields with primitive types
- the Rust enum for one-of fields
- messages whose field type are messages that also implement Copy

Generated code for Protobuf enums already derives Copy.

* fix: Remove clone call when copy is implemented

Clippy reports: warning: using `clone` on type `Timestamp` which implements the `Copy` trait
shizzard and others added 15 commits May 20, 2024 16:42
* Change generated functions signatures to remove type parameters; fixes #1042

* Add test to confirm no type shadowing

* Change generated functions signatures to remove type parameters (rest of ::prost::Message trait)

* Change functions signatures to avoid generic type parameters
Due to two pull requests changing the same function a build error occurred. `fields` has move to inside `oneof` and has changed type.
Instead of rebuilding everything with Rust 1.70 (MSRV), use `cargo hack` to only build published crates at their specified `rust-version`.

Co-authored-by: tottoto <tottotodev@gmail.com>
Add a job that only finished if all tests pass. This will be configured as a required test to make sure all jobs pass on every commit.
Updates the requirements on [env_logger](https://github.com/rust-cli/env_logger) to permit the latest version.
- [Release notes](https://github.com/rust-cli/env_logger/releases)
- [Changelog](https://github.com/rust-cli/env_logger/blob/main/CHANGELOG.md)
- [Commits](rust-cli/env_logger@v0.10.0...v0.11.3)

---
updated-dependencies:
- dependency-name: env_logger
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updates the requirements on [criterion](https://github.com/bheisler/criterion.rs) to permit the latest version.
- [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md)
- [Commits](bheisler/criterion.rs@0.4.0...0.5.1)

---
updated-dependencies:
- dependency-name: criterion
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…rrs (#951)

* better checking of tag duplicates, avoid discarding invalid variant errors

* add some simple derive tests :)

* use itertools duplicates()

* don't print out unreadable syn junk when encountering unknown attributes

* clarify and test backstop for the "multiple tags in a oneof variant" condition

* use expect_err

* nicer framing around the unknown attribute tokens

* express higher minimal versions of itertools and proc-macro2 for cargo hack check

* simplify bounds for proc-macro2

Co-authored-by: Casper Meijn <casper@meijn.net>

* update the other instance of the .tuple_windows() trick to use .duplicates()

* clarify & shorten assertion

---------

Co-authored-by: Casper Meijn <casper@meijn.net>
The release scripts were broken by moving `prost` crate into a separated directory in #1033.

fixes #1054
Add a new UnknownEnumValue error type to prost,
change the TryFrom<i32> conversions generated for enums to use that
as the associated Error type. The error value carries the original
integer, making it also more informative than DecodeError.
libz-sys is a optional dependency of a private crate that is never enabled.
* ci: Ensure both README are the same and prost version is correct

Fixes #1053

* docs: Update prost version in README

* build: Fix prepare-release.sh for README
* docs: Fix broken link warnings

* ci: Check for documentation warnings
* chore: remove `Cargo.toml` `documentation` field

* chore: use cargo manifest  `workspace.package.authors`

* chore: use cargo manifest  `workspace.package.repository`

* chore: use cargo manifest  `workspace.package.license`

* chore: use cargo manifest  `workspace.package.rust-version`

* chore: use cargo manifest  `workspace.package.edition`:

* chore: use cargo manifest  `workspace.package.version`

* chore: group cargo workspace package metadata usage

* chore: use `workspace.edition` for remaining 2021 edition crates
Most generated files are untouched when the contents doesn't change. Use the same mechanism for include file as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
9 participants