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

Thanks to @huonw for some mentoring. :cake: