Fixed mistake in "Putting it all together" page in docs#2247
Fixed mistake in "Putting it all together" page in docs#2247parno merged 2 commits intoverus-lang:mainfrom
Conversation
parno
left a comment
There was a problem hiding this comment.
Thanks for catching this! What if we used text like this?
To keep the overflow reasoning simple, we add a precondition to
loop_trianglesaying that the result needs to fit within au32.
I think something like the initial clause is needed to imply that this is a somewhat artificial precondition (we're asking the caller to establish a bound on the final value, but presumably it's calling this function because it doesn't know the actual value!).
I'd also be inclined to simplify the code by replacing < 0x1_0000_0000 with <+ u32::MAX. I think that would make the intent of the property clearer.
What do you think?
|
I agree we should use |
Also reworded doc text per suggestion from @parno.
bd3665d to
9d9eec5
Compare
|
Updated the text per @parno's suggestion and changed the recursion example to use u32::MAX throughout instead of the magic number. This probably should've been an issue not a PR so you could word things how you want, sorry about that. |
|
Thanks for making the updates! I think it looks good now.
No worries -- we appreciate contributions in all forms :) |
|
yes, PRs are a perfectly fine way to iterate on minor changes |
|
Should this use |
yes it should, good catch: #2256 |
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.