15 KiB
15 KiB
Changelog
v0.20.10 (July 9, 2024)
- Add
#[allow(clippy::manual_unwrap_or_default)]to all generated impls to avoid causing clippy fails in crates usingdarling#296 - Properly initialize
attrsmagic field in derivedFromAttributesimpls #297
v0.20.9 (May 15, 2024)
- Allow word-form for newtype enum variants whose only field produces a value when
from_noneis called on their type #249 - Add
FromMetaimpls for thestd::num::NonZero*types #288 - Fix panic in number
FromMetaimpls when the parsed value is too large for the receiver type #289
v0.20.8 (February 23, 2024)
- Add
#[darling(with = ...)]support toattrsmagic field to allow using custom receiver types forattrs#273
v0.20.7 (February 22, 2024)
- Add
#[darling(flatten)]to allow forwarding unknown fields to another struct #146 - Don't suggest names of skipped fields in derived impls #268
v0.20.6 (February 14, 2024)
- Fix some missing syn invisible group handling in
FromMetaimpls #263 - Fix misleading error message on
Error::unexpected_typeso it no longer implies the type was a literal #264 - Impl
FromMetaVecof literals, e.g.LitStr#265
v0.20.5 (January 30, 2024)
- Add
Flag::spaninherent method, asFlagcan no longer implsyn::spanned::Spanned#242
v0.20.4 (January 29, 2024)
- Accept bare paths in
#[darling(default = ...)]#258 - Add
FromMetaimpl forPathBuf#259 - Improve
FromMetaimplementation for enums #260- Properly implement unit arms in
FromMeta::from_listto provide a consistent API for heterogeneous enums that include a mix of unit, newtype and struct variants - Add
#[darling(word)]attribute for unit enum variants (See #63 for details)
- Properly implement unit arms in
v0.20.3 (July 12, 2023)
- Add
FromMetaimpl foru128andi128#243
v0.20.2 (May 25, 2023)
- Allow darling users to omit quotation marks for paths and idents #236
- Add new util functions for controlling how quotation marks are handled when reading into
Exprfields #235
v0.20.1 (May 2, 2023)
- Add
Cloneimpl forNestedMeta#230
v0.20.0 (April 27, 2023)
- Bump syn to version 2, courtesy of @jonasbb #227
Breaking Changes
-
Replace all occurrences of syn::NestedMeta with darling::ast::NestedMeta.
-
Replacement for the deprecated AttributeArgs:
// Before
parse_macro_input!(args as AttributeArgs);
// After
match NestedMeta::parse_meta_list(args) {
Ok(v) => v,
Err(e) => {
return TokenStream::from(Error::from(e).write_errors());
}
};
- In GenericParamExt,
LifetimeDefis nowLifetimeParam. - In GenericParamExt,
as_lifetime_defis renamed toas_lifetime_param. - Flag and SpannedValue no longer implement
syn::spanned::Spanned. - The MSRV (minimum supported Rust version) is now 1.56, because of syn.
Deprecation Warnings
In previous versions of darling, arbitrary expressions were passed in attributes by wrapping them in quotation marks.
v0.20.0 preserves this behavior for syn::Expr, but as a result a field expecting a syn::Expr cannot accept a string literal - it will incorrectly attempt to parse the contents. If this is an issue for you, please add a comment to #229.
v0.14.4 (March 9, 2023)
- Add support for child diagnostics when
diagnosticsfeature enabled #224
v0.14.3 (February 3, 2023)
- Re-export
synfromdarlingto avoid requiring that consuming crates have asyndependency. - Change
<SpannedValue<T> as FromMeta>impl to more precisely capture the value span, as opposed to the span of the entire item. - Add
darling::util::{AsShape, Shape, ShapeSet}to improve "shape" validation for structs and variants. #222
v0.14.2 (October 26, 2022)
- Derived impls of
FromMetawill now error on literals, rather than silently ignoring them. #193 - Don't include property paths in compile errors when spans are available. #203
v0.14.1 (April 28, 2022)
- Fix a bug where using a trait that accepts
#[darling(attributes(...))]without specifying any attributes would emit code that did not compile. #183 - Impl
Clonefordarling::Error#184 - Impl
From<darling::Error> for syn::Error#184 - Add
Error::spanandError::explicit_spanmethods #184
v0.14.0 (April 13, 2022)
- BREAKING CHANGE: Remove many trait impls from
util::Flag. This type had a number of deref and operator impls that made it usable as sort-of-a-boolean. Real-world usage showed this type is more useful if it's able to carry a span for good errors, and that most of those impls were unnecessary. #179 - Remove need for
#[darling(default)]onOption<T>andFlagfields #161 - Improve validation of enum shapes #178
- Bump
proc-macro2dependency to 1.0.37 #180 - Bump
quotedependency to 1.0.18 #180 - Bump
syndependency to 1.0.91 #180
v0.13.4 (April 6, 2022)
- Impl
FromMetaforsyn::Visibility#173
v0.13.3 (April 5, 2022)
- Add
error::Accumulatorfor dealing with multiple errors #164 - Impl
FromMetaforsyn::Typeand its variants #172
v0.13.2 (March 30, 2022)
- Impl
FromMetaforsyn::ExprPath#169
v0.13.1 (December 7, 2021)
- Add
FromAttributestrait and macro #151
v0.13.0 (May 20, 2021)
- Update darling to 2018 edition #129
- Error on duplicate fields in
#[darling(...)]attributes #130 - Impl
CopyforSpannedValue<T: Copy> - Add
SpannedValue::map_ref
v0.13.0-beta (April 20, 2021)
v0.12.4 (April 20, 2021)
- Add
and_thento derive macros fordarling
v0.12.3 (April 8, 2021)
- Fix
FromMetaimpl forcharnot to panic #126
v0.12.2 (February 23, 2021)
- Impl
FromMetaforHashMap<Ident, V>andHashMap<Path, V>
v0.12.1 (February 22, 2021)
- Impl
FromMetaforsyn::ExprArray#122 - Remove use of
unreachablefromdarling::ast::Data#123 - Add
darling::ast::Data::try_empty_fromto avoid panics when trying to read a union body #123
v0.12.0 (January 5, 2021)
- POSSIBLY BREAKING: Derived impls of
FromDeriveInput,FromField,FromVariant, andFromTypeParamwill now error when encountering an attributedarlinghas been asked to parse that isn't a supported shape. Any crates usingdarlingthat relied on those attributes being silently ignored could see new errors reported in their dependent crates. #113 - Impl
syn::spanned::Spannedfordarling::util::SpannedValue#113 - Add
darling::util::parse_attribute_to_meta_listto provide useful errors during attribute parsing #113 - Add
impl From<syn::Error> for Errorto losslessly propagatesynerrors #116
v0.11.0 (December 14, 2020)
- Bump minor version due to unexpected breaking change #107
v0.10.3 (December 10, 2020)
- Add
discriminantmagic field when derivingFromVariant#105
v0.10.2 (October 30, 2019)
- Bump syn dependency to 1.0.1 #83
v0.10.1 (September 25, 2019)
- Fix test compilation errors #81
v0.10.0 (August 15, 2019)
- Bump syn and quote to 1.0 #79
- Increase rust version to 1.31
v0.9.0 (March 20, 2019)
- Enable "did you mean" suggestions by default
- Make
darling_core::{codegen, options}private #58 - Fix
Override::as_mut: #66
v0.8.6 (March 18, 2019)
- Added "did you mean" suggestions for unknown fields behind the
suggestionsflag #60 - Added
Error::unknown_field_with_altsto support the suggestion use-case. - Added
ast::Fields::lenandast::Fields::is_emptymethods.
v0.8.5 (February 4, 2019)
- Accept unquoted positive numeric literals #52
- Add
FromMetato thesyn::Litenum and its variants - Improve error message for unexpected literal formats to not say "other"
v0.8.4 (February 4, 2019)
- Use
syn::Errorto provide precise errors beforeproc_macro::Diagnosticis available - Add
diagnosticsfeature flag to toggle between stable and unstable error backends - Attach error information in more contexts
- Add
allow_unknown_fieldsto support parsing the same attribute multiple times for different macros #51 - Proc-macro authors will now see better errors in
darlingattributes
v0.8.3 (January 21, 2019)
- Attach spans to errors in generated trait impls #37
- Attach spans to errors for types with provided bespoke implementations
- Deprecate
set_spanfrom 0.8.2, as spans should never be broadened after being initially set
v0.8.2 (January 17, 2019)
- Add spans to errors to make quality warnings and errors easy in darling. This is blocked on diagnostics stabilizing.
- Add
darling::util::SpannedValueso proc-macro authors can remember position information alongside parsed values.
v0.8.0
- Update dependency on
synto 0.15 #44. Thanks to @hcpl
v0.7.0 (July 24, 2018)
- Update dependencies on
synandproc-macro2 - Add
util::IdentString, which acts as an Ident or its string equivalent
v0.6.3 (May 22, 2018)
- Add support for
Uses*traits in where predicates
v0.6.2 (May 22, 2018)
- Add
usagemodule for tracking type param and lifetime usage in generic declarations - Don't add
FromMetabounds to type parameters only used by skipped fields #40
v0.6.1 (May 17, 2018)
- Fix an issue where the
synupdate broke shape validation #36
v0.6.0 (May 15, 2018)
Breaking Changes
- Renamed
FromMetaItemtoFromMeta, and renamedfrom_meta_itemmethod tofrom_meta - Added dedicated
derive(FromMetaItem)which panics and redirects users toFromMeta
v0.5.0 (May 10, 2018)
- Add
ast::Genericsandast::GenericParamto work with generics in a manner similar toast::Data - Add
ast::GenericParamExtto support alternate representations of generic parameters - Add
util::WithOriginalto get a parsed representation and syn's own struct for a syntax block - Add
FromGenericsandFromGenericParamtraits (without derive support) - Change generated code for
genericsmagic field to invokeFromGenericstrait during parsing - Add
FromTypeParamtrait #30. Thanks to @upsuper
v0.4.0 (April 5, 2018)
- Update dependencies on
proc-macro,quote, andsyn#26. Thanks to @hcpl
v0.3.3 (April 2, 2018)
YANKED
v0.3.2 (March 13, 2018)
- Derive
Defaultondarling::Ignored(fixes #25).
v0.3.1 (March 7, 2018)
- Support proc-macro2/nightly #24. Thanks to @kdy1
v0.3.0 (January 26, 2018)
Breaking Changes
- Update
synto 0.12 #20. Thanks to @Eijebong - Update
quoteto 0.4 #20. Thanks to @Eijebong - Rename magic field
bodyin derivedFromDeriveInputstructs todatato stay in sync withsyn - Rename magic field
datain derivedFromVariantstructs tofieldsto stay in sync withsyn
v0.2.2 (December 5, 2017)
- Update
lazy_staticto 1.0 #15. Thanks to @Eijebong
v0.2.1 (November 28, 2017)
- Add
impl FromMetaItemfor integer types #15