]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAdd tests
Nadrieril [Sat, 2 Jan 2021 22:38:18 +0000 (22:38 +0000)]
Add tests

3 years agoAuto merge of #81058 - Smittyvb:wasm-num-tests, r=Mark-Simulacrum
bors [Sun, 17 Jan 2021 11:51:47 +0000 (11:51 +0000)]
Auto merge of #81058 - Smittyvb:wasm-num-tests, r=Mark-Simulacrum

Re-enable all num tests on WASM

This was partially done by #47365, but a few tests were missed in that PR.

3 years agoAuto merge of #81083 - ssomers:btree_drainy_refactor_1, r=Mark-Simulacrum
bors [Sun, 17 Jan 2021 08:44:12 +0000 (08:44 +0000)]
Auto merge of #81083 - ssomers:btree_drainy_refactor_1, r=Mark-Simulacrum

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`

3 years agoAuto merge of #78818 - scottmcm:as_rchunks, r=KodrAus
bors [Sun, 17 Jan 2021 05:43:55 +0000 (05:43 +0000)]
Auto merge of #78818 - scottmcm:as_rchunks, r=KodrAus

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.

3 years agoAuto merge of #80942 - c410-f3r:tests-tests-tests, r=petrochenkov
bors [Sun, 17 Jan 2021 02:48:07 +0000 (02:48 +0000)]
Auto merge of #80942 - c410-f3r:tests-tests-tests, r=petrochenkov

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`

3 years agoAuto merge of #81093 - calebcartwright:update-rustfmt, r=Mark-Simulacrum
bors [Sat, 16 Jan 2021 23:15:35 +0000 (23:15 +0000)]
Auto merge of #81093 - calebcartwright:update-rustfmt, r=Mark-Simulacrum

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`

3 years agoTry ignore-debug in the codegen test
Scott McMurray [Sat, 16 Jan 2021 22:52:48 +0000 (14:52 -0800)]
Try ignore-debug in the codegen test

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.

3 years agoMove some tests to more reasonable directories - 2
Caio [Sat, 16 Jan 2021 18:54:05 +0000 (15:54 -0300)]
Move some tests to more reasonable directories - 2

Address comments

Update limits

3 years agoAuto merge of #81089 - m-ou-se:rollup-z7iac6i, r=m-ou-se
bors [Sat, 16 Jan 2021 20:26:20 +0000 (20:26 +0000)]
Auto merge of #81089 - m-ou-se:rollup-z7iac6i, r=m-ou-se

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

3 years agobump rustfmt to v1.4.32
Caleb Cartwright [Sat, 16 Jan 2021 18:29:38 +0000 (12:29 -0600)]
bump rustfmt to v1.4.32

3 years agoRollup merge of #81081 - bugadani:double-partialeq, r=Mark-Simulacrum
Mara Bos [Sat, 16 Jan 2021 17:30:17 +0000 (17:30 +0000)]
Rollup merge of #81081 - bugadani:double-partialeq, r=Mark-Simulacrum

Add test for #34792

Closes #34792

3 years agoRollup merge of #81069 - ogoffart:rc_new_cyclic_doc, r=Mark-Simulacrum
Mara Bos [Sat, 16 Jan 2021 17:30:15 +0000 (17:30 +0000)]
Rollup merge of #81069 - ogoffart:rc_new_cyclic_doc, r=Mark-Simulacrum

Add sample code for Rc::new_cyclic

3 years agoRollup merge of #81065 - osa1:cranelift_semicolon_warning, r=jyn514
Mara Bos [Sat, 16 Jan 2021 17:30:13 +0000 (17:30 +0000)]
Rollup merge of #81065 - osa1:cranelift_semicolon_warning, r=jyn514

codegen_cranelift: Fix redundant semicolon warn

3 years agoRollup merge of #81060 - nagisa:nagisa/regression-50041, r=Mark-Simulacrum
Mara Bos [Sat, 16 Jan 2021 17:30:12 +0000 (17:30 +0000)]
Rollup merge of #81060 - nagisa:nagisa/regression-50041, r=Mark-Simulacrum

Add a regression test for #50041

AFAICT the test case never landed alongside the fix for the issue.

3 years agoRollup merge of #81040 - osa1:fix_80992, r=jyn514
Mara Bos [Sat, 16 Jan 2021 17:30:10 +0000 (17:30 +0000)]
Rollup merge of #81040 - osa1:fix_80992, r=jyn514

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

3 years agoRollup merge of #81021 - CraftSpider:rustdoc-remove-import, r=jyn514
Mara Bos [Sat, 16 Jan 2021 17:30:08 +0000 (17:30 +0000)]
Rollup merge of #81021 - CraftSpider:rustdoc-remove-import, r=jyn514

Remove doctree::Import

Per the title. Part of cleaning up doctree

3 years agoRollup merge of #80971 - camelid:feature-gate-testsuite-organization, r=Mark-Simulacrum
Mara Bos [Sat, 16 Jan 2021 17:30:06 +0000 (17:30 +0000)]
Rollup merge of #80971 - camelid:feature-gate-testsuite-organization, 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/`.

3 years agoRollup merge of #80968 - KodrAus:stabilize/poll_map, r=Mark-Simulacrum
Mara Bos [Sat, 16 Jan 2021 17:30:04 +0000 (17:30 +0000)]
Rollup merge of #80968 - KodrAus:stabilize/poll_map, r=Mark-Simulacrum

Stabilize the poll_map feature

Stabilizes the `poll_map` feature as tracked by #63514 (with a completed FCP).

3 years agoRollup merge of #80941 - JohnTitor:ref-mut-pat-in-loops, r=varkor
Mara Bos [Sat, 16 Jan 2021 17:30:02 +0000 (17:30 +0000)]
Rollup merge of #80941 - JohnTitor:ref-mut-pat-in-loops, r=varkor

Do not suggest invalid code in pattern with loop

Fixes #80913

3 years agoRollup merge of #80902 - JohnTitor:issue-76281, r=Mark-Simulacrum
Mara Bos [Sat, 16 Jan 2021 17:30:00 +0000 (17:30 +0000)]
Rollup merge of #80902 - JohnTitor:issue-76281, r=Mark-Simulacrum

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

3 years agoRollup merge of #80901 - jyn514:better-colors, r=Mark-Simulacrum
Mara Bos [Sat, 16 Jan 2021 17:29:58 +0000 (17:29 +0000)]
Rollup merge of #80901 - jyn514:better-colors, r=Mark-Simulacrum

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```

3 years agoRollup merge of #80764 - CAD97:weak-unsized-as-ptr-again, r=RalfJung
Mara Bos [Sat, 16 Jan 2021 17:29:56 +0000 (17:29 +0000)]
Rollup merge of #80764 - CAD97:weak-unsized-as-ptr-again, r=RalfJung

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.

3 years agoRollup merge of #80681 - ChrisJefferson:logic-error-doc, r=m-ou-se
Mara Bos [Sat, 16 Jan 2021 17:29:53 +0000 (17:29 +0000)]
Rollup merge of #80681 - ChrisJefferson:logic-error-doc, r=m-ou-se

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

3 years agoRollup merge of #80670 - the8472:fix-zip-trusted-random-access-composition, r=m-ou-se
Mara Bos [Sat, 16 Jan 2021 17:29:51 +0000 (17:29 +0000)]
Rollup merge of #80670 - the8472:fix-zip-trusted-random-access-composition, 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)

3 years agoRollup merge of #80614 - 1000teslas:issue-78938-fix, r=tmandry
Mara Bos [Sat, 16 Jan 2021 17:29:49 +0000 (17:29 +0000)]
Rollup merge of #80614 - 1000teslas:issue-78938-fix, r=tmandry

Explain why borrows can't be held across yield point in async blocks

For https://github.com/rust-lang/rust/issues/78938.

3 years agoRollup merge of #80144 - rust-lang:frewsxcv-patch-3, r=nikomatsakis
Mara Bos [Sat, 16 Jan 2021 17:29:47 +0000 (17:29 +0000)]
Rollup merge of #80144 - rust-lang:frewsxcv-patch-3, r=nikomatsakis

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

3 years agoRollup merge of #78455 - udoprog:refcell-opt-map, r=KodrAus
Mara Bos [Sat, 16 Jan 2021 17:29:45 +0000 (17:29 +0000)]
Rollup merge of #78455 - udoprog:refcell-opt-map, r=KodrAus

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).

3 years agoAuto merge of #80290 - RalfJung:less-intrinsic-write, r=lcnr
bors [Sat, 16 Jan 2021 17:28:32 +0000 (17:28 +0000)]
Auto merge of #80290 - RalfJung:less-intrinsic-write, r=lcnr

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).

3 years agoAdd test for #34792
Dániel Buga [Sat, 16 Jan 2021 15:41:53 +0000 (16:41 +0100)]
Add test for #34792

3 years agoBTreeMap: expose new_internal function and sanitize from_new_internal
Stein Somers [Wed, 18 Nov 2020 17:19:38 +0000 (18:19 +0100)]
BTreeMap: expose new_internal function and sanitize from_new_internal

3 years agoAuto merge of #81077 - bugadani:shrink, r=Mark-Simulacrum
bors [Sat, 16 Jan 2021 14:04:43 +0000 (14:04 +0000)]
Auto merge of #81077 - bugadani:shrink, r=Mark-Simulacrum

Remove unnecessary manual shrink_to_fit calls

3 years agoRemove unnecessary manual shrink_to_fit calls
Dániel Buga [Sat, 16 Jan 2021 13:02:36 +0000 (14:02 +0100)]
Remove unnecessary manual shrink_to_fit calls

3 years agoAuto merge of #77435 - hanmertens:binary_heap_append, r=scottmcm
bors [Sat, 16 Jan 2021 11:10:13 +0000 (11:10 +0000)]
Auto merge of #77435 - hanmertens:binary_heap_append, r=scottmcm

Always use extend in BinaryHeap::append

This is faster, see #77433.

Fixes #77433

3 years agoClarify what the effects of a 'logic error' are
Chris Jefferson [Mon, 4 Jan 2021 09:22:56 +0000 (09:22 +0000)]
Clarify what the effects of a 'logic error' are

3 years agoAdd sample code for Rc::new_cyclic
Olivier Goffart [Sat, 16 Jan 2021 09:29:21 +0000 (10:29 +0100)]
Add sample code for Rc::new_cyclic

3 years agoAuto merge of #80873 - ssomers:btree_cleanup_slices_4, r=Mark-Simulacrum
bors [Sat, 16 Jan 2021 07:12:12 +0000 (07:12 +0000)]
Auto merge of #80873 - ssomers:btree_cleanup_slices_4, r=Mark-Simulacrum

BTreeMap: tougher checks on code using raw into_kv_pointers

r? `@Mark-Simulacrum`

3 years agoAdd a regression test for #76281
Yuki Okushi [Mon, 11 Jan 2021 04:20:18 +0000 (13:20 +0900)]
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).

3 years agoRename as_chunks_mut_unchecked -> as_chunks_unchecked_mut
Scott McMurray [Sat, 16 Jan 2021 05:25:30 +0000 (21:25 -0800)]
Rename as_chunks_mut_unchecked -> as_chunks_unchecked_mut

3 years agoAdd `as_rchunks` (and friends) to slices
Scott McMurray [Fri, 6 Nov 2020 21:51:44 +0000 (13:51 -0800)]
Add `as_rchunks` (and friends) to slices

3 years agocodegen_cranelift: Fix redundant semicolon warn
Ömer Sinan Ağacan [Sat, 16 Jan 2021 04:17:13 +0000 (07:17 +0300)]
codegen_cranelift: Fix redundant semicolon warn

3 years agoAdd a test
Ömer Sinan Ağacan [Sat, 16 Jan 2021 03:55:16 +0000 (06:55 +0300)]
Add a test

3 years agodoctest: Reset errors before dropping the parse session
Ömer Sinan Ağacan [Fri, 15 Jan 2021 12:51:32 +0000 (15:51 +0300)]
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

3 years agoAuto merge of #77885 - erikdesjardins:probeasm, r=cuviper
bors [Sat, 16 Jan 2021 03:10:52 +0000 (03:10 +0000)]
Auto merge of #77885 - erikdesjardins:probeasm, r=cuviper

Use probe-stack=inline-asm in LLVM 11+

Fixes (?) #74405, related to #43241

r? `@cuviper`

3 years agoadd tracking issue to cell_filter_map
Ashley Mannix [Sat, 16 Jan 2021 00:40:36 +0000 (10:40 +1000)]
add tracking issue to cell_filter_map

3 years agoAuto merge of #81057 - GuillaumeGomez:rollup-yl2kqst, r=GuillaumeGomez
bors [Sat, 16 Jan 2021 00:13:26 +0000 (00:13 +0000)]
Auto merge of #81057 - GuillaumeGomez:rollup-yl2kqst, r=GuillaumeGomez

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

3 years agoAdd a regression test for #50041
Simonas Kazlauskas [Thu, 14 Jan 2021 18:10:13 +0000 (20:10 +0200)]
Add a regression test for #50041

AFAICT the test case never landed alongside the fix for the issue.

3 years agoRollup merge of #81054 - LingMan:rem_as_ref, r=jyn514
Guillaume Gomez [Fri, 15 Jan 2021 22:31:03 +0000 (23:31 +0100)]
Rollup merge of #81054 - LingMan:rem_as_ref, r=jyn514

Drop a few unneeded borrows

`@rustbot` modify labels +C-cleanup +T-compiler

3 years agoRollup merge of #81049 - tmiasko:layout-cost, r=oli-obk
Guillaume Gomez [Fri, 15 Jan 2021 22:31:01 +0000 (23:31 +0100)]
Rollup merge of #81049 - tmiasko:layout-cost, r=oli-obk

inline: Round word-size cost estimates up

3 years agoRollup merge of #81033 - jyn514:nested-variant, r=CraftSpider
Guillaume Gomez [Fri, 15 Jan 2021 22:31:00 +0000 (23:31 +0100)]
Rollup merge of #81033 - jyn514:nested-variant, r=CraftSpider

Remove useless `clean::Variant` struct

It had exactly one field and no special behavior, so there was no point in having it.

r? `@CraftSpider`

3 years agoRollup merge of #81030 - ehuss:update-mdbook, r=Mark-Simulacrum
Guillaume Gomez [Fri, 15 Jan 2021 22:30:58 +0000 (23:30 +0100)]
Rollup merge of #81030 - ehuss:update-mdbook, r=Mark-Simulacrum

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.

3 years agoRollup merge of #80515 - GuillaumeGomez:js-for-loop-perf, r=Nemo157,jyn514
Guillaume Gomez [Fri, 15 Jan 2021 22:30:53 +0000 (23:30 +0100)]
Rollup merge of #80515 - GuillaumeGomez:js-for-loop-perf, r=Nemo157,jyn514

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`

3 years agoRollup merge of #77693 - bugadani:issue-59352, r=oli-obk
Guillaume Gomez [Fri, 15 Jan 2021 22:30:51 +0000 (23:30 +0100)]
Rollup merge of #77693 - bugadani:issue-59352, r=oli-obk

Add test for #59352

Issue #59352 reported an optimization regression with rustc 1.32.0+. That regression could be tracked to a change that caused a function to miss the size limit of llvm's inlining, which results in an unreachable panicing branch being generated.
Enabling mir inline solves the issue, but is currently only done for `mir-opt-level>=2`.

This PR adds a test that can serve as a regression test for #59352, if/when mir inlining gets mature enough for opt-level 1, or some other optimization can remove the panic.

3 years agoRe-enable all num tests on WASM
Smitty [Fri, 15 Jan 2021 21:58:44 +0000 (16:58 -0500)]
Re-enable all num tests on WASM

This was partially done by #47365, but a few tests
were missed in that PR.

3 years agoUse Array.some instead of onEach to have better performance
Guillaume Gomez [Fri, 8 Jan 2021 13:52:12 +0000 (14:52 +0100)]
Use Array.some instead of onEach to have better performance

3 years agoImprove JS performance by storing length before comparing to it in loops
Guillaume Gomez [Wed, 30 Dec 2020 15:36:08 +0000 (16:36 +0100)]
Improve JS performance by storing length before comparing to it in loops

3 years agoAuto merge of #80602 - tgnottingham:cratemetadata_you_aint_special, r=michaelwoerister
bors [Fri, 15 Jan 2021 21:13:35 +0000 (21:13 +0000)]
Auto merge of #80602 - tgnottingham:cratemetadata_you_aint_special, r=michaelwoerister

Remove DepKind::CrateMetadata and pre-allocation of DepNodes

Remove much of the special-case handling around crate metadata
dependency tracking by replacing `DepKind::CrateMetadata` and the
pre-allocation of corresponding `DepNodes` with on-demand invocation
of the `crate_hash` query.

3 years agoChange rebuild heuristic in BinaryHeap::append
Han Mertens [Fri, 15 Jan 2021 20:50:05 +0000 (21:50 +0100)]
Change rebuild heuristic in BinaryHeap::append

See #77433 for why the new heuristic was chosen.

Fixes #77433

3 years agoDrop a few unneeded borrows
LingMan [Fri, 15 Jan 2021 20:29:28 +0000 (21:29 +0100)]
Drop a few unneeded borrows

3 years agoRename VariantKind -> Variant
Joshua Nelson [Fri, 15 Jan 2021 06:17:23 +0000 (01:17 -0500)]
Rename VariantKind -> Variant

There's no `Variant`, so it seems silly to have `Kind`.

3 years agoRemove useless `clean::Variant` struct
Joshua Nelson [Fri, 15 Jan 2021 02:42:59 +0000 (21:42 -0500)]
Remove useless `clean::Variant` struct

It had exactly one field and no special behavior, so there was no point.

3 years agoAuto merge of #81043 - hyd-dev:update-miri, r=RalfJung
bors [Fri, 15 Jan 2021 18:17:09 +0000 (18:17 +0000)]
Auto merge of #81043 - hyd-dev:update-miri, r=RalfJung

Update Miri

Fixes #80907.

r? `@RalfJung`

3 years agoAdd warning to compare.py about error messages
Rune Tynan [Fri, 15 Jan 2021 00:39:59 +0000 (19:39 -0500)]
Add warning to compare.py about error messages

3 years agoFix JSON test
Rune Tynan [Fri, 15 Jan 2021 00:01:48 +0000 (19:01 -0500)]
Fix JSON test

3 years agoAddress nit
Rune Tynan [Thu, 14 Jan 2021 20:03:17 +0000 (15:03 -0500)]
Address nit

3 years agoRemove doctree::Import
Rune Tynan [Thu, 14 Jan 2021 19:49:58 +0000 (14:49 -0500)]
Remove doctree::Import

3 years agoAdd test for #59352
Dániel Buga [Wed, 7 Oct 2020 20:59:18 +0000 (22:59 +0200)]
Add test for #59352

3 years agoUse Result and rename to filter_map
John-John Tedro [Thu, 17 Dec 2020 00:46:06 +0000 (01:46 +0100)]
Use Result and rename to filter_map

The use of Result allows for making use of a reconstructed original value on failed
projections.

3 years agoUpdate compiler/rustc_mir/src/borrow_check/diagnostics/conflict_errors.rs
1000teslas [Fri, 15 Jan 2021 16:32:54 +0000 (03:32 +1100)]
Update compiler/rustc_mir/src/borrow_check/diagnostics/conflict_errors.rs

Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
3 years agoUpdate Miri
hyd-dev [Fri, 15 Jan 2021 14:55:32 +0000 (22:55 +0800)]
Update Miri

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoAuto merge of #80974 - ehuss:update-cargo, r=ehuss
bors [Fri, 15 Jan 2021 15:26:05 +0000 (15:26 +0000)]
Auto merge of #80974 - ehuss:update-cargo, r=ehuss

Update cargo

10 commits in 329895f5b52a358e5d9ecb26215708b5cb31d906..a73e5b7d567c3036b296fc6b33ed52c5edcd882e
2021-01-06 00:01:52 +0000 to 2021-01-12 23:45:39 +0000
- Sort available binaries when multiple (rust-lang/cargo#9066)
- Fix misspelling of environment variable (rust-lang/cargo#9067)
- Remove statement that opt-level 0 turns on debug (rust-lang/cargo#9070)
- Fix `links` vars showing up for testing packages (rust-lang/cargo#9065)
- Fix unit_for computation on proc-macros in shared workspace. (rust-lang/cargo#9059)
- Document `could not find the github team` error on `cargo owner --add` (rust-lang/cargo#9000)
- Unstable section of cargo/config.toml takes bools (rust-lang/cargo#9057)
- [doc] add note about empty environment variables for missing manifest keys (rust-lang/cargo#9053)
- another round of clippy lint fixes (rust-lang/cargo#9051)
- Updated display message of cargo metadata --help (rust-lang/cargo#9050)

3 years agoIntroduce {Ref, RefMut}::try_map for optional projections
John-John Tedro [Tue, 27 Oct 2020 23:15:36 +0000 (00:15 +0100)]
Introduce {Ref, RefMut}::try_map for optional projections

3 years agoAuto merge of #80625 - jyn514:python-what-python, r=Mark-Simulacrum
bors [Fri, 15 Jan 2021 12:26:09 +0000 (12:26 +0000)]
Auto merge of #80625 - jyn514:python-what-python, r=Mark-Simulacrum

Choose the version of python at runtime (portable version)

r? `@Mark-Simulacrum`

Fixed version of https://github.com/rust-lang/rust/pull/80585. The goal is to avoid giving 'error: python3 required' when downloading LLVM from CI and instead default to python3 where possible.

This has some minor overhead when you have `python` as python2, but almost nothing compared to actually running the build.

3 years agoAuto merge of #81035 - JohnTitor:rollup-9m03awf, r=JohnTitor
bors [Fri, 15 Jan 2021 09:27:21 +0000 (09:27 +0000)]
Auto merge of #81035 - JohnTitor:rollup-9m03awf, r=JohnTitor

Rollup of 5 pull requests

Successful merges:

 - #80254 (Don't try to add nested predicate to Rustdoc auto-trait `ParamEnv`)
 - #80834 (Remove unreachable panics from VecDeque::{front/back}[_mut])
 - #80944 (Use Option::map_or instead of `.map(..).unwrap_or(..)`)
 - #81008 (Don't ICE when computing a layout of a generator tainted by errors)
 - #81023 (Remove doctree::Variant)

Failed merges:

 - #81033 (Remove useless `clean::Variant` struct)

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #81023 - CraftSpider:rustdoc-remove-variant, r=jyn514
Yuki Okushi [Fri, 15 Jan 2021 09:26:18 +0000 (18:26 +0900)]
Rollup merge of #81023 - CraftSpider:rustdoc-remove-variant, r=jyn514

Remove doctree::Variant

This was easy, probably was missed when whatever used it was removed

3 years agoRollup merge of #81008 - tmiasko:generator-layout-err, r=tmandry
Yuki Okushi [Fri, 15 Jan 2021 09:26:16 +0000 (18:26 +0900)]
Rollup merge of #81008 - tmiasko:generator-layout-err, r=tmandry

Don't ICE when computing a layout of a generator tainted by errors

Fixes #80998.

3 years agoRollup merge of #80944 - LingMan:map_or, r=nagisa
Yuki Okushi [Fri, 15 Jan 2021 09:26:14 +0000 (18:26 +0900)]
Rollup merge of #80944 - LingMan:map_or, r=nagisa

Use Option::map_or instead of `.map(..).unwrap_or(..)`

``@rustbot`` modify labels +C-cleanup +T-compiler

3 years agoRollup merge of #80834 - bugadani:vecdeque, r=oli-obk
Yuki Okushi [Fri, 15 Jan 2021 09:26:11 +0000 (18:26 +0900)]
Rollup merge of #80834 - bugadani:vecdeque, r=oli-obk

Remove unreachable panics from VecDeque::{front/back}[_mut]

`VecDeque`'s `front`, `front_mut`, `back` and `back_mut` methods are implemented in terms of the index operator, which causes these functions to contain [unreachable panic calls](https://rust.godbolt.org/z/MTnq1o).

This PR reimplements these methods in terms of `get[_mut]` instead.

3 years agoRollup merge of #80254 - Aaron1011:rustdoc-auto-param-env, r=estebank
Yuki Okushi [Fri, 15 Jan 2021 09:26:04 +0000 (18:26 +0900)]
Rollup merge of #80254 - Aaron1011:rustdoc-auto-param-env, r=estebank

Don't try to add nested predicate to Rustdoc auto-trait `ParamEnv`

Fixes #80233

We already have logic in `evaluate_predicates` that tries to add
unimplemented predicates to our `ParamEnv`. Trying to add a predicate
that already holds can lead to errors later on, since projection
will prefer trait candidates from the `ParamEnv` to predicates from an
impl.

3 years agoSimplify E0373 async code example
1000teslas [Fri, 15 Jan 2021 05:50:48 +0000 (16:50 +1100)]
Simplify E0373 async code example

3 years agoAuto merge of #80993 - Aaron1011:collect-set-tokens, r=petrochenkov
bors [Fri, 15 Jan 2021 05:36:48 +0000 (05:36 +0000)]
Auto merge of #80993 - Aaron1011:collect-set-tokens, r=petrochenkov

Set tokens on AST node in `collect_tokens`

A new `HasTokens` trait is introduced, which is used to move logic from
the callers of `collect_tokens` into the body of `collect_tokens`.

In addition to reducing duplication, this paves the way for PR #80689,
which needs to perform additional logic during token collection.

3 years agoUse probe-stack=inline-asm in LLVM 11+
Erik Desjardins [Tue, 13 Oct 2020 02:33:27 +0000 (22:33 -0400)]
Use probe-stack=inline-asm in LLVM 11+

3 years agoAuto merge of #81027 - Xanewok:update-rls, r=calebcartwright
bors [Fri, 15 Jan 2021 02:11:37 +0000 (02:11 +0000)]
Auto merge of #81027 - Xanewok:update-rls, r=calebcartwright

Update RLS and Rustfmt

Fixes #80576

Updates Rustfmt to use `rustfmt-v1.4.31` branch. Both are updated (along with `racer`) in tandem to pull in the exact same version of rustc-ap-* libraries.

r? `@calebcartwright`

3 years agoChoose the version of python at runtime (portable version)
Joshua Nelson [Fri, 1 Jan 2021 16:52:31 +0000 (11:52 -0500)]
Choose the version of python at runtime (portable version)

- Try `py -3` first for windows compatibility
- Fall back to `python3` if `py` doesn't work

3 years agoUpdate mdbook
Eric Huss [Fri, 15 Jan 2021 01:50:23 +0000 (17:50 -0800)]
Update mdbook

3 years ago...and update Cargo.lock again
Igor Matuszewski [Fri, 15 Jan 2021 01:26:55 +0000 (02:26 +0100)]
...and update Cargo.lock again

3 years agoRemove local patch in Cargo.toml for rls-* crates
Igor Matuszewski [Fri, 15 Jan 2021 01:21:04 +0000 (02:21 +0100)]
Remove local patch in Cargo.toml for rls-* crates

3 years agoUpdate RLS and Rustfmt
Igor Matuszewski [Fri, 15 Jan 2021 00:50:59 +0000 (01:50 +0100)]
Update RLS and Rustfmt

3 years agoinline: Round word-size cost estimates up
Tomasz Miąsko [Fri, 15 Jan 2021 00:00:00 +0000 (00:00 +0000)]
inline: Round word-size cost estimates up

3 years agoRemove doctree::Variant
Rune Tynan [Thu, 14 Jan 2021 20:21:44 +0000 (15:21 -0500)]
Remove doctree::Variant

3 years agoAuto merge of #81018 - m-ou-se:rollup-7202dc7, r=m-ou-se
bors [Thu, 14 Jan 2021 20:21:20 +0000 (20:21 +0000)]
Auto merge of #81018 - m-ou-se:rollup-7202dc7, r=m-ou-se

Rollup of 17 pull requests

Successful merges:

 - #79982 (Add missing methods to unix ExitStatusExt)
 - #80017 (Suggest `_` and `..` if a pattern has too few fields)
 - #80169 (Recommend panic::resume_unwind instead of panicking.)
 - #80217 (Add a `std::io::read_to_string` function)
 - #80444 (Add as_ref and as_mut methods for Bound)
 - #80567 (Add Iterator::intersperse_with)
 - #80829 (Get rid of `DepConstructor`)
 - #80895 (Fix handling of malicious Readers in read_to_end)
 - #80966 (Deprecate atomic::spin_loop_hint in favour of hint::spin_loop)
 - #80969 (Use better ICE message when no MIR is available)
 - #80972 (Remove unstable deprecated Vec::remove_item)
 - #80973 (Update books)
 - #80980 (Fixed incorrect doc comment)
 - #80981 (Fix -Cpasses=list and llvm version print with -vV)
 - #80985 (Fix stabilisation version of slice_strip)
 - #80990 (llvm: Remove the unused context from CreateDebugLocation)
 - #80991 (Fix formatting specifiers doc links)

Failed merges:

 - #80944 (Use Option::map_or instead of `.map(..).unwrap_or(..)`)

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRemove unreachable panics from VecDeque
Dániel Buga [Sat, 9 Jan 2021 09:22:06 +0000 (10:22 +0100)]
Remove unreachable panics from VecDeque

3 years agoUse Option::map_or instead of `.map(..).unwrap_or(..)`
LingMan [Mon, 11 Jan 2021 19:45:33 +0000 (20:45 +0100)]
Use Option::map_or instead of `.map(..).unwrap_or(..)`

3 years agoRollup merge of #80991 - calebsander:fix/fmt-link, r=m-ou-se
Mara Bos [Thu, 14 Jan 2021 18:00:31 +0000 (18:00 +0000)]
Rollup merge of #80991 - calebsander:fix/fmt-link, r=m-ou-se

Fix formatting specifiers doc links

d36e3e23a80f039ee98117ebba0bb2ea6e34f0c1 seems to have inadvertently changed many of these links to point to `core::fmt` instead of `std::fmt`. The information about formatting specifiers is only documented in [`std::fmt`](https://doc.rust-lang.org/std/fmt/); [`core::fmt`](https://doc.rust-lang.org/core/fmt/) is empty. 3baf6a4a749bd6ac4a8b9f1054d3f2ad2fc91e45 seems to have already fixed a couple of these links to point back to `std::fmt`.

3 years agoRollup merge of #80990 - cuviper:unused-debug-context, r=nagisa
Mara Bos [Thu, 14 Jan 2021 18:00:29 +0000 (18:00 +0000)]
Rollup merge of #80990 - cuviper:unused-debug-context, r=nagisa

llvm: Remove the unused context from CreateDebugLocation

This went unused in commit 88d874de6395, part of #68965.

3 years agoRollup merge of #80985 - ijackson:slice-strip-fix, r=jyn514
Mara Bos [Thu, 14 Jan 2021 18:00:27 +0000 (18:00 +0000)]
Rollup merge of #80985 - ijackson:slice-strip-fix, r=jyn514

Fix stabilisation version of slice_strip

See https://github.com/rust-lang/rust/pull/77853#pullrequestreview-564921079

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoRollup merge of #80981 - bjorn3:bjorn3-patch-1, r=jonas-schievink
Mara Bos [Thu, 14 Jan 2021 18:00:25 +0000 (18:00 +0000)]
Rollup merge of #80981 - bjorn3:bjorn3-patch-1, r=jonas-schievink

Fix -Cpasses=list and llvm version print with -vV

cc https://github.com/rust-lang/rust/pull/77975#issuecomment-759362933

3 years agoRollup merge of #80980 - trevarj:patch-1, r=nagisa
Mara Bos [Thu, 14 Jan 2021 18:00:22 +0000 (18:00 +0000)]
Rollup merge of #80980 - trevarj:patch-1, r=nagisa

Fixed incorrect doc comment

">" is right alignment, not left

3 years agoRollup merge of #80973 - ehuss:update-books, r=ehuss
Mara Bos [Thu, 14 Jan 2021 18:00:20 +0000 (18:00 +0000)]
Rollup merge of #80973 - ehuss:update-books, r=ehuss

Update books

## nomicon

2 commits in a5a48441d411f61556b57d762b03d6874afe575d..a8584998eacdea7106a1dfafcbf6c1c06fcdf925
2020-12-06 10:39:41 +0900 to 2021-01-06 12:49:49 -0500
- Update vector code examples
- Remove outdated information about `jemalloc`

## reference

13 commits in b278478b766178491a8b6f67afa4bcd6b64d977a..50af691f838937c300b47812d0507c6d88c14f97
2020-12-21 18:18:03 -0800 to 2021-01-12 21:19:20 -0800
- Update grammar for parser unification. (rust-lang/reference#927)
- Define constraining an implementation (rust-lang/reference#928)
- Document extra behavior of #[no_mangle] (rust-lang/reference#930)
- Add a float examle without a `.`. (rust-lang/reference#929)
- Add more details about const generics. (rust-lang/reference#921)
- Fix footnotes. (rust-lang/reference#926)
- Add "Logic errors" as behavior not considered unsafe (rust-lang/reference#919)
- Update grammar for order of parameters/arguments. (rust-lang/reference#920)
- Fix formatting in the tuple section (rust-lang/reference#923)
- document const generics (rust-lang/reference#901)
- Update mdbook (rust-lang/reference#918)
- linkage.md: update link to FFI section of the Book. (rust-lang/reference#917)
- Document array expression with a const. (rust-lang/reference#914)

## book

8 commits in 5bb44f8b5b0aa105c8b22602e9b18800484afa21..ac57a0ddd23d173b26731ccf939f3ba729753275
2020-12-18 20:07:31 -0500 to 2021-01-09 14:18:45 -0500
- Update version of mdbook we're testing with to 0.4.5 (rust-lang/book#2561)
- Fix grammar in ch13-01-closures.md (rust-lang/book#2534)
- Merge remote-tracking branch 'origin/pr/2527'
- Clarify code example ch6.3 (rust-lang/book#2485)
- Fix link added in rust-lang/book#2495 to be relative and at the bottom
- Merge remote-tracking branch 'origin/pr/2495'
- Update output to match the updated poem punctuation
- Fix rust-lang/book#2539 - Remove fancy apostrophes from poem for Windows

## rust-by-example

3 commits in 1cce0737d6a7d3ceafb139b4a206861fb1dcb2ab..03e23af01f0b4f83a3a513da280e1ca92587f2ec
2020-12-21 17:36:29 -0300 to 2021-01-09 10:20:28 -0300
- Replace for loop with iteration (rust-lang/rust-by-example#1404)
- Update mdbook (rust-lang/rust-by-example#1402)
- Add note for match guards to include catch-all (rust-lang/rust-by-example#1401)

## embedded-book

1 commits in ba34b8a968f9531d38c4dc4411d5568b7c076bfe..ceec19e873be87c6ee5666b030c6bb612f889a96
2020-11-17 00:20:43 +0000 to 2021-01-03 13:13:10 +0000
- book.toml: add link to GitHub repo  (rust-embedded/book#276)

3 years agoRollup merge of #80972 - KodrAus:deprecate/remove_item, r=nagisa
Mara Bos [Thu, 14 Jan 2021 18:00:18 +0000 (18:00 +0000)]
Rollup merge of #80972 - KodrAus:deprecate/remove_item, r=nagisa

Remove unstable deprecated Vec::remove_item

Closes #40062

The `Vec::remove_item` method was deprecated in `1.46.0` (in August of 2020). This PR now removes that unstable method entirely.

3 years agoRollup merge of #80969 - camelid:monomorph-ice-msg, r=nagisa
Mara Bos [Thu, 14 Jan 2021 18:00:16 +0000 (18:00 +0000)]
Rollup merge of #80969 - camelid:monomorph-ice-msg, r=nagisa

Use better ICE message when no MIR is available

The ICE message is somewhat confusing and overly specific - the issue is
that there's no MIR available.

This should make debugging these ICEs easier since the error tells you
what's actually wrong, not what it was trying to do when it failed.

cc https://github.com/rust-lang/rust/pull/80952#issuecomment-759198841
cc `````@jyn514`````