```rust struct Foo; impl !Send for Foo {} let _: impl Send = || { let guard = Foo; drop(guard); yield; }; ``` ([full playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=40cf8544ae9dd8b93f9e30808e6366f6)) fails with ``` error[E0277]: `Foo` cannot be sent between threads safely --> src/main.rs:14:12 | 14 | let _: impl Send = || { | ^^^^^^^^^ `Foo` cannot be sent between threads safely | = help: within `[generator@src/main.rs:14:24: 18:6 {Foo, ()}]`, the trait `std::marker::Send` is not implemented for `Foo` = note: required because it appears within the type `{Foo, ()}` = note: required because it appears within the type `[generator@src/main.rs:14:24: 18:6 {Foo, ()}]` ``` The guard should be dead and deallocated before the yield point so shouldn't appear in the generator type and affect the `Send`ness. Wrapping the guard in a new scope before the `yield` avoids this (included in the playground). First noticed [in relation to async functions on u.rl.o](https://users.rust-lang.org/t/mutexguard-cannot-be-sent-inside-future-generator/21584?u=nemo157). <!-- TRIAGEBOT_START --> <!-- TRIAGEBOT_ASSIGN_START --> <!-- TRIAGEBOT_ASSIGN_DATA_START$${"user":"eholk"}$$TRIAGEBOT_ASSIGN_DATA_END --> <!-- TRIAGEBOT_ASSIGN_END --> <!-- TRIAGEBOT_END -->