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

Replace Router::{map_inner, tap_inner_mut} by macros #2954

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

jplatte
Copy link
Member

@jplatte jplatte commented Oct 3, 2024

… so that #[track_caller] works.

Adding #[track_caller] to the two functions would not have the same effect as the closures passed to both would also need the attribute, but it's currently not supported on closures:
rust-lang/rust#87417

Motivation

We use #[track_caller] in a few places where we panic on invalid user input, to have the panic message point at the relevant method call in the user's code. A few of those, including the one for the new routing syntax, don't work as intended; the panic message still points at something inside axum.

Solution

Replace the internal helpers that break #[track_caller] by macros.

… so that #[track_caller] works.
Adding #[track_caller] to the two functions would not have the same
effect as the closures passed to both would also need the attribute, but
it's currently not supported on closures:
rust-lang/rust#87417
@jplatte jplatte requested a review from mladedav October 3, 2024 18:03
@jplatte jplatte merged commit 20a0624 into main Oct 4, 2024
18 checks passed
@jplatte jplatte deleted the jplatte/path-pattern-syntax-panic-location branch October 4, 2024 17:00
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