add tests for async await · rust-lang/rust@5374688 (original) (raw)

``

1

`+

error: future cannot be sent between threads safely

`

``

2

`+

--> $DIR/async-await-let-else.rs:45:13

`

``

3

`+

|

`

``

4

`+

LL | is_send(foo(Some(true)));

`

``

5

`` +

| ^^^^^^^^^^^^^^^ future returned by foo is not Send

``

``

6

`+

|

`

``

7

`` +

= help: within impl Future<Output = ()>, the trait Send is not implemented for Rc<()>

``

``

8

`` +

note: future is not Send as this value is used across an await

``

``

9

`+

--> $DIR/async-await-let-else.rs:8:14

`

``

10

`+

|

`

``

11

`+

LL | let r = Rc::new(());

`

``

12

`` +

| - has type Rc<()> which is not Send

``

``

13

`+

LL | bar().await

`

``

14

`` +

| ^^^^^^ await occurs here, with r maybe used later

``

``

15

`+

LL | };

`

``

16

`` +

| - r is later dropped here

``

``

17

`` +

note: required by a bound in is_send

``

``

18

`+

--> $DIR/async-await-let-else.rs:16:15

`

``

19

`+

|

`

``

20

`+

LL | fn is_send<T: Send>(_: T) {}

`

``

21

`` +

| ^^^^ required by this bound in is_send

``

``

22

+

``

23

`+

error: future cannot be sent between threads safely

`

``

24

`+

--> $DIR/async-await-let-else.rs:47:13

`

``

25

`+

|

`

``

26

`+

LL | is_send(foo2(Some(true)));

`

``

27

`` +

| ^^^^^^^^^^^^^^^^ future returned by foo2 is not Send

``

``

28

`+

|

`

``

29

`` +

= help: within impl Future<Output = ()>, the trait Send is not implemented for Rc<()>

``

``

30

`` +

note: future is not Send as this value is used across an await

``

``

31

`+

--> $DIR/async-await-let-else.rs:20:26

`

``

32

`+

|

`

``

33

`+

LL | bar2(Rc::new(())).await

`

``

34

`` +

| ----------- ^^^^^^ await occurs here, with Rc::new(()) maybe used later

``

``

35

`+

| |

`

``

36

`` +

| has type Rc<()> which is not Send

``

``

37

`+

LL | };

`

``

38

`` +

| - Rc::new(()) is later dropped here

``

``

39

`` +

note: required by a bound in is_send

``

``

40

`+

--> $DIR/async-await-let-else.rs:16:15

`

``

41

`+

|

`

``

42

`+

LL | fn is_send<T: Send>(_: T) {}

`

``

43

`` +

| ^^^^ required by this bound in is_send

``

``

44

+

``

45

`+

error: future cannot be sent between threads safely

`

``

46

`+

--> $DIR/async-await-let-else.rs:49:13

`

``

47

`+

|

`

``

48

`+

LL | is_send(foo3(Some(true)));

`

``

49

`` +

| ^^^^^^^^^^^^^^^^ future returned by foo3 is not Send

``

``

50

`+

|

`

``

51

`` +

= help: within impl Future<Output = ()>, the trait Send is not implemented for Rc<()>

``

``

52

`` +

note: future is not Send as this value is used across an await

``

``

53

`+

--> $DIR/async-await-let-else.rs:30:28

`

``

54

`+

|

`

``

55

`+

LL | (Rc::new(()), bar().await);

`

``

56

`` +

| ----------- ^^^^^^ await occurs here, with Rc::new(()) maybe used later

``

``

57

`+

| |

`

``

58

`` +

| has type Rc<()> which is not Send

``

``

59

`` +

note: Rc::new(()) is later dropped here

``

``

60

`+

--> $DIR/async-await-let-else.rs:30:35

`

``

61

`+

|

`

``

62

`+

LL | (Rc::new(()), bar().await);

`

``

63

`+

| ^

`

``

64

`` +

note: required by a bound in is_send

``

``

65

`+

--> $DIR/async-await-let-else.rs:16:15

`

``

66

`+

|

`

``

67

`+

LL | fn is_send<T: Send>(_: T) {}

`

``

68

`` +

| ^^^^ required by this bound in is_send

``

``

69

+

``

70

`+

error: future cannot be sent between threads safely

`

``

71

`+

--> $DIR/async-await-let-else.rs:51:13

`

``

72

`+

|

`

``

73

`+

LL | is_send(foo4(Some(true)));

`

``

74

`` +

| ^^^^^^^^^^^^^^^^ future returned by foo4 is not Send

``

``

75

`+

|

`

``

76

`` +

= help: within impl Future<Output = ()>, the trait Send is not implemented for Rc<()>

``

``

77

`` +

note: future is not Send as this value is used across an await

``

``

78

`+

--> $DIR/async-await-let-else.rs:38:14

`

``

79

`+

|

`

``

80

`+

LL | let r = Rc::new(());

`

``

81

`` +

| - has type Rc<()> which is not Send

``

``

82

`+

LL | bar().await;

`

``

83

`` +

| ^^^^^^ await occurs here, with r maybe used later

``

``

84

`+

...

`

``

85

`+

LL | };

`

``

86

`` +

| - r is later dropped here

``

``

87

`` +

note: required by a bound in is_send

``

``

88

`+

--> $DIR/async-await-let-else.rs:16:15

`

``

89

`+

|

`

``

90

`+

LL | fn is_send<T: Send>(_: T) {}

`

``

91

`` +

| ^^^^ required by this bound in is_send

``

``

92

+

``

93

`+

error: aborting due to 4 previous errors

`

``

94

+