Skip to content
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
d617d93
Fix GitHub Actions: wrong Cargo.toml path
LuisFerLCC Sep 22, 2025
5c51be3
Merge pull request #14 from LuisFerLCC/gh-config
LuisFerLCC Sep 22, 2025
f7df30e
Update GitHub labels
LuisFerLCC Sep 22, 2025
49f335f
Change Dependabot schedule to daily
LuisFerLCC Sep 22, 2025
8c83704
Merge remote-tracking branch 'origin/master' into gh-config
LuisFerLCC Sep 22, 2025
7db0508
Merge pull request #15 from LuisFerLCC/gh-config
LuisFerLCC Sep 22, 2025
1db9e75
Bump regex from 1.11.2 to 1.11.3
dependabot[bot] Sep 25, 2025
87e064f
Merge pull request #16 from LuisFerLCC/dependabot/cargo/regex-1.11.3
LuisFerLCC Sep 26, 2025
02fafec
dependabot.yml: Use existing labels and assign to me (LuisFerLCC)
LuisFerLCC Sep 26, 2025
19bae9b
dependabot.yml: Restricted dev dependencies to `impl` directory
LuisFerLCC Sep 26, 2025
bfd633c
Merge pull request #17 from LuisFerLCC/gh-config
LuisFerLCC Sep 26, 2025
e554aaf
Refactor `FormatData` (now `TypeData`) to eliminate unnecessary alloc…
LuisFerLCC Sep 28, 2025
a8cbe4e
Add calls to `std::mem::drop` to deallocate each resource as soon as …
LuisFerLCC Sep 28, 2025
e2a0b6b
Remove unnecessary `pub(crate)`
LuisFerLCC Sep 29, 2025
4c63deb
Store non-display attributes in `ErrorStackDeriveInput` and apply to …
LuisFerLCC Sep 29, 2025
bc54cc3
Use `syn::parse2`
LuisFerLCC Sep 29, 2025
b5882b3
Bump quote from 1.0.40 to 1.0.41
dependabot[bot] Sep 29, 2025
6715621
Remove tolerance for trailing comma
LuisFerLCC Sep 29, 2025
b9906a4
Store non-display variant attributes and apply to output
LuisFerLCC Sep 29, 2025
fe14cce
Optimizations (calls to `std::mem::drop` and remove unnecessary gener…
LuisFerLCC Sep 30, 2025
e68f3a0
Move `TypeData` associated functions to `src::types::fmt::util`
LuisFerLCC Sep 30, 2025
d240a71
Add support for generics
LuisFerLCC Sep 30, 2025
017136f
Add support for `where` clauses
LuisFerLCC Sep 30, 2025
a050561
Add tests for generics and other attributes
LuisFerLCC Oct 1, 2025
cf2a15c
Merge pull request #18 from LuisFerLCC/dependabot/cargo/quote-1.0.41
LuisFerLCC Oct 1, 2025
d2e2274
Merge branch 'master' into impl_error_stack
LuisFerLCC Oct 1, 2025
dd40c5e
Merge pull request #20 from LuisFerLCC/impl_error_stack
LuisFerLCC Oct 1, 2025
a58146b
Prepare release 0.2.0
LuisFerLCC Oct 1, 2025
83f748f
Merge pull request #21 from LuisFerLCC/release-prep
LuisFerLCC Oct 1, 2025
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
3 changes: 2 additions & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ If you wish to contribute to the `error-stack-macros2` codebase, feel free to fo

1. Refer to the [documentation](https://docs.rs/error-stack-macros2) to make sure the error is actually a bug and not a mistake of your own or intended behavior.
1. Make sure the issue hasn't already been reported or suggested.
1. Before starting to make your changes, please create an issue (if there isn't one yet) in order to discuss your proposal.
1. Fork and clone the repository.
1. Make your changes (add or modify tests and documentation comments as necessary to cover your changes).
1. Run `cargo test` (or VSCode task _Cargo: Test_) to run the tests. You can also run `cargo build` (_Cargo: Create development build_) to test the macro in a local Cargo project, or run `cargo doc` (_Cargo: Generate documentation_) to build the documentation.
1. Run `cargo fmt` and `cargo clippy` (or VSCode tasks _RustFMT: Format_ and _Cargo Clippy: Lint_) and make sure there are no warnings or errors.
1. Commit and push your changes.
1. Commit and push your changes. **NOTE: This repository requires all commits to be [signed](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification). Please make sure to sign all of your commits. Commits made through the GitHub web app are signed by default.**
1. [Submit a pull request](https://github.com/LuisFerLCC/error-stack-macros2/compare).
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Make sure to read the [contribution guidelines](https://github.com/LuisFerLCC/error-stack-macros2/blob/master/.github/CONTRIBUTING.md) before you go any further.
- Is there an issue related to your changes? If so, link to it here. If not, create an issue before submitting your pull request in order to discuss.
- **Please make sure that all of your commits are [signed](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification).**

## (How) do your changes work?

Expand Down
22 changes: 21 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
version: 2

updates:
# Production dependencies (e.g., [dependencies], [build-dependencies])
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "weekly"
interval: daily
allow:
- dependency-type: "production"
labels:
- "📦 Dependencies"
assignees:
- LuisFerLCC

# Development dependencies (e.g., [dev-dependencies])
- package-ecosystem: "cargo"
directory: "impl"
schedule:
interval: daily
allow:
- dependency-type: "development"
labels:
- "💻 Dev Dependencies"
assignees:
- LuisFerLCC
22 changes: 17 additions & 5 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
- name: 💣 Breaking change
description: Unintended change that breaks existing behavior
description: Change that modifies existing behavior
color: "f79f34"

- name: 🐞 Bug
description: Not working as intended
color: "d73a4a"

- name: ⚙️ Configuration
description: Changes to configuration files
color: "7057ff"

- name: 📦 Dependencies
description: PRs that update production dependencies
color: "0d7bb5"

- name: 💻 Dev Dependencies
description: PRs that update development dependencies
color: "155e8c"
Expand Down Expand Up @@ -74,6 +82,10 @@
description: Unit testing is needed
color: "c23675"

- name: 🔄 New release
description: This PR into `stable` marks a new release
color: "f9c74f"

- name: 🍰 Nice to have
description: Unplanned behavior, but useful
color: "c5def5"
Expand All @@ -82,6 +94,10 @@
description: Development on this issue has been suspended
color: "d4c5f9"

- name: 🚀 Performance
description: Improvements to performance
color: "fbca04"

- name: ✅ Ready to merge
description: This PR is ready to be merged
color: "0ff40b"
Expand All @@ -90,10 +106,6 @@
description: Preparing for a new release (version bump, release notes, etc.)
color: "f9c74f"

- name: 🔄 New release
description: This PR into `stable` marks a new release
color: "f9c74f"

- name: 🧪 Tests
description: Improvements or additions to unit tests
color: "9f2d60"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Get crate version
id: get_crate_info
run: |
CRATE_VERSION=$(grep '^version = ' Cargo.toml | head -n 1 | cut -d '"' -f 2)
CRATE_VERSION=$(grep '^version = ' impl/Cargo.toml | head -n 1 | cut -d '"' -f 2)
echo "Crate error-stack-macros2"
echo "Crate Version: $CRATE_VERSION"
echo "crate_version=$CRATE_VERSION" >> "$GITHUB_OUTPUT"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testToStable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Get crate version
id: get_crate_info
run: |
CRATE_VERSION=$(grep '^version = ' Cargo.toml | head -n 1 | cut -d '"' -f 2)
CRATE_VERSION=$(grep '^version = ' impl/Cargo.toml | head -n 1 | cut -d '"' -f 2)
echo "Crate error-stack-macros2"
echo "Crate Version: $CRATE_VERSION"
echo "crate_version=$CRATE_VERSION" >> "$GITHUB_OUTPUT"
Expand Down
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 23 additions & 37 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,41 @@
# `error-stack-macros2` v0.1.0
# `error-stack-macros2` v0.2.0

The very first development version of `error-stack-macros2` is finally here!
We have a new development version of `error-stack-macros2`!

## Features
## Fixes

This version (0.1.0) offers a derive macro for the [`Error`](https://doc.rust-lang.org/stable/core/error/trait.Error.html) trait which encourages the best practices for defining [`error-stack`](https://crates.io/crates/error-stack) context types.
This version (0.2.0) adds support for generics and external attributes to the [`impl_error_stack`](https://docs.rs/error-stack-macros2/latest/error_stack_macros2/derive.Error.html) macro.

Here's an example. This code:
This means that types like this:

```rust
use std::{
error::Error,
fmt::{self, Display, Formatter},
};

#[derive(Debug)]
pub enum CreditCardError {
InvalidInput(String),
Other,
}

impl Display for CreditCardError {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
let msg = match self {
Self::InvalidInput(_) => "credit card not found",
Self::Other => "failed to retrieve credit card",
};
use error_stack_macros2::Error;

f.write_str(msg)
}
#[derive(Debug, Error)]
#[display("failed to retrieve credit card")]
enum CreditCardError<T>
where
T: Display
{
InvalidInput(T),
Other
}

impl Error for CreditCardError {}
#[derive(Debug, Error)]
#[display("invalid card string")]
#[allow(non_camel_case_types)]
struct parseCardError;
```

...can now be reduced to this code:
...can now compile properly.

```rust
use error_stack_macros2::Error;
## Performance

#[derive(Debug, Error)]
pub enum CreditCardError {
#[display("credit card not found")]
InvalidInput(String),
The entire source code has been refactored to eliminate unnecessary allocations, cloning, and double iterator consumptions. This should make compile times faster and reduce memory usage.

#[display("failed to retrieve credit card")]
Other,
}
```
## Dependencies

This new release also means that we will now be listening to feedback and accepting new features (macros, obviously). We are also now committed to maintaining this macro going forward and keeping our dependencies up to date.
As promised, all dependencies have been updated to their latest versions, which in this case means performance improvements and bug fixes.

## Previous release notes

Expand Down
3 changes: 2 additions & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

| Version | Supported |
| ------- | --------- |
| 0.1.0 | ✅ |
| 0.2.0 | ✅ |
| < 0.2.0 | ❎ |

## Report a vulnerability

Expand Down
6 changes: 3 additions & 3 deletions impl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "error-stack-macros2"
version = "0.1.0"
version = "0.2.0"
authors = ["LuisFerLCC"]
edition = "2024"
rust-version = "1.90.0"
Expand Down Expand Up @@ -31,8 +31,8 @@ panic = "warn"

[dependencies]
proc-macro2 = "1.0.101"
quote = "1.0.40"
regex = "1.11.2"
quote = "1.0.41"
regex = "1.11.3"
syn = { version = "2.0.106", features = [] }

[dev-dependencies]
Expand Down
2 changes: 0 additions & 2 deletions impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ use syn::parse_macro_input;
mod types;
use types::ErrorStackDeriveInput;

mod util;

/// Derive macro for the [`Error`] trait that implements the best practices for
/// [`error-stack`].
///
Expand Down
Loading