about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorCorey Richardson <corey@octayn.net>2014-12-05 10:07:41 -0800
committerCorey Richardson <corey@octayn.net>2014-12-05 10:07:41 -0800
commit33e96be29919be817d78eb932b58c237ac507ea6 (patch)
tree4e8a8b9381cc230816cf778fd3eb1d947668e661 /src/rustllvm/RustWrapper.cpp
parenta8c1812f365c3b7466536f57d4eb745a90ca31e9 (diff)
parent2e1911b47ae5a4fd8cf4c4a98e739666f99daf82 (diff)
downloadrust-33e96be29919be817d78eb932b58c237ac507ea6.tar.gz
rust-33e96be29919be817d78eb932b58c237ac507ea6.zip
rollup merge of #19512: cybergeek94/master
Added the example from [this Reddit thread][1], reworked to be more robust with correct logic (first link skipped the 0th and 1st Fibonacci numbers, second forgot about the last two valid values before overflow). Will yield all Fibonacci numbers sequentially in the range `[0, <u32 as Int>::max_value())`.

If the example is too complicated I can change it to a more naive version, perhaps using signed integers to check for overflow instead of `Option` and `.checked_add()`.

Also reworded the doc comments to clarify the usage and behavior of `Unfold`, as the thread suggested that it wasn't really clear how `Unfold` worked and when one should use it.

This change is in the `core` crate but I based the example on `std` since that's where most readers will find the example. I included a note about `core` for clarity. Edit: removed.

Tested with `rustdoc src/libcore/lib.rs`. Rebased against latest master as of the creation of this PR.

[1]: http://www.reddit.com/r/rust/comments/2ny8r1/a_question_about_loops/cmighu4?context=10000
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions