Skip to content

track_caller for capacity overflow panics - #236

Merged
bluss merged 1 commit into
bluss:masterfrom
kornelski:track_caller
May 5, 2023
Merged

bluss merged 1 commit into
bluss:masterfrom
kornelski:track_caller

Conversation

@kornelski

Copy link
Copy Markdown
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
@bluss

bluss commented May 5, 2023

Copy link
Copy Markdown
Owner

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
Copy Markdown
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.

2 participants