Skip to content

Commit 266e06c

Browse files
authored
Merge pull request #1066 from rust-lang/cleanups
Creating the Coordinator is no longer async
2 parents debf744 + ac626f7 commit 266e06c

File tree

7 files changed

+485
-494
lines changed

7 files changed

+485
-494
lines changed

compiler/base/orchestrator/src/coordinator.rs

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ impl CoordinatorFactory {
861861
CoordinatorId { start, id }
862862
}
863863

864-
pub async fn build<B>(&self) -> Coordinator<B>
864+
pub fn build<B>(&self) -> Coordinator<B>
865865
where
866866
B: Backend + From<CoordinatorId>,
867867
{
@@ -2849,30 +2849,30 @@ mod tests {
28492849
static TEST_COORDINATOR_FACTORY: Lazy<CoordinatorFactory> =
28502850
Lazy::new(|| CoordinatorFactory::new(*MAX_CONCURRENT_TESTS));
28512851

2852-
async fn new_coordinator_test() -> Coordinator<TestBackend> {
2853-
TEST_COORDINATOR_FACTORY.build().await
2852+
fn new_coordinator_test() -> Coordinator<TestBackend> {
2853+
TEST_COORDINATOR_FACTORY.build()
28542854
}
28552855

2856-
async fn new_coordinator_docker() -> Coordinator<DockerBackend> {
2857-
TEST_COORDINATOR_FACTORY.build().await
2856+
fn new_coordinator_docker() -> Coordinator<DockerBackend> {
2857+
TEST_COORDINATOR_FACTORY.build()
28582858
}
28592859

2860-
async fn new_coordinator() -> Coordinator<impl Backend> {
2860+
fn new_coordinator() -> Coordinator<impl Backend> {
28612861
#[cfg(not(force_docker))]
28622862
{
2863-
new_coordinator_test().await
2863+
new_coordinator_test()
28642864
}
28652865

28662866
#[cfg(force_docker)]
28672867
{
2868-
new_coordinator_docker().await
2868+
new_coordinator_docker()
28692869
}
28702870
}
28712871

28722872
#[tokio::test]
28732873
#[snafu::report]
28742874
async fn versions() -> Result<()> {
2875-
let coordinator = new_coordinator().await;
2875+
let coordinator = new_coordinator();
28762876

28772877
let versions = coordinator.versions().with_timeout().await.unwrap();
28782878

@@ -2903,7 +2903,7 @@ mod tests {
29032903
#[tokio::test]
29042904
#[snafu::report]
29052905
async fn execute_response() -> Result<()> {
2906-
let coordinator = new_coordinator().await;
2906+
let coordinator = new_coordinator();
29072907

29082908
let response = coordinator
29092909
.execute(new_execute_request())
@@ -2931,7 +2931,7 @@ mod tests {
29312931
];
29322932

29332933
let tests = params.into_iter().map(|(mode, expected)| async move {
2934-
let coordinator = new_coordinator().await;
2934+
let coordinator = new_coordinator();
29352935

29362936
let request = ExecuteRequest {
29372937
mode,
@@ -2971,7 +2971,7 @@ mod tests {
29712971
let tests = params.into_iter().flat_map(|(code, works_in)| {
29722972
Edition::ALL.into_iter().zip(works_in).map(
29732973
move |(edition, expected_to_work)| async move {
2974-
let coordinator = new_coordinator().await;
2974+
let coordinator = new_coordinator();
29752975

29762976
let request = ExecuteRequest {
29772977
code: code.into(),
@@ -3012,7 +3012,7 @@ mod tests {
30123012
];
30133013

30143014
let tests = params.into_iter().map(|(crate_type, expected)| async move {
3015-
let coordinator = new_coordinator().await;
3015+
let coordinator = new_coordinator();
30163016

30173017
let request = ExecuteRequest {
30183018
crate_type,
@@ -3045,7 +3045,7 @@ mod tests {
30453045
let params = [(false, "Running `"), (true, "Running unittests")];
30463046

30473047
let tests = params.into_iter().map(|(tests, expected)| async move {
3048-
let coordinator = new_coordinator().await;
3048+
let coordinator = new_coordinator();
30493049

30503050
let request = ExecuteRequest {
30513051
code: code.into(),
@@ -3078,7 +3078,7 @@ mod tests {
30783078
];
30793079

30803080
let tests = params.into_iter().map(|(backtrace, expected)| async move {
3081-
let coordinator = new_coordinator().await;
3081+
let coordinator = new_coordinator();
30823082

30833083
let request = ExecuteRequest {
30843084
code: code.into(),
@@ -3107,7 +3107,7 @@ mod tests {
31073107
#[tokio::test]
31083108
#[snafu::report]
31093109
async fn execute_stdin() -> Result<()> {
3110-
let coordinator = new_coordinator().await;
3110+
let coordinator = new_coordinator();
31113111

31123112
let request = ExecuteRequest {
31133113
code: r#"
@@ -3155,7 +3155,7 @@ mod tests {
31553155
#[tokio::test]
31563156
#[snafu::report]
31573157
async fn execute_stdin_close() -> Result<()> {
3158-
let coordinator = new_coordinator().await;
3158+
let coordinator = new_coordinator();
31593159

31603160
let request = ExecuteRequest {
31613161
code: r#"
@@ -3213,7 +3213,7 @@ mod tests {
32133213
#[tokio::test]
32143214
#[snafu::report]
32153215
async fn execute_kill() -> Result<()> {
3216-
let coordinator = new_coordinator().await;
3216+
let coordinator = new_coordinator();
32173217

32183218
let request = ExecuteRequest {
32193219
code: r#"
@@ -3272,7 +3272,7 @@ mod tests {
32723272
#[tokio::test]
32733273
#[snafu::report]
32743274
async fn execute_status() -> Result<()> {
3275-
let coordinator = new_coordinator().await;
3275+
let coordinator = new_coordinator();
32763276

32773277
let request = ExecuteRequest {
32783278
code: r#"
@@ -3345,7 +3345,7 @@ mod tests {
33453345
#[tokio::test]
33463346
#[snafu::report]
33473347
async fn compile_response() -> Result<()> {
3348-
let coordinator = new_coordinator().await;
3348+
let coordinator = new_coordinator();
33493349

33503350
let req = CompileRequest {
33513351
code: HELLO_WORLD_CODE.into(),
@@ -3366,7 +3366,7 @@ mod tests {
33663366
#[tokio::test]
33673367
#[snafu::report]
33683368
async fn compile_streaming() -> Result<()> {
3369-
let coordinator = new_coordinator().await;
3369+
let coordinator = new_coordinator();
33703370

33713371
let req = CompileRequest {
33723372
code: HELLO_WORLD_CODE.into(),
@@ -3401,7 +3401,7 @@ mod tests {
34013401
#[snafu::report]
34023402
async fn compile_edition() -> Result<()> {
34033403
for edition in Edition::ALL {
3404-
let coordinator = new_coordinator().await;
3404+
let coordinator = new_coordinator();
34053405

34063406
let req = CompileRequest {
34073407
edition,
@@ -3447,7 +3447,7 @@ mod tests {
34473447
#[tokio::test]
34483448
#[snafu::report]
34493449
async fn compile_assembly() -> Result<()> {
3450-
let coordinator = new_coordinator().await;
3450+
let coordinator = new_coordinator();
34513451

34523452
let req = CompileRequest {
34533453
code: ADD_CODE.into(),
@@ -3480,7 +3480,7 @@ mod tests {
34803480
];
34813481

34823482
for (flavor, expected) in cases {
3483-
let coordinator = new_coordinator().await;
3483+
let coordinator = new_coordinator();
34843484

34853485
let req = CompileRequest {
34863486
target: CompileTarget::Assembly(
@@ -3514,7 +3514,7 @@ mod tests {
35143514
];
35153515

35163516
for (mangle, expected) in cases {
3517-
let coordinator = new_coordinator().await;
3517+
let coordinator = new_coordinator();
35183518

35193519
let req = CompileRequest {
35203520
target: CompileTarget::Assembly(
@@ -3546,7 +3546,7 @@ mod tests {
35463546
];
35473547

35483548
for (process, expected) in cases {
3549-
let coordinator = new_coordinator().await;
3549+
let coordinator = new_coordinator();
35503550

35513551
let req = CompileRequest {
35523552
target: CompileTarget::Assembly(
@@ -3589,7 +3589,7 @@ mod tests {
35893589
#[tokio::test]
35903590
#[snafu::report]
35913591
async fn compile_hir() -> Result<()> {
3592-
let coordinator = new_coordinator().await;
3592+
let coordinator = new_coordinator();
35933593

35943594
let req = CompileRequest {
35953595
code: SUBTRACT_CODE.into(),
@@ -3609,7 +3609,7 @@ mod tests {
36093609
#[tokio::test]
36103610
#[snafu::report]
36113611
async fn compile_llvm_ir() -> Result<()> {
3612-
let coordinator = new_coordinator().await;
3612+
let coordinator = new_coordinator();
36133613

36143614
let req = CompileRequest {
36153615
target: CompileTarget::LlvmIr,
@@ -3636,7 +3636,7 @@ mod tests {
36363636
#[snafu::report]
36373637
async fn compile_wasm() -> Result<()> {
36383638
// cargo-wasm only exists inside the container
3639-
let coordinator = new_coordinator_docker().await;
3639+
let coordinator = new_coordinator_docker();
36403640

36413641
let req = CompileRequest {
36423642
target: CompileTarget::Wasm,
@@ -3680,7 +3680,7 @@ mod tests {
36803680
#[tokio::test]
36813681
#[snafu::report]
36823682
async fn format() -> Result<()> {
3683-
let coordinator = new_coordinator().await;
3683+
let coordinator = new_coordinator();
36843684

36853685
let req = FormatRequest {
36863686
code: ARBITRARY_FORMAT_INPUT.into(),
@@ -3702,7 +3702,7 @@ mod tests {
37023702
#[snafu::report]
37033703
async fn format_channel() -> Result<()> {
37043704
for channel in Channel::ALL {
3705-
let coordinator = new_coordinator().await;
3705+
let coordinator = new_coordinator();
37063706

37073707
let req = FormatRequest {
37083708
channel,
@@ -3731,7 +3731,7 @@ mod tests {
37313731
];
37323732

37333733
for (code, works_in) in cases {
3734-
let coordinator = new_coordinator().await;
3734+
let coordinator = new_coordinator();
37353735

37363736
for (edition, works) in Edition::ALL.into_iter().zip(works_in) {
37373737
let req = FormatRequest {
@@ -3760,7 +3760,7 @@ mod tests {
37603760
#[tokio::test]
37613761
#[snafu::report]
37623762
async fn clippy() -> Result<()> {
3763-
let coordinator = new_coordinator().await;
3763+
let coordinator = new_coordinator();
37643764

37653765
let req = ClippyRequest {
37663766
code: r#"
@@ -3796,7 +3796,7 @@ mod tests {
37963796
let tests = cases.into_iter().flat_map(|(code, expected_to_be_clean)| {
37973797
Edition::ALL.into_iter().zip(expected_to_be_clean).map(
37983798
move |(edition, expected_to_be_clean)| async move {
3799-
let coordinator = new_coordinator().await;
3799+
let coordinator = new_coordinator();
38003800

38013801
let req = ClippyRequest {
38023802
edition,
@@ -3835,7 +3835,7 @@ mod tests {
38353835
#[snafu::report]
38363836
async fn miri() -> Result<()> {
38373837
// cargo-miri-playground only exists inside the container
3838-
let coordinator = new_coordinator_docker().await;
3838+
let coordinator = new_coordinator_docker();
38393839

38403840
let req = MiriRequest {
38413841
code: r#"
@@ -3870,7 +3870,7 @@ mod tests {
38703870
#[tokio::test]
38713871
#[snafu::report]
38723872
async fn macro_expansion() -> Result<()> {
3873-
let coordinator = new_coordinator().await;
3873+
let coordinator = new_coordinator();
38743874

38753875
let req = MacroExpansionRequest {
38763876
code: r#"
@@ -3904,7 +3904,7 @@ mod tests {
39043904
#[tokio::test]
39053905
#[snafu::report]
39063906
async fn compile_clears_old_main_rs() -> Result<()> {
3907-
let coordinator = new_coordinator().await;
3907+
let coordinator = new_coordinator();
39083908

39093909
// Create a main.rs file
39103910
let req = ExecuteRequest {
@@ -3955,7 +3955,7 @@ mod tests {
39553955
#[tokio::test]
39563956
#[snafu::report]
39573957
async fn still_usable_after_idle() -> Result<()> {
3958-
let mut coordinator = new_coordinator().await;
3958+
let mut coordinator = new_coordinator();
39593959

39603960
let req = ExecuteRequest {
39613961
channel: Channel::Stable,
@@ -3983,7 +3983,7 @@ mod tests {
39833983
#[tokio::test]
39843984
#[snafu::report]
39853985
async fn exit_due_to_signal_is_reported() -> Result<()> {
3986-
let coordinator = new_coordinator().await;
3986+
let coordinator = new_coordinator();
39873987

39883988
let req = ExecuteRequest {
39893989
channel: Channel::Stable,
@@ -4021,7 +4021,7 @@ mod tests {
40214021
#[snafu::report]
40224022
async fn network_connections_are_disabled() -> Result<()> {
40234023
// The limits are only applied to the container
4024-
let coordinator = new_coordinator_docker().await;
4024+
let coordinator = new_coordinator_docker();
40254025

40264026
let req = ExecuteRequest {
40274027
code: r#"
@@ -4049,7 +4049,7 @@ mod tests {
40494049
#[snafu::report]
40504050
async fn memory_usage_is_limited() -> Result<()> {
40514051
// The limits are only applied to the container
4052-
let coordinator = new_coordinator_docker().await;
4052+
let coordinator = new_coordinator_docker();
40534053

40544054
let req = ExecuteRequest {
40554055
code: r#"
@@ -4078,7 +4078,7 @@ mod tests {
40784078
#[snafu::report]
40794079
async fn number_of_pids_is_limited() -> Result<()> {
40804080
// The limits are only applied to the container
4081-
let coordinator = new_coordinator_docker().await;
4081+
let coordinator = new_coordinator_docker();
40824082

40834083
let req = ExecuteRequest {
40844084
code: r##"
@@ -4109,7 +4109,7 @@ mod tests {
41094109
#[snafu::report]
41104110
async fn amount_of_output_is_limited() -> Result<()> {
41114111
// The limits are only applied to the container
4112-
let coordinator = new_coordinator_docker().await;
4112+
let coordinator = new_coordinator_docker();
41134113

41144114
let req = ExecuteRequest {
41154115
code: r##"

0 commit comments

Comments
 (0)