about summary refs log tree commit diff
path: root/src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-12-24 14:40:33 +0000
committerbors <bors@rust-lang.org>2019-12-24 14:40:33 +0000
commitf6dca76be55dd6bb8d0d7d3b6bc39ae8373db506 (patch)
tree7a11fc8bb67b4bdcdc6c49860d1f41381411f64f /src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs
parent84d8f9ddd3819501735d30b3c584c6935ef6c9da (diff)
parent811bdeee002827fbc950ac52a6175e933567823c (diff)
downloadrust-f6dca76be55dd6bb8d0d7d3b6bc39ae8373db506.tar.gz
rust-f6dca76be55dd6bb8d0d7d3b6bc39ae8373db506.zip
Auto merge of #66221 - ohadravid:doc-constants, r=Dylan-DPC
Show the actual value of constant values in the documentation

Fixes #66099, making rustdoc show evaluated constant scalar values.

![image](https://user-images.githubusercontent.com/2358365/68474827-c7a95e80-0226-11ea-818a-ded7bbff861f.png)

where `main.rs` is
```
pub const VAL3: i32 = i32::max_value();
pub const VAL4: i32 = i32::max_value() - 1;
```

As a fallback, when a constant value is not evaluated (either because of an error or because it isn't a scalar), the original expression is used for consistency.

I mimicked the way min/max values of integers are [`pretty_print`ed](https://github.com/rust-lang/rust/blob/master/src/librustc/ty/print/pretty.rs#L900), to show both the value a the "hint". While a little goofy for `std`, in user crates I think it's actually rather helpful.
Diffstat (limited to 'src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs')
0 files changed, 0 insertions, 0 deletions