about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2020-04-07Further improve commentsJonas Schievink-3/+4
2020-04-07Add some more commentsJonas Schievink-0/+11
2020-04-06Add some comments and rename variableJonas Schievink-2/+9
2020-04-06Merge redundant match armsJonas Schievink-11/+8
2020-04-06Move closure check upwardsJonas Schievink-7/+6
2020-04-06Don't lint for self-recursion when the function can divergeJonas Schievink-92/+132
2020-04-05Auto merge of #70816 - Dylan-DPC:rollup-kzcs8px, r=Dylan-DPCbors-158/+164
Rollup of 5 pull requests Successful merges: - #67797 (Query-ify Instance::resolve) - #70777 (Don't import integer and float modules, use assoc consts) - #70795 (Keep track of position when deleting from a BTreeMap) - #70812 (Do not use "nil" to refer to `()`) - #70815 (Enable layout debugging for `impl Trait` type aliases) Failed merges: r? @ghost
2020-04-05Rollup merge of #70815 - RalfJung:layout-debug, r=jonas-schievinkDylan DPC-8/+48
Enable layout debugging for `impl Trait` type aliases I also made it print the actual type name that the alias picks under the hood.
2020-04-05Rollup merge of #70812 - rossmacarthur:fix/unit-called-nil, r=LukasKalbertodtDylan DPC-1/+1
Do not use "nil" to refer to `()` "nil" is not used in the [book](https://doc.rust-lang.org/book) or in the [standard library](https://doc.rust-lang.org/std) anywhere else. Because "nil" is often used in programming languages to refer to "None" or "null" I think it could be a little confusing for newcomers to see this type referred to as "nil".
2020-04-05Rollup merge of #70795 - Amanieu:btree_remove_tracking, r=Mark-SimulacrumDylan DPC-49/+64
Keep track of position when deleting from a BTreeMap This improves the performance of drain_filter and is needed for future Cursor support for BTreeMap. cc @ssomers r? @Mark-Simulacrum
2020-04-05Rollup merge of #70777 - faern:use-assoc-int-consts2, r=dtolnayDylan DPC-75/+27
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 #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
2020-04-05Rollup merge of #67797 - Aaron1011:feature/instance-query, r=nikomatsakisDylan DPC-25/+24
Query-ify Instance::resolve Split off from #65989 Instance::resolve is now a wrapper for a new `resolve_instance` query. This greatly improves performance on several benchmarks
2020-04-05Auto merge of #70809 - matthiaskrgr:submodule_upd, r=Mark-Simulacrumbors-11/+18
submodules: update clippy from 326b2204 to 7907abea Changes: ```` Rustup to rust-lang/rust#70634 Update clippy_lints/src/types.rs Update types.rs Update types.rs Improve docs for option_option useless Rc<Rc<T>>, Rc<Box<T>>, Rc<&T>, Box<&T> Allow let_underscore Update option_option ui test Test for ignoring let_underscore_must_use Downgrade option_option to pedantic ```` Fixes #70709
2020-04-05also print type typeRalf Jung-6/+6
2020-04-05also print rustc_layout on impl trait type aliasesRalf Jung-3/+43
2020-04-05Apply review feedbackAmanieu d'Antras-15/+10
2020-04-05Auto merge of #70807 - Dylan-DPC:rollup-qd1kgl2, r=Dylan-DPCbors-39/+138
Rollup of 5 pull requests Successful merges: - #70558 (Fix some aliasing issues in Vec) - #70760 (docs: make the description of Result::map_or more clear) - #70769 (Miri: remove an outdated FIXME) - #70776 (clarify comment in RawVec::into_box) - #70806 (fix Miri assignment sanity check) Failed merges: r? @ghost
2020-04-05Do not use "nil" to refer to `()`Ross MacArthur-1/+1
2020-04-05submodules: update clippy from 326b2204 to 7907abeaMatthias Krüger-11/+18
Changes: ```` Rustup to rust-lang/rust#70634 Update clippy_lints/src/types.rs Update types.rs Update types.rs Improve docs for option_option useless Rc<Rc<T>>, Rc<Box<T>>, Rc<&T>, Box<&T> Allow let_underscore Update option_option ui test Test for ignoring let_underscore_must_use Downgrade option_option to pedantic ```` Fixes #70709
2020-04-05Keep track of position when deleting from a BTreeMapAmanieu d'Antras-39/+59
This improves the performance of drain_filter and is needed for future Cursor support for BTreeMap.
2020-04-05Rollup merge of #70806 - RalfJung:miri-assignment-check, r=eddybDylan DPC-19/+49
fix Miri assignment sanity check Thanks @eddyb for pointing me to the right APIs! r? @eddyb Fixes https://github.com/rust-lang/rust/issues/70804
2020-04-05Rollup merge of #70776 - RalfJung:raw-vec, r=Dylan-DPC,TimDiekmannDylan DPC-3/+6
clarify comment in RawVec::into_box On first reading I almost thought "len <= cap" would be all that there is to check here. Expand the comment to clarify that that is not the case.
2020-04-05Rollup merge of #70769 - RalfJung:fixed, r=Dylan-DPCDylan DPC-1/+0
Miri: remove an outdated FIXME We even [have a test ](https://github.com/rust-lang/rust/blob/49dc2f9f091748beb1a8a9d5b3eb3bbe7362c3bd/src/test/ui/consts/miri_unleashed/drop.rs) making sure that we detect dropping with a non-const implementation. r? @oli-obk
2020-04-05Rollup merge of #70760 - PonasKovas:docs, r=Dylan-DPCDylan DPC-2/+4
docs: make the description of Result::map_or more clear The documentation of [`Result::map_or`](https://doc.rust-lang.org/std/result/enum.Result.html#method.map_or) is very unclear and confusing, probably because it was copied straight from [`Option::map_or`](https://doc.rust-lang.org/std/option/enum.Option.html#method.map_or) and someone forgot to adapt it for Result.
2020-04-05Rollup merge of #70558 - RalfJung:vec-extend-aliasing, r=AmanieuDylan DPC-14/+79
Fix some aliasing issues in Vec `Vec::extend` and `Vec::truncate` invalidated references into the vector even without reallocation, because they (implicitly) created a mutable reference covering the *entire* initialized part of the vector. Fixes https://github.com/rust-lang/rust/issues/70301 I verified the fix by adding some new tests here that I ran in Miri.
2020-04-05fix commentRalf Jung-3/+3
2020-04-05clarify safety in RawVec::into_boxRalf Jung-3/+6
2020-04-05add testRalf Jung-0/+10
2020-04-05miri assignment check: compare types after normalizing all late-bound ↵Ralf Jung-19/+39
regions away
2020-04-05Auto merge of #70803 - arlosi:hash-regression, r=eddybbors-11/+10
Fix performance regression in debuginfo file_metadata. Fixes performance regression caused by #69718. Finding the `SourceFile` associated with a `FileName` called `get_source_file` on the `SourceMap`, which does a linear search through all files in the `SourceMap`. This resolves the issue by passing the `SourceFile` in from the caller (which already had it available) instead of the `FileName` Fixes #70785.
2020-04-05Stop importing integer modules in libstdLinus Färnstrand-4/+0
2020-04-05Stop importing int module in float parse testLinus Färnstrand-1/+0
2020-04-05Stop importing int modules in librustdocLinus Färnstrand-2/+0
2020-04-05Stop importing int/float modules in libserializeLinus Färnstrand-1/+0
2020-04-05Stop importing int/float modules in librustc_*Linus Färnstrand-18/+4
2020-04-05Stop importing int/float modules in libcoreLinus Färnstrand-39/+23
2020-04-05Stop importing integer modules in liballocLinus Färnstrand-10/+0
2020-04-05Fix performance regression in debuginfo file_metadata.Arlo Siemsen-11/+10
Finding the `SourceFile` associated with a `FileName` called `get_source_file` on the `SourceMap`, which does a linear search through all files in the `SourceMap`. This resolves the issue by passing the SourceFile in from the caller (which already had it available).
2020-04-05tweak swap_removeRalf Jung-3/+4
2020-04-05Auto merge of #70800 - Dylan-DPC:rollup-9jjoptp, r=Dylan-DPCbors-49/+100
Rollup of 6 pull requests Successful merges: - #70635 (rustc_target: Some cleanup to `no_default_libraries`) - #70748 (Do not disable field reordering on enums with big discriminant) - #70752 (Add slice::fill) - #70766 (use ManuallyDrop instead of forget inside collections) - #70768 (macro_rules: `NtLifetime` cannot start with an identifier) - #70783 (comment refers to removed type) Failed merges: r? @ghost
2020-04-05Query-ify Instance::resolveAaron Hill-25/+24
2020-04-05Rollup merge of #70783 - tshepang:deleted-types, r=XanewokDylan DPC-1/+0
comment refers to removed type Was removed in 51938c61f6f1b26e463f9071716f543543486e72
2020-04-05Rollup merge of #70768 - petrochenkov:macambig, r=Centril,mark-i-mDylan DPC-1/+14
macro_rules: `NtLifetime` cannot start with an identifier Fixes https://github.com/rust-lang/rust/issues/70446
2020-04-05Rollup merge of #70766 - tspiteri:forget-to-ManuallyDrop, ↵Dylan DPC-38/+34
r=Mark-Simulacrum,RalfJung use ManuallyDrop instead of forget inside collections This PR changes some usage of `mem::forget` into `mem::ManuallyDrop` in some `Vec`, `VecDeque`, `BTreeMap` and `Box` methods. Before the commit, the generated IR for some of the methods was longer, and even after optimization, some unwinding artifacts were still present.
2020-04-05Rollup merge of #70752 - yoshuawuyts:slice_fill, r=dtolnayDylan DPC-0/+24
Add slice::fill Adds the `slice::fill` method to fill a slice with an item. This replaces manual for loops where items are copied one-by-one. This is a counterpart to C++20's [`std::fill`](https://en.cppreference.com/w/cpp/algorithm/fill) function. ## Usage ```rust let mut buf = vec![0; 10]; buf.fill(1); assert_eq!(buf, vec![1; 10]); ``` ## Performance When compiling in release mode, for `[u8]` and `[u16]` this method will optimize to a `memset(3)` call ([godbolt](https://godbolt.org/z/85El_c)). The initial implementation relies on LLVM's optimizer to make it as fast as possible for any given input. But as @jonas-schievink [pointed out](https://twitter.com/sheevink/status/1245756597453885442) this can later be optimized through specialization to guarantee it has a specific performance profile. ## Why now? Conversations about adding `slice::fill` are not new. In fact, https://github.com/rust-lang/rfcs/issues/2067 was opened 3 years ago about this exact topic. However discussion stranded while discussing implementation details, and it's not seen much forward motion since. In ["The Hunt for the Fastest Zero"](https://travisdowns.github.io/blog/2020/01/20/zero.html) Travis Downs provides disects C++'s `std::fill` performance profile on gcc, comparing it among others to `memset(3)`. Even though `memset(3)` outperforms `std::fill` in their tests, the author notes the following: > That the optimization fails, perhaps unexpectedly, in some cases is unfortunate but it’s nice that you can fix it yourself. [...] Do we throw out modern C++ idioms, at least where performance matters, for example by replacing std::fill with memset? I don’t think so. Much of the article focuses on how how to fix the performance of `std::fill` by providing specializations for specific input. In Rust we don't have any dedicated methods to fill slices with values, so it either needs to be optimized at the MIR layer, or more likely rely on LLVM's optimizer. By adding a dedicated method for filling slices with values it opens up the ability for us to in the future guarantee that e.g. `Vec<u8>` will always optimize to `memset` even in debug mode. Or perhaps provide stronger guarantees about memory when zeroing values when a certain flag is passed. But regardless of that, it improves general ergonomics of working with slices by providing a dedicated method with documentation and examples. ## References - [slice-fill prototype on docs.rs](https://docs.rs/slice-fill/1.0.1/slice_fill/) - [The Hunt For The Fastest Zero](https://travisdowns.github.io/blog/2020/01/20/zero.html) - [Safe memset for slices](https://github.com/rust-lang/rfcs/issues/2067) - [C++20 std::fill](https://en.cppreference.com/w/cpp/algorithm/fill) - [ASM output on Godbolt](https://godbolt.org/z/5-XU66)
2020-04-05Rollup merge of #70748 - ogoffart:enum-layout-optim2, r=eddybDylan DPC-5/+28
Do not disable field reordering on enums with big discriminant The field are always re-ordered to minimize padding, regardless of the alignment of the discriminant (spinoff from #70477)
2020-04-05Rollup merge of #70635 - petrochenkov:nodefault, r=nagisaDylan DPC-4/+0
rustc_target: Some cleanup to `no_default_libraries`
2020-04-05Add slice::fillYoshua Wuyts-0/+24
2020-04-04Auto merge of #70149 - Xanewok:update-rls, r=Xanewokbors-72/+121
submodules: Update RLS and Rustfmt Fixes #70129. Fixes #70280. Regression fixed specifically with https://github.com/rust-lang/rls/commit/4a587b5fda6c2c9302562ece8c2795cd9848c553. r? @ghost
2020-04-05rustc-workspace-hack: Account for upgraded crossbeam-utils 0.7Igor Matuszewski-2/+2