mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-17 00:00:16 +02:00
Improve compile errors for unimplemented traits (#1436)
* Improve `debug_handler` to use the correct span for specific bounds This results in better localised error messages, as they now point directly to the corresponding argument instead of to the macro itself. * Improve some error messages behind a `nightly-error-messages` feature flag This uses the nightly only `rustc_on_unimplemented` attribute to improve some error messages when users try to use invalid handler functions. This should be seen as prove of concept, not as full solution for all potential error cases. The underlying feature is currently marked as permanently unstable, but I'm working on getting this specific attribute (or an attribute with different name, similar functionality) ready to work on a stable compiler. * Apply suggestions from code review Co-authored-by: Jonas Platte <[email protected]> * Enable the `nightly-error-messages` feature unconditionally for nightly compilers * Use a nightly compiler to run the axum-marcos compile fail tests * update to newer nightly * Run axum-macros tests on nightly * tweak compile error hints a bit * more tweaks * update test Co-authored-by: Jonas Platte <[email protected]> Co-authored-by: David Pedersen <[email protected]>
This commit is contained in:
co-authored by
Jonas Platte
David Pedersen
parent
2e3000f1a3
commit
d5de3bc7e3
@@ -75,8 +75,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
# nightly has an ICE, so ignore it for now
|
||||
# rust: [stable, beta, nightly]
|
||||
rust: [stable, beta]
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
@@ -92,6 +90,23 @@ jobs:
|
||||
command: test
|
||||
args: --all --all-features --all-targets
|
||||
|
||||
test-nightly:
|
||||
needs: check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
# same as `axum-macros/rust-toolchain`
|
||||
toolchain: nightly-2022-11-18
|
||||
override: true
|
||||
profile: minimal
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
- name: Run nightly tests
|
||||
working-directory: axum-macros
|
||||
run: |
|
||||
cargo test
|
||||
|
||||
# some examples doesn't support our MSRV (such as async-graphql)
|
||||
# so we only test axum itself on our MSRV
|
||||
test-msrv:
|
||||
|
||||
Reference in New Issue
Block a user