-
Notifications
You must be signed in to change notification settings - Fork 1.2k
panic does not compile intoResponse in Rust 1.85 and edition2024 #3169
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
Comments
Since we can't |
Yeah we can impl this once |
I quickly skimmed through that issue. |
That's already implemented: https://docs.rs/axum-core/0.5.0/axum_core/response/trait.IntoResponse.html#impl-IntoResponse-for-Infallible |
Rust 1.85 and edition2024 is now stable, is there any workaround available? |
If you need just a workaround, then cast it explicitly, e.g. But otherwise we need to implement the trait but make sure we do it in a way that doesn't break people who still use the older edition. |
Actually, I'm not so sure we can do that simply. We can gate the implementation block based on compiler version used but I don't think we can support two editions unless we release two different versions For context, our current MSRV is 1.75 and supporting this would mean we would have to bump it all the way to the current stable which is 1.85. When we went from edition 2018 to 2021, it was 8 months after its initial release, upgrading to 1.56 while 1.61 was already out. I think we should give users some time to upgrade if we're to upgrade this in a patch release. |
out of curiosity, what is the use case for supporting unconditional |
|
are you sure about that? my understating is that that todo macro uses a generic return type and behaves differently from panic in that regard. I agree that writing the loop that way is weird but I don't see the use case for wiring that in a route handler fn in the first place 😄 |
I am certain that all the cases David listed are the same. And |
looks like you're right. I wasn't aware that the behavior of but as you said, since the |
No macro behavior was changed. It's type inference that changed. |
FYI, Bevy ran into this over at rust-lang/rust#139610, and we're considering implementing the never_say_never hacky workaround if you'd like to learn from our approach. |
I know about that hack, but we already implement |
could we restrict the hack impl by Rust version or something like that? |
I suppose we could do a compile probe thing. For using the version, we'd have to know which version is going to stabilize never, and then it could still break for nightly users. Also, so far this issue has not received any reactions or comments from users other than the one who reported it. I don't think we urgently need to do anything. |
Uh oh!
There was an error while loading. Please reload this page.
Bug Report
Version
cargo tree | grep axum
Platform
Steps to reproduce code:
Cargo.toml
main.rs
compiler errors:
edition2021
compiles without errors.Maybe its related to this: rust-lang/rust#123748
The text was updated successfully, but these errors were encountered: