about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2021-01-17validation test: turn some const_err back into validation failuresRalf Jung-81/+59
2021-01-17Auto merge of #81083 - ssomers:btree_drainy_refactor_1, r=Mark-Simulacrumbors-13/+14
BTreeMap: expose new_internal function and sanitize from_new_internal `new_internal` is the functional core of the imperative `push_internal_level`, and `from_new_internal` can easily do a proper job instead of returning a half-baked node. r? `@Mark-Simulacrum`
2021-01-17Auto merge of #78818 - scottmcm:as_rchunks, r=KodrAusbors-7/+187
Add `as_rchunks` (and friends) to slices `@est31` mentioned (https://github.com/rust-lang/rust/issues/76354#issuecomment-717027175) that, for completeness, there needed to be an `as_chunks`-like method that chunks from the end (with the remainder at the beginning) like `rchunks` does. So here's a PR for `as_rchunks: &[T] -> (&[T], &[[T; N]])` and `as_rchunks_mut: &mut [T] -> (&mut [T], &mut [[T; N]])`. But as I was doing this and copy-pasting `from_raw_parts` calls, I thought that I should extract that into an unsafe method. It started out a private helper, but it seemed like `as_chunks_unchecked` could be reasonable as a "real" method, so I added docs and made it public. Let me know if you think it doesn't pull its weight.
2021-01-17Auto merge of #80942 - c410-f3r:tests-tests-tests, r=petrochenkovbors-69/+3
Move some tests to more reasonable directories - 2 All tests with a score equal or greater than 1.0 were moved to their respective directories by issuing ```bash cat FILE | tr -s " " | tr -d '():' | sort -k3 | awk '$3 >= 1' | cut -d " " -f1-2 | sed 's;\\;/;g' | xargs -n2 git mv ``` **Observation**: The first column values is the only column with results greater zero To attest the confidentiality of the model, some manual revision of at least of tests is needed and this process will be tracked in the following list: * `src/test/ui/abi/issue-28676.rs` OK #28676 * `src/test/ui/array-slice-vec/issue-15730.rs` OK * `src/test/ui/associated-types/issue-24338.rs` OK #54823 * `src/test/ui/associated-types/issue-48551.rs` Looks OK #48551 * `src/test/ui/associated-types/issue-50301.rs` Looks OK #63577 ... cc #73494 r? `@petrochenkov`
2021-01-16Auto merge of #81093 - calebcartwright:update-rustfmt, r=Mark-Simulacrumbors-6/+6
bump rustfmt to v1.4.32 Fixes an indentation bug with bounds reported in https://github.com/rust-lang/rust/pull/80843#discussion_r554476529 r? `@Mark-Simulacrum`
2021-01-16Try ignore-debug in the codegen testScott McMurray-0/+1
This fixed things the last time I had a problem like this. And plausibly will here too -- the check it's failing on is for the high bit being set in the length of the slice, which is a check that's only in a debug_assert.
2021-01-16Move some tests to more reasonable directories - 2Caio-69/+3
Address comments Update limits
2021-01-16Auto merge of #81089 - m-ou-se:rollup-z7iac6i, r=m-ou-sebors-225/+606
Rollup of 17 pull requests Successful merges: - #78455 (Introduce {Ref, RefMut}::try_map for optional projections in RefCell) - #80144 (Remove giant badge in README) - #80614 (Explain why borrows can't be held across yield point in async blocks) - #80670 (TrustedRandomAaccess specialization composes incorrectly for nested iter::Zips) - #80681 (Clarify what the effects of a 'logic error' are) - #80764 (Re-stabilize Weak::as_ptr and friends for unsized T) - #80901 (Make `x.py --color always` apply to logging too) - #80902 (Add a regression test for #76281) - #80941 (Do not suggest invalid code in pattern with loop) - #80968 (Stabilize the poll_map feature) - #80971 (Put all feature gate tests under `feature-gates/`) - #81021 (Remove doctree::Import) - #81040 (doctest: Reset errors before dropping the parse session) - #81060 (Add a regression test for #50041) - #81065 (codegen_cranelift: Fix redundant semicolon warn) - #81069 (Add sample code for Rc::new_cyclic) - #81081 (Add test for #34792) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-01-16bump rustfmt to v1.4.32Caleb Cartwright-6/+6
2021-01-16Rollup merge of #81081 - bugadani:double-partialeq, r=Mark-SimulacrumMara Bos-0/+16
Add test for #34792 Closes #34792
2021-01-16Rollup merge of #81069 - ogoffart:rc_new_cyclic_doc, r=Mark-SimulacrumMara Bos-0/+20
Add sample code for Rc::new_cyclic
2021-01-16Rollup merge of #81065 - osa1:cranelift_semicolon_warning, r=jyn514Mara Bos-1/+1
codegen_cranelift: Fix redundant semicolon warn
2021-01-16Rollup merge of #81060 - nagisa:nagisa/regression-50041, r=Mark-SimulacrumMara Bos-0/+34
Add a regression test for #50041 AFAICT the test case never landed alongside the fix for the issue.
2021-01-16Rollup merge of #81040 - osa1:fix_80992, r=jyn514Mara Bos-0/+23
doctest: Reset errors before dropping the parse session The first parse is to collect whether the code contains macros, has `main`, and uses other crates. In that pass we ignore errors as those will be reported when the test file is actually built. For that we need to reset errors in the `Diagnostic` otherwise when dropping it unhandled errors will be reported as compiler bugs. Fixes #80992
2021-01-16Rollup merge of #81021 - CraftSpider:rustdoc-remove-import, r=jyn514Mara Bos-116/+91
Remove doctree::Import Per the title. Part of cleaning up doctree
2021-01-16Rollup merge of #80971 - camelid:feature-gate-testsuite-organization, ↵Mara Bos-0/+0
r=Mark-Simulacrum Put all feature gate tests under `feature-gates/` There was one directory that had only a single test and there was also a test in the top-level directory. This moves both of them to `feature-gates/`.
2021-01-16Rollup merge of #80968 - KodrAus:stabilize/poll_map, r=Mark-SimulacrumMara Bos-2/+2
Stabilize the poll_map feature Stabilizes the `poll_map` feature as tracked by #63514 (with a completed FCP).
2021-01-16Rollup merge of #80941 - JohnTitor:ref-mut-pat-in-loops, r=varkorMara Bos-1/+29
Do not suggest invalid code in pattern with loop Fixes #80913
2021-01-16Rollup merge of #80902 - JohnTitor:issue-76281, r=Mark-SimulacrumMara Bos-0/+12
Add a regression test for #76281 This has been fixed between 1.47.0-nightly (663d2f5cd 2020-08-22) and 1.47.0-nightly (5180f3da5 2020-08-23). Maybe fixed by #73526? Created `wasm` dir, it currently has only one test but I'll move some wasm-related tests there as a follow-up. Closes #76281
2021-01-16Rollup merge of #80901 - jyn514:better-colors, r=Mark-SimulacrumMara Bos-0/+10
Make `x.py --color always` apply to logging too Follow-up to https://github.com/rust-lang/rust/pull/78548, https://github.com/rust-lang/rust/pull/79004. r? ```@Mark-Simulacrum```
2021-01-16Rollup merge of #80764 - CAD97:weak-unsized-as-ptr-again, r=RalfJungMara Bos-95/+153
Re-stabilize Weak::as_ptr and friends for unsized T As per [T-lang consensus](https://hackmd.io/7r3_is6uTz-163fsOV8Vfg), this uses a branch to handle the dangling case. The discussed optimization of only doing the branch in the T: ?Sized case is left for a followup patch, as doing so is not trivial (as it requires specialization) and not _obviously_ better (as it requires using `wrapping_offset` rather than `offset` more). <details><summary>Basically said optimization</summary> Specialize on `T: Sized`: ```rust fn as_ptr(&self) -> *const T { if [ T is Sized ] || !is_dangling(ptr) { (ptr as *mut T).set_ptr_value( (ptr as *mut u8).wrapping_offset(data_offset) ) } else { ptr::null() } } fn from_raw(*const T) -> Self { if [ T is Sized ] || !ptr.is_null() { let ptr = (ptr as *mut RcBox).set_ptr_value( (ptr as *mut u8).wrapping_offset(-data_offset) ); Weak { ptr } } else { Weak::new() } } ``` (but with more `set_ptr_value` to avoid `Sized` restrictions and maintain metadata.) Written in this fashion, this is not a correctness-critical specialization (i.e. so long as `[ T is Sized ]` is false for unsized `T`, it can be `rand()` for sized `T` without breaking correctness), but it's still touchy, so I'd rather do it in another PR with separate review. --- </details> This effectively reverts #80422 and re-establishes #74160. T-libs [previously signed off](https://github.com/rust-lang/rust/pull/74160#issuecomment-660539373) on this stable API change in #74160.
2021-01-16Rollup merge of #80681 - ChrisJefferson:logic-error-doc, r=m-ou-seMara Bos-2/+16
Clarify what the effects of a 'logic error' are This clarifies what a 'logic error' is (which is a term used to describe what happens if you put things in a hash table or btree and then use something like a refcell to break the internal ordering). This tries to be as vague as possible, as we don't really want to promise what happens, except "bad things, but not UB". This was discussed in #80657
2021-01-16Rollup merge of #80670 - the8472:fix-zip-trusted-random-access-composition, ↵Mara Bos-0/+23
r=m-ou-se TrustedRandomAaccess specialization composes incorrectly for nested iter::Zips I found this while working on improvements for TRA. After partially consuming a Zip adapter and then wrapping it into another Zip where the adapters use their `TrustedRandomAccess` specializations leads to the outer adapter returning elements which should have already been consumed. If the optimizer gets tripped up by the addition this might affect performance for chained `zip()` iterators even when the inner one is not partially advanced but it would require more extensive fixes to `TrustedRandomAccess` to communicate those offsets earlier. Included test fails on nightly, [playground link](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=24fa1edf8a104ff31f5a24830593b01f)
2021-01-16Rollup merge of #80614 - 1000teslas:issue-78938-fix, r=tmandryMara Bos-5/+89
Explain why borrows can't be held across yield point in async blocks For https://github.com/rust-lang/rust/issues/78938.
2021-01-16Rollup merge of #80144 - rust-lang:frewsxcv-patch-3, r=nikomatsakisMara Bos-3/+1
Remove giant badge in README Is it meant to be this big? I haven't seen any other open source project with this sort of thing
2021-01-16Rollup merge of #78455 - udoprog:refcell-opt-map, r=KodrAusMara Bos-0/+86
Introduce {Ref, RefMut}::try_map for optional projections in RefCell This fills a usability gap of `RefCell` I've personally encountered to perform optional projections, mostly into collections such as `RefCell<Vec<T>>` or `RefCell<HashMap<U, T>>`: > This kind of API was briefly featured under Open questions in #10514 back in 2013 (!) ```rust let values = RefCell::new(vec![1, 2, 3, 4]); let b = Ref::opt_map(values.borrow(), |vec| vec.get(2)); ``` It primarily avoids this alternative approach to accomplish the same kind of projection which is both rather noisy and panicky: ```rust let values = RefCell::new(vec![1, 2, 3, 4]); let b = if values.get(2).is_some() { Some(Ref::map(values.borrow(), |vec| vec.get(2).unwrap())) } else { None }; ``` ### Open questions The naming `opt_map` is preliminary. I'm not aware of prior art in std to lean on here, but this name should probably be improved if this functionality is desirable. Since `opt_map` consumes the guard, and alternative syntax might be more appropriate which instead *tries* to perform the projection, allowing the original borrow to be recovered in case it fails: ```rust pub fn try_map<U: ?Sized, F>(orig: Ref<'b, T>, f: F) -> Result<Ref<'b, U>, Self> where F: FnOnce(&T) -> Option<&U>; ``` This would be more in line with the `try_map` method [provided by parking lot](https://docs.rs/lock_api/0/lock_api/struct.RwLockWriteGuard.html#method.try_map).
2021-01-16Auto merge of #80290 - RalfJung:less-intrinsic-write, r=lcnrbors-408/+46
implement ptr::write without dedicated intrinsic This makes `ptr::write` more consistent with `ptr::write_unaligned`, `ptr::read`, `ptr::read_unaligned`, all of which are implemented in terms of `copy_nonoverlapping`. This means we can also remove `move_val_init` implementations in codegen and Miri, and its special handling in the borrow checker. Also see [this Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/ptr.3A.3Aread.20vs.20ptr.3A.3Awrite).
2021-01-16Add test for #34792Dániel Buga-0/+16
2021-01-16BTreeMap: expose new_internal function and sanitize from_new_internalStein Somers-13/+14
2021-01-16Auto merge of #81077 - bugadani:shrink, r=Mark-Simulacrumbors-3/+0
Remove unnecessary manual shrink_to_fit calls
2021-01-16Remove unnecessary manual shrink_to_fit callsDániel Buga-3/+0
2021-01-16Auto merge of #77435 - hanmertens:binary_heap_append, r=scottmcmbors-2/+8
Always use extend in BinaryHeap::append This is faster, see #77433. Fixes #77433
2021-01-16Clarify what the effects of a 'logic error' areChris Jefferson-2/+16
2021-01-16Add sample code for Rc::new_cyclicOlivier Goffart-0/+20
2021-01-16Auto merge of #80873 - ssomers:btree_cleanup_slices_4, r=Mark-Simulacrumbors-81/+88
BTreeMap: tougher checks on code using raw into_kv_pointers r? `@Mark-Simulacrum`
2021-01-16Add a regression test for #76281Yuki Okushi-0/+12
This has been fixed between 1.47.0-nightly (663d2f5cd 2020-08-22) and 1.47.0-nightly (5180f3da5 2020-08-23).
2021-01-15Rename as_chunks_mut_unchecked -> as_chunks_unchecked_mutScott McMurray-7/+7
2021-01-15Add `as_rchunks` (and friends) to slicesScott McMurray-7/+186
2021-01-16codegen_cranelift: Fix redundant semicolon warnÖmer Sinan Ağacan-1/+1
2021-01-16Add a testÖmer Sinan Ağacan-0/+17
2021-01-16doctest: Reset errors before dropping the parse sessionÖmer Sinan Ağacan-0/+6
The first parse is to collect whether the code contains macros, has `main`, and uses other crates. In that pass we ignore errors as those will be reported when the test file is actually built. For that we need to reset errors in the `Diagnostic` otherwise when dropping it unhandled errors will be reported as compiler bugs. Fixes #80992
2021-01-16Auto merge of #77885 - erikdesjardins:probeasm, r=cuviperbors-10/+62
Use probe-stack=inline-asm in LLVM 11+ Fixes (?) #74405, related to #43241 r? `@cuviper`
2021-01-16add tracking issue to cell_filter_mapAshley Mannix-2/+2
2021-01-16Auto merge of #81057 - GuillaumeGomez:rollup-yl2kqst, r=GuillaumeGomezbors-112/+231
Rollup of 6 pull requests Successful merges: - #77693 (Add test for #59352) - #80515 (Improve JS performance by storing length before comparing to it in loops) - #81030 (Update mdbook) - #81033 (Remove useless `clean::Variant` struct) - #81049 (inline: Round word-size cost estimates up) - #81054 (Drop a few unneeded borrows) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-01-16Add a regression test for #50041Simonas Kazlauskas-0/+34
AFAICT the test case never landed alongside the fix for the issue.
2021-01-15Rollup merge of #81054 - LingMan:rem_as_ref, r=jyn514Guillaume Gomez-5/+5
Drop a few unneeded borrows `@rustbot` modify labels +C-cleanup +T-compiler
2021-01-15Rollup merge of #81049 - tmiasko:layout-cost, r=oli-obkGuillaume Gomez-1/+1
inline: Round word-size cost estimates up
2021-01-15Rollup merge of #81033 - jyn514:nested-variant, r=CraftSpiderGuillaume Gomez-47/+33
Remove useless `clean::Variant` struct It had exactly one field and no special behavior, so there was no point in having it. r? `@CraftSpider`
2021-01-15Rollup merge of #81030 - ehuss:update-mdbook, r=Mark-SimulacrumGuillaume Gomez-3/+3
Update mdbook Just a few small fixes and changes, see https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md#mdbook-046 for a list.
2021-01-15Rollup merge of #80515 - GuillaumeGomez:js-for-loop-perf, r=Nemo157,jyn514Guillaume Gomez-56/+50
Improve JS performance by storing length before comparing to it in loops Since https://github.com/rust-lang/rust/pull/79052 is quite complicated to review, I suggested to split into smaller parts. This first part is mostly about saving the array length into a variable (I tried to not change anything else as much as possible :smiley: ). r? `@jyn514`