Skip to content

Commit 363000b

Browse files
convex-renovate-runner[bot]Convex, Inc.
authored and
Convex, Inc.
committed
Update Rust crate derive_more to v2 (#36071)
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [derive_more](https://redirect.github.com/JelteF/derive_more) | workspace.dependencies | major | `0.99` -> `2.0` | --- ### Release Notes <details> <summary>JelteF/derive_more (derive_more)</summary> ### [`v2.0.1`](https://redirect.github.com/JelteF/derive_more/blob/HEAD/CHANGELOG.md#201---2025-02-03) [Compare Source](https://redirect.github.com/JelteF/derive_more/compare/v2.0.0...v2.0.1) ##### Added - Add crate metadata for the Rust Playground. This makes sure that the Rust Playground will have all `derive_more` features available once [`selectors`](https://docs.rs/selectors/latest/selectors) crate updates its `derive_more` version. ([#&#8203;445](https://redirect.github.com/JelteF/derive_more/pull/445)) ### [`v2.0.0`](https://redirect.github.com/JelteF/derive_more/blob/HEAD/CHANGELOG.md#200---2025-02-03) [Compare Source](https://redirect.github.com/JelteF/derive_more/compare/v1.0.0...v2.0.0) ##### Breaking changes - `use derive_more::SomeTrait` now imports macro only. Importing macro with its trait along is possible now via `use derive_more::with_trait::SomeTrait`. ([#&#8203;406](https://redirect.github.com/JelteF/derive_more/pull/406)) - Top-level `#[display("...")]` attribute on an enum now has defaulting behavior instead of replacing when no wrapping is possible (no `_variant` placeholder). ([#&#8203;395](https://redirect.github.com/JelteF/derive_more/pull/395)) ##### Fixed - Associated types of type parameters not being treated as generics in `Debug` and `Display` expansions. ([#&#8203;399](https://redirect.github.com/JelteF/derive_more/pull/399)) - `unreachable_code` warnings on generated code when `!` (never type) is used. ([#&#8203;404](https://redirect.github.com/JelteF/derive_more/pull/404)) - Ambiguous associated item error when deriving `TryFrom`, `TryInto` or `FromStr` with an associated item called `Error` or `Err` respectively. ([#&#8203;410](https://redirect.github.com/JelteF/derive_more/pull/410)) - Top-level `#[display("...")]` attribute on an enum being incorrectly treated as transparent or wrapping. ([#&#8203;395](https://redirect.github.com/JelteF/derive_more/pull/395)) - Omitted raw identifiers in `Debug` and `Display` expansions. ([#&#8203;431](https://redirect.github.com/JelteF/derive_more/pull/431)) - Incorrect rendering of raw identifiers as field names in `Debug` expansions. ([#&#8203;431](https://redirect.github.com/JelteF/derive_more/pull/431)) - Top-level `#[display("...")]` attribute on an enum not working transparently for directly specified fields. ([#&#8203;438](https://redirect.github.com/JelteF/derive_more/pull/438)) - Incorrect dereferencing of unsized fields in `Debug` and `Display` expansions. ([#&#8203;440](https://redirect.github.com/JelteF/derive_more/pull/440)) ### [`v1.0.0`](https://redirect.github.com/JelteF/derive_more/blob/HEAD/CHANGELOG.md#100---2024-08-07) [Compare Source](https://redirect.github.com/JelteF/derive_more/compare/v0.99.19...v1.0.0) More than 8 years after the first commit and almost 5 years after the 0.99.0 release, `derive_more` has finally reached its 1.0.0 release. This release contains a lot of changes (including some breaking ones) to make it easier to use the derives and make it possible to extend them without having to break backwards compatibility again. There are five major changes that I would like to call out, but there are many more changes that are documented below: 1. There is a new `Debug` derive that can be used to easily customize `Debug` formatting. 2. A greatly improved `Display` derive, which allows you to do anything that [`thiserror`](https://redirect.github.com/dtolnay/thiserror) provides, but it works for any type not just errors. And by combining the `Display` derive with the `Error` and `From` derives, there shouldn't really be any need to use `thiserror` anymore (if you are missing a feature/behaviour from `thiserror` please report an issue). 3. Traits that can return errors now return a type that implements `Error` when an error occurs instead of a `&'static str`. 4. When using `use derive_more::SomeTrait` the actual trait is also imported not just the derive macro. This is especially useful for `Error` and `Display` 5. The docs are now rendered on docs.rs and are much better overall. ##### Breaking changes - The minimum supported Rust version (MSRV) is now Rust 1.75. - Add the `std` feature which should be disabled in `no_std` environments. - All Cargo features, except `std`, are now disabled by default. The `full` feature can be used to get the old behavior of supporting all possible derives. - The `TryFrom`, `Add`, `Sub`, `BitAnd`, `BitOr`, `BitXor`, `Not` and `Neg` derives now return a dedicated error type instead of a `&'static str` on error. - The `FromStr` derive now uses a dedicated `FromStrError` error type instead of generating unique one each time. - The `Display` derive (and other `fmt`-like ones) now uses `#[display("...", (<expr>),*)]` syntax instead of `#[display(fmt = "...", ("<expr>"),*)]`, and `#[display(bound(<bound>))]` instead of `#[display(bound = "<bound>")]`. So without the double quotes around the expressions and bounds. - The `Debug` and `Display` derives (and other `fmt`-like ones) now transparently delegate to the inner type when `#[display("...", (<expr>),*)]` attribute is trivially substitutable with a transparent call. ([#&#8203;322](https://redirect.github.com/JelteF/derive_more/pull/322)) - The `DebugCustom` derive is renamed to just `Debug` (gated now under a separate `debug` feature), and its semantics were changed to be a superset of `std` variant of `Debug`. - The `From` derive doesn't derive `From<()>` for enum variants without any fields anymore. This feature was removed because it was considered useless in practice. - The `From` derive now uses `#[from(<types>)]` instead of `#[from(types(<types>))]` and ignores field type itself. - The `Into` derive now uses `#[into(<types>)]` instead of `#[into(types(<types>))]` and ignores field type itself. - The `Into` derive now generates separate impls for each field whenever the `#[into(...)]` attribute is applied to it. ([#&#8203;291](https://redirect.github.com/JelteF/derive_more/pull/291)) - Importing a derive macro now also imports its corresponding trait. - The `Error` derive is updated with changes to the `error_generic_member_access` unstable feature for nightly users. ([#&#8203;200](https://redirect.github.com/JelteF/derive_more/pull/200), [#&#8203;294](https://redirect.github.com/JelteF/derive_more/pull/294)) - The `as_mut` feature is removed, and the `AsMut` derive is now gated by the `as_ref` feature. ([#&#8203;295](https://redirect.github.com/JelteF/derive_more/pull/295)) - A top level `#[display("...")]` attribute on an enum now requires the usage of `{_variant}` to include the variant instead of including it at `{}`. The reason is that `{}` now references the first argument to the format string, just like in all other format strings. ([#&#8203;377](https://redirect.github.com/JelteF/derive_more/pull/377)) ##### Added - Add support captured identifiers in `Display` derives. So now you can use: `#[display(fmt = "Prefix: {field}")]` instead of needing to use `#[display(fmt = "Prefix: {}", field)]` - Add `FromStr` derive support for enums that contain variants without fields. If you pass the name of the variant to `from_str` it will create the matching variant. - Add `#[unwrap(owned, ref, ref_mut)]` attribute for the `Unwrap` derive. By using them, it is possible to derive implementations for the reference types as well. ([#&#8203;206](https://redirect.github.com/JelteF/derive_more/pull/206)) - Add `TryUnwrap` derive similar to the `Unwrap` derive. This one returns a `Result` and does not panic. ([#&#8203;206](https://redirect.github.com/JelteF/derive_more/pull/206)) - Add support for container format in `Debug` derive with the same syntax as `Display` derives. ([#&#8203;279](https://redirect.github.com/JelteF/derive_more/pull/279)) - `derive_more::derive` module exporting only macros, without traits. ([#&#8203;290](https://redirect.github.com/JelteF/derive_more/pull/290)) - Add support for specifying concrete types to `AsRef`/`AsMut` derives. ([#&#8203;298](https://redirect.github.com/JelteF/derive_more/pull/298)) - Add `TryFrom` derive for enums to convert from their discriminant. ([#&#8203;300](https://redirect.github.com/JelteF/derive_more/pull/300)) - `#[inline]` attributes to `IsVariant` and `Debug` implementations. ([#&#8203;334](https://redirect.github.com/JelteF/derive_more/pull/334) - Add `#[track_caller]` to `Add`, `Mul`, `AddAssign` and `MulAssign` derives ([#&#8203;378](https://redirect.github.com/JelteF/derive_more/pull/378) ##### Changed - The `Constructor` and `IsVariant` derives now generate `const fn` functions. - Static methods derived by `IsVariant` are now marked `#[must_use]`. ([#&#8203;350](https://redirect.github.com/JelteF/derive_more/pull/350)) - The `Unwrap` and `IsVariant` derives now generate doc comments. - `#[automatically_derived]` is now emitted from all macro expansions. This should prevent code style linters from attempting to modify the generated code. - Upgrade to `syn` 2.0. - The `Error` derive now works in nightly `no_std` environments ##### Fixed - Use a deterministic `HashSet` in all derives, this is needed for rust analyzer to work correctly. - Use `Provider` API for backtraces in `Error` derive. - Fix `Error` derive not working with `const` generics. - Support trait objects for source in Error, e.g. `Box<dyn Error + Send + 'static>` - Fix bounds on derived `IntoIterator` impls for generic structs. ([#&#8203;284](https://redirect.github.com/JelteF/derive_more/pull/284)) - Fix documentation of generated bounds in `Display` derive. ([#&#8203;297](https://redirect.github.com/JelteF/derive_more/pull/297)) - Hygiene of macro expansions in presence of custom `core` crate. ([#&#8203;327](https://redirect.github.com/JelteF/derive_more/pull/327)) - Fix documentation of generated methods in `IsVariant` derive. - Make `{field:p}` do the expected thing in format strings for `Display` and `Debug`. Also document weirdness around `Pointer` formatting when using expressions, due to field variables being references. ([#&#8203;381](https://redirect.github.com/JelteF/derive_more/pull/381)) ### [`v0.99.19`](https://redirect.github.com/JelteF/derive_more/blob/HEAD/CHANGELOG.md#09919---2025-02-03) [Compare Source](https://redirect.github.com/JelteF/derive_more/compare/v0.99.18...v0.99.19) - Add crate metadata for the Rust Playground. ### [`v0.99.18`](https://redirect.github.com/JelteF/derive_more/blob/HEAD/CHANGELOG.md#09918---2024-06-15) [Compare Source](https://redirect.github.com/JelteF/derive_more/compare/v0.99.17...v0.99.18) - Upgrade to `syn` 2.0. - The minimum supported Rust version (MSRV) is now Rust 1.65. </details> --- ### Configuration 📅 **Schedule**: Branch creation - "on the first day of the month" in timezone America/Los_Angeles, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://redirect.github.com/renovatebot/renovate). GitOrigin-RevId: 00b6b96364202d0b70cda83eda3e589736a6ca9f
1 parent 4fac55b commit 363000b

File tree

8 files changed

+121
-88
lines changed

8 files changed

+121
-88
lines changed

Cargo.lock

+30-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ctrlc = "3.4"
4545
deadpool-postgres = "^0.14.0"
4646
deno_core = "0.284.0"
4747
deno_core_icudata = "0.73.0"
48-
derive_more = "0.99"
48+
derive_more = { version = "2", features = [ "full" ] }
4949
divan = "0.1.14"
5050
dotenvy = "0.15.7"
5151
dynfmt = "0.1.5"

crates/common/src/schemas/mod.rs

+11-12
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ pub const MAX_INDEXES_PER_TABLE: usize = 64;
6363
#[derive(derive_more::Display, Debug, Clone, PartialEq)]
6464
pub enum SchemaValidationError {
6565
#[display(
66-
fmt = "Document with ID \"{id}\" in table \"{table_name}\" does not match the schema: \
67-
{validation_error}"
66+
"Document with ID \"{id}\" in table \"{table_name}\" does not match the schema: \
67+
{validation_error}"
6868
)]
6969
ExistingDocument {
7070
validation_error: ValidationError,
@@ -75,19 +75,18 @@ pub enum SchemaValidationError {
7575
// TODO: Figure out if it's possible to surface the document ID here,
7676
// this is a concurrent write condition
7777
#[display(
78-
fmt = "New document in table \"{table_name}\" does not match the schema: \
79-
{validation_error}"
78+
"New document in table \"{table_name}\" does not match the schema: {validation_error}"
8079
)]
8180
NewDocument {
8281
validation_error: ValidationError,
8382
table_name: TableName,
8483
},
8584

86-
#[display(fmt = "Failed to delete table \"{table_name}\" because it appears in the schema")]
85+
#[display("Failed to delete table \"{table_name}\" because it appears in the schema")]
8786
TableCannotBeDeleted { table_name: TableName },
8887
#[display(
89-
fmt = "Failed to delete table \"{table_name}\" because `v.id(\"{table_name}\")` appears \
90-
in the schema of table \"{table_in_schema}\""
88+
"Failed to delete table \"{table_name}\" because `v.id(\"{table_name}\")` appears in the \
89+
schema of table \"{table_in_schema}\""
9190
)]
9291
ReferencedTableCannotBeDeleted {
9392
table_in_schema: TableName,
@@ -98,18 +97,18 @@ pub enum SchemaValidationError {
9897
#[derive(derive_more::Display, Debug, Clone, PartialEq)]
9998
pub enum SchemaEnforcementError {
10099
#[display(
101-
fmt = "Failed to insert or update a document in table \"{table_name}\" because it does \
102-
not match the schema: {validation_error}"
100+
"Failed to insert or update a document in table \"{table_name}\" because it does not \
101+
match the schema: {validation_error}"
103102
)]
104103
Document {
105104
validation_error: ValidationError,
106105
table_name: TableName,
107106
},
108-
#[display(fmt = "Failed to delete table \"{table_name}\" because it appears in the schema")]
107+
#[display("Failed to delete table \"{table_name}\" because it appears in the schema")]
109108
TableCannotBeDeleted { table_name: TableName },
110109
#[display(
111-
fmt = "Failed to delete table \"{table_name}\" because `v.id(\"{table_name}\")` appears \
112-
in the schema of table \"{table_in_schema}\""
110+
"Failed to delete table \"{table_name}\" because `v.id(\"{table_name}\")` appears in the \
111+
schema of table \"{table_in_schema}\""
113112
)]
114113
ReferencedTableCannotBeDeleted {
115114
table_in_schema: TableName,

crates/common/src/schemas/validator.rs

+14-11
Original file line numberDiff line numberDiff line change
@@ -1040,8 +1040,8 @@ impl Display for FieldValidator {
10401040
#[derive(derive_more::Display, Debug, Clone, PartialEq)]
10411041
pub enum ValidationError {
10421042
#[display(
1043-
fmt = "Found ID \"{id}\" from table `{found_table_name}`, which does not match the table \
1044-
name in validator `v.id(\"{validator_table}\")`.{context}"
1043+
"Found ID \"{id}\" from table `{found_table_name}`, which does not match the table name \
1044+
in validator `v.id(\"{validator_table}\")`.{context}"
10451045
)]
10461046
TableNamesDoNotMatch {
10471047
id: DeveloperDocumentId,
@@ -1050,24 +1050,25 @@ pub enum ValidationError {
10501050
context: ValidationContext,
10511051
},
10521052
#[display(
1053-
fmt = "Found ID \"{id}\" from a system table, which does not match the table name in \
1054-
validator `v.id(\"{validator_table}\")`.{context}"
1053+
"Found ID \"{id}\" from a system table, which does not match the table name in validator \
1054+
`v.id(\"{validator_table}\")`.{context}"
10551055
)]
10561056
SystemTableReference {
10571057
id: DeveloperDocumentId,
10581058
validator_table: TableName,
10591059
context: ValidationContext,
10601060
},
1061-
#[display(fmt = "`{value}` does not match literal validator \
1062-
`v.literal({literal_validator})`.{context}")]
1061+
#[display(
1062+
"`{value}` does not match literal validator `v.literal({literal_validator})`.{context}"
1063+
)]
10631064
LiteralValuesDoNotMatch {
10641065
value: ConvexValue,
10651066
literal_validator: LiteralValidator,
10661067
context: ValidationContext,
10671068
},
10681069
#[display(
1069-
fmt = "Object is missing the required field `{field_name}`. Consider wrapping the field \
1070-
validator in `v.optional(...)` if this is expected.
1070+
"Object is missing the required field `{field_name}`. Consider wrapping the field \
1071+
validator in `v.optional(...)` if this is expected.
10711072
{context}
10721073
Object: {object}
10731074
Validator: {object_validator}"
@@ -1079,7 +1080,7 @@ Validator: {object_validator}"
10791080
context: ValidationContext,
10801081
},
10811082
#[display(
1082-
fmt = "Object contains extra field `{field_name}` that is not in the validator.
1083+
"Object contains extra field `{field_name}` that is not in the validator.
10831084
{context}
10841085
Object: {object}
10851086
Validator: {object_validator}"
@@ -1090,10 +1091,12 @@ Validator: {object_validator}"
10901091
object_validator: ObjectValidator,
10911092
context: ValidationContext,
10921093
},
1093-
#[display(fmt = "Value does not match validator.
1094+
#[display(
1095+
"Value does not match validator.
10941096
{context}
10951097
Value: {value}
1096-
Validator: {validator}")]
1098+
Validator: {validator}"
1099+
)]
10971100
NoMatch {
10981101
value: ConvexValue,
10991102
validator: Validator,

crates/common/src/types/index.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use crate::{
3535

3636
/// Descriptor for an index, e.g., "by_email".
3737
#[derive(Clone, derive_more::Deref, derive_more::Display, PartialEq, Eq, PartialOrd, Ord, Hash)]
38-
#[display(fmt = "{_0}")]
38+
#[display("{_0}")]
3939
pub struct IndexDescriptor(Cow<'static, str>);
4040

4141
impl IndexDescriptor {

crates/convex/Cargo.oss.lock

+30-21
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,12 @@ dependencies = [
163163

164164
[[package]]
165165
name = "convert_case"
166-
version = "0.4.0"
166+
version = "0.7.1"
167167
source = "registry+https://github.com/rust-lang/crates.io-index"
168-
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
168+
checksum = "bb402b8d4c85569410425650ce3eddc7d698ed96d39a73f941b08fb63082f1e7"
169+
dependencies = [
170+
"unicode-segmentation",
171+
]
169172

170173
[[package]]
171174
name = "convex"
@@ -266,15 +269,24 @@ checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb"
266269

267270
[[package]]
268271
name = "derive_more"
269-
version = "0.99.17"
272+
version = "2.0.1"
270273
source = "registry+https://github.com/rust-lang/crates.io-index"
271-
checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
274+
checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678"
275+
dependencies = [
276+
"derive_more-impl",
277+
]
278+
279+
[[package]]
280+
name = "derive_more-impl"
281+
version = "2.0.1"
282+
source = "registry+https://github.com/rust-lang/crates.io-index"
283+
checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3"
272284
dependencies = [
273285
"convert_case",
274286
"proc-macro2",
275287
"quote",
276-
"rustc_version",
277-
"syn 1.0.109",
288+
"syn 2.0.95",
289+
"unicode-xid",
278290
]
279291

280292
[[package]]
@@ -1208,15 +1220,6 @@ version = "0.1.22"
12081220
source = "registry+https://github.com/rust-lang/crates.io-index"
12091221
checksum = "d4a36c42d1873f9a77c53bde094f9664d9891bc604a45b4798fd2c389ed12e5b"
12101222

1211-
[[package]]
1212-
name = "rustc_version"
1213-
version = "0.4.0"
1214-
source = "registry+https://github.com/rust-lang/crates.io-index"
1215-
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
1216-
dependencies = [
1217-
"semver",
1218-
]
1219-
12201223
[[package]]
12211224
name = "rustix"
12221225
version = "0.38.43"
@@ -1339,12 +1342,6 @@ dependencies = [
13391342
"libc",
13401343
]
13411344

1342-
[[package]]
1343-
name = "semver"
1344-
version = "1.0.23"
1345-
source = "registry+https://github.com/rust-lang/crates.io-index"
1346-
checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
1347-
13481345
[[package]]
13491346
name = "serde"
13501347
version = "1.0.219"
@@ -1730,6 +1727,18 @@ version = "1.0.8"
17301727
source = "registry+https://github.com/rust-lang/crates.io-index"
17311728
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
17321729

1730+
[[package]]
1731+
name = "unicode-segmentation"
1732+
version = "1.12.0"
1733+
source = "registry+https://github.com/rust-lang/crates.io-index"
1734+
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
1735+
1736+
[[package]]
1737+
name = "unicode-xid"
1738+
version = "0.2.6"
1739+
source = "registry+https://github.com/rust-lang/crates.io-index"
1740+
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
1741+
17331742
[[package]]
17341743
name = "untrusted"
17351744
version = "0.9.0"

0 commit comments

Comments
 (0)