-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "chore: disable warnings in old CI (#4691)"
- Loading branch information
Showing
22 changed files
with
323 additions
and
37 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
|
@@ -11,5 +11,6 @@ members = [ | |
"benches", | ||
"examples", | ||
"stress-test", | ||
"tests-build", | ||
"tests-integration", | ||
] |
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,16 @@ | ||
[package] | ||
name = "tests-build" | ||
version = "0.1.0" | ||
authors = ["Tokio Contributors <[email protected]>"] | ||
edition = "2018" | ||
publish = false | ||
|
||
[features] | ||
full = ["tokio/full"] | ||
rt = ["tokio/rt", "tokio/macros"] | ||
|
||
[dependencies] | ||
tokio = { path = "../tokio", optional = true } | ||
|
||
[dev-dependencies] | ||
trybuild = "1.0" |
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,2 @@ | ||
Tests the various combination of feature flags. This is broken out to a separate | ||
crate to work around limitations with cargo features. |
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,2 @@ | ||
#[cfg(feature = "tokio")] | ||
pub use tokio; |
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,6 @@ | ||
use tests_build::tokio; | ||
|
||
#[tokio::main] | ||
async fn my_fn() {} | ||
|
||
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,7 @@ | ||
error: The default runtime flavor is `multi_thread`, but the `rt-multi-thread` feature is disabled. | ||
--> $DIR/macros_core_no_default.rs:3:1 | ||
| | ||
3 | #[tokio::main] | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the attribute macro `tokio::main` (in Nightly builds, run with -Z macro-backtrace for more info) |
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,8 @@ | ||
#![deny(dead_code)] | ||
|
||
use tests_build::tokio; | ||
|
||
#[tokio::main] | ||
async fn f() {} | ||
|
||
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,11 @@ | ||
error: function is never used: `f` | ||
--> $DIR/macros_dead_code.rs:6:10 | ||
| | ||
6 | async fn f() {} | ||
| ^ | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/macros_dead_code.rs:1:9 | ||
| | ||
1 | #![deny(dead_code)] | ||
| ^^^^^^^^^ |
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,40 @@ | ||
use tests_build::tokio; | ||
|
||
#[tokio::main] | ||
fn main_is_not_async() {} | ||
|
||
#[tokio::main(foo)] | ||
async fn main_attr_has_unknown_args() {} | ||
|
||
#[tokio::main(threadpool::bar)] | ||
async fn main_attr_has_path_args() {} | ||
|
||
#[tokio::test] | ||
fn test_is_not_async() {} | ||
|
||
#[tokio::test(foo)] | ||
async fn test_attr_has_args() {} | ||
|
||
#[tokio::test(foo = 123)] | ||
async fn test_unexpected_attr() {} | ||
|
||
#[tokio::test(flavor = 123)] | ||
async fn test_flavor_not_string() {} | ||
|
||
#[tokio::test(flavor = "foo")] | ||
async fn test_unknown_flavor() {} | ||
|
||
#[tokio::test(flavor = "multi_thread", start_paused = false)] | ||
async fn test_multi_thread_with_start_paused() {} | ||
|
||
#[tokio::test(flavor = "multi_thread", worker_threads = "foo")] | ||
async fn test_worker_threads_not_int() {} | ||
|
||
#[tokio::test(flavor = "current_thread", worker_threads = 4)] | ||
async fn test_worker_threads_and_current_thread() {} | ||
|
||
#[tokio::test] | ||
#[test] | ||
async fn test_has_second_test_attr() {} | ||
|
||
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,71 @@ | ||
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 one of: `flavor`, `worker_threads`, `start_paused` | ||
--> $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(threadpool::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: Unknown attribute foo is specified; expected one of: `flavor`, `worker_threads`, `start_paused` | ||
--> $DIR/macros_invalid_input.rs:15:15 | ||
| | ||
15 | #[tokio::test(foo)] | ||
| ^^^ | ||
|
||
error: Unknown attribute foo is specified; expected one of: `flavor`, `worker_threads`, `start_paused` | ||
--> $DIR/macros_invalid_input.rs:18:15 | ||
| | ||
18 | #[tokio::test(foo = 123)] | ||
| ^^^^^^^^^ | ||
|
||
error: Failed to parse value of `flavor` as string. | ||
--> $DIR/macros_invalid_input.rs:21:24 | ||
| | ||
21 | #[tokio::test(flavor = 123)] | ||
| ^^^ | ||
|
||
error: No such runtime flavor `foo`. The runtime flavors are `current_thread` and `multi_thread`. | ||
--> $DIR/macros_invalid_input.rs:24:24 | ||
| | ||
24 | #[tokio::test(flavor = "foo")] | ||
| ^^^^^ | ||
|
||
error: The `start_paused` option requires the `current_thread` runtime flavor. Use `#[tokio::test(flavor = "current_thread")]` | ||
--> $DIR/macros_invalid_input.rs:27:55 | ||
| | ||
27 | #[tokio::test(flavor = "multi_thread", start_paused = false)] | ||
| ^^^^^ | ||
|
||
error: Failed to parse value of `worker_threads` as integer. | ||
--> $DIR/macros_invalid_input.rs:30:57 | ||
| | ||
30 | #[tokio::test(flavor = "multi_thread", worker_threads = "foo")] | ||
| ^^^^^ | ||
|
||
error: The `worker_threads` option requires the `multi_thread` runtime flavor. Use `#[tokio::test(flavor = "multi_thread")]` | ||
--> $DIR/macros_invalid_input.rs:33:59 | ||
| | ||
33 | #[tokio::test(flavor = "current_thread", worker_threads = 4)] | ||
| ^ | ||
|
||
error: second test attribute is supplied | ||
--> $DIR/macros_invalid_input.rs:37:1 | ||
| | ||
37 | #[test] | ||
| ^^^^^^^ |
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,26 @@ | ||
use tests_build::tokio; | ||
|
||
#[tokio::main] | ||
async fn missing_semicolon_or_return_type() { | ||
Ok(()) | ||
} | ||
|
||
#[tokio::main] | ||
async fn missing_return_type() { | ||
return Ok(()); | ||
} | ||
|
||
#[tokio::main] | ||
async fn extra_semicolon() -> Result<(), ()> { | ||
/* TODO(taiki-e): help message still wrong | ||
help: try using a variant of the expected enum | ||
| | ||
23 | Ok(Ok(());) | ||
| | ||
23 | Err(Ok(());) | ||
| | ||
*/ | ||
Ok(()); | ||
} | ||
|
||
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,45 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/macros_type_mismatch.rs:5:5 | ||
| | ||
5 | Ok(()) | ||
| ^^^^^^ expected `()`, found enum `Result` | ||
| | ||
= note: expected unit type `()` | ||
found enum `Result<(), _>` | ||
help: consider using a semicolon here | ||
| | ||
5 | Ok(()); | ||
| + | ||
help: try adding a return type | ||
| | ||
4 | async fn missing_semicolon_or_return_type() -> Result<(), _> { | ||
| ++++++++++++++++ | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/macros_type_mismatch.rs:10:5 | ||
| | ||
9 | async fn missing_return_type() { | ||
| - help: try adding a return type: `-> Result<(), _>` | ||
10 | return Ok(()); | ||
| ^^^^^^^^^^^^^^ expected `()`, found enum `Result` | ||
| | ||
= note: expected unit type `()` | ||
found enum `Result<(), _>` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/macros_type_mismatch.rs:23:5 | ||
| | ||
14 | async fn extra_semicolon() -> Result<(), ()> { | ||
| -------------- expected `Result<(), ()>` because of return type | ||
... | ||
23 | Ok(()); | ||
| ^^^^^^^ expected enum `Result`, found `()` | ||
| | ||
= note: expected enum `Result<(), ()>` | ||
found unit type `()` | ||
help: try using a variant of the expected enum | ||
| | ||
23 | Ok(Ok(());) | ||
| | ||
23 | Err(Ok(());) | ||
| |
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,27 @@ | ||
#[test] | ||
fn compile_fail_full() { | ||
let t = trybuild::TestCases::new(); | ||
|
||
#[cfg(feature = "full")] | ||
t.pass("tests/pass/forward_args_and_output.rs"); | ||
|
||
#[cfg(feature = "full")] | ||
t.pass("tests/pass/macros_main_return.rs"); | ||
|
||
#[cfg(feature = "full")] | ||
t.pass("tests/pass/macros_main_loop.rs"); | ||
|
||
#[cfg(feature = "full")] | ||
t.compile_fail("tests/fail/macros_invalid_input.rs"); | ||
|
||
#[cfg(feature = "full")] | ||
t.compile_fail("tests/fail/macros_dead_code.rs"); | ||
|
||
#[cfg(feature = "full")] | ||
t.compile_fail("tests/fail/macros_type_mismatch.rs"); | ||
|
||
#[cfg(all(feature = "rt", not(feature = "full")))] | ||
t.compile_fail("tests/fail/macros_core_no_default.rs"); | ||
|
||
drop(t); | ||
} |
Oops, something went wrong.