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

Use associated numeric consts in documentation #69860

Merged
merged 3 commits into from
Apr 3, 2020

Conversation

faern
Copy link
Contributor

@faern faern commented Mar 9, 2020

Now when the associated constants on int/float types are stabilized and the recommended way of accessing said constants (#68952). We can start using it in this repository, and recommend it via documentation example code.

This PR is the reincarnation of #67913 minus the actual adding + stabilization of said constants. (EDIT: Now it's only changing the documentation. So users will see the new consts, but we don't yet update the internal code)

Because of how fast bit rot happens to PRs that touch this many files, it does not try to replace 100% of the old usage of the constants in the entire repo, but a good chunk of them.

@rust-highfive
Copy link
Collaborator

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.
2020-03-09T16:35:44.8045460Z Prepare build directory.
2020-03-09T16:35:44.8368176Z Set build variables.
2020-03-09T16:35:44.8400756Z Download all required tasks.
2020-03-09T16:35:44.8515159Z Downloading task: Bash (3.163.1)
2020-03-09T16:35:45.8287256Z Checking job knob settings.
2020-03-09T16:35:45.8307719Z Finished checking job knob settings.
2020-03-09T16:35:45.8843186Z ##[section]Finishing: Initialize job
2020-03-09T16:35:45.9166902Z ##[section]Starting: Configure Job Name
2020-03-09T16:35:45.9383578Z ==============================================================================
2020-03-09T16:35:45.9384284Z Task         : Bash
---
2020-03-09T16:35:47.2840491Z ========================== Starting Command Output ===========================
2020-03-09T16:35:47.2843442Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/95bf42f9-4174-4335-a72f-852c0e0f37d8.sh
2020-03-09T16:35:47.2843778Z 
2020-03-09T16:35:47.2848421Z ##[section]Finishing: Disable git automatic line ending conversion
2020-03-09T16:35:47.2871871Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69860/merge to s
2020-03-09T16:35:47.2875666Z Task         : Get sources
2020-03-09T16:35:47.2876046Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-09T16:35:47.2876410Z Version      : 1.0.0
2020-03-09T16:35:47.2876660Z Author       : Microsoft
---
2020-03-09T16:35:48.2966656Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-03-09T16:35:48.2971842Z ##[command]git config gc.auto 0
2020-03-09T16:35:48.2975397Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-03-09T16:35:48.2979080Z ##[command]git config --get-all http.proxy
2020-03-09T16:35:48.2984897Z ##[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/69860/merge:refs/remotes/pull/69860/merge
---
2020-03-09T17:29:48.4533123Z .................................................................................................... 1700/9754
2020-03-09T17:29:52.5535073Z .................................................................................................... 1800/9754
2020-03-09T17:30:03.1470126Z ...........................................................i........................................ 1900/9754
2020-03-09T17:30:09.9574798Z .................................................................................................... 2000/9754
2020-03-09T17:30:22.7605099Z .................................................iiiii.............................................. 2100/9754
2020-03-09T17:30:31.9349661Z .................................................................................................... 2300/9754
2020-03-09T17:30:33.9190168Z .................................................................................................... 2400/9754
2020-03-09T17:30:36.9651145Z .................................................................................................... 2500/9754
2020-03-09T17:30:56.7729975Z .................................................................................................... 2600/9754
---
2020-03-09T17:33:24.7822419Z ....................i...............i............................................................... 5000/9754
2020-03-09T17:33:33.6843819Z .................................................................................................... 5100/9754
2020-03-09T17:33:38.7969705Z ...............................................................i.................................... 5200/9754
2020-03-09T17:33:44.7111799Z .................................................................................................... 5300/9754
2020-03-09T17:33:52.8797597Z ............................................ii.ii........i...i...................................... 5400/9754
2020-03-09T17:34:00.2179282Z .................................................................................................... 5600/9754
2020-03-09T17:34:08.8665967Z .................................................................................................... 5700/9754
2020-03-09T17:34:15.0198700Z ...................................i................................................................ 5800/9754
2020-03-09T17:34:20.3550343Z .................................................................................................... 5900/9754
2020-03-09T17:34:20.3550343Z .................................................................................................... 5900/9754
2020-03-09T17:34:29.9894768Z .................................................................................................... 6000/9754
2020-03-09T17:34:38.6889308Z ............................ii...i..ii...........i.................................................. 6100/9754
2020-03-09T17:34:54.7480259Z .................................................................................................... 6300/9754
2020-03-09T17:34:57.9447693Z .................................................................................................... 6400/9754
2020-03-09T17:34:57.9447693Z .................................................................................................... 6400/9754
2020-03-09T17:35:03.6725591Z ...........................................................i..ii.................................... 6500/9754
2020-03-09T17:35:27.3684961Z .................................................................................................... 6700/9754
2020-03-09T17:35:30.4554672Z .....................................................i.............................................. 6800/9754
2020-03-09T17:35:32.3363995Z .................................................................................................... 6900/9754
2020-03-09T17:35:34.2607150Z ....................................................................................i............... 7000/9754
---
2020-03-09T17:36:59.1185094Z .................................................................................................... 7600/9754
2020-03-09T17:37:03.5968548Z .................................................................................................... 7700/9754
2020-03-09T17:37:08.1712596Z .................................................................................................... 7800/9754
2020-03-09T17:37:12.5175712Z .................................................................................................... 7900/9754
2020-03-09T17:37:18.8630917Z ..................................iF................................................................ 8000/9754
2020-03-09T17:37:27.0550748Z ...................................................................................iiiiiiiiii..i.... 8100/9754
2020-03-09T17:37:41.3654380Z ...........................i......i................................................................. 8300/9754
2020-03-09T17:37:45.7857172Z .................................................................................................... 8400/9754
2020-03-09T17:37:56.0648092Z .................................................................................................... 8500/9754
2020-03-09T17:38:06.7193413Z .................................................................................................... 8600/9754
---
2020-03-09T17:39:51.8643778Z 
2020-03-09T17:39:51.8644700Z ---- [ui] ui/rfc-2627-raw-dylib/link-ordinal-too-large.rs stdout ----
2020-03-09T17:39:51.8644979Z diff of stderr:
2020-03-09T17:39:51.8645109Z 
2020-03-09T17:39:51.8645332Z 12 LL |     #[link_ordinal(18446744073709551616)]
2020-03-09T17:39:51.8645832Z 14    |
2020-03-09T17:39:51.8646298Z -    = note: the value may not exceed `std::usize::MAX`
2020-03-09T17:39:51.8646667Z +    = note: the value may not exceed `usize::MAX`
2020-03-09T17:39:51.8646897Z 16 
2020-03-09T17:39:51.8646897Z 16 
2020-03-09T17:39:51.8647108Z 17 error: aborting due to previous error
2020-03-09T17:39:51.8647302Z 18 
2020-03-09T17:39:51.8647405Z 
2020-03-09T17:39:51.8647505Z 
2020-03-09T17:39:51.8647723Z The actual stderr differed from the expected stderr.
2020-03-09T17:39:51.8648456Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large/link-ordinal-too-large.stderr
2020-03-09T17:39:51.8649135Z To update references, rerun the tests and pass the `--bless` flag
2020-03-09T17:39:51.8649783Z To only update this specific test, also pass `--test-args rfc-2627-raw-dylib/link-ordinal-too-large.rs`
2020-03-09T17:39:51.8650254Z error: 1 errors occurred comparing output.
2020-03-09T17:39:51.8650503Z status: exit code: 1
2020-03-09T17:39:51.8650503Z status: exit code: 1
2020-03-09T17:39:51.8655456Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-A" "unused" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large/auxiliary"
2020-03-09T17:39:51.8657291Z ------------------------------------------
2020-03-09T17:39:51.8657467Z 
2020-03-09T17:39:51.8657846Z ------------------------------------------
2020-03-09T17:39:51.8658049Z stderr:
---
2020-03-09T17:39:51.8660252Z    |            ^^^^^^^^^
2020-03-09T17:39:51.8660418Z    |
2020-03-09T17:39:51.8660658Z    = note: `#[warn(incomplete_features)]` on by default
2020-03-09T17:39:51.8660858Z 
2020-03-09T17:39:51.8663251Z error: ordinal value in `link_ordinal` is too large: `18446744073709551616`
2020-03-09T17:39:51.8664310Z    |
2020-03-09T17:39:51.8664310Z    |
2020-03-09T17:39:51.8664519Z LL |     #[link_ordinal(18446744073709551616)]
2020-03-09T17:39:51.8665009Z    |
2020-03-09T17:39:51.8665238Z    = note: the value may not exceed `usize::MAX`
2020-03-09T17:39:51.8665442Z 
2020-03-09T17:39:51.8665638Z error: aborting due to previous error
---
2020-03-09T17:39:51.8668971Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:348:22
2020-03-09T17:39:51.8669385Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2020-03-09T17:39:51.8669616Z 
2020-03-09T17:39:51.8669713Z 
2020-03-09T17:39:51.8673514Z 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" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-7/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" "7.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2020-03-09T17:39:51.8677132Z 
2020-03-09T17:39:51.8677253Z 
2020-03-09T17:39:51.8677516Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2020-03-09T17:39:51.8677840Z Build completed unsuccessfully in 0:58:40
2020-03-09T17:39:51.8677840Z Build completed unsuccessfully in 0:58:40
2020-03-09T17:39:51.8733954Z == clock drift check ==
2020-03-09T17:39:51.8753079Z   local time: Mon Mar  9 17:39:51 UTC 2020
2020-03-09T17:39:52.1641615Z   network time: Mon, 09 Mar 2020 17:39:52 GMT
2020-03-09T17:39:52.1648629Z == end clock drift check ==
2020-03-09T17:39:52.8357231Z 
2020-03-09T17:39:52.8439471Z ##[error]Bash exited with code '1'.
2020-03-09T17:39:52.8451863Z ##[section]Finishing: Run build
2020-03-09T17:39:52.8502053Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69860/merge to s
2020-03-09T17:39:52.8507162Z Task         : Get sources
2020-03-09T17:39:52.8507505Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-09T17:39:52.8507839Z Version      : 1.0.0
2020-03-09T17:39:52.8508058Z Author       : Microsoft
2020-03-09T17:39:52.8508058Z Author       : Microsoft
2020-03-09T17:39:52.8508404Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-03-09T17:39:52.8508826Z ==============================================================================
2020-03-09T17:39:53.1628584Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-03-09T17:39:53.1672805Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/69860/merge to s
2020-03-09T17:39:53.1755550Z Cleaning up task key
2020-03-09T17:39:53.1756793Z Start cleaning up orphan processes.
2020-03-09T17:39:53.1913434Z Terminate orphan process: pid (4103) (python)
2020-03-09T17:39:53.2148572Z ##[section]Finishing: Finalize Job

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 @rust-lang/infra. (Feature Requests)

src/liballoc/rc.rs Outdated Show resolved Hide resolved
@rust-highfive
Copy link
Collaborator

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.
2020-03-09T21:06:54.0214892Z Prepare build directory.
2020-03-09T21:06:54.0484074Z Set build variables.
2020-03-09T21:06:54.0512121Z Download all required tasks.
2020-03-09T21:06:54.0608080Z Downloading task: Bash (3.163.1)
2020-03-09T21:06:54.7561716Z Checking job knob settings.
2020-03-09T21:06:54.7578390Z Finished checking job knob settings.
2020-03-09T21:06:54.8058135Z ##[section]Finishing: Initialize job
2020-03-09T21:06:54.8344170Z ##[section]Starting: Configure Job Name
2020-03-09T21:06:54.8559885Z ==============================================================================
2020-03-09T21:06:54.8560648Z Task         : Bash
---
2020-03-09T21:06:56.2241350Z ========================== Starting Command Output ===========================
2020-03-09T21:06:56.2243859Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/ab688191-f7e7-4bd2-b31a-d09b1b636c90.sh
2020-03-09T21:06:56.2244128Z 
2020-03-09T21:06:56.2248243Z ##[section]Finishing: Disable git automatic line ending conversion
2020-03-09T21:06:56.2264792Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69860/merge to s
2020-03-09T21:06:56.2267600Z Task         : Get sources
2020-03-09T21:06:56.2267873Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-09T21:06:56.2268082Z Version      : 1.0.0
2020-03-09T21:06:56.2268223Z Author       : Microsoft
---
2020-03-09T21:06:57.2353250Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-03-09T21:06:57.2360226Z ##[command]git config gc.auto 0
2020-03-09T21:06:57.2364003Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-03-09T21:06:57.2368171Z ##[command]git config --get-all http.proxy
2020-03-09T21:06:57.2374668Z ##[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/69860/merge:refs/remotes/pull/69860/merge
---
2020-03-09T21:56:44.1640865Z .................................................................................................... 1700/9754
2020-03-09T21:56:47.7421954Z .................................................................................................... 1800/9754
2020-03-09T21:56:56.9181906Z ...........................................................i........................................ 1900/9754
2020-03-09T21:57:03.0678530Z .................................................................................................... 2000/9754
2020-03-09T21:57:14.4068593Z .................................................iiiii.............................................. 2100/9754
2020-03-09T21:57:22.3836953Z .................................................................................................... 2300/9754
2020-03-09T21:57:24.0553898Z .................................................................................................... 2400/9754
2020-03-09T21:57:26.6333742Z .................................................................................................... 2500/9754
2020-03-09T21:57:43.8406715Z .................................................................................................... 2600/9754
---
2020-03-09T21:59:49.2326240Z ....................i...............i............................................................... 5000/9754
2020-03-09T21:59:56.9455159Z .................................................................................................... 5100/9754
2020-03-09T22:00:01.4114935Z ...............................................................i.................................... 5200/9754
2020-03-09T22:00:06.9206108Z .................................................................................................... 5300/9754
2020-03-09T22:00:14.8754717Z ............................................ii.ii........i...i...................................... 5400/9754
2020-03-09T22:00:21.5984842Z .................................................................................................... 5600/9754
2020-03-09T22:00:29.3223588Z .................................................................................................... 5700/9754
2020-03-09T22:00:34.9841323Z ...................................i................................................................ 5800/9754
2020-03-09T22:00:39.8398942Z .................................................................................................... 5900/9754
2020-03-09T22:00:39.8398942Z .................................................................................................... 5900/9754
2020-03-09T22:00:48.6512860Z .................................................................................................... 6000/9754
2020-03-09T22:00:56.4555073Z ............................ii...i..ii...........i.................................................. 6100/9754
2020-03-09T22:01:10.2730978Z .................................................................................................... 6300/9754
2020-03-09T22:01:15.6828557Z .................................................................................................... 6400/9754
2020-03-09T22:01:15.6828557Z .................................................................................................... 6400/9754
2020-03-09T22:01:25.2623769Z ...........................................................i..ii.................................... 6500/9754
2020-03-09T22:01:49.9208827Z .................................................................................................... 6700/9754
2020-03-09T22:01:52.5711983Z .....................................................i.............................................. 6800/9754
2020-03-09T22:01:54.1633439Z .................................................................................................... 6900/9754
2020-03-09T22:01:55.7742406Z ....................................................................................i............... 7000/9754
---
2020-03-09T22:03:15.5760186Z .................................................................................................... 7700/9754
2020-03-09T22:03:18.7513027Z .................................................................................................... 7800/9754
2020-03-09T22:03:23.5369807Z .................................................................................................... 7900/9754
2020-03-09T22:03:29.1421606Z ..................................i................................................................. 8000/9754
2020-03-09T22:03:36.3759908Z ...................................................................................iiiiiiiiii.i..... 8100/9754
2020-03-09T22:03:49.7225125Z ...........................i......i................................................................. 8300/9754
2020-03-09T22:03:53.8446370Z .................................................................................................... 8400/9754
2020-03-09T22:04:03.3770470Z .................................................................................................... 8500/9754
2020-03-09T22:04:13.2832009Z .................................................................................................... 8600/9754
---
2020-03-09T22:06:10.9832929Z  finished in 6.839
2020-03-09T22:06:10.9977168Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-03-09T22:06:11.1227717Z 
2020-03-09T22:06:11.1228880Z running 179 tests
2020-03-09T22:06:13.6361701Z iiii......i...........ii..iiii....i....i...........i............i..i..................i....i........ 100/179
2020-03-09T22:06:15.5483856Z ....i.i.i...iii..iiiiiiiiiiiiiiii.......................iii............ii......
2020-03-09T22:06:15.5486498Z 
2020-03-09T22:06:15.5491249Z  finished in 4.551
2020-03-09T22:06:15.5640101Z Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-03-09T22:06:15.6852071Z 
---
2020-03-09T22:06:17.2987592Z  finished in 1.734
2020-03-09T22:06:17.3130348Z Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-03-09T22:06:17.4319874Z 
2020-03-09T22:06:17.4320067Z running 9 tests
2020-03-09T22:06:17.4323193Z iiiiiiiii
2020-03-09T22:06:17.4323981Z 
2020-03-09T22:06:17.4326794Z  finished in 0.119
2020-03-09T22:06:17.4500825Z Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-03-09T22:06:17.5740923Z 
---
2020-03-09T22:06:34.4121519Z  finished in 16.962
2020-03-09T22:06:34.4297191Z Check compiletest suite=debuginfo mode=debuginfo (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-03-09T22:06:34.5519572Z 
2020-03-09T22:06:34.5520017Z running 115 tests
2020-03-09T22:06:45.8364510Z iiiii..i.....i..i...i..i.i.i..i..i..ii....i.i....ii..........iiii.........i.....i..i.......ii.i.ii.. 100/115
2020-03-09T22:06:47.3348859Z ...iiii.....ii.
2020-03-09T22:06:47.3355007Z 
2020-03-09T22:06:47.3358451Z  finished in 12.905
2020-03-09T22:06:47.3359173Z Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-03-09T22:06:47.3361899Z Copying stage2 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
---
2020-03-09T22:16:29.2588572Z    Compiling core v0.0.0 (/checkout/src/libcore)
2020-03-09T22:16:30.6864492Z error[E0425]: cannot find value `umax` in this scope
2020-03-09T22:16:30.6868695Z     --> src/libcore/../libcore/tests/iter.rs:2282:21
2020-03-09T22:16:30.6869159Z      |
2020-03-09T22:16:30.6877324Z 2282 |     assert_eq!((0..=umax - 1).size_hint(), (usize::MAX, Some(usize::MAX)));
2020-03-09T22:16:30.6878367Z 
2020-03-09T22:16:30.6878745Z error[E0425]: cannot find value `umax` in this scope
2020-03-09T22:16:30.6879264Z     --> src/libcore/../libcore/tests/iter.rs:2283:21
2020-03-09T22:16:30.6879668Z      |
2020-03-09T22:16:30.6879668Z      |
2020-03-09T22:16:30.6880189Z 2283 |     assert_eq!((0..=umax).size_hint(), (usize::MAX, None));
2020-03-09T22:16:30.6881152Z 
2020-03-09T22:16:30.6886214Z error[E0425]: cannot find value `umax` in this scope
2020-03-09T22:16:30.6886732Z     --> src/libcore/../libcore/tests/iter.rs:2284:21
2020-03-09T22:16:30.6887144Z      |
2020-03-09T22:16:30.6887144Z      |
2020-03-09T22:16:30.6887673Z 2284 |     assert_eq!((0..=umax + 1).size_hint(), (usize::MAX, None));
2020-03-09T22:16:30.6888646Z 
2020-03-09T22:16:39.0014319Z error: aborting due to 3 previous errors
2020-03-09T22:16:39.0014915Z 
2020-03-09T22:16:39.0015557Z For more information about this error, try `rustc --explain E0425`.
---
2020-03-09T22:16:39.0250393Z   local time: Mon Mar  9 22:16:39 UTC 2020
2020-03-09T22:16:39.3144593Z   network time: Mon, 09 Mar 2020 22:16:39 GMT
2020-03-09T22:16:39.3146934Z == end clock drift check ==
2020-03-09T22:16:39.7411309Z 
2020-03-09T22:16:39.7478644Z ##[error]Bash exited with code '1'.
2020-03-09T22:16:39.7492667Z ##[section]Finishing: Run build
2020-03-09T22:16:39.7571183Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69860/merge to s
2020-03-09T22:16:39.7575129Z Task         : Get sources
2020-03-09T22:16:39.7575554Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-09T22:16:39.7575806Z Version      : 1.0.0
2020-03-09T22:16:39.7576000Z Author       : Microsoft
2020-03-09T22:16:39.7576000Z Author       : Microsoft
2020-03-09T22:16:39.7576278Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-03-09T22:16:39.7576773Z ==============================================================================
2020-03-09T22:16:40.0374478Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-03-09T22:16:40.0409500Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/69860/merge to s
2020-03-09T22:16:40.0484367Z Cleaning up task key
2020-03-09T22:16:40.0485383Z Start cleaning up orphan processes.
2020-03-09T22:16:40.0631162Z Terminate orphan process: pid (3847) (python)
2020-03-09T22:16:40.0822793Z ##[section]Finishing: Finalize Job

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 @rust-lang/infra. (Feature Requests)

@JohnTitor JohnTitor added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 15, 2020
@bors
Copy link
Contributor

bors commented Mar 19, 2020

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

@faern faern changed the title Use associated numeric consts Use associated numeric consts in documentation Mar 27, 2020
@faern
Copy link
Contributor Author

faern commented Mar 27, 2020

I made this PR smaller and only focus on the most important parts: Documentation. Showing users the recommended way to write new code. Updating internal usage of the old way of reaching the constants can be done later. The important part is that we are consistent and up to date when users read documentation to try to learn how to do stuff.

There is a separate PR on the stdarch repo (rust-lang/stdarch#843) which I bump in this PR. Please tell me if this is not the correct procedure to get a submodule updated here.

@bors
Copy link
Contributor

bors commented Mar 29, 2020

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

@faern
Copy link
Contributor Author

faern commented Mar 29, 2020

Fixed the conflict and dropping the bump in stdarch in hope that unblocks reviewing this PR and as a result hopefully makes it merge faster.

@bors
Copy link
Contributor

bors commented Apr 3, 2020

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

@faern
Copy link
Contributor Author

faern commented Apr 3, 2020

Fixed the new collisions. Reassigning to @dtolnay since they reviewed and approved the initial stabilization of these constants.

r? @dtolnay

@faern
Copy link
Contributor Author

faern commented Apr 3, 2020

Seems like I can't do that... Anyway, it would be awesome to get a small docs PR merged before something else collides with it again. The closer to stabilization of the feature we can make the docs up to date the better. @sfackler

Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dtolnay
Copy link
Member

dtolnay commented Apr 3, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Apr 3, 2020

📌 Commit c831265 has been approved by dtolnay

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 3, 2020
@dtolnay
Copy link
Member

dtolnay commented Apr 3, 2020

I would also be happy to accept the non-doc cases of this in a separate PR.

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 3, 2020
Use associated numeric consts in documentation

Now when the associated constants on int/float types are stabilized and the recommended way of accessing said constants (rust-lang#68952). We can start using it in this repository, and recommend it via documentation example code.

This PR is the reincarnation of rust-lang#67913 minus the actual adding + stabilization of said constants. (EDIT: Now it's only changing the documentation. So users will see the new consts, but we don't yet update the internal code)

Because of how fast bit rot happens to PRs that touch this many files, it does not try to replace 100% of the old usage of the constants in the entire repo, but a good chunk of them.
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 3, 2020
Rollup of 9 pull requests

Successful merges:

 - rust-lang#69860 (Use associated numeric consts in documentation)
 - rust-lang#70576 (Update the description of the ticket to point at RFC 1721)
 - rust-lang#70597 (Fix double-free and undefined behaviour in libstd::syn::unix::Thread::new)
 - rust-lang#70640 (Hide `task_context` when lowering body)
 - rust-lang#70641 (Remove duplicated code in trait selection)
 - rust-lang#70707 (Remove unused graphviz emitter)
 - rust-lang#70720 (Place TLS initializers with relocations in .tdata)
 - rust-lang#70735 (Clean up E0502 explanation)
 - rust-lang#70741 (Add test for rust-lang#59023)

Failed merges:

r? @ghost
@bors bors merged commit 9b22fdc into rust-lang:master Apr 3, 2020
@faern faern deleted the use-assoc-int-consts branch April 4, 2020 15:10
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 5, 2020
Don't import integer and float modules, use assoc consts

Stop importing the standard library integer and float modules to reach the `MIN`, `MAX` and other constants. They are available directly on the primitive types now.

This PR is a follow up of rust-lang#69860 which made sure we use the new constants in documentation.

This type of change touches a lot of files, and previously all my assoc int consts PRs had collisions and were accepted only after a long delay. So I'd prefer to do it in smaller steps now. Just removing these imports seem like a good next step.

r? @dtolnay
Centril added a commit to Centril/rust that referenced this pull request Apr 5, 2020
…lnay

Stop importing the float modules in documentation

Follow up to rust-lang#69860. I realized I had not searched for and fixed this for the float values. So with this PR they also use the associated constants instead of the module level constants.

For the documentation where it also was using the `consts` submodule I opted to change it to import that directly. This becomes more in line with how other docs that use the `consts` submodule looks. And it also makes it so there are not two `f32` or `f64` things in the current namespace (both the module and the primitive type) and then hopefully confusing documentation readers less.

r? @dtolnay
bors added a commit to rust-lang/rust-clippy that referenced this pull request Apr 8, 2020
Use assoc int and float consts instead of module level ones

changelog: Recommend primitive type associated constants instead of module level constants

In Rust 1.43 integer and float primitive types will have a number of new associated constants. For example `MAX`, `MIN` and a number of constants related to the machine representation of floats. rust-lang/rust#68952

These new constants are preferred over the module level constants in `{core,std}::{f*, u*, i*}`. I have in the last few days made sure that the documentation in the main rust repository uses the new constants in every place I could find (rust-lang/rust#69860, rust-lang/rust#70782). So the next step is naturally to make the linter recommend the new constants as well.

This PR only changes two lints. There are more. But I did not want the PR to be too big. And since I have not contributed to clippy before it felt saner to start with a small PR so I see if there are any quirks. More will come later.
@dtolnay dtolnay assigned dtolnay and unassigned sfackler Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants