-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add special handling of Extension and Clone for debug_handler
- Loading branch information
Logan Nielsen
committed
Nov 1, 2023
1 parent
d7258bf
commit 9b68146
Showing
3 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use axum_macros::debug_handler; | ||
use axum::extract::Extension; | ||
|
||
struct NonCloneType; | ||
|
||
#[debug_handler] | ||
async fn test_extension_non_clone(_: Extension<NonCloneType>) {} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error[E0277]: the trait bound `NonCloneType: Clone` is not satisfied | ||
--> tests/debug_handler/fail/not_clone.rs:7:38 | ||
| | ||
7 | async fn test_extension_non_clone(_: Extension<NonCloneType>) {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `NonCloneType` | ||
| | ||
= note: required for `Extension<NonCloneType>` to implement `Clone` | ||
= help: see issue #48214 | ||
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable | ||
help: consider annotating `NonCloneType` with `#[derive(Clone)]` | ||
| | ||
4 + #[derive(Clone)] | ||
5 | struct NonCloneType; | ||
| |