doc: forward-port the conditions tutorial + fixup libstd example
auto merge of #10986 : adridu59/rust/patch-new, r=pcwalton

Thanks to @huonw for some mentoring. :cake: