diff options
author | daxpedda <daxpedda@gmail.com> | 2020-01-26 18:35:39 +0100 |
---|---|---|
committer | Carl Lerche <me@carllerche.com> | 2020-01-26 09:35:39 -0800 |
commit | 4996e276733a13fd16b2a08f617570ea201718ba (patch) | |
tree | 55583b75a0dc3c2b09be434b386e62d7f35475b5 /tests-integration | |
parent | 5bf06f2b5a81ae7b5b8adfe4a44fab033f4156cf (diff) |
macros: fix skipping generics on #[tokio::main] (#2177)
When using #[tokio::main] on a function with generics, the generics are
skipped. Simply using #vis #sig instead of #vis fn #name(#inputs) #ret
fixes the problem.
Fixes #2176
Diffstat (limited to 'tests-integration')
-rw-r--r-- | tests-integration/tests/macros_main.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests-integration/tests/macros_main.rs b/tests-integration/tests/macros_main.rs index 182e2779..42f5be3b 100644 --- a/tests-integration/tests/macros_main.rs +++ b/tests-integration/tests/macros_main.rs @@ -5,6 +5,11 @@ async fn basic_main() -> usize { 1 } +#[tokio::main] +async fn generic_fun<T: Default>() -> T { + T::default() +} + #[cfg(feature = "rt-core")] mod spawn { #[tokio::main] @@ -22,4 +27,5 @@ mod spawn { #[test] fn shell() { assert_eq!(1, basic_main()); + assert_eq!(bool::default(), generic_fun::<bool>()) } |