Debian Codegraph @

debian/missing-sources/derive_more/CHANGELOG.md

raw symbols SCIP
1 # Changelog
2
3 All notable changes to this project will be documented in this file.
4
5 The format is based on [Keep a Changelog](http://keepachangelog.com/)
6 and this project adheres to [Semantic Versioning](http://semver.org/).
7
8 ## 2.1.1 - 2025-12-22
9
10 ### Fixed
11
12 - `.as_dyn_error()` method hygiene inside `Error` derive expansion.
13 ([#527](https://github.com/JelteF/derive_more/pull/527))
14
15 ## 2.1.0 - 2025-12-02
16
17 ### Added
18
19 - Support `#[display(rename_all = "<casing>")]` attribute to change output for
20 implicit naming of unit enum variants or unit structs when deriving `Display`.
21 ([#443](https://github.com/JelteF/derive_more/pull/443))
22 - Support `#[from_str(rename_all = "<casing>")]` attribute for unit enum variants
23 and unit structs when deriving `FromStr`.
24 ([#467](https://github.com/JelteF/derive_more/pull/467))
25 - Support `Option` fields for `Error::source()` in `Error` derive.
26 ([#459](https://github.com/JelteF/derive_more/pull/459))
27 - Support structs with no fields in `FromStr` derive.
28 ([#469](https://github.com/JelteF/derive_more/pull/469))
29 - Add `PartialEq` derive similar to `std`'s one, but considering generics correctly,
30 and implementing `ne()` method as well.
31 ([#473](https://github.com/JelteF/derive_more/pull/473),
32 [#475](https://github.com/JelteF/derive_more/pull/475))
33 - Add `Eq` derive similar to `std`'s one, but considering generics correctly.
34 ([#479](https://github.com/JelteF/derive_more/pull/479))
35 - Proxy-pass `#[allow]`/`#[expect]` attributes of the type in `Constructor` derive.
36 ([#477](https://github.com/JelteF/derive_more/pull/477))
37 - Support `Deref` and `DerefMut` derives for enums.
38 ([#485](https://github.com/JelteF/derive_more/pull/485))
39 - Support custom error in `FromStr` derive.
40 ([#494](https://github.com/JelteF/derive_more/pull/494))
41 - Support custom error in `TryInto` derive.
42 ([#503](https://github.com/JelteF/derive_more/pull/503))
43 - Support skipping fields in `Add`-like, `AddAssign`-like, `Mul`-like and
44 `MulAssign`-like derives.
45 ([#472](https://github.com/JelteF/derive_more/pull/472))
46
47 ### Changed
48
49 - The minimum supported Rust version (MSRV) is now Rust 1.81.
50 ([#466](https://github.com/JelteF/derive_more/pull/466))
51 - `Add`-like, `AddAssign`-like, `Mul`-like and `MulAssign`-like derives now
52 infer trait bounds for generics structurally (bound field types instead of
53 type parameters directly).
54 ([#472](https://github.com/JelteF/derive_more/pull/472))
55
56 ### Fixed
57
58 - Suppress deprecation warnings in generated code.
59 ([#454](https://github.com/JelteF/derive_more/pull/454))
60 - Silent no-op when `#[try_from(repr)]` attribute is not specified for `TryFrom` derive.
61 ([#458](https://github.com/JelteF/derive_more/pull/458))
62 - Missing trait bounds in `AsRef`/`AsMut` derives when associative types are involved.
63 ([#474](https://github.com/JelteF/derive_more/pull/474))
64 - Erroneous code generated in `Try`/`TryInto` derives when `Self` type is present in
65 the struct or enum definition.
66 ([#489](https://github.com/JelteF/derive_more/pull/489))
67 - Dependency on unstable `feature(error_generic_member_access)` in `Error` derive when
68 using `Backtrace` on a non-nightly toolchain.
69 ([#513](https://github.com/JelteF/derive_more/pull/513))
70 - Broken support for `#[<display-trait>("default formatting")]` attribute without `{_variant}`
71 being used as default for enum variants without explicit formatting.
72 ([#495](https://github.com/JelteF/derive_more/pull/495))
73
74 ## 2.0.1 - 2025-02-03
75
76 ### Added
77
78 - Add crate metadata for the Rust Playground. This makes sure that the Rust
79 Playground will have all `derive_more` features available once
80 [`selectors`](https://docs.rs/selectors/latest/selectors) crate updates its
81 `derive_more` version.
82 ([#445](https://github.com/JelteF/derive_more/pull/445))
83
84 ## 2.0.0 - 2025-02-03
85
86 ### Breaking changes
87
88 - `use derive_more::SomeTrait` now imports macro only. Importing macro with
89 its trait along is possible now via `use derive_more::with_trait::SomeTrait`.
90 ([#406](https://github.com/JelteF/derive_more/pull/406))
91 - Top-level `#[display("...")]` attribute on an enum now has defaulting behavior
92 instead of replacing when no wrapping is possible (no `_variant` placeholder).
93 ([#395](https://github.com/JelteF/derive_more/pull/395))
94
95 ### Fixed
96
97 - Associated types of type parameters not being treated as generics in `Debug`
98 and `Display` expansions.
99 ([#399](https://github.com/JelteF/derive_more/pull/399))
100 - `unreachable_code` warnings on generated code when `!` (never type) is used.
101 ([#404](https://github.com/JelteF/derive_more/pull/404))
102 - Ambiguous associated item error when deriving `TryFrom`, `TryInto` or `FromStr`
103 with an associated item called `Error` or `Err` respectively.
104 ([#410](https://github.com/JelteF/derive_more/pull/410))
105 - Top-level `#[display("...")]` attribute on an enum being incorrectly treated
106 as transparent or wrapping.
107 ([#395](https://github.com/JelteF/derive_more/pull/395))
108 - Omitted raw identifiers in `Debug` and `Display` expansions.
109 ([#431](https://github.com/JelteF/derive_more/pull/431))
110 - Incorrect rendering of raw identifiers as field names in `Debug` expansions.
111 ([#431](https://github.com/JelteF/derive_more/pull/431))
112 - Top-level `#[display("...")]` attribute on an enum not working transparently
113 for directly specified fields.
114 ([#438](https://github.com/JelteF/derive_more/pull/438))
115 - Incorrect dereferencing of unsized fields in `Debug` and `Display` expansions.
116 ([#440](https://github.com/JelteF/derive_more/pull/440))
117
118 ## 0.99.19 - 2025-02-03
119
120 - Add crate metadata for the Rust Playground.
121
122 ## 1.0.0 - 2024-08-07
123
124 More than 8 years after the first commit and almost 5 years after the 0.99.0
125 release, `derive_more` has finally reached its 1.0.0 release. This release
126 contains a lot of changes (including some breaking ones) to make it easier to
127 use the derives and make it possible to extend them without having to break
128 backwards compatibility again. There are five major changes that I would like
129 to call out, but there are many more changes that are documented below:
130 1. There is a new `Debug` derive that can be used to easily customize `Debug`
131 formatting.
132 2. A greatly improved `Display` derive, which allows you to do anything that
133 [`thiserror`](https://github.com/dtolnay/thiserror) provides, but it works
134 for any type not just errors. And by combining the `Display` derive with the
135 `Error` and `From` derives, there shouldn't really be any need to use
136 `thiserror` anymore (if you are missing a feature/behaviour from `thiserror`
137 please report an issue).
138 3. Traits that can return errors now return a type that implements `Error`
139 when an error occurs instead of a `&'static str`.
140 4. When using `use derive_more::SomeTrait` the actual trait is also imported
141 not just the derive macro. This is especially useful for `Error` and
142 `Display`
143 5. The docs are now rendered on docs.rs and are much better overall.
144
145
146 ### Breaking changes
147
148 - The minimum supported Rust version (MSRV) is now Rust 1.75.
149 - Add the `std` feature which should be disabled in `no_std` environments.
150 - All Cargo features, except `std`, are now disabled by default. The `full`
151 feature can be used to get the old behavior of supporting all possible
152 derives.
153 - The `TryFrom`, `Add`, `Sub`, `BitAnd`, `BitOr`, `BitXor`, `Not` and `Neg`
154 derives now return a dedicated error type instead of a `&'static str` on
155 error.
156 - The `FromStr` derive now uses a dedicated `FromStrError` error type instead
157 of generating unique one each time.
158 - The `Display` derive (and other `fmt`-like ones) now uses
159 `#[display("...", (<expr>),*)]` syntax instead of
160 `#[display(fmt = "...", ("<expr>"),*)]`, and `#[display(bound(<bound>))]`
161 instead of `#[display(bound = "<bound>")]`. So without the double quotes
162 around the expressions and bounds.
163 - The `Debug` and `Display` derives (and other `fmt`-like ones) now transparently
164 delegate to the inner type when `#[display("...", (<expr>),*)]` attribute is
165 trivially substitutable with a transparent call.
166 ([#322](https://github.com/JelteF/derive_more/pull/322))
167 - The `DebugCustom` derive is renamed to just `Debug` (gated now under a separate
168 `debug` feature), and its semantics were changed to be a superset of `std` variant
169 of `Debug`.
170 - The `From` derive doesn't derive `From<()>` for enum variants without any
171 fields anymore. This feature was removed because it was considered useless in
172 practice.
173 - The `From` derive now uses `#[from(<types>)]` instead of `#[from(types(<types>))]`
174 and ignores field type itself.
175 - The `Into` derive now uses `#[into(<types>)]` instead of `#[into(types(<types>))]`
176 and ignores field type itself.
177 - The `Into` derive now generates separate impls for each field whenever the `#[into(...)]`
178 attribute is applied to it. ([#291](https://github.com/JelteF/derive_more/pull/291))
179 - Importing a derive macro now also imports its corresponding trait.
180 - The `Error` derive is updated with changes to the `error_generic_member_access`
181 unstable feature for nightly users. ([#200](https://github.com/JelteF/derive_more/pull/200),
182 [#294](https://github.com/JelteF/derive_more/pull/294))
183 - The `as_mut` feature is removed, and the `AsMut` derive is now gated by the
184 `as_ref` feature. ([#295](https://github.com/JelteF/derive_more/pull/295))
185 - A top level `#[display("...")]` attribute on an enum now requires the usage
186 of `{_variant}` to include the variant instead of including it at `{}`. The
187 reason is that `{}` now references the first argument to the format string,
188 just like in all other format strings. ([#377](https://github.com/JelteF/derive_more/pull/377))
189
190 ### Added
191
192 - Add support captured identifiers in `Display` derives. So now you can use:
193 `#[display(fmt = "Prefix: {field}")]` instead of needing to use
194 `#[display(fmt = "Prefix: {}", field)]`
195 - Add `FromStr` derive support for enums that contain variants without fields.
196 If you pass the name of the variant to `from_str` it will create the matching
197 variant.
198 - Add `#[unwrap(owned, ref, ref_mut)]` attribute for the `Unwrap` derive.
199 By using them, it is possible to derive implementations for the reference types as well.
200 ([#206](https://github.com/JelteF/derive_more/pull/206))
201 - Add `TryUnwrap` derive similar to the `Unwrap` derive. This one returns a `Result` and does not panic.
202 ([#206](https://github.com/JelteF/derive_more/pull/206))
203 - Add support for container format in `Debug` derive with the same syntax as `Display` derives.
204 ([#279](https://github.com/JelteF/derive_more/pull/279))
205 - `derive_more::derive` module exporting only macros, without traits.
206 ([#290](https://github.com/JelteF/derive_more/pull/290))
207 - Add support for specifying concrete types to `AsRef`/`AsMut` derives.
208 ([#298](https://github.com/JelteF/derive_more/pull/298))
209 - Add `TryFrom` derive for enums to convert from their discriminant.
210 ([#300](https://github.com/JelteF/derive_more/pull/300))
211 - `#[inline]` attributes to `IsVariant` and `Debug` implementations.
212 ([#334](https://github.com/JelteF/derive_more/pull/334)
213 - Add `#[track_caller]` to `Add`, `Mul`, `AddAssign` and `MulAssign` derives
214 ([#378](https://github.com/JelteF/derive_more/pull/378)
215
216
217 ### Changed
218
219 - The `Constructor` and `IsVariant` derives now generate `const fn` functions.
220 - Static methods derived by `IsVariant` are now marked `#[must_use]`.
221 ([#350](https://github.com/JelteF/derive_more/pull/350))
222 - The `Unwrap` and `IsVariant` derives now generate doc comments.
223 - `#[automatically_derived]` is now emitted from all macro expansions. This
224 should prevent code style linters from attempting to modify the generated
225 code.
226 - Upgrade to `syn` 2.0.
227 - The `Error` derive now works in nightly `no_std` environments
228
229 ### Fixed
230
231 - Use a deterministic `HashSet` in all derives, this is needed for rust analyzer
232 to work correctly.
233 - Use `Provider` API for backtraces in `Error` derive.
234 - Fix `Error` derive not working with `const` generics.
235 - Support trait objects for source in Error, e.g.
236 `Box<dyn Error + Send + 'static>`
237 - Fix bounds on derived `IntoIterator` impls for generic structs.
238 ([#284](https://github.com/JelteF/derive_more/pull/284))
239 - Fix documentation of generated bounds in `Display` derive.
240 ([#297](https://github.com/JelteF/derive_more/pull/297))
241 - Hygiene of macro expansions in presence of custom `core` crate.
242 ([#327](https://github.com/JelteF/derive_more/pull/327))
243 - Fix documentation of generated methods in `IsVariant` derive.
244 - Make `{field:p}` do the expected thing in format strings for `Display` and
245 `Debug`. Also document weirdness around `Pointer` formatting when using
246 expressions, due to field variables being references.
247 ([#381](https://github.com/JelteF/derive_more/pull/381))
248
249 ## 0.99.18 - 2024-06-15
250
251 - Upgrade to `syn` 2.0.
252 - The minimum supported Rust version (MSRV) is now Rust 1.65.
253
254 ## 0.99.10 - 2020-09-11
255
256 ### Added
257
258 - `From` supports additional types for conversion: `#[from(types(u8, u16))]`.
259
260
261 ## 0.99.7 - 2020-05-16
262
263 ### Changed
264
265 - When specifying specific features of the crate to only enable specific
266 derives, the `extra-traits` feature of `syn` is not always enabled
267 when those the specified features do not require it. This should speed up
268 compile time of `syn` when this feature is not needed.
269
270 ### Fixed
271
272 - Fix generic derives for `MulAssign`
273
274 ## 0.99.6 - 2020-05-13
275
276 ### Changed
277
278 - Make sure output of derives is deterministic, for better support in
279 rust-analyzer
280
281
282 ## 0.99.5 - 2020-03-28
283
284 ### Added
285
286 - Support for deriving `Error`!!! (many thanks to @ffuugoo and @tyranron)
287
288 ### Fixed
289
290 - Fix generic bounds for `Deref` and `DerefMut` with `forward`, i.e. put `Deref`
291 bound on whole type, so on `where Box<T>: Deref` instead of on `T: Deref`.
292 ([#107](https://github.com/JelteF/derive_more/issues/114))
293
294 - The `tests` directory is now correctly included in the crate (requested by
295 Debian package maintainers)
296
297 ## 0.99.4 - 2020-03-28 [YANKED]
298
299 Note: This version is yanked, because quickly after release it was found out
300 tests did not run in CI.
301
302 ## 0.99.3 - 2020-02-19
303
304 ### Fixed
305
306 - Fix generic bounds for `Deref` and `DerefMut` with no `forward`, i.e. no bounds
307 are necessary. ([#107](https://github.com/JelteF/derive_more/issues/114))
308
309
310 ## 0.99.2 - 2019-11-17
311
312 ### Fixed
313
314 - Hotfix for a regression in allowed `Display` derives using `#` flag, such as
315 `{:#b}` ([#107](https://github.com/JelteF/derive_more/issues/107))
316
317 ## 0.99.1 - 2019-11-12
318
319 ### Fixed
320
321 - Hotfix for a regression in allowed `From` derives
322 ([#105](https://github.com/JelteF/derive_more/issues/105))
323
324 ## 0.99.0 - 2019-11-11
325
326 This release is a huge milestone for this library.
327 Lot's of new derives are implemented and a ton of attributes are added for
328 configuration purposes.
329 These attributes will allow future releases to add features/options without
330 breaking backwards compatibility.
331 This is why the next release with breaking changes is planned to be 1.0.0.
332
333 ### Breaking changes
334 - The minimum supported rust version (MSRV) is now Rust 1.36.
335 - When using in a Rust 2015 crate, you should add `extern crate core` to your
336 code.
337 - `no_std` feature is removed, the library now supports `no_std` without having
338 to configure any features.
339
340
341 ### Added
342
343 - `Deref` derives now dereference to the type in the newtype. So if you have
344 `MyBox(Box<i32>)`, dereferencing it will result in a `Box<i32>` not an `i32`.
345 To get the old behaviour of forwarding the dereference you can add the
346 `#[deref(forward)]` attribute on the struct or field.
347 - Derives for `AsRef`, `AsMut`, `Sum`, `Product`, `IntoIterator`.
348 - Choosing the field of a struct for which to derive the newtype derive.
349 - Ignoring variants of enums when deriving `From`, by using `#[from(ignore)]`.
350 - Add `#[from(forward)]` attribute for `From` derives. This forwards the `from`
351 calls to the fields themselves. So if your field is an `i64` you can call from
352 on an `i32` and it will work.
353 - Add `#[mul(forward)]` and `#[mul_assign(forward)]`, which implement `Mul` and
354 `MulAssign` with the semantics as if they were `Add`/`AddAssign`.
355 - You can use features to cut down compile time of the crate by only compiling
356 the code needed for the derives that you use. (see Cargo.toml for the
357 features, by default they are all on)
358 - Add `#[into(owned, ref, ref_mut)]` and `#[try_into(owned, ref, ref_mut)]`
359 attributes. These cause the `Into` and `TryInto` derives to also implement
360 derives that return references to the inner fields.
361 - Allow `#[display(fmt="some shared display text for all enum variants {}")]`
362 attribute on enum.
363 - Better bounds inference of `Display` trait.
364
365 ### Changed
366
367 - Remove dependency on `regex` to cut down compile time.
368 - Use `syn` 1.0
369
370 ## 0.15.0 - 2019-06-08
371
372 ### Fixed
373
374 - Automatic detection of traits needed for `Display` format strings
375
376 ## 0.14.0 - 2019-02-02
377
378 ### Added
379
380 - Added `no_std` support
381
382 ### Changed
383
384 - Suppress `unused_variables` warnings in derives
385
386 ## 0.13.0 - 2018-10-19
387
388 ### Added
389
390 - Extended Display-like derives to support custom formats
391
392 ### Changed
393
394 - Updated to `syn` v0.15
395
396 ## 0.12.0 - 2018-09-19
397
398 ### Changed
399
400 - Updated to `syn` v0.14, `quote` v0.6 and `proc-macro2` v0.4
401
402 ## 0.11.0 - 2018-05-12
403
404 ### Changed
405
406 - Updated to latest version of `syn` and `quote`
407
408 ### Fixed
409
410 - Changed some URLs in the docs so they were correct on crates.io and docs.rs
411 - The `Result` type is now referenced in the derives using its absolute path
412 (`::std::result::Result`) to make sure that the derives don't accidentally use
413 another `Result` type that is in scope.
414
415 ## 0.10.0 - 2018-03-29
416
417 ### Added
418
419 - Allow deriving of `TryInto`
420 - Allow deriving of `Deref`
421 - Allow deriving of `DerefMut`
422
423 ## 0.9.0 - 2018-03-18
424
425 ### Added
426
427 - Allow deriving of `Display`, `Binary`, `Octal`, `LowerHex`, `UpperHex`, `LowerExp`, `UpperExp`, `Pointer`
428 - Allow deriving of `Index`
429 - Allow deriving of `IndexMut`
430
431 ### Fixed
432
433 - Allow cross crate inlining of derived methods
434
435 ## 0.8.0 - 2018-03-10
436
437 ### Added
438
439 - Allow deriving of `FromStr`
440
441 ### Changed
442
443 - Updated to latest version of `syn` and `quote`
444
445 ## 0.7.1 - 2018-01-25
446
447 ### Fixed
448
449 - Add `#[allow(missing_docs)]` to the Constructor definition
450
451 ## 0.7.0 - 2017-07-25
452
453 ### Changed
454
455 - Changed code to work with newer version of the `syn` library.
456
457 ## 0.6.2 - 2017-04-23
458
459 ### Changed
460
461 - Deriving `From`, `Into` and `Constructor` now works for empty structs.
462
463 ## 0.6.1 - 2017-03-08
464
465 ### Changed
466
467 - The `new()` method that is created when deriving `Constructor` is now public.
468 This makes it a lot more useful.
469
470 ## 0.6.0 - 2017-02-20
471
472 ### Added
473
474 - Derives for `Into`, `Constructor` and `MulAssign`-like
475
476 ### Changed
477
478 - `From` is now derived for enum variants with multiple fields.
479
480 ### Fixed
481
482 - Derivations now support generics.
483
484 ## 0.5.0 - 2017-02-02
485
486 ### Added
487
488 - Lots of docs.
489 - Derives for `Neg`-like and `AddAssign`-like.
490
491 ### Changed
492
493 - `From` can now be derived for structs with multiple fields.