about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2021-02-22Auto merge of #77551 - simonvandel:extend-simplify-branch-same, r=oli-obkbors-285/+655
MIR-OPT: Pass to deduplicate blocks This pass finds basic blocks that are completely equal, and replaces all uses with just one of them. ```bash $ RUSTC_LOG=rustc_mir::transform::deduplicate_blocks ./x.py build --stage 2 | grep "SUCCESS: Replacing: " > log ... $ cat log | wc -l 23875 ```
2021-02-22Auto merge of #82393 - JohnTitor:rollup-5c8jryl, r=JohnTitorbors-212/+767
Rollup of 9 pull requests Successful merges: - #82098 (Add internal `collect_into_array[_unchecked]` to remove duplicate code) - #82228 (Provide NonZero_c_* integers) - #82287 (Make "missing field" error message more natural) - #82351 (Use the first paragraph, instead of cookie-cutter text, for rustdoc descriptions) - #82353 (rustdoc: Remove unnecessary `Cell` around `param_env`) - #82367 (remove redundant option/result wrapping of return values) - #82372 (improve UnsafeCell docs) - #82379 (Fix sizes of repr(C) enums on hexagon) - #82382 (rustdoc: Remove `fake_def_ids` RefCell) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-02-22Rollup merge of #82382 - camelid:remove-fake_def_ids-refcell, r=jyn514Yuki Okushi-6/+4
rustdoc: Remove `fake_def_ids` RefCell
2021-02-22Rollup merge of #82379 - nagisa:nagisa/hexagon-enums, r=estebankYuki Okushi-0/+476
Fix sizes of repr(C) enums on hexagon Enums on hexagon use a smallest size (but at least 1 byte) that fits all the enumeration values. This is unlike many other ABIs where enums are at least 32 bits. Fixes #82100
2021-02-22Rollup merge of #82372 - RalfJung:unsafe-cell, r=KodrAusYuki Okushi-10/+11
improve UnsafeCell docs Sometimes [questions like this come up](https://rust-lang.zulipchat.com/#narrow/stream/136281-t-lang.2Fwg-unsafe-code-guidelines/topic/UnsafeCells.20as.20raw.20pointers) because the UnsafeCell docs say "it's the only legal way to obtain aliasable data that is considered mutable". That is not entirely correct, since raw pointers also provide that option. So I propose we focus the docs on the interaction of `UnsafeCell` and *shared references* specifically, which is really where they are needed.
2021-02-22Rollup merge of #82367 - matthiaskrgr:wraps, r=petrochenkovYuki Okushi-46/+30
remove redundant option/result wrapping of return values If a function always returns `Ok(something)`, we can return `something` directly and remove the corresponding error handling in the callers. clippy::unnecessary_wraps
2021-02-22Rollup merge of #82353 - camelid:no-more-param_env-cell, r=jyn514Yuki Okushi-9/+6
rustdoc: Remove unnecessary `Cell` around `param_env` r? `@jyn514`
2021-02-22Rollup merge of #82351 - notriddle:docs-meta-description, r=jyn514Yuki Okushi-1/+44
Use the first paragraph, instead of cookie-cutter text, for rustdoc descriptions Partially addresses #82283.
2021-02-22Rollup merge of #82287 - r00ster91:field_name_and, r=petrochenkovYuki Okushi-26/+29
Make "missing field" error message more natural ```rust struct A { x: i32, y: i32, z: i32, } fn main() { A { }; } ``` ``` error[E0063]: missing fields `x`, `y`, `z` in initializer of `A` --> src/main.rs:8:5 | 8 | A { }; | ^ missing `x`, `y`, `z` ``` This error is now: ``` error[E0063]: missing fields `x`, `y` and `z` in initializer of `A` --> src/main.rs:8:5 | 8 | A { }; | ^ missing `x`, `y` and `z` ``` I thought it looked nicer and more natural this way. Also, if there is >3 fields missing, there is an "and" as well ("missing \`x\`, \`y\`, \`z\` *and* 1 other field"), but for <=3 there is not. As such it improves consistency too. As for the implementation, originally I ended up with a chunky `push_str` algorithm but then I figured I could just do the formatting manually since it's just 3 field names at maximum. It is comparatively readable. As a sidenote, one thing I was wondering about is, isn't there more cases where you have a list of things like field names? Maybe this whole thing can at some point later be made into a more general function to be used in multiple areas.
2021-02-22Rollup merge of #82228 - ijackson:nonzero-cint, r=KodrAusYuki Okushi-54/+57
Provide NonZero_c_* integers I'm pretty sure I am going want this for #73125 and it seems like an omission that would be in any case good to remedy. <strike>Because the raw C types are in `std`, not `core`, to achieve this we must export the relevant macros from `core` so that `std` can use them. That's done with a new `num_internals` perma-unstable feature. The macros need to take more parameters for the module to get the types from and feature attributes to use. I have eyeballed the docs output for core, to check that my changes to these macros have made no difference to the core docs output.</strike>
2021-02-22Rollup merge of #82098 - LukasKalbertodt:add-collect-into-array, r=dtolnayYuki Okushi-60/+110
Add internal `collect_into_array[_unchecked]` to remove duplicate code Unlike the similar PRs #69985, #75644 and #79659, this PR only adds private functions and does not propose any new public API. The change is just for the purpose of avoiding duplicate code. Many array methods already contained the same kind of code and there are still many array related methods to come (e.g. `Iterator::{chunks, map_windows, next_n, ...}`, `[T; N]::{cloned, copied, ...}`, ...) which all basically need this functionality. Writing custom `unsafe` code for each of those doesn't seem like a good idea. I added two functions in this PR (and not just the `unsafe` version) because I already know that I need the `Option`-returning version for `Iterator::map_windows`. This is closely related to https://github.com/rust-lang/rust/issues/81615. I think that all options listed in that issue can be implemented using the function added in this PR. The only instance where `collect_array_into` might not be general enough is when the caller want to handle incomplete arrays manually. Currently, if `iter` yields fewer than `N` items, `None` is returned and the already yielded items are dropped. But as this is just a private function, it can be made more general in future PRs. And while this was not the goal, this seems to lead to better assembly for `array::map`: https://rust.godbolt.org/z/75qKTa (CC ``@JulianKnodt)`` Let me know what you think :) CC ``@matklad`` ``@bstrie``
2021-02-22Auto merge of #79979 - GuillaumeGomez:rustdoc-gui-tests, r=Mark-Simulacrumbors-3/+312
Rustdoc gui tests This is a reopening of #70533. For this first version, there will be no screenshot comparison. Also, a big change compared to the previous version: the tests are now hosted in the rust repository directly. Since there is no image, it's pretty lightweight to say the least. So now, only remains the nodejs script to run the tests and the tests themselves. Just one thing is missing: where should I put the documentation for these tests? I'm not sure where would be the best place for that. The doc will contain important information like the documentation of the framework used and how to install it (`npm install browser-ui-test`, but still needs to be put somewhere so no one is lost). We'd also need to install the package when running the CI too. For now, it runs as long as we have nodejs installed, but I think we don't it to run in all nodejs targets? cc `@jyn514` r? `@Mark-Simulacrum`
2021-02-22Auto merge of #81732 - m-ou-se:inherit-overflow-checks, r=Mark-Simulacrumbors-38/+65
Use `#[rustc_inherit_overflow_checks]` instead of Add::add etc. See https://github.com/rust-lang/rust/issues/81721
2021-02-21rustdoc: Remove `fake_def_ids` RefCellCamelid-6/+4
2021-02-22Auto merge of #82295 - jyn514:feature-gate, r=Manishearthbors-0/+11
[intra-doc links] Don't check feature gates of items re-exported across crates It should be never break another crate to re-export a public item. Note that this doesn't check the feature gate at *all* for other crates: - Feature-gates aren't currently serialized, so the only way to check the gate is with ad-hoc attribute checking. - Checking the feature gate twice (once when documenting the original crate and one when documenting the current crate) seems not great. This should still catch using the feature most of the time though, since people tend to document their own crates. Closes https://github.com/rust-lang/rust/issues/82284. r? `@Manishearth`
2021-02-22Fix sizes of repr(C) enums on hexagonSimonas Kazlauskas-0/+476
Enums on hexagon use a smallest size (but at least 1 byte) that fits all the enumeration values. This is unlike many other ABIs where enums are at least 32 bits.
2021-02-21New pass to deduplicate blocksSimon Vandel Sillesen-37/+422
2021-02-21Make MatchBranchSimplification clean up after itselfSimon Vandel Sillesen-247/+232
2021-02-21Drive-by formatting of commentSimon Vandel Sillesen-2/+2
2021-02-21remove redundant wrapping of return types of allow_internal_unstable() and ↵Matthias Krüger-9/+8
rustc_allow_const_fn_unstable()
2021-02-21Update src/test/rustdoc/description.rsMichael Howell-0/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-02-21Update src/test/rustdoc/description.rsMichael Howell-0/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-02-21improve UnsafeCell docsRalf Jung-10/+11
2021-02-21Update CI scriptsGuillaume Gomez-2/+26
2021-02-21Add rustdoc gui testsGuillaume Gomez-0/+100
2021-02-21Ignore nodejs/npm filesGuillaume Gomez-0/+2
2021-02-21Add new rustdoc-gui test suiteGuillaume Gomez-1/+184
2021-02-21rustc_mir: remove redundant wrapping of return type in numeric_intrinsic()Matthias Krüger-7/+3
2021-02-21rustc_codegen_ssa: remove unneeded wrapping of return type of ↵Matthias Krüger-4/+4
execute_copy_from_cache_work_item (always returns Ok(..))
2021-02-21remove redundant return value Ok(()) of clear_relocations()Matthias Krüger-10/+3
2021-02-21parser: remove unneccessary wrapping of return value in parse_extern()Matthias Krüger-7/+3
2021-02-21Auto merge of #82359 - JohnTitor:rollup-6puemik, r=JohnTitorbors-311/+708
Rollup of 11 pull requests Successful merges: - #81300 (BTree: share panicky test code & test panic during clear, clone) - #81706 (Document BinaryHeap unsafe functions) - #81833 (parallelize x.py test tidy) - #81966 (Add new `rustc` target for Arm64 machines that can target the iphonesimulator) - #82154 (Update RELEASES.md 1.50 to include methods stabilized in #79342) - #82177 (Do not delete bootstrap.exe on Windows during clean) - #82181 (Add check for ES5 in CI) - #82229 (Add [A-diagnostics] bug report template) - #82233 (try-back-block-type test: Use TryFromSliceError for From test) - #82302 (Remove unsafe impl Send for CompletedTest & TestResult) - #82349 (test: Print test name only once on timeout) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-02-21remove unneccessary wrapping of return value in mk_await_expr()Matthias Krüger-3/+3
2021-02-21rustc_parse: remove unneccessary wrapping of return value in fn mk_range() ↵Matthias Krüger-5/+5
which would always return Ok(..)
2021-02-21remove unneccessary wrapping of return value of allow_unstable(), it would ↵Matthias Krüger-5/+5
always return Some(thing)
2021-02-21update tracking issue for raw_os_nonzeroAshley Mannix-1/+1
2021-02-21Auto merge of #82340 - kennytm:fix-82254, r=Mark-Simulacrumbors-16/+34
Fix some Python2→3 error in publish_toolstate.py Fix #82254. The error is primarily due to `data = json.dumps(…)` producing a `str` instead of a `bytes`, which are different types on Python 3. But then `urllib.request.urlopen(…, data)` cannot accept `data` as a `str`, thus the error. This PR added `.encode()` call after `json.dumps()` to ensure we are sending `bytes`. Additionally, we added type annotation to ensure things can statically type-check with `mypy` on both Python 2 and 3.
2021-02-21Rollup merge of #82349 - tmiasko:pretty-test-timeout, r=Mark-SimulacrumYuki Okushi-4/+0
test: Print test name only once on timeout Pretty formatter when using multiple test threads displays test name twice on timeout event. This implicitly suggest that those are two different events, while in fact they are always printed together. Print test name only once. Before: ``` running 3 tests test src/lib.rs - c (line 16) ... ok test src/lib.rs - a (line 3) ... ok test src/lib.rs - b (line 9) ... test src/lib.rs - b (line 9) has been running for over 60 seconds test src/lib.rs - b (line 9) ... ok ``` After: ``` running 3 tests test src/lib.rs - c (line 16) ... ok test src/lib.rs - a (line 3) ... ok test src/lib.rs - b (line 9) has been running for over 60 seconds test src/lib.rs - b (line 9) ... ok ```
2021-02-21Rollup merge of #82302 - tmiasko:test-unsafe-send, r=Mark-SimulacrumYuki Okushi-4/+0
Remove unsafe impl Send for CompletedTest & TestResult
2021-02-21Rollup merge of #82233 - ijackson:try-block-type-test, r=Mark-SimulacrumYuki Okushi-8/+4
try-back-block-type test: Use TryFromSliceError for From test Using `i32` is rather fragile because it has many implementations. Recently in an early draft of another MR (#82228) I did something that introduced a new `i32 as From<something>` impl and this test broke. TryFromSliceError is nice because it doesn't seem likely to grow new conversions. We still have one conversion, from Infallible. My other MR is going to be reworked and won't need this any more but having done it I thought I would submit it rather than just throw it away. Sorry for the tiny MR.
2021-02-21Rollup merge of #82229 - estebank:issue-templace, r=Mark-SimulacrumYuki Okushi-0/+46
Add [A-diagnostics] bug report template
2021-02-21Rollup merge of #82181 - GuillaumeGomez:es5-checks-ci, r=Mark-SimulacrumYuki Okushi-1/+8
Add check for ES5 in CI Follow-up of #82145. r? ```@Mark-Simulacrum```
2021-02-21Rollup merge of #82177 - rylev:no-delete-bootstrap-windows, r=Mark-SimulacrumYuki Okushi-4/+36
Do not delete bootstrap.exe on Windows during clean Windows does not allow deleting currently running executables. This an addition to ```@jyn514's``` change in https://github.com/rust-lang/rust/pull/80574.
2021-02-21Rollup merge of #82154 - CDirkx:ip-changelog, r=Mark-SimulacrumYuki Okushi-0/+34
Update RELEASES.md 1.50 to include methods stabilized in #79342 I noticed that #79342 was missing from the release notes for 1.50.
2021-02-21Rollup merge of #81966 - deg4uss3r:degausser/aarch64_apple_ios_sim, r=shepmasterYuki Okushi-6/+63
Add new `rustc` target for Arm64 machines that can target the iphonesimulator This PR lands a new target (`aarch64-apple-ios-sim`) that targets arm64 iphone simulator, previously unreachable from Apple Silicon machines. resolves #81632 r? `@shepmaster`
2021-02-21Rollup merge of #81833 - the8472:parallel-bootstrap-rustfmt, r=Mark-SimulacrumYuki Okushi-18/+63
parallelize x.py test tidy Running tidy on individual commits when rewriting git history was somewhat of an annoyance, so I have parallelized it a bit. running `time ./x.py test tidy` with warm IO caches: old: ``` real 0m11.123s user 0m14.495s sys 0m5.227s ``` new: ``` real 0m1.834s user 0m13.545s sys 0m3.094s ``` There's further room for improvement (<0.9s should be feasible) but that would require bigger changes.
2021-02-21Rollup merge of #81706 - SkiFire13:document-binaryheap-unsafe, r=Mark-SimulacrumYuki Okushi-49/+117
Document BinaryHeap unsafe functions `BinaryHeap` contains some private safe functions but that are actually unsafe to call. This PR marks them `unsafe` and documents all the `unsafe` function calls inside them. While doing this I might also have found a bug: some "SAFETY" comments in `sift_down_range` and `sift_down_to_bottom` are valid only if you assume that `child` doesn't overflow. However it may overflow if `end > isize::MAX` which can be true for ZSTs (but I think only for them). I guess the easiest fix would be to skip any sifting if `mem::size_of::<T> == 0`. Probably conflicts with #81127 but solving the eventual merge conflict should be pretty easy.
2021-02-21Rollup merge of #81300 - ssomers:btree_cleanup_leak_tests, r=Mark-SimulacrumYuki Okushi-217/+337
BTree: share panicky test code & test panic during clear, clone Bases almost all tests of panic on the same, richer definition, and extends it to cloning to test panic during clone. r? ```@Mark-Simulacrum```
2021-02-21Auto merge of #79100 - a1phyr:better_assert_eq, r=m-ou-sebors-831/+292
Improve assert_eq! and assert_ne! This PR improves `assert_eq!` and `assert_ne!` by moving the panicking code in an external function. It does not change the fast path, but the move of the formatting in the cold path (the panic) may have a positive effect on in instruction cache use and with inlining. Moreover, the use of trait objects instead of generic may improve compile times for `assert_eq!`-heavy code. Godbolt link: ~~https://rust.godbolt.org/z/TYa9MT~~ \ Updated: https://rust.godbolt.org/z/bzE84x
2021-02-20rustdoc: Remove unnecessary `Cell` around `param_env`Camelid-9/+6