-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Add primitive module to libcore #67637
Conversation
cc @sgrif since you raised the issue |
The job Click to expand the log.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks good to me.
Do we know how these get rendered by rustdoc? If they appear as pub type u8 = U8
then I think it's worth doing something about that before landing. I think ideally it should appear as pub use u8
, similar to how non-doc(inline)
reexports normally appear.
a1a47ed
to
d59e54a
Compare
I've force-pushed an update. It looks like rustdoc currently has a bug (it panics) when it attempts to inline the documentation from a To avoid that, we instead directly include the same primitive file twice via The rendering is as follows in both core and std, unfortunately we do not get hyperlinking to the primitive type docs in either location. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The job Click to expand the log.
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 |
d59e54a
to
7c14f0f
Compare
Hm, actually, now that these are re-exports, direct use is not going to trigger stability lints (e.g., the UI test added by this PR passes without a feature gate). Only We may want to FCP this as an insta-stable addition in that case. |
The job Click to expand the log.
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 |
7c14f0f
to
f5499a9
Compare
The job Click to expand the log.
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 |
LGTM. Insta-stable FCP makes sense to me given the stability bug around
re-exports (I've got an issue opened for this but can't grab a link at the
moment)
…On Thu, Dec 26, 2019 at 4:21 PM Rust highfive robot < ***@***.***> wrote:
The job x86_64-gnu-llvm-7 of your PR failed
<https://dev.azure.com/rust-lang/rust/_build/results?buildId=16883&view=logs&jobId=0230d20d-e0df-5b62-a6ec-fad0f9c3c3d5>
(pretty log
<https://rust-lang.github.io/rust-log-analyzer/log-viewer/#https://dev.azure.com/rust-lang/e71b0ddf-dd27-435a-873c-e30f86eea377/_apis/build/builds/16883/logs/69>,
raw log
<https://dev.azure.com/rust-lang/e71b0ddf-dd27-435a-873c-e30f86eea377/_apis/build/builds/16883/logs/69>).
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-26T22:11:23.3293161Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-26T22:11:23.3499736Z <https://github.com/rust-lang/rust2019-12-26T22:11:23.3499736Z> ##[command]git config gc.auto 0
2019-12-26T22:11:23.3580840Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-26T22:11:23.3644655Z <https://github.com/rust-lang/rust.extraheader2019-12-26T22:11:23.3644655Z> ##[command]git config --get-all http.proxy
2019-12-26T22:11:23.3795182Z ##[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/67637/merge:refs/remotes/pull/67637/merge
---
2019-12-26T23:10:52.8096041Z .................................................................................................... 1600/9456
2019-12-26T23:10:57.2323528Z .................................................................................................... 1700/9456
2019-12-26T23:11:06.0754509Z .............................................................................................i...... 1800/9456
2019-12-26T23:11:13.8418529Z .................................................................................................... 1900/9456
2019-12-26T23:11:20.1797793Z ...............................................................................iiiii................ 2000/9456
2019-12-26T23:11:40.7841922Z .................................................................................................... 2200/9456
2019-12-26T23:11:42.9173717Z .................................................................................................... 2300/9456
2019-12-26T23:11:45.1791860Z .................................................................................................... 2400/9456
2019-12-26T23:11:50.9628990Z .................................................................................................... 2500/9456
---
2019-12-26T23:14:41.6944527Z ..........i...............i......................................................................... 4900/9456
2019-12-26T23:14:51.1608939Z .................................................................................................... 5000/9456
2019-12-26T23:14:56.1167848Z ......................................................i............................................. 5100/9456
2019-12-26T23:15:05.1066329Z .................................................................................................... 5200/9456
2019-12-26T23:15:11.0174261Z .....................ii.ii...........i.............................................................. 5300/9456
2019-12-26T23:15:19.4197634Z .................................................................................................... 5500/9456
2019-12-26T23:15:29.9965126Z .................................................................................................... 5600/9456
2019-12-26T23:15:36.8988941Z ...i................................................................................................ 5700/9456
2019-12-26T23:15:42.3399537Z .................................................................................................... 5800/9456
2019-12-26T23:15:42.3399537Z .................................................................................................... 5800/9456
2019-12-26T23:15:52.2015236Z ...........................................................................................ii...i..i 5900/9456
2019-12-26T23:16:04.3047168Z i...........i....................................................................................... 6000/9456
2019-12-26T23:16:21.1406643Z .................................................................................................... 6200/9456
2019-12-26T23:16:28.1547135Z .................................................................................................... 6300/9456
2019-12-26T23:16:28.1547135Z .................................................................................................... 6300/9456
2019-12-26T23:16:42.7336314Z ..................i..ii............................................................................. 6400/9456
2019-12-26T23:17:01.8645243Z ...............................................................................................i.... 6600/9456
2019-12-26T23:17:03.8713937Z .................................................................................................... 6700/9456
2019-12-26T23:17:05.9324490Z ...............................................................................................i.... 6800/9456
2019-12-26T23:17:08.2984413Z .................................................................................................... 6900/9456
---
2019-12-26T23:18:42.4485967Z .................................................................................................... 7500/9456
2019-12-26T23:18:47.0182093Z .......................................................F............................................ 7600/9456
2019-12-26T23:18:53.3810272Z .................................................................................................... 7700/9456
2019-12-26T23:19:03.2194583Z .................................................................................................... 7800/9456
2019-12-26T23:19:09.4288692Z ..........................iiii...................................................................... 7900/9456
2019-12-26T23:19:23.2720987Z .................................................................................................... 8100/9456
2019-12-26T23:19:32.3203810Z .................................................................................................... 8200/9456
2019-12-26T23:19:45.2634922Z .................................................................................................... 8300/9456
2019-12-26T23:19:51.9624791Z .................................................................................................... 8400/9456
---
2019-12-26T23:21:40.7628630Z 14 --> $DIR/resolve-primitive-fallback.rs:3:5
2019-12-26T23:21:40.7629015Z
2019-12-26T23:21:40.7629209Z
2019-12-26T23:21:40.7629414Z The actual stderr differed from the expected stderr.
2019-12-26T23:21:40.7629977Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/resolve/resolve-primitive-fallback/resolve-primitive-fallback.stderr
2019-12-26T23:21:40.7630529Z To update references, rerun the tests and pass the `--bless` flag
2019-12-26T23:21:40.7631078Z To only update this specific test, also pass `--test-args resolve/resolve-primitive-fallback.rs`
2019-12-26T23:21:40.7631597Z error: 1 errors occurred comparing output.
2019-12-26T23:21:40.7631931Z status: exit code: 1
2019-12-26T23:21:40.7631931Z status: exit code: 1
2019-12-26T23:21:40.7632772Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/resolve/resolve-primitive-fallback.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/resolve/resolve-primitive-fallback" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/resolve/resolve-primitive-fallback/auxiliary" "-A" "unused"
2019-12-26T23:21:40.7633373Z ------------------------------------------
2019-12-26T23:21:40.7633564Z
2019-12-26T23:21:40.7634305Z ------------------------------------------
2019-12-26T23:21:40.7634551Z stderr:
---
2019-12-26T23:21:40.7642823Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:385:22
2019-12-26T23:21:40.7642894Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-12-26T23:21:40.7653894Z
2019-12-26T23:21:40.7654161Z
2019-12-26T23:21:40.7655938Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "/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" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2019-12-26T23:21:40.7658861Z
2019-12-26T23:21:40.7659865Z
2019-12-26T23:21:40.7664996Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-12-26T23:21:40.7665058Z Build completed unsuccessfully in 1:03:16
2019-12-26T23:21:40.7665058Z Build completed unsuccessfully in 1:03:16
2019-12-26T23:21:40.7711864Z == clock drift check ==
2019-12-26T23:21:40.7734810Z local time: Thu Dec 26 23:21:40 UTC 2019
2019-12-26T23:21:41.0730580Z network time: Thu, 26 Dec 2019 23:21:41 GMT
2019-12-26T23:21:41.0730750Z == end clock drift check ==
2019-12-26T23:21:42.2398050Z
2019-12-26T23:21:42.2491413Z ##[error]Bash exited with code '1'.
2019-12-26T23:21:42.2585035Z ##[section]Starting: Checkout
2019-12-26T23:21:42.2586633Z ==============================================================================
2019-12-26T23:21:42.2586681Z Task : Get sources
2019-12-26T23:21:42.2586910Z Description : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
I'm a bot <https://github.com/rust-ops/rust-log-analyzer>! 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 ***@***.****. (Feature
Requests
<https://github.com/rust-ops/rust-log-analyzer/issues?q=is%3Aopen+is%3Aissue+label%3Afeature-request>
)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#67637?email_source=notifications&email_token=AALVMK2XOC5SOXP3TFD3WHDQ2U4AXA5CNFSM4J7NNIJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHWILVI#issuecomment-569148885>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALVMKZ6WQOJ4ODOLWDXMLTQ2U4AXANCNFSM4J7NNIJQ>
.
--
Thanks,
Sean Griffin
|
f5499a9
to
a58ba90
Compare
The job Click to expand the log.
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 |
Failing test looks to be due to a test that makes sure that |
This has (hopefully) now been unblocked, so I'll be taking another look soon. |
a58ba90
to
b419835
Compare
libcore and libstd are both now a wall of "pub use". libstd has links to the primitive documentation, libcore doesn't (as the docs are defined in libstd, though I'm not sure why). As noted previously, we don't really have a good stability story here for the common usage pattern (specifically using them directly vs. via an import), at least as far as I can tell:
So we probably want to invoke FCP merge here. @dtolnay, could you do that? |
#![feature(arbitrary_self_types)] | ||
#![feature(array_error_internals)] | ||
#![feature(asm)] | ||
#![feature(assoc_int_consts)] | ||
#![feature(associated_type_bounds)] | ||
#![feature(atomic_mut_ptr)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unrelated (probably autorebase failure). I think the new location is technically the correct one from an alphabetic perspective though (and these seem to be alphabetized...).
This comment has been minimized.
This comment has been minimized.
b419835
to
b26cd43
Compare
This re-exports the primitive types from libcore at `core::primitive` to allow macro authors to have a reliable location to use them from.
b26cd43
to
178de46
Compare
@rfcbot fcp merge This PR adds stable re-exports of the primitive types under core::primitive and std::primitive, e.g. |
Team member @dtolnay has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
//! ``` | ||
|
||
#[stable(feature = "core_primitive", since = "1.42.0")] | ||
pub use bool; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could these re-exports not be merged, so the attribute doesn't have to be repeated a bunch of times?
pub use {
bool,
char,
...
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I consider multiline use a mistake in most cases as it breaks grepping for use.*Identifier
, so I'm not going to change this, but I believe it is possible.
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. The RFC will be merged soon. |
\o/ @bors r+ |
📌 Commit 9c3ee1b has been approved by |
…olnay Add primitive module to libcore This re-exports the primitive types from libcore at `core::primitive` to allow macro authors to have a reliable location to use them from. Fixes rust-lang#44865
Rollup of 7 pull requests Successful merges: - #67637 (Add primitive module to libcore) - #69387 (Deduplicate identifier printing a bit) - #69412 (Mark attributes consumed by `check_mod_attrs` as normal) - #69423 (syntax: Remove `Nt(Impl,Trait,Foreign)Item`) - #69429 (remove redundant clones and import) - #69457 (Clean up e0370 e0371) - #69468 ([master] Backport release notes of 1.41.1) Failed merges: r? @ghost
Pkgsrc changes: * Bump rust bootstrap version to 1.42.0, except for Darwin/i686 where the bootstrap is not (yet?) available. Upstream changes: Version 1.43.0 (2020-04-23) ========================== Language -------- - [Fixed using binary operations with `&{number}` (e.g. `&1.0`) not having the type inferred correctly.][68129] - [Attributes such as `#[cfg()]` can now be used on `if` expressions.][69201] **Syntax only changes** - [Allow `type Foo: Ord` syntactically.][69361] - [Fuse associated and extern items up to defaultness.][69194] - [Syntactically allow `self` in all `fn` contexts.][68764] - [Merge `fn` syntax + cleanup item parsing.][68728] - [`item` macro fragments can be interpolated into `trait`s, `impl`s, and `extern` blocks.][69366] For example, you may now write: ```rust macro_rules! mac_trait { ($i:item) => { trait T { $i } } } mac_trait! { fn foo() {} } ``` These are still rejected *semantically*, so you will likely receive an error but these changes can be seen and parsed by macros and conditional compilation. Compiler -------- - [You can now pass multiple lint flags to rustc to override the previous flags.][67885] For example; `rustc -D unused -A unused-variables` denies everything in the `unused` lint group except `unused-variables` which is explicitly allowed. However, passing `rustc -A unused-variables -D unused` denies everything in the `unused` lint group **including** `unused-variables` since the allow flag is specified before the deny flag (and therefore overridden). - [rustc will now prefer your system MinGW libraries over its bundled libraries if they are available on `windows-gnu`.][67429] - [rustc now buffers errors/warnings printed in JSON.][69227] Libraries --------- - [`Arc<[T; N]>`, `Box<[T; N]>`, and `Rc<[T; N]>`, now implement `TryFrom<Arc<[T]>>`,`TryFrom<Box<[T]>>`, and `TryFrom<Rc<[T]>>` respectively.][69538] **Note** These conversions are only available when `N` is `0..=32`. - [You can now use associated constants on floats and integers directly, rather than having to import the module.][68952] e.g. You can now write `u32::MAX` or `f32::NAN` with no imports. - [`u8::is_ascii` is now `const`.][68984] - [`String` now implements `AsMut<str>`.][68742] - [Added the `primitive` module to `std` and `core`.][67637] This module reexports Rust's primitive types. This is mainly useful in macros where you want avoid these types being shadowed. - [Relaxed some of the trait bounds on `HashMap` and `HashSet`.][67642] - [`string::FromUtf8Error` now implements `Clone + Eq`.][68738] Stabilized APIs --------------- - [`Once::is_completed`] - [`f32::LOG10_2`] - [`f32::LOG2_10`] - [`f64::LOG10_2`] - [`f64::LOG2_10`] - [`iter::once_with`] Cargo ----- - [You can now set config `[profile]`s in your `.cargo/config`, or through your environment.][cargo/7823] - [Cargo will now set `CARGO_BIN_EXE_<name>` pointing to a binary's executable path when running integration tests or benchmarks.][cargo/7697] `<name>` is the name of your binary as-is e.g. If you wanted the executable path for a binary named `my-program`you would use `env!("CARGO_BIN_EXE_my-program")`. Misc ---- - [Certain checks in the `const_err` lint were deemed unrelated to const evaluation][69185], and have been moved to the `unconditional_panic` and `arithmetic_overflow` lints. Compatibility Notes ------------------- - [Having trailing syntax in the `assert!` macro is now a hard error.][69548] This has been a warning since 1.36.0. - [Fixed `Self` not having the correctly inferred type.][69340] This incorrectly led to some instances being accepted, and now correctly emits a hard error. [69340]: rust-lang/rust#69340 Internal Only ------------- These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of `rustc` and related tools. - [All components are now built with `opt-level=3` instead of `2`.][67878] - [Improved how rustc generates drop code.][67332] - [Improved performance from `#[inline]`-ing certain hot functions.][69256] - [traits: preallocate 2 Vecs of known initial size][69022] - [Avoid exponential behaviour when relating types][68772] - [Skip `Drop` terminators for enum variants without drop glue][68943] - [Improve performance of coherence checks][68966] - [Deduplicate types in the generator witness][68672] - [Invert control in struct_lint_level.][68725] [67332]: rust-lang/rust#67332 [67429]: rust-lang/rust#67429 [67637]: rust-lang/rust#67637 [67642]: rust-lang/rust#67642 [67878]: rust-lang/rust#67878 [67885]: rust-lang/rust#67885 [68129]: rust-lang/rust#68129 [68672]: rust-lang/rust#68672 [68725]: rust-lang/rust#68725 [68728]: rust-lang/rust#68728 [68738]: rust-lang/rust#68738 [68742]: rust-lang/rust#68742 [68764]: rust-lang/rust#68764 [68772]: rust-lang/rust#68772 [68943]: rust-lang/rust#68943 [68952]: rust-lang/rust#68952 [68966]: rust-lang/rust#68966 [68984]: rust-lang/rust#68984 [69022]: rust-lang/rust#69022 [69185]: rust-lang/rust#69185 [69194]: rust-lang/rust#69194 [69201]: rust-lang/rust#69201 [69227]: rust-lang/rust#69227 [69548]: rust-lang/rust#69548 [69256]: rust-lang/rust#69256 [69361]: rust-lang/rust#69361 [69366]: rust-lang/rust#69366 [69538]: rust-lang/rust#69538 [cargo/7823]: rust-lang/cargo#7823 [cargo/7697]: rust-lang/cargo#7697 [`Once::is_completed`]: https://doc.rust-lang.org/std/sync/struct.Once.html#method.is_completed [`f32::LOG10_2`]: https://doc.rust-lang.org/std/f32/consts/constant.LOG10_2.html [`f32::LOG2_10`]: https://doc.rust-lang.org/std/f32/consts/constant.LOG2_10.html [`f64::LOG10_2`]: https://doc.rust-lang.org/std/f64/consts/constant.LOG10_2.html [`f64::LOG2_10`]: https://doc.rust-lang.org/std/f64/consts/constant.LOG2_10.html [`iter::once_with`]: https://doc.rust-lang.org/std/iter/fn.once_with.html
This re-exports the primitive types from libcore at
core::primitive
to allowmacro authors to have a reliable location to use them from.
Fixes #44865