Skip to content

Skip field names v0.14.1#1

Open
h3zh1 wants to merge 52 commits intochainreactors:masterfrom
h3zh1:skip-field-names-v0.14.1
Open

Skip field names v0.14.1#1
h3zh1 wants to merge 52 commits intochainreactors:masterfrom
h3zh1:skip-field-names-v0.14.1

Conversation

@h3zh1
Copy link
Collaborator

@h3zh1 h3zh1 commented Mar 15, 2026

No description provided.

caspermeijn and others added 30 commits November 15, 2024 09:26
This test uses a invalid doctest to confirm `disable_comments` works as expected. Rename the test to what is tested.
- Use package name `custom_attributes` to ease finding related files
- Make config dependency explicit in `build.rs`
- Add oneof fields to make every `field_attribute` part of the test
The leading zeros count may perform better on many architectures
when the zero case is excluded.
Also use ilog2 as shorthand for the leading zeros trick because
it makes more clearly what we mean to get, and should be ideally
optimized by the compiler.
…18 to >=16, <=19 (tokio-rs#1195)

Updates the requirements on [pulldown-cmark-to-cmark](https://github.com/Byron/pulldown-cmark-to-cmark) to permit the latest version.
- [Release notes](https://github.com/Byron/pulldown-cmark-to-cmark/releases)
- [Changelog](https://github.com/Byron/pulldown-cmark-to-cmark/blob/main/CHANGELOG.md)
- [Commits](Byron/pulldown-cmark-to-cmark@v16.0.0...v19.0.0)

---
updated-dependencies:
- dependency-name: pulldown-cmark-to-cmark
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat(prost): Make encoding_len_varint a const fn

* feat(prost): Make key_len a const fn
- Move related tests to separate module
- Check default of `CMsgRemoteClientBroadcastHeader`
- Make config dependency explicit in `build.rs`
…19 to >=16, <=20 (tokio-rs#1206)

Updates the requirements on [pulldown-cmark-to-cmark](https://github.com/Byron/pulldown-cmark-to-cmark) to permit the latest version.
- [Release notes](https://github.com/Byron/pulldown-cmark-to-cmark/releases)
- [Changelog](https://github.com/Byron/pulldown-cmark-to-cmark/blob/main/CHANGELOG.md)
- [Commits](Byron/pulldown-cmark-to-cmark@v16.0.0...v20.0.0)

---
updated-dependencies:
- dependency-name: pulldown-cmark-to-cmark
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Add feature to derive `trait Arbitrary` for each type.
* Add a config option to avoid passing include_source_info

* Update prost-build/src/config.rs

Co-authored-by: David Barsky <me@davidbarsky.com>

* Update prost-build/src/config.rs

Co-authored-by: David Barsky <me@davidbarsky.com>

* fix fmt

---------

Co-authored-by: Lucio Franco <luciofranco14@gmail.com>
Co-authored-by: David Barsky <me@davidbarsky.com>
…10, <=0.14 (tokio-rs#1222)

Updates the requirements on [itertools](https://github.com/rust-itertools/itertools) to permit the latest version.
- [Changelog](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md)
- [Commits](rust-itertools/itertools@v0.10.1...v0.14.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Fixes clippy lints like this:
```
warning: this `map_or` is redundant
   --> prost-build/src/ast.rs:104:9
    |
104 | /         chars
105 | |             .next()
106 | |             .map_or(false, |c| c != ' ' || chars.next() == Some(' '))
    | |_____________________________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
    = note: `#[warn(clippy::unnecessary_map_or)]` on by default
```
- Move related tests to separate module
- Make config dependency explicit in `build.rs`
flake.lock hasn't been updated in 2+ years, it was still pinned to using cargo 1.63 or some very old version. Following the tutorial at https://docs.rs/prost-build/latest/prost_build/ didn't work because it would download the latest version of prost_build which requires cargo 1.71.
Updates the requirements on [petgraph](https://github.com/petgraph/petgraph) to permit the latest version.
- [Changelog](https://github.com/petgraph/petgraph/blob/master/RELEASES.rst)
- [Commits](https://github.com/petgraph/petgraph/compare/petgraph@v0.6.0...petgraph@v0.7.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updates the requirements on [rand](https://github.com/rust-random/rand) to permit the latest version.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](rust-random/rand@0.8.0...0.9.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Move related tests to separate module
- Make config dependency explicit in `build.rs`
- Move related tests to separate module
- Make config dependency explicit in `build.rs`
…to `Context` (tokio-rs#1190)

* refactor(prost-build): Context

Move global context data and logic around it from CodeGenerator
to a new Context struct. Also move the logic of can_message_derive_copy
and can_field_derive_copy from MessageGraph where it caused some
data duplication.

* chore: make CodeGenerator::generate crate-private

It was not obvious immediately from the declaration that
CodeGenerator is private to the crate.

* docs(prost-build): life of Context, CodeGenerator

Add doc comments clarifying the lifetime of `Context` and
`CodeGenerator` in the code generation process.

* refactor: CodeGenerator::config helper

* refactor: rename Context::service_generator

Rename to service_generator_mut so it's evident that we are obtaining
a mutable reference even though the Context reference is shared.

* chore: revert can_message_derive_copy behavior

Avoid behavioral changes in the Context refactoring.

* chore: revert should_disable_comments behavior

Avoid behavioral changes in the Context refactoring.

* chore: elide a lifetime in CodeGenerator impl

To please clippy.
…1239)

- Move related tests to separate module
- Make config dependency explicit in `build.rs`
Use enum getter function to compare enum values instead of `i32` values.
caspermeijn and others added 22 commits February 12, 2025 07:01
Inform `cargo` about the files and env vars used by `prost-build`. Then `cargo` can better determine when to rebuild a project.

- Emit `rerun-if-changed` for each proto file specified
- Emit `rerun-if-changed` for each include directory specified
- Emit `rerun-if-changed` if `file_descriptor_set_path` is set
- Emit `rerun-if-env-changed` for `PROTOC` and `PROTOC_INCLUDE`

https://doc.rust-lang.org/cargo/reference/build-scripts.html#rerun-if-changed

BREAKING CHANGE: Previously `cargo` assumed it had to rerun `build.rs` if any files in the project changed. `prost-build` will now emit `rerun` commands, which means only the explicitly marked files cause a rerun. If your `build.rs` is dependent on any other file paths than those given to `prost-build`, then your `build.rs` needs to emit `rerun` commands as well.
…1175)

Integer and bytes types can be compared using trait Eq. Some generated Rust structs can also have this property by deriving the Eq trait.

Automatically derive Eq and Hash for:
- messages that only have fields with integer or bytes types
- messages where all field types also implement Eq and Hash
- the Rust enum for one-of fields, where all fields implement Eq and Hash

Generated code for Protobuf enums already derives Eq and Hash.

BREAKING CHANGE: `prost-build` will automatically derive `trait Eq` and `trait Hash` for types where all field support those as well. If you manually `impl Eq` and/or `impl Hash` for generated types, then you need to remove the manual implementation. If you use `type_attribute` to `derive(Eq)` and/or `derive(Hash)`, then you need to remove those.
Repeated fields are stored in a `Vec`, and therefore they are already heap allocated.

BREAKING CHANGE: A repeated field that is manually marked as boxed was typed as `Vec<Box<T>>`. Those fields are now simply typed as `Vec<T>` to prevent double indirection. The `boxed` configuration is effectively ignored for repeated fields.
Prevents clippy warnings like:
```
warning: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator
   --> prost-build/src/code_generator.rs:473:54
    |
473 |                         .and_then(|ty| ty.split('.').last())
    |                                                      ^^^^^^ help: try: `next_back()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_ended_iterator_last
    = note: `#[warn(clippy::double_ended_iterator_last)]` on by default
```
In rust edition 2024 `gen` is a keyword.

- Prefix protobuf field name `r#gen`
- Rename variable names in our code
* harden ref mut according to edition 2024

Signed-off-by: Xinye Tao <xinye.tao@metabit-trading.com>

* address comment

Signed-off-by: Xinye Tao <xinye.tao@metabit-trading.com>

---------

Signed-off-by: Xinye Tao <xinye.tao@metabit-trading.com>
Co-authored-by: Xinye Tao <xinye.tao@metabit-trading.com>
* build(deps): update pulldown-cmark requirement from 0.12 to 0.13

Updates the requirements on [pulldown-cmark](https://github.com/raphlinus/pulldown-cmark) to permit the latest version.
- [Release notes](https://github.com/raphlinus/pulldown-cmark/releases)
- [Commits](pulldown-cmark/pulldown-cmark@v0.12.0...v0.13.0)

---
updated-dependencies:
- dependency-name: pulldown-cmark
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* build(deps): update pulldown-cmark-to-cmark requirement to 21

Updates the requirements on [pulldown-cmark-to-cmark](https://github.com/Byron/pulldown-cmark-to-cmark) to permit the latest version.
- [Release notes](https://github.com/Byron/pulldown-cmark-to-cmark/releases)
- [Changelog](https://github.com/Byron/pulldown-cmark-to-cmark/blob/main/CHANGELOG.md)
- [Commits](Byron/pulldown-cmark-to-cmark@v16.0.0...v21.0.0)

---
updated-dependencies:
- dependency-name: pulldown-cmark-to-cmark
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: jimmycathy <clonecode@outlook.com>
)

* Update dead link LICENSE in `prost-type/README.md`

* Update prost-types/README.md

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

---------

Co-authored-by: Casper Meijn <casper@meijn.net>
Temporary set workspace edition to 2024 to enable more lints in the macros. This verifies that the generated code in our macros is 2024 edition compatible.
)

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.5.0...0.6.0)

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

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

This reverts commit 7c16959.

In version 0.14.0, `prost-build` began emitting `rerun` commands. This change introduced regressions for some users—for example, those generating `protos` from an `includes` directory. These edge cases are non-trivial to address comprehensively, so version 0.14.1 reverts the emission of `rerun` commands.
For more details, see issue tokio-rs#1296.
Backport the skip_field_names feature from the skip-field-names branch
(based on v0.14.3) to v0.14.1 to support rustc 1.71.1+ environments.
This strips struct/field names from binaries for security-sensitive apps.
Also remove tests-2024 workspace member for older Cargo compatibility.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.