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

Syncnew #2

Merged
merged 29 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9dd92be
Allow file descriptor be generated without --include_source_info (#786)
dfreese Dec 20, 2022
3081a48
release 0.11.5 (#788)
LucioFranco Dec 20, 2022
14ac71e
Add message and enum attributes to prost-build (#784)
damelLP Dec 20, 2022
9e10633
chore: Prepare 0.11.6 release (#794)
LucioFranco Jan 10, 2023
b72967a
chore: Added Kani to CI. (#1) (#798)
YoshikiTakashima Jan 17, 2023
963a2cf
Added Kani documentation. (#799)
YoshikiTakashima Feb 2, 2023
c00da0b
Fix issue with negative nanos in Duration::try_from(), and add tests …
danielsn Feb 2, 2023
bff66a6
Prevent spurious overflow in check_duration_roundtrip test (#804)
danielsn Feb 2, 2023
49c33f3
Clarify `default_package_filename` documentation. (#809)
Gilnaa Feb 8, 2023
0c350dc
Bump msrv to 1.60 (#814)
LucioFranco Feb 8, 2023
db1c936
chore(types): Remove including generated code (#801)
tottoto Feb 9, 2023
6ddef5e
chore: Update github action (#815)
tottoto Feb 9, 2023
597a54b
chore: Add cargo-machete to detect unused dependencies (#817)
tottoto Feb 10, 2023
83382aa
chore: Update msrv to 1.60 (#818)
tottoto Feb 10, 2023
a21cf6b
feat: Added try_normalize to Timestamp (#796)
oliverbrowneprima Feb 13, 2023
b845e69
Update PropProof docs to note the need to submodule init (#805)
danielsn Feb 13, 2023
e895d4c
feat(build): Add direct fds compile support (#819)
LucioFranco Feb 17, 2023
cd607bb
release 0.11.7 (#821)
LucioFranco Feb 22, 2023
0f53e3d
fix: correct change in visibility of compiler module (#824)
neoeinstein Feb 24, 2023
6a02e4d
release 0.11.8 (#825)
neoeinstein Feb 24, 2023
8754050
Add existing roundtrip test to Kani CI and avoid recursive submodulin…
adpaco-aws Mar 13, 2023
34d0e2b
Update to `syn@2` & `prettyplease@0.2` (#833)
ldm0 Mar 24, 2023
a4f5992
Fix corrupted tests and missing CI testing (#832)
ldm0 Apr 3, 2023
4c378f6
chore: Update to criterion 0.4 (#835)
tottoto Apr 4, 2023
f63691b
Fix build in directory not named `prost` (#839)
3541 Apr 10, 2023
6b5516a
prost-build: support boxing fields (#802)
krallin Apr 12, 2023
1b105ca
chore: Update to baptiste0928/cargo-install@v2 (#840)
tottoto Apr 19, 2023
2037251
Fix typo in bail message (#848)
BKDaugherty Apr 19, 2023
c50f714
Merge remote-tracking branch 'upstream/master' into syncnew
Jasperav Jun 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 72 additions & 20 deletions .github/workflows/continuous-integration-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ jobs:
with:
submodules: recursive
- name: install toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
default: true
profile: minimal
components: rustfmt
- name: Install Protoc
uses: arduino/setup-protoc@v1
Expand All @@ -25,10 +22,7 @@ jobs:
- name: build b_tests
run: cargo build --package b_tests
- name: rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
run: cargo fmt --all --check
# Disabled because downstream crates don't check this as well
# minversions:
# runs-on: ubuntu-latest
Expand Down Expand Up @@ -63,13 +57,29 @@ jobs:
# args: --workspace --all-targets
# toolchain: stable

machete:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: install toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-machete
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-machete
- name: Check unused dependencies
run: cargo machete

test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
toolchain:
- stable
- 1.56.1
- "1.60"
os:
- ubuntu-latest
- macos-latest
Expand All @@ -80,29 +90,55 @@ jobs:
with:
submodules: recursive
- name: install toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
default: true
profile: minimal
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: install ninja
uses: seanmiddleditch/gha-setup-ninja@v3
- uses: Swatinem/rust-cache@v1
- uses: Swatinem/rust-cache@v2
- name: test
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --all-targets
run: cargo test --workspace --all-targets
- name: test no-default-features
uses: actions-rs/cargo@v1
run: cargo test -p prost-build -p prost-derive -p prost-types --all-targets --no-default-features
# Run doc tests separately: https://github.com/rust-lang/cargo/issues/6669
- name: test doc
run: cargo test --workspace --doc
- name: test doc
run: cargo test -p prost-build -p prost-derive -p prost-types --doc --no-default-features

kani:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: Verify with Kani
uses: model-checking/kani-github-action@0.23
with:
command: test
args: --no-default-features
enable-propproof: true
args: |
--tests -p prost-types --default-unwind 3 \
--harness "tests::check_timestamp_roundtrip_via_system_time" \
--harness "tests::check_duration_roundtrip_nanos"
# --default-unwind N roughly corresponds to how much effort
# Kani will spend trying to prove correctness of the
# program. Higher the number, more programs can be proven
# correct. However, Kani will require more time and memory. If
# Kani fails with "Failed Checks: unwinding assertion," this
# number may need to be raised for Kani to succeed.

no-std:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: install toolchain
uses: dtolnay/rust-toolchain@nightly
# no-std:
# runs-on: ubuntu-latest
# steps:
Expand All @@ -120,6 +156,22 @@ jobs:
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v2
- name: install cargo-no-std-check
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-no-std-check
- name: prost cargo-no-std-check
run: cargo no-std-check --manifest-path Cargo.toml --no-default-features
- name: prost-types cargo-no-std-check
run: cargo no-std-check --manifest-path prost-types/Cargo.toml --no-default-features
# prost-build depends on prost with --no-default-features, but when
# prost-build is built through the workspace, prost typically has default
# features enabled due to vagaries in Cargo workspace feature resolution.
# This additional check ensures that prost-build does not rely on any of
# prost's default features to compile.
- name: prost-build check
run: cargo check --manifest-path prost-build/Cargo.toml
# - uses: Swatinem/rust-cache@v1
# - name: install cargo-no-std-check
# uses: actions-rs/cargo@v1
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "prost"
version = "0.11.3"
version = "0.11.8"
authors = [
"Dan Burkert <dan@danburkert.com>",
"Lucio Franco <luciofranco14@gmail.com",
Expand All @@ -14,7 +14,7 @@ description = "A Protocol Buffers implementation for the Rust Language."
keywords = ["protobuf", "serialization"]
categories = ["encoding"]
edition = "2021"
rust-version = "1.56"
rust-version = "1.60"

[workspace]
members = [
Expand Down Expand Up @@ -49,11 +49,11 @@ std = []

[dependencies]
bytes = { version = "1", default-features = false }
prost-derive = { version = "0.11.0", path = "prost-derive", optional = true }
prost-derive = { version = "0.11.8", path = "prost-derive", optional = true }
uuid = { version = "1", features = ["v4"] }

[dev-dependencies]
criterion = "0.3"
criterion = { version = "0.4", default-features = false }
env_logger = { version = "0.8", default-features = false }
log = "0.4"
proptest = "1"
Expand Down
69 changes: 69 additions & 0 deletions KANI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Kani
This document describes how to **locally** install and use Kani, along
with its experimental PropProof feature. Because of instability in
Kani internals, the GitHub action is the recommended option if you are
running in CI.

Kani is a software verification tool that complements testing by
proving the absence of certain classes of bugs like unwrap exceptions,
overflows, and assertion failures. See the [Kani
book](https://model-checking.github.io/kani/) for a full list of
capabilities and limitations.

## Installing Kani and PropProof
- The install instructions for Kani can be [found
here](https://model-checking.github.io/kani/install-guide.html). Once
Kani is installed, you can run with `cargo kani` for projects or
`kani` for individual Rust files.
- **[UNSTABLE]** To use PropProof, first download the source code
from the Kani repository.
```bash
git clone https://github.com/model-checking/kani.git --branch features/proptest propproof
cd propproof; git submodule update --init
```

Then, use `.cargo/config.toml` enable it in the local directory you
want to run Kani in. This will override the `proptest` import in
your repo.

```bash
cd $YOUR_REPO_LOCAL_PATH
mkdir '.cargo'
echo "paths =[\"$PATH_TO_PROPPROOF\"]" > .cargo/config.toml
```

**Please Note**:
- `features/proptest` branch under Kani is likely not the final
location for this code. If these instructions stop working, please
consult the Kani documentation and file an issue on [the Kani
repo](https://github.com/model-checking/kani.git).
- The cargo config file will force cargo to always use PropProof. To
use `proptest`, delete the file.

## Running Kani
After installing Kani and PropProof, `cargo kani --tests` should
automatically run `proptest!` harnesses inside your crate. Use
`--harness` to run a specific harness, and `-p` for a specific
sub-crate.

If Kani returns with an error, you can use the concrete playback
feature using `--enable-unstable --concrete-playback print` and paste
in the code to your repository. Running this harness with `cargo test`
will replay the input found by Kani that produced this crash. Please
note that this feature is unstable and using `--concrete-playback
inplace` to automatically inject a replay harness is not supported
when using PropProof.

## Debugging CI Failure
```yaml
- name: Verify with Kani
uses: model-checking/kani-github-action@v0.xx
with:
enable-propproof: true
args: |
$KANI_ARGUMENTS
```

The above GitHub CI workflow is equivalent to `cargo kani
$KANI_ARGUMENTS` with PropProof installed. To replicate issues
locally, run `cargo kani` with the same arguments.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ First, add `prost` and its public dependencies to your `Cargo.toml`:

```ignore
[dependencies]
prost = "0.10"
prost = "0.11"
# Only necessary if using Protobuf well-known types:
prost-types = "0.10"
prost-types = "0.11"
```

The recommended way to add `.proto` compilation to a Cargo project is to use the
Expand All @@ -44,7 +44,7 @@ start-to-finish example.

### MSRV

`prost` follows the `tokio-rs` projects MSRV model and supports 1.56+. For more
`prost` follows the `tokio-rs` projects MSRV model and supports 1.60. For more
information on the tokio msrv policy you can check it out [here][tokio msrv]

[tokio msrv]: https://github.com/tokio-rs/tokio/#supported-rust-versions
Expand Down
1 change: 0 additions & 1 deletion conformance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ edition = "2018"
[dependencies]
bytes = "1"
env_logger = { version = "0.8", default-features = false }
log = "0.4"
prost = { path = ".." }
protobuf = { path = "../protobuf" }
tests = { path = "../tests" }
13 changes: 6 additions & 7 deletions prost-build/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "prost-build"
version = "0.11.4"
version = "0.11.8"
authors = [
"Dan Burkert <dan@danburkert.com>",
"Lucio Franco <luciofranco14@gmail.com>",
Expand All @@ -12,7 +12,7 @@ documentation = "https://docs.rs/prost-build"
readme = "README.md"
description = "A Protocol Buffers implementation for the Rust Language."
edition = "2021"
rust-version = "1.56"
rust-version = "1.60"

[features]
default = ["format"]
Expand All @@ -27,20 +27,19 @@ itertools = { version = "0.10", default-features = false, features = ["use_alloc
log = "0.4"
multimap = { version = "0.8", default-features = false }
petgraph = { version = "0.6", default-features = false }
prost = { version = "0.11.0", path = "..", default-features = false }
prost-types = { version = "0.11.0", path = "../prost-types", default-features = false }
prost = { version = "0.11.8", path = "..", default-features = false }
prost-types = { version = "0.11.8", path = "../prost-types", default-features = false }
tempfile = "3"
lazy_static = "1.4.0"
regex = { version = "1.5.5", default-features = false, features = ["std", "unicode-bool"] }
which = "4"

prettyplease = { version = "0.1", optional = true }
syn = { version = "1", features = ["full"], optional = true }
prettyplease = { version = "0.2", optional = true }
syn = { version = "2", features = ["full"], optional = true }

# These two must be kept in sync, used for `cleanup-markdown` feature.
pulldown-cmark = { version = "0.9.1", optional = true, default-features = false }
pulldown-cmark-to-cmark = { version = "10.0.1", optional = true }

[dev-dependencies]
env_logger = { version = "0.8", default-features = false }

2 changes: 1 addition & 1 deletion prost-build/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use pulldown_cmark::{CodeBlockKind, Event, Options, Parser, Tag};
use regex::Regex;

/// Comments on a Protobuf item.
#[derive(Debug, Clone)]
#[derive(Debug, Default, Clone)]
pub struct Comments {
/// Leading detached blocks of comments.
pub leading_detached: Vec<Vec<String>>,
Expand Down
Loading