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

track_caller for capacity overflow panics #236

Merged
merged 1 commit into from May 5, 2023

Conversation

kornelski
Copy link
Contributor

'CapacityError: insufficient capacity' panic points to ~/.cargo/registry/src/github.com-1ecc6299db9ec823/arrayvec-0.7.2/src/arrayvec.rs:176:9 instead of the line of user code that pushed.

#[track_caller] makes this error more relevant to users.

@bluss bluss merged commit 6712744 into bluss:master May 5, 2023
5 checks passed
@bluss
Copy link
Owner

bluss commented May 5, 2023

Thanks, it does make sense. track_caller is supposed to have some overhead, but I can't find it quantified anywhere. I suppose it's not API-defining anyway, so worst case it can always be changed around - just saying that to make it easy for us to include this change.

@kornelski
Copy link
Contributor Author

It has overhead of having an extra function argument, but when used with small generic functions, the calls and their arguments get inlined, so the overhead usually disappears.

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.

None yet

2 participants