File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
compiler/rustc_middle/src/mir Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -821,6 +821,11 @@ pub enum TerminatorKind<'tcx> {
821821 /// continues at the `resume` basic block, with the second argument written to the `resume_arg`
822822 /// place. If the coroutine is dropped before then, the `drop` basic block is invoked.
823823 ///
824+ /// Note that coroutines can be (unstably) cloned under certain conditions, which means that
825+ /// this terminator can **return multiple times**! MIR optimizations that reorder code into
826+ /// different basic blocks needs to be aware of that.
827+ /// See <https://github.com/rust-lang/rust/issues/95360>.
828+ ///
824829 /// Not permitted in bodies that are not coroutine bodies, or after coroutine lowering.
825830 ///
826831 /// **Needs clarification**: What about the evaluation order of the `resume_arg` and `value`?
Original file line number Diff line number Diff line change 11//@compile-flags: --diagnostic-width=300
22// gate-test-coroutine_clone
33// Verifies that static coroutines cannot be cloned/copied.
4+ // This is important: the cloned coroutine would reference state of the original
5+ // coroutine, leading to semantic nonsense.
46
57#![ feature( coroutines, coroutine_clone, stmt_expr_attributes) ]
68
You can’t perform that action at this time.
0 commit comments