mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-20 00:00:08 +02:00
In the past, it was not possible to choose to use the multi-threaded tokio `Runtime` in tests, which meant that any test that transitively used `executor::threadpool::blocking` would fail with ``` 'blocking' annotation used from outside the context of a thread pool ``` This patch adds a runtime annotation attribute to `#[tokio::test]` just like `#[tokio::main]` has, which lets users opt in to the threadpool runtime over `current_thread` (the default).
42 lines
1.1 KiB
Plaintext
42 lines
1.1 KiB
Plaintext
error: the async keyword is missing from the function declaration
|
|
--> $DIR/macros_invalid_input.rs:4:1
|
|
|
|
|
4 | fn main_is_not_async() {}
|
|
| ^^
|
|
|
|
error: Unknown attribute foo is specified; expected `single_thread` or `multi_thread`
|
|
--> $DIR/macros_invalid_input.rs:6:15
|
|
|
|
|
6 | #[tokio::main(foo)]
|
|
| ^^^
|
|
|
|
error: Must have specified ident
|
|
--> $DIR/macros_invalid_input.rs:9:15
|
|
|
|
|
9 | #[tokio::main(multi_thread::bar)]
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
error: the async keyword is missing from the function declaration
|
|
--> $DIR/macros_invalid_input.rs:13:1
|
|
|
|
|
13 | fn test_is_not_async() {}
|
|
| ^^
|
|
|
|
error: the test function cannot accept arguments
|
|
--> $DIR/macros_invalid_input.rs:16:27
|
|
|
|
|
16 | async fn test_fn_has_args(_x: u8) {}
|
|
| ^^^^^^
|
|
|
|
error: Unknown attribute foo is specified; expected `single_thread` or `multi_thread`
|
|
--> $DIR/macros_invalid_input.rs:18:15
|
|
|
|
|
18 | #[tokio::test(foo)]
|
|
| ^^^
|
|
|
|
error: second test attribute is supplied
|
|
--> $DIR/macros_invalid_input.rs:22:1
|
|
|
|
|
22 | #[test]
|
|
| ^^^^^^^
|