Strange behaviour with multiple channels caused by illegal pattern-bindings
I would expect the following code: https://gist.github.com/4688550
to print (Left | Right): Some(0|1|2) in an infinite loop.
It only prints Some(0) and Some(2).
Removing the right channels causes Some(0), Some(1) and Some(2) to all be printed as expected.
Getting rid of the try_recv() on the right port doesn't get rid of the problem.
I'm not sure if it helps, but this is on the master branch from the end of December. It doesn't look like there have been any big changes to pipes since then.
The crashing thing seems to have just been from using try_recv() on an empty channel, so it's just the fact that Some(1) isn't getting printed that's weird.
Also, it only seems to affect spawn, spawn_sched works fine. Makes me think that fixing #4419 should fix this too.
This code is unsound because the spawn closures are making incorrect copies of the ports and channels as in #4679. Mapping those pairs from &(Port, Chan) to Port looks buggy too. Neither Port nor Chan are copyable types, so they must be moved around (or shared and cloned with SharedChan). I expect this not to compile on incoming, but I am interested in whether or not an adapted version continues to exhibit problems.
I believe the &-patterns are a known soundness hole that allow copying noncopyables. Removing the infinite loop at the end causes the vector, which has illegal copies of the ports/chans in it, to double-destruct them. #3235 will make this illegal; closing.