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

chore: Update internal crates to Rust edition 2021 #1039

Merged
merged 1 commit into from
Apr 28, 2024

Conversation

caspermeijn
Copy link
Collaborator

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.

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.
@gibbz00
Copy link
Contributor

gibbz00 commented Apr 27, 2024

Hii, two things 😊

  1. Why are we testing against old editions?

https://doc.rust-lang.org/edition-guide/editions/#editions-do-not-split-the-ecosystem

The most important rule for editions is that crates in one edition can interoperate seamlessly with crates compiled in other editions. This ensures that the decision to migrate to a newer edition is a "private one" that the crate can make without affecting others.

  1. Maybe the test-2018 addition should be made into a separate PR so that we can discuss 1) separately without blocking this one for workspace package metadata #1036

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this change should be made after #1036 and #1035.

@caspermeijn
Copy link
Collaborator Author

  1. Why are we testing against old editions?

I am not sure, but I assume this is because we generate code that must be compatible with older and newer editions. For example, in some test code is a cfg_if that adds extern crate statements for 2015 edition only.

Well, I see two options:

  1. Add the tests-2018 crate. I mostly did this because the tests-2015 crate exists. I am not sure what the added value is over just running the tests with the oldest edition.
  2. Update main tests crate to edition 2021 and don't explicitly test 2018. I am fine with that, as I think the difference between 2018 and 2021 is small enough to not cause any problems.

What do you think is best?

Copy link
Member

@LucioFranco LucioFranco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to test old editions if its easy to do and I think option 1 here makes a lot of sense to me

@gibbz00
Copy link
Contributor

gibbz00 commented Apr 28, 2024

we generate code that must be compatible with older and newer editions.

Ahh, I see. Makes perfect sense.

Also agree that it's worth testing against the 2018 edition given that it's quite easy.

@caspermeijn caspermeijn added this pull request to the merge queue Apr 28, 2024
Merged via the queue into tokio-rs:master with commit a21d90c Apr 28, 2024
13 checks passed
@caspermeijn caspermeijn deleted the edition branch April 28, 2024 17:31
caspermeijn added a commit to caspermeijn/prost that referenced this pull request May 5, 2024
_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 (tokio-rs#1002)
- Place Config::format behind the format feature flag
- Handle keyword `Self` after stripping enum type prefix (tokio-rs#998)

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

## Internal
- style(codegen): `Syntax` to a separate file (tokio-rs#1029)
- chore(codegen): extract c string escaping to a separate file (tokio-rs#1028)
- style(prost-build): `CodeGenerator::boxed` method (tokio-rs#1019)
- style(prost-build): Consolidate field data into struct (tokio-rs#1017)
- style(prost-build): `BytesType and MapType` into a `collections` module. (tokio-rs#1030)
- style(prost-build): Split `Config` and `Module` into a separate module and files (tokio-rs#1020)
- style(prost-build): prost_path helper (tokio-rs#1018)
- style: Fix toml indent (tokio-rs#1048)
- style: Fix clippy warnings and enable clippy in CI (tokio-rs#1008)
- build: Use git submodule to download protobuf sources (tokio-rs#1014)
- ci: Add TOML validation with `taplo` (tokio-rs#1034)
- tests: Create a separate tempdir for each test (tokio-rs#1044)
- tests: Remove GoogleMessage3 and GoogleMessage4 benchmarks (tokio-rs#1037)
- chore: Update internal crates to Rust edition 2021 (tokio-rs#1039)
- chore: Update crate descriptions (tokio-rs#1038)
- chore: Fix clippy checks in CI (tokio-rs#1032)
- chore: Add Casper Meijn as author (tokio-rs#1025)
github-merge-queue bot pushed a commit that referenced this pull request May 8, 2024
_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)
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.

3 participants