Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show the actual value of constant values in the documentation #66221

Merged
merged 1 commit into from Dec 24, 2019

Conversation

@ohadravid
Copy link
Contributor

ohadravid commented Nov 8, 2019

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

image

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_printed, to show both the value a the "hint". While a little goofy for std, in user crates I think it's actually rather helpful.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Nov 8, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-11-08T13:50:12.2822827Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-11-08T13:50:12.2995793Z ##[command]git config gc.auto 0
2019-11-08T13:50:12.3073509Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-11-08T13:50:12.3132033Z ##[command]git config --get-all http.proxy
2019-11-08T13:50:12.3262461Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/66221/merge:refs/remotes/pull/66221/merge
---
2019-11-08T14:47:02.2531339Z .................................................................................................... 1600/9290
2019-11-08T14:47:07.4513248Z .................................................................................................... 1700/9290
2019-11-08T14:47:18.9411872Z .................................................................i.................................. 1800/9290
2019-11-08T14:47:26.2739181Z .................................................................................................... 1900/9290
2019-11-08T14:47:39.8231203Z .................................................iiiii.............................................. 2000/9290
2019-11-08T14:47:49.5313615Z .................................................................................................... 2200/9290
2019-11-08T14:47:51.7929660Z .................................................................................................... 2300/9290
2019-11-08T14:47:55.1814611Z .................................................................................................... 2400/9290
2019-11-08T14:48:16.4622569Z .................................................................................................... 2500/9290
---
2019-11-08T14:50:47.0906664Z .............................................i...............i...................................... 4800/9290
2019-11-08T14:50:54.8868623Z .................................................................................................... 4900/9290
2019-11-08T14:51:02.2145734Z .................................................................................................... 5000/9290
2019-11-08T14:51:08.0366159Z .................................................................................................... 5100/9290
2019-11-08T14:51:17.2120477Z ...............................................ii.ii...........i.................................... 5200/9290
2019-11-08T14:51:25.9377063Z .................................................................................................... 5400/9290
2019-11-08T14:51:35.4875398Z .................................................................................................... 5500/9290
2019-11-08T14:51:42.1773441Z .............................i...................................................................... 5600/9290
2019-11-08T14:51:48.1245200Z .................................................................................................... 5700/9290
2019-11-08T14:51:48.1245200Z .................................................................................................... 5700/9290
2019-11-08T14:51:59.1723718Z .................................................................................................... 5800/9290
2019-11-08T14:52:09.8264266Z ..............ii...i..ii...........i................................................................ 5900/9290
2019-11-08T14:52:25.2298239Z .................................................................................................... 6100/9290
2019-11-08T14:52:28.9388218Z .................................................................................................... 6200/9290
2019-11-08T14:52:28.9388218Z .................................................................................................... 6200/9290
2019-11-08T14:52:41.5270497Z .................................i..ii.............................................................. 6300/9290
2019-11-08T14:53:00.8250615Z .................................................................................................... 6500/9290
2019-11-08T14:53:02.7373709Z .i.................................................................................................. 6600/9290
2019-11-08T14:53:04.7784187Z .....................................................................................i.............. 6700/9290
2019-11-08T14:53:07.2392472Z .................................................................................................... 6800/9290
---
2019-11-08T14:58:00.3388608Z  finished in 5.208
2019-11-08T14:58:00.3560094Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-11-08T14:58:00.5093771Z 
2019-11-08T14:58:00.5094471Z running 156 tests
2019-11-08T14:58:03.2483308Z iiii....iii......iii..iiii...i.............................i..i..................i....i...........ii 100/156
2019-11-08T14:58:05.0679503Z .i.i..ii.ii.............i.........iii.i.........ii......
2019-11-08T14:58:05.0680744Z 
2019-11-08T14:58:05.0686105Z  finished in 4.712
2019-11-08T14:58:05.0874172Z Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-11-08T14:58:06.1431691Z 
---
2019-11-08T14:58:07.1795869Z  finished in 2.092
2019-11-08T14:58:07.1971331Z Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-11-08T14:58:07.3478891Z 
2019-11-08T14:58:07.3479065Z running 9 tests
2019-11-08T14:58:07.3483324Z iiiiiiiii
2019-11-08T14:58:07.3483990Z 
2019-11-08T14:58:07.3487045Z  finished in 0.151
2019-11-08T14:58:07.3651834Z Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-11-08T14:58:07.5166709Z 
---
2019-11-08T14:58:25.4537232Z  finished in 18.088
2019-11-08T14:58:25.4713530Z Check compiletest suite=debuginfo mode=debuginfo-gdb+lldb (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-11-08T14:58:25.6175623Z 
2019-11-08T14:58:25.6176073Z running 123 tests
2019-11-08T14:58:47.6654578Z .iiiii...i.....i..i...i..i.i.i..i.ii..i.i.....i..i....ii..........iiii..........i...ii...i.......ii. 100/123
2019-11-08T14:58:52.0860508Z i.i.i......iii.i.....ii
2019-11-08T14:58:52.0861136Z 
2019-11-08T14:58:52.0868602Z  finished in 26.615
2019-11-08T14:58:52.0879962Z Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-11-08T14:58:52.0882486Z Copying stage2 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
---
2019-11-08T15:04:57.7470704Z failures:
2019-11-08T15:04:57.7471121Z 
2019-11-08T15:04:57.7471525Z ---- [rustdoc] rustdoc/dont-show-const-contents.rs stdout ----
2019-11-08T15:04:57.7471687Z 
2019-11-08T15:04:57.7471845Z error: htmldocck failed!
2019-11-08T15:04:57.7471983Z status: exit code: 1
2019-11-08T15:04:57.7472444Z command: "/usr/bin/python2.7" "/checkout/src/etc/htmldocck.py" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc/dont-show-const-contents" "/checkout/src/test/rustdoc/dont-show-const-contents.rs"
2019-11-08T15:04:57.7473380Z ------------------------------------------
2019-11-08T15:04:57.7473533Z 
2019-11-08T15:04:57.7473857Z ------------------------------------------
2019-11-08T15:04:57.7474019Z stderr:
2019-11-08T15:04:57.7474019Z stderr:
2019-11-08T15:04:57.7474319Z ------------------------------------------
2019-11-08T15:04:57.7474512Z 4: @!has check failed
2019-11-08T15:04:57.7474643Z  `PATTERN` did not match
2019-11-08T15:04:57.7474978Z  // @!has dont_show_const_contents/constant.CONST_S.html 'dont show this'
2019-11-08T15:04:57.7475292Z Encountered 1 errors
2019-11-08T15:04:57.7475405Z 
2019-11-08T15:04:57.7475729Z ------------------------------------------
2019-11-08T15:04:57.7475874Z 
---
2019-11-08T15:04:57.7483289Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:537:22
2019-11-08T15:04:57.7483551Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-11-08T15:04:57.7489016Z 
2019-11-08T15:04:57.7489256Z 
2019-11-08T15:04:57.7491793Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--rustdoc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "--src-base" "/checkout/src/test/rustdoc" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "rustdoc" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2019-11-08T15:04:57.7492492Z 
2019-11-08T15:04:57.7492634Z 
2019-11-08T15:04:57.7502515Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-11-08T15:04:57.7502755Z Build completed unsuccessfully in 1:08:26
2019-11-08T15:04:57.7502755Z Build completed unsuccessfully in 1:08:26
2019-11-08T15:04:57.7558088Z == clock drift check ==
2019-11-08T15:04:57.7575772Z   local time: Fri Nov  8 15:04:57 UTC 2019
2019-11-08T15:04:58.7540711Z   network time: Fri, 08 Nov 2019 15:04:58 GMT
2019-11-08T15:04:58.7541888Z == end clock drift check ==
2019-11-08T15:05:00.4789219Z 
2019-11-08T15:05:00.4887722Z ##[error]Bash exited with code '1'.
2019-11-08T15:05:00.4944103Z ##[section]Starting: Checkout
2019-11-08T15:05:00.4945588Z ==============================================================================
2019-11-08T15:05:00.4945650Z Task         : Get sources
2019-11-08T15:05:00.4945686Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@ohadravid ohadravid force-pushed the ohadravid:doc-constants branch from fb581b9 to deb4f7a Nov 8, 2019
@GuillaumeGomez

This comment has been minimized.

Copy link
Member

GuillaumeGomez commented Nov 11, 2019

I'm not sure we want this... Why not keeping the original value and putting it into a link to its definition instead?

@ohadravid

This comment has been minimized.

Copy link
Contributor Author

ohadravid commented Nov 11, 2019

The motivating example here is u8::MAX, where clicking on src for it gets you something which isn't very useful.
It's also true for things which are computed (like the i32::max_value() - 1 example).

I saw the tweet and it also happened to me multiple times so I figured I might as well fix it 🙂

Prior art:
C#/VB.Net Int32.MaxValue show the value directly (link), other constants seems to be shown the same way, like Math.PI (link)
JS Number.MAX_VALUE shows the value in the description (link)
Go int64 shows the value in the description of the type (link) and module constants are shown directly as they appear in the source file, like math.Pi (link)

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Nov 14, 2019

☔️ The latest upstream changes (presumably #66233) made this pull request unmergeable. Please resolve the merge conflicts.

@ohadravid ohadravid force-pushed the ohadravid:doc-constants branch 2 times, most recently from 216cfc6 to b14632f Nov 14, 2019
@ollie27

This comment has been minimized.

Copy link
Contributor

ollie27 commented Nov 22, 2019

This is effectively a partial revert of #53409. The reason we stopped showing const values is because of issues like #32735 and #42759. I personally would like to see the calculated values of consts in the docs but it's not clear how best to display them.

@ollie27 ollie27 closed this Nov 22, 2019
@ollie27 ollie27 reopened this Nov 22, 2019
@ohadravid

This comment has been minimized.

Copy link
Contributor Author

ohadravid commented Nov 24, 2019

So in #53409 the problem seems to be over-detail when displaying a module, and this view it's not changed by this PR at all.

For #42759, it's at least somewhat of an improvement because for non-scalar values we will mirror the source. However clearly the author of the issue wanted to see a value for the constant, so not showing anything is kind of a funny fix.

#32735 is an ugly corner case, but I'll argue that there are more "should show the value of" than "should hide the value of" pub consts.

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

GuillaumeGomez commented Nov 25, 2019

I still have issue with this PR: in case it is a mathematical value like PI, why would I want the full number and not the constant PI?

const stuff: f64 = math::PI;
const stuff: f64 = 3.1415;

I strongly prefer the first case. Even more considering that if you really want to see the full number, you can just click on the value...

@ohadravid

This comment has been minimized.

Copy link
Contributor Author

ohadravid commented Nov 26, 2019

What if we showed it like this (approximated html):

<pre>
const stuff: f64 = math::PI;
</pre>

[-] The doc string ...
    ....


[-] Value: 
     <pre>
     3.1415...f32
     </pre>

Where the value part is only added for scalars?

While remaining authentic to the original source code, it'll also solve the problem for std's integers and it provides more information for both cases.

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

GuillaumeGomez commented Nov 27, 2019

Providing the "complete" value as a comment would be fine for me. For example:

const STUFF: f64 = math::pi; /* 3.1415 */
@ohadravid ohadravid force-pushed the ohadravid:doc-constants branch 2 times, most recently from ed5ef16 to 7b9ef3f Nov 28, 2019
@ohadravid

This comment has been minimized.

Copy link
Contributor Author

ohadravid commented Nov 28, 2019

@GuillaumeGomez what do you think about this?

image

It's a little noisy for some values (like EPSILON, because of the E vs e), but I didn't want to do a more complex heuristic for not-showing-values.

src/librustdoc/clean/mod.rs Outdated Show resolved Hide resolved
src/test/rustdoc/show-const-contents.rs Show resolved Hide resolved
@ohadravid ohadravid force-pushed the ohadravid:doc-constants branch from 7b9ef3f to d2d4429 Nov 28, 2019
@GuillaumeGomez

This comment has been minimized.

Copy link
Member

GuillaumeGomez commented Nov 28, 2019

In the first case, since this is already a value, there is no need to add the comment. Can you not provide it in case this is "direct" value? (no idea how to express correctly what I have in mind, I hope people will understand XD)

@ohadravid ohadravid force-pushed the ohadravid:doc-constants branch from 6a89be2 to 5062d47 Nov 29, 2019
@ohadravid

This comment has been minimized.

Copy link
Contributor Author

ohadravid commented Nov 29, 2019

I changed the code to not show the computed value for consts which are literals (or -{literal}), which I think should cut down most of the noise.
However, this check uses the HIR, and so is not available for external crates (and for std that means we can't check it for all the numbered constants).

I implemented a version (diff) which adds the is_literal to the const metadata (in the rendered_const query). However I don't think it's worth the added complexity.

@ohadravid ohadravid force-pushed the ohadravid:doc-constants branch from 5062d47 to de2ff01 Nov 29, 2019
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Nov 29, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-11-29T19:41:59.7065952Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-11-29T19:41:59.7256592Z ##[command]git config gc.auto 0
2019-11-29T19:41:59.7339210Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-11-29T19:41:59.7395229Z ##[command]git config --get-all http.proxy
2019-11-29T19:41:59.7540947Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/66221/merge:refs/remotes/pull/66221/merge
---
2019-11-29T19:48:07.6455943Z Found 0 error codes with no tests
2019-11-29T19:48:07.6456141Z Done!
2019-11-29T19:48:07.6456692Z 
2019-11-29T19:48:07.6456853Z 
2019-11-29T19:48:07.6460663Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor"
2019-11-29T19:48:07.6460863Z 
2019-11-29T19:48:07.6460915Z 
2019-11-29T19:48:07.6460965Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2019-11-29T19:48:07.6461033Z Build completed unsuccessfully in 0:01:30
2019-11-29T19:48:07.6461033Z Build completed unsuccessfully in 0:01:30
2019-11-29T19:48:07.6522098Z == clock drift check ==
2019-11-29T19:48:07.6523517Z   local time: Fri Nov 29 19:48:07 UTC 2019
2019-11-29T19:48:07.6881495Z   network time: Fri, 29 Nov 2019 19:48:07 GMT
2019-11-29T19:48:07.6886511Z == end clock drift check ==
2019-11-29T19:48:09.0671336Z 
2019-11-29T19:48:09.0794770Z ##[error]Bash exited with code '1'.
2019-11-29T19:48:09.0823002Z ##[section]Starting: Checkout
2019-11-29T19:48:09.0825176Z ==============================================================================
2019-11-29T19:48:09.0825236Z Task         : Get sources
2019-11-29T19:48:09.0825271Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@ohadravid ohadravid force-pushed the ohadravid:doc-constants branch from de2ff01 to 4200924 Nov 29, 2019
@GuillaumeGomez

This comment has been minimized.

Copy link
Member

GuillaumeGomez commented Nov 29, 2019

Instead of using HIR to check, can't you compare both displays and if they're the same, not print the comment one?

@ohadravid

This comment has been minimized.

Copy link
Contributor Author

ohadravid commented Nov 29, 2019

This is what the current code does, but it doesn't catch everything (like EPSILON: f32 = 1.19209290e-07_f32; - the zeros don't appear in the evaluated value).
I think this is pretty good! I couldn't find std constants which failed the simpler check (except f32::EPSILON, which I changed).

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

GuillaumeGomez commented Nov 29, 2019

Well I guess you can limit the display to nth first characters or something along the line? But yes, I think we're close to the end. Thanks so much for working on this!

@ohadravid

This comment has been minimized.

Copy link
Contributor Author

ohadravid commented Dec 4, 2019

@GuillaumeGomez I added splitting for big numbers! Let me know what you think.
@ollie27 Do you want me to check anything else?

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

GuillaumeGomez commented Dec 8, 2019

@ohadravid Do you have screenshots by any chance? :)

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 9, 2019

☔️ The latest upstream changes (presumably #66984) made this pull request unmergeable. Please resolve the merge conflicts.

@ohadravid

This comment has been minimized.

Copy link
Contributor Author

ohadravid commented Dec 9, 2019

@ GuillaumeGomez 😄
image

@ohadravid ohadravid force-pushed the ohadravid:doc-constants branch 2 times, most recently from 8f2fd28 to 7a10e20 Dec 9, 2019
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 11, 2019

☔️ The latest upstream changes (presumably #67202) made this pull request unmergeable. Please resolve the merge conflicts.

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

GuillaumeGomez commented Dec 11, 2019

Nice! Well then, unless @ollie27 wants something else to be updated, you can r=me once you have rebased.

@ohadravid ohadravid force-pushed the ohadravid:doc-constants branch from 7a10e20 to ea7b622 Dec 11, 2019
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 23, 2019

☔️ The latest upstream changes (presumably #67540) made this pull request unmergeable. Please resolve the merge conflicts.

@ohadravid ohadravid force-pushed the ohadravid:doc-constants branch from ea7b622 to 53ff21e Dec 23, 2019
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Dec 23, 2019

The job mingw-check of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-12-23T18:43:05.4910429Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-23T18:43:06.4183117Z ##[command]git config gc.auto 0
2019-12-23T18:43:06.4187764Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-23T18:43:06.4191605Z ##[command]git config --get-all http.proxy
2019-12-23T18:43:06.4197699Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/66221/merge:refs/remotes/pull/66221/merge
---
2019-12-23T18:53:42.0812311Z     Checking rustdoc v0.0.0 (/checkout/src/librustdoc)
2019-12-23T18:53:43.7872529Z error[E0599]: no method named `const_eval` found for type `rustc::ty::TyCtxt<'_>` in the current scope
2019-12-23T18:53:43.7873639Z    --> src/librustdoc/clean/utils.rs:491:24
2019-12-23T18:53:43.7874369Z     |
2019-12-23T18:53:43.7874847Z 491 |     let value = cx.tcx.const_eval(param_env.and(cid)).ok().and_then(|value| {
2019-12-23T18:53:43.7875703Z 
2019-12-23T18:53:44.9227392Z error: aborting due to previous error
2019-12-23T18:53:44.9230262Z 
2019-12-23T18:53:44.9235110Z For more information about this error, try `rustc --explain E0599`.
---
2019-12-23T18:53:44.9488616Z   local time: Mon Dec 23 18:53:44 UTC 2019
2019-12-23T18:53:45.2282645Z   network time: Mon, 23 Dec 2019 18:53:45 GMT
2019-12-23T18:53:45.2282722Z == end clock drift check ==
2019-12-23T18:53:46.0874723Z 
2019-12-23T18:53:46.0963155Z ##[error]Bash exited with code '1'.
2019-12-23T18:53:46.0988950Z ##[section]Starting: Checkout
2019-12-23T18:53:46.0991172Z ==============================================================================
2019-12-23T18:53:46.0991231Z Task         : Get sources
2019-12-23T18:53:46.0991279Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@ohadravid ohadravid force-pushed the ohadravid:doc-constants branch from 53ff21e to e398f59 Dec 23, 2019
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Dec 23, 2019

The job x86_64-gnu-llvm-7 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-12-23T20:54:29.1457211Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-23T20:54:29.1468380Z ##[command]git config gc.auto 0
2019-12-23T20:54:29.1470612Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-23T20:54:29.1472326Z ##[command]git config --get-all http.proxy
2019-12-23T20:54:29.1474753Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/66221/merge:refs/remotes/pull/66221/merge

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@ohadravid ohadravid force-pushed the ohadravid:doc-constants branch from e398f59 to 531622a Dec 24, 2019
@ohadravid ohadravid force-pushed the ohadravid:doc-constants branch from 531622a to 811bdee Dec 24, 2019
@ohadravid

This comment has been minimized.

Copy link
Contributor Author

ohadravid commented Dec 24, 2019

ping @ollie27? 🙏

@Dylan-DPC

This comment has been minimized.

Copy link
Member

Dylan-DPC commented Dec 24, 2019

@bors r+ rollup

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 24, 2019

📌 Commit 811bdee has been approved by Dylan-DPC

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 24, 2019

🌲 The tree is currently closed for pull requests below priority 100, this pull request will be tested once the tree is reopened

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 24, 2019

⌛️ Testing commit 811bdee with merge f6dca76...

bors added a commit that referenced this pull request Dec 24, 2019
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.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 24, 2019

☀️ Test successful - checks-azure
Approved by: Dylan-DPC
Pushing f6dca76 to master...

@bors bors added the merged-by-bors label Dec 24, 2019
@bors bors merged commit 811bdee into rust-lang:master Dec 24, 2019
5 checks passed
5 checks passed
homu Test successful
Details
pr Build #20191224.22 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-7) Linux x86_64-gnu-llvm-7 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
@ohadravid ohadravid deleted the ohadravid:doc-constants branch Dec 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
9 participants
You can’t perform that action at this time.