Commit Graph

334 Commits

Author SHA1 Message Date
Jeffrey Griffin
9c5d46e72a add std feature for no-std compatibility 2020-01-17 14:57:06 -08:00
Dan Burkert
9ec3614580 release 0.6.1 2020-01-16 09:29:57 -08:00
Dan Burkert
04091d3e74 apply recursion limit when skipping fields
Fixes #267
2020-01-16 09:29:05 -08:00
koushiro
221ebbf5e6 Update outdated dependencies
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2020-01-16 08:38:03 -08:00
Dan Burkert
a8ed170657 publish script bugfixes 2020-01-12 17:13:58 -08:00
Dan Burkert
4b1914fe68 release 0.6.0 2020-01-12 16:20:26 -08:00
Dan Burkert
6cc470208e Add prepare-release.sh, publish-release.sh scripts
Automates preparing and publishing a new release of the prost crates.
2020-01-12 16:19:49 -08:00
Dan Burkert
420e032fe7 Reintroduce unsafe in encoding::string::merge
3ab36fda9a1788e0 introduced a ~3% regression on some decoding
benchmarks. My best guess is that swapping the value temporarily with a
new string is not being optimized well. This commit reverts to using
String::as_mut_vec, but carefully clears the string on decode failure.
It also fixes up the associated regression test, which wasn't properly
covering the malformed UTF-8 case.

    // Before #194
    dataset/google_message3_2/decode
                            time:   [219.45 ms 219.48 ms 219.51 ms]
                            thrpt:  [458.64 MiB/s 458.72 MiB/s 458.78 MiB/s]

    // #194
    dataset/google_message3_2/decode
                            time:   [226.08 ms 226.11 ms 226.18 ms]
                            thrpt:  [445.12 MiB/s 445.25 MiB/s 445.32 MiB/s]

    // This commit
    dataset/google_message3_2/decode
                            time:   [219.05 ms 219.76 ms 221.78 ms]
                            thrpt:  [453.94 MiB/s 458.12 MiB/s 459.61 MiB/s]
2020-01-12 12:11:47 -08:00
Dan Burkert
51ed67d9c7 remove deprecated error description methods 2020-01-11 23:24:27 -08:00
Dan Burkert
59c11cab04
Bump packaged Protobuf to 3.11.2 (#263)
The new conformance test cases caught some edge case bugs related to
decoding messages with repeated instances of scalar strings, bytes, and
oneofs.
2020-01-11 22:23:14 -08:00
Dan Burkert
7e0070f140 More fallible Try to TryFrom conversions
This is a breaking change to `prost-types`.
2020-01-11 16:57:01 -08:00
Nicolas Polomack
20684a721a Move from failure to anyhow in prost-derive 2020-01-11 14:07:05 -08:00
Lucio Franco
ea788ba8de Remove bytes depdency requirement from the readme 2020-01-11 13:10:15 -08:00
Dan Burkert
8c0c18031f fail gracefully on missing package specifier 2020-01-11 12:22:11 -08:00
koushiro
91f4ff6f8e Use std::convert::TryFrom
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2020-01-11 11:52:46 -08:00
Tim Hutt
8c6474ea48 Don't write prost-build output if its content is unchanged
This means things like cargo-watch work better. Fixes #231.
2020-01-11 11:47:16 -08:00
Stephan Wolski
2f7602b092 fix compilation error for types named "Option" with a repeated field 2020-01-11 11:25:07 -08:00
Dan Burkert
ce5f6e5d67 rustfmt 2020-01-11 11:25:07 -08:00
Erich Gubler
5e2bc154fa Update to syn/quote/proc-macro2 1.0 2020-01-11 10:44:56 -08:00
Lucio Franco
067e259518 Update derive to not require bytes 2020-01-11 10:06:43 -08:00
Joel Gallant
8df3a14e8c Add a more detailed error message for missing package specifier 2019-12-14 11:15:39 +13:00
Dan Burkert
dfe51e94e9
bump deps (except syn/quote/proc-macro2) (#252)
* bump deps (except syn/quote/proc-macro2)

* fix throughput casts in varint benchmark
2019-12-14 11:15:15 +13:00
Jay Oster
cb79d3fc30 Add ServiceGenerator::finalize_package
Update finalize_package to provide the package name, and do not call on packages without services

Add tests for ServiceGenerator::finalize_package()
2019-12-13 19:42:58 +13:00
Lucio Franco
ece64fa021 Update to bytes 0.5 2019-12-13 18:09:52 +13:00
M@ Dunlap
b709729c89 add docstrings for generated getters and setters
improve getter/setter method docs
2019-12-13 18:02:13 +13:00
Dan Burkert
1efcabfe7b prost-derive: remove unnecessary dummy consts
They were inhibiting rustdoc from generating code for nested impl
blocks, and are no longer necessary since the new 2018 edition fully
qualified imports.
2019-12-13 13:59:31 +13:00
Dan Burkert
5c2cfe1685 bump MSRV to 1.34
miniz_oxide, a transitive dependency, forces this bump.
2019-12-13 11:14:07 +13:00
Dan Burkert
fa14e72d18 Rework benchmarks 2019-12-13 11:14:07 +13:00
lukaslueg
9551f2852e Remove byteorder-dependency (#212) 2019-08-10 11:45:32 -07:00
Luffbee
fd582a9158 fix issue#205 (#206) 2019-08-10 10:44:34 -07:00
Nick Cameron
1944c27c30 Micro-optimise decoding (#187)
* Strengthen some inlines and remove a cast

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Optimise bytes::merge by pre-allocating and using an efficient copy

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Use get_unchecked rather than indexing where it is safe to do so

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Use `Bytes::put` rather than our memcpy in `bytes::merge`

Authored by Dan Burkert <dan@danburkert.com>
2019-06-23 18:57:36 -07:00
Nick Cameron
565d3bcf23 Implement a recursion limit (#186)
* Add a recursion-limit feature

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Thread a DecodeContext through decoding

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Add recursion limit checks

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Test for recursion limit

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Document the recursion limit

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* wip

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Use a 'by value' implementation of DecodeContext

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Reviewer changes

Primarily changing the `recursion-limit` feature to `no-recursion-limit`,

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Move the DecodeContext code to keep the varint code together

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Add tests and fix docs

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Address reviewer comments

No breaking changes to the API, attributes formatted consistently.

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Apply suggestions from code review

Co-Authored-By: Dan Burkert <dan@danburkert.com>
2019-06-16 21:15:17 -07:00
Mikhail Zabaluev
5a25f27470 Fix UTF-8 unsoundness in string::merge (#194)
* Merge string value without as_mut_vec unsoundness

In case of an encoding error in string::merge, the appended string value
is left with broken UTF-8 in case of an error. The same can happen if
any of the Buf methods panics. This results in UB if the string value is used
after the error return or in unwind, respectively.

Change the implementation to truncate the string back to valid UTF-8
content in any code path that does not go through validation of the
newly appended bytes.

* Unit test for string::merge failure

Test that adding an invalid UTF-8 sequence results in an error,
and that the string is reverted to its state prior to the merge call.

* Safe reimplementation of string::merge

As suggested by Dan Burkert:
https://github.com/danburkert/prost/pull/194#discussion_r292096009

The existing string value is dropped in case of a merge failure,
but this is better than exposing an invalid value.
2019-06-10 22:40:17 -07:00
Dan Burkert
ab6af6e6b7
Fix build on CI (#191)
* test

* try building on xenial

* Add workaround for protobuf#6210

* fix typo
2019-06-07 07:21:24 -07:00
Dan Burkert
cde27565d5
Bump thirdparty included Protobuf to 3.7.1 (#189)
* Bump Protobuf to 3.7.1

* update prost-types
2019-05-27 17:55:17 -07:00
Dan Burkert
6635b3a4d4
Enable all upstream benchmarks (#188)
* enable all upstream benchmarks

This was previously blocked on group support.

* fix unused doc warnings

* do not run benchmarks on CI
2019-05-26 23:25:50 -07:00
Dan Burkert
60eac4beb7
Fix well-known-type enum field compilation error (#185)
* Fix well-known-type enum field compilation error

* fix 2015 tests
2019-05-18 18:33:37 -07:00
Dan Burkert
77eea55058 fix some group bugs 2019-05-18 15:24:52 -07:00
Dan Burkert
0c55a070d3 fix fuzzers 2019-05-18 15:24:52 -07:00
Dan Burkert
733d7a5abe Simplify groups implementation 2019-05-18 15:24:52 -07:00
Hanya
47804ad4ed Add tests for group 2019-05-18 15:24:52 -07:00
Hanya
0c0f79d733 Add group support 2019-05-18 15:24:52 -07:00
Dan Burkert
ff851fd1ab
Additional keyword ident conversion tests (#183) 2019-05-11 14:57:15 -07:00
FujiApple
f51cbb2d23 Fix for unsupported keyword raw identifiers (#180)
* fix for https://github.com/danburkert/prost/issues/179

* simplified the code
2019-05-11 13:48:50 -07:00
Dan Burkert
26adada0bd v0.5.0 2019-03-10 13:36:47 -07:00
Dan Burkert
8b2cabdd90 fix Cargo.toml issues 2019-03-10 13:36:47 -07:00
Dan Burkert
8b55157466 enforce minimum rustc version of 1.32.0 2019-03-10 12:27:10 -07:00
Dan Burkert
744cd3ed3a revert docs.rs hack
I believe docs.rs has been sufficiently updated that the workaround is
no longer necessary.
2019-03-10 12:19:38 -07:00
Dan Burkert
5b81f50245 bump syn 2019-03-09 23:16:55 -08:00
Dan Burkert
e37c11d9d0 bump dependencies 2019-03-09 23:16:55 -08:00