]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #81463 - matsujika:nll-ensure-c-case, r=varkor
Jonas Schievink [Mon, 1 Feb 2021 13:29:35 +0000 (14:29 +0100)]
Rollup merge of #81463 - matsujika:nll-ensure-c-case, r=varkor

Rename NLL* to Nll* accordingly to C-CASE

Given [C-CASE](https://rust-lang.github.io/api-guidelines/naming.html#casing-conforms-to-rfc-430-c-case), `NLLRegionVariableOrigin` and `NLL` are encouraged to be `NllRegionVariableOrigin` and `Nll` respectively.

3 years agoRollup merge of #81387 - c410-f3r:tests-tests-tests, r=petrochenkov
Jonas Schievink [Mon, 1 Feb 2021 13:29:33 +0000 (14:29 +0100)]
Rollup merge of #81387 - c410-f3r:tests-tests-tests, r=petrochenkov

Move some tests to more reasonable directories - 3

cc #73494
r? ````@petrochenkov````

https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-56202.rs <sup>https://github.com/rust-lang/rust/issues/56202</sup>: traits 1.008
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-69841.rs <sup>https://github.com/rust-lang/rust/issues/69841</sup>: for-loop-while 1.014
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-10763.rs <sup>https://github.com/rust-lang/rust/issues/10763</sup>: extern 1.016
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-50599.rs <sup>https://github.com/rust-lang/rust/issues/50599</sup>: resolve 1.018
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-6128.rs <sup>https://github.com/rust-lang/rust/issues/6128</sup>: traits 1.043
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-20616-8.rs <sup>https://github.com/rust-lang/rust/issues/20616</sup>: parser 1.045
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-46553.rs <sup>https://github.com/rust-lang/rust/issues/46553</sup>: consts 1.081
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-33140-hack-boundaries.rs <sup>https://github.com/rust-lang/rust/issues/33140</sup>: traits 1.101
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-25826.rs <sup>https://github.com/rust-lang/rust/issues/25826</sup>: consts 1.108
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-56488.rs <sup>https://github.com/rust-lang/rust/issues/56488</sup>: traits 1.110
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-58856-1.rs <sup>https://github.com/rust-lang/rust/issues/58856</sup>: parser 1.133
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-57819.rs <sup>https://github.com/rust-lang/rust/issues/57819</sup>: parser 1.138
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-54348.rs <sup>https://github.com/rust-lang/rust/issues/54348</sup>: consts 1.155
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-14309.rs <sup>https://github.com/rust-lang/rust/issues/14309</sup>: lint 1.160
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-4446.rs <sup>https://github.com/rust-lang/rust/issues/4446</sup>: threads-sendsync 1.203
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-53675-a-test-called-panic.rs <sup>https://github.com/rust-lang/rust/issues/53675</sup>: test-attrs 1.211
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-40231-2.rs <sup>https://github.com/rust-lang/rust/issues/40231</sup>: consts 1.213
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-22037.rs <sup>https://github.com/rust-lang/rust/issues/22037</sup>: associated-types 1.214
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-59029-2.rs <sup>https://github.com/rust-lang/rust/issues/59029</sup>: traits 1.219
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-18425.rs <sup>https://github.com/rust-lang/rust/issues/18425</sup>: consts 1.237
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-6157.rs <sup>https://github.com/rust-lang/rust/issues/6157</sup>: regions 1.238
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-33819.rs <sup>https://github.com/rust-lang/rust/issues/33819</sup>: borrowck 1.280
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-3683.rs <sup>https://github.com/rust-lang/rust/issues/3683</sup>: traits 1.283
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-8709.rs <sup>https://github.com/rust-lang/rust/issues/8709</sup>: macros 1.291
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-20616-9.rs <sup>https://github.com/rust-lang/rust/issues/20616</sup>: parser 1.293
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-64732.rs <sup>https://github.com/rust-lang/rust/issues/64732</sup>: parser 1.296
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-18655.rs <sup>https://github.com/rust-lang/rust/issues/18655</sup>: associated-types 1.305
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-32947.rs <sup>https://github.com/rust-lang/rust/issues/32947</sup>: simd 1.322
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-57198.rs <sup>https://github.com/rust-lang/rust/issues/57198</sup>: parser 1.342
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-10764-rpass.rs <sup>https://github.com/rust-lang/rust/issues/10764</sup>: extern 1.392
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-73541-2.rs <sup>https://github.com/rust-lang/rust/issues/73541</sup>: async-await 1.422
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-7970b.rs <sup>https://github.com/rust-lang/rust/issues/7970</sup>: parser 1.439
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-57684.rs <sup>https://github.com/rust-lang/rust/issues/57684</sup>: parser 1.512
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-33264.rs <sup>https://github.com/rust-lang/rust/issues/33264</sup>: llvm-asm 1.523
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-65284-suggest-generic-trait-bound.rs <sup>https://github.com/rust-lang/rust/issues/65284</sup>: suggestions 1.647
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-17458.rs <sup>https://github.com/rust-lang/rust/issues/17458</sup>: consts 1.711
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-56762.rs <sup>https://github.com/rust-lang/rust/issues/56762</sup>: consts 1.787
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-2216.rs <sup>https://github.com/rust-lang/rust/issues/2216</sup>: for-loop-while 1.856
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs <sup>https://github.com/rust-lang/rust/issues/45696</sup>: nll 2.009
https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-46036.rs <sup>https://github.com/rust-lang/rust/issues/46036</sup>: nll 2.059

````@petrochenkov```` Can you put a place holder (like `N/A`) for tests without GitHub issues? It is a lot easier to parse fixed sized rows.

3 years agoRollup merge of #81364 - camelid:improve-build-matches-docs, r=varkor
Jonas Schievink [Mon, 1 Feb 2021 13:29:31 +0000 (14:29 +0100)]
Rollup merge of #81364 - camelid:improve-build-matches-docs, r=varkor

Improve `rustc_mir_build::matches` docs

- Fix typos
- Add more information
- General cleanup

3 years agoRollup merge of #79291 - JulianKnodt:ce_priv, r=petrochenkov
Jonas Schievink [Mon, 1 Feb 2021 13:29:29 +0000 (14:29 +0100)]
Rollup merge of #79291 - JulianKnodt:ce_priv, r=petrochenkov

Add error message for private fn

Attempts to add a more detailed error when a `const_evaluatable` fn from another scope is used inside of a scope which cannot access it.

r? ````@lcnr````

3 years agoRollup merge of #78641 - the8472:buffered-copy, r=sfackler
Jonas Schievink [Mon, 1 Feb 2021 13:29:28 +0000 (14:29 +0100)]
Rollup merge of #78641 - the8472:buffered-copy, r=sfackler

Let io::copy reuse BufWriter buffers

This optimization will allow users to implicitly set the buffer size for io::copy by wrapping the writer into a `BufWriter` if the default block size is insufficient, which should fix #49921

Due to min_specialization limitations this approach only works with `BufWriter` but not for `BufReader<R>` since `R` is unconstrained and thus the necessary specialization on `R: Read` is not always applicable. Once specialization becomes more powerful this optimization could be extended to look at the reader and writer side and use whichever buffer is larger.

3 years agoAuto merge of #80851 - m-ou-se:panic-2021, r=petrochenkov
bors [Mon, 1 Feb 2021 10:25:31 +0000 (10:25 +0000)]
Auto merge of #80851 - m-ou-se:panic-2021, r=petrochenkov

Implement Rust 2021 panic

This implements the Rust 2021 versions of `panic!()`. See https://github.com/rust-lang/rust/issues/80162 and https://github.com/rust-lang/rfcs/pull/3007.

It does so by replacing `{std, core}::panic!()` by a bulitin macro that expands to either `$crate::panic::panic_2015!(..)` or `$crate::panic::panic_2021!(..)` depending on the edition of the caller.

This does not yet make std's panic an alias for core's panic on Rust 2021 as the RFC proposes. That will be a separate change: https://github.com/rust-lang/rust/pull/80879/commits/c5273bdfb266c35e8eab9413aa8d58d27fdbe114 That change is blocked on figuring out what to do with https://github.com/rust-lang/rust/issues/80846 first.

3 years agoAuto merge of #81591 - RalfJung:miri, r=RalfJung
bors [Mon, 1 Feb 2021 02:42:07 +0000 (02:42 +0000)]
Auto merge of #81591 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/81551
Cc `@rust-lang/miri` r? `@ghost`

3 years agoAuto merge of #81596 - jonas-schievink:rollup-utk14gr, r=jonas-schievink
bors [Sun, 31 Jan 2021 23:45:37 +0000 (23:45 +0000)]
Auto merge of #81596 - jonas-schievink:rollup-utk14gr, r=jonas-schievink

Rollup of 11 pull requests

Successful merges:

 - #80092 (2229: Fix issues with move closures and mutability)
 - #80404 (Remove const_in_array_repeat)
 - #81255 (Don't link with --export-dynamic on wasm32-wasi)
 - #81480 (Add suggestion for nested fields)
 - #81549 (Misc ip documentation fixes)
 - #81566 (Add a test for #71202)
 - #81568 (Fix an old FIXME in redundant paren lint)
 - #81571 (Fix typo in E0759)
 - #81572 (Edit multiple error code Markdown files)
 - #81589 (Fix small typo in string.rs)
 - #81590 (Stabilize int_bits_const)

Failed merges:

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

3 years agoUpdate outdated comment
Camelid [Sun, 31 Jan 2021 23:41:17 +0000 (15:41 -0800)]
Update outdated comment

The highest-priority item is the *first* in the list, not the last.
See [this code][1] for more.

[this code]: https://github.com/rust-lang/rust/blob/0e63af5da3400ace48a0345117980473fd21ad73/compiler/rustc_mir_build/src/build/matches/mod.rs#L1334-L1335

3 years agoMove some tests to more reasonable directories
Caio [Sun, 31 Jan 2021 22:46:46 +0000 (19:46 -0300)]
Move some tests to more reasonable directories

3 years agoAdd error message for private fn
kadmin [Sun, 22 Nov 2020 09:37:37 +0000 (09:37 +0000)]
Add error message for private fn

Bless tests

Update with changes from comments

3 years agoRollup merge of #81590 - KodrAus:stabilize/int_bits_const, r=m-ou-se
Jonas Schievink [Sun, 31 Jan 2021 15:36:57 +0000 (16:36 +0100)]
Rollup merge of #81590 - KodrAus:stabilize/int_bits_const, r=m-ou-se

Stabilize int_bits_const

Closes #76904

The FCP to stabilize the `int_bits_const` feature completed on the tracking issue.

3 years agoRollup merge of #81589 - Seppel3210:master, r=jonas-schievink
Jonas Schievink [Sun, 31 Jan 2021 15:36:56 +0000 (16:36 +0100)]
Rollup merge of #81589 - Seppel3210:master, r=jonas-schievink

Fix small typo in string.rs

3 years agoRollup merge of #81572 - pierwill:edit-error-codes-1, r=jonas-schievink
Jonas Schievink [Sun, 31 Jan 2021 15:36:54 +0000 (16:36 +0100)]
Rollup merge of #81572 - pierwill:edit-error-codes-1, r=jonas-schievink

Edit multiple error code Markdown files

Makes small edits to several error code files. Fixes some missing punctuation. Changes some wording, grammar, and formatting for clarity and readability.

Adds a link to the rustup book in E0658.

3 years agoRollup merge of #81571 - schteve:fix_e0759_typo, r=jonas-schievink
Jonas Schievink [Sun, 31 Jan 2021 15:36:52 +0000 (16:36 +0100)]
Rollup merge of #81571 - schteve:fix_e0759_typo, r=jonas-schievink

Fix typo in E0759

Minor typo in E0759 error message.

3 years agoRollup merge of #81568 - osa1:remove_old_fixme, r=jonas-schievink
Jonas Schievink [Sun, 31 Jan 2021 15:36:51 +0000 (16:36 +0100)]
Rollup merge of #81568 - osa1:remove_old_fixme, r=jonas-schievink

Fix an old FIXME in redundant paren lint

Referenced bug was fixed a while ago

3 years agoRollup merge of #81566 - osa1:issue71202, r=jonas-schievink
Jonas Schievink [Sun, 31 Jan 2021 15:36:49 +0000 (16:36 +0100)]
Rollup merge of #81566 - osa1:issue71202, r=jonas-schievink

Add a test for #71202

Closes #71202

---

Note that the test normally generates this warning:

```
warning: cannot use constants which depend on generic parameters in types
  --> test.rs:10:5
   |
10 | /     const ITEM_IS_COPY: [(); 1 - {
11 | |         trait NotCopy {
12 | |             const VALUE: bool = false;
13 | |         }
...  |
26 | |         <IsCopy<T>>::VALUE
27 | |     } as usize] = [];
   | |_____________________^
   |
   = note: `#[warn(const_evaluatable_unchecked)]` on by default
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #76200 <https://github.com/rust-lang/rust/issues/76200>
```

I added `allow(const_evaluatable_unchecked)`, but maybe we just don't want to add a test for this as the program is not really valid?

3 years agoRollup merge of #81549 - est31:wording_fix, r=jonas-schievink
Jonas Schievink [Sun, 31 Jan 2021 15:36:47 +0000 (16:36 +0100)]
Rollup merge of #81549 - est31:wording_fix, r=jonas-schievink

Misc ip documentation fixes

3 years agoRollup merge of #81480 - b-naber:nested_fields_suggestion, r=estebank
Jonas Schievink [Sun, 31 Jan 2021 15:36:46 +0000 (16:36 +0100)]
Rollup merge of #81480 - b-naber:nested_fields_suggestion, r=estebank

Add suggestion for nested fields

Closes https://github.com/rust-lang/rust/issues/81220

r? ```@estebank```

3 years agoRollup merge of #81255 - sunfishcode:wasi-no-export-dynamic, r=alexcrichton
Jonas Schievink [Sun, 31 Jan 2021 15:36:44 +0000 (16:36 +0100)]
Rollup merge of #81255 - sunfishcode:wasi-no-export-dynamic, r=alexcrichton

Don't link with --export-dynamic on wasm32-wasi

Remove --export-dynamic from the link arguments on the wasm32-wasi
target, as it emits spurious exports and increases code size.

Leave it in place for wasm32-unknown-unknown and
wasm32-unknown-emscripten. Even though it isn't a great solution
there, users are likely depending on its behavior there.

3 years agoRollup merge of #80404 - JulianKnodt:arr_ref, r=oli-obk
Jonas Schievink [Sun, 31 Jan 2021 15:36:42 +0000 (16:36 +0100)]
Rollup merge of #80404 - JulianKnodt:arr_ref, r=oli-obk

Remove const_in_array_repeat

Fixes #80371. Fixes #81315. Fixes #80767. Fixes #75682.

I thought there might be some issue with `Repeats(_, 0)`, but if you increase the items in the array it still ICEs. I'm not sure if this is the best fix but it does fix the given issue.

3 years agoRollup merge of #80092 - sexxi-goose:restrict_precision, r=nikomatsakis
Jonas Schievink [Sun, 31 Jan 2021 15:36:41 +0000 (16:36 +0100)]
Rollup merge of #80092 - sexxi-goose:restrict_precision, r=nikomatsakis

2229: Fix issues with move closures and mutability

This PR fixes two issues when feature `capture_disjoint_fields` is used.

1. Can't mutate using a mutable reference
2. Move closures try to move value out through a reference.

To do so, we
1. Compute the mutability of the capture and store it as part of the `CapturedPlace`  that is written in TypeckResults
2. Restrict capture precision. Note this is temporary for now, to allow the feature to be used with move closures and ByValue captures and might change depending on discussions with the lang team.
    - No Derefs are captured for ByValue captures, since that will result in value behind a reference getting moved.
    - No projections are applied to raw pointers since these require unsafe blocks. We capture
    them completely.

r? `````@nikomatsakis`````

3 years agoBless coverage-spanview/expected_mir_dump.*.
Mara Bos [Sun, 31 Jan 2021 15:10:08 +0000 (16:10 +0100)]
Bless coverage-spanview/expected_mir_dump.*.

3 years agospecialize io::copy to use the memory of the writer if it is a BufWriter
The8472 [Sun, 1 Nov 2020 18:59:24 +0000 (19:59 +0100)]
specialize io::copy to use the memory of the writer if it is a BufWriter

3 years agoupdate Miri
Ralf Jung [Sun, 31 Jan 2021 12:45:15 +0000 (13:45 +0100)]
update Miri

3 years agostabilize int_bits_const
Ashley Mannix [Sun, 31 Jan 2021 11:50:47 +0000 (21:50 +1000)]
stabilize int_bits_const

3 years agoFix small typo
Sebastian Widua [Sun, 31 Jan 2021 11:19:09 +0000 (12:19 +0100)]
Fix small typo

3 years agoAuto merge of #81478 - sivadeilra:windows_dll_imports, r=m-ou-se
bors [Sun, 31 Jan 2021 10:01:15 +0000 (10:01 +0000)]
Auto merge of #81478 - sivadeilra:windows_dll_imports, r=m-ou-se

Resolve DLL imports at CRT startup, not on demand

On Windows, libstd uses GetProcAddress to locate some DLL imports, so
that libstd can run on older versions of Windows. If a given DLL import
is not present, then libstd uses other behavior (such as fallback
implementations).

This commit uses a feature of the Windows CRT to do these DLL imports
during module initialization, before main() (or DllMain()) is called.
This is the ideal time to resolve imports, because the module is
effectively single-threaded at that point; no other threads can
touch the data or code of the module that is being initialized.

This avoids several problems. First, it makes the cost of performing
the DLL import lookups deterministic. Right now, the DLL imports are
done on demand, which means that application threads _might_ have to
do the DLL import during some time-sensitive operation. This is a
small source of unpredictability. Since threads can race, it's even
possible to have more than one thread running the same redundant
DLL lookup.

This commit also removes using the heap to allocate strings, during
the DLL lookups.

3 years agoAuto merge of #81327 - RalfJung:codegen-no-const-fail, r=oli-obk
bors [Sun, 31 Jan 2021 07:03:09 +0000 (07:03 +0000)]
Auto merge of #81327 - RalfJung:codegen-no-const-fail, r=oli-obk

codegen: assume constants cannot fail to evaluate

https://github.com/rust-lang/rust/pull/80579 landed, so we can finally remove this old hack from codegen and instead assume that consts never fail to evaluate. :)

r? `@oli-obk`

3 years agoAuto merge of #81578 - jonas-schievink:rollup-yhiyowl, r=jonas-schievink
bors [Sun, 31 Jan 2021 03:05:09 +0000 (03:05 +0000)]
Auto merge of #81578 - jonas-schievink:rollup-yhiyowl, r=jonas-schievink

Rollup of 18 pull requests

Successful merges:

 - #78044 (Implement io::Seek for io::Empty)
 - #79285 (Stabilize Arc::{increment,decrement}_strong_count)
 - #80053 (stabilise `cargo test -- --include-ignored`)
 - #80279 (Implement missing `AsMut<str>` for `str`)
 - #80470 (Stabilize by-value `[T; N]` iterator `core::array::IntoIter`)
 - #80945 (Add Box::downcast() for dyn Any + Send + Sync)
 - #81048 (Stabilize `core::slice::fill_with`)
 - #81198 (Remove requirement that forces symmetric and transitive PartialEq impls to exist)
 - #81422 (Account for existing `_` field pattern when suggesting `..`)
 - #81472 (Clone entire `TokenCursor` when collecting tokens)
 - #81484 (Optimize decimal formatting of 128-bit integers)
 - #81491 (Balance sidebar `Deref` cycle check with main content)
 - #81509 (Add a regression test for ICE of bad_placeholder_type)
 - #81547 (Edit rustc_typeck top-level docs)
 - #81550 (Replace predecessor with range in collections documentation)
 - #81558 (Fix ascii art text wrapping in mobile)
 - #81562 (Clarify that InPlaceIterable guarantees extend to all advancing iterator methods.)
 - #81563 (Improve docblock readability on small screen)

Failed merges:

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

3 years agoRollup merge of #81563 - pickfire:patch-6, r=GuillaumeGomez
Jonas Schievink [Sun, 31 Jan 2021 00:47:48 +0000 (01:47 +0100)]
Rollup merge of #81563 - pickfire:patch-6, r=GuillaumeGomez

Improve docblock readability on small screen

Before

![image](https://user-images.githubusercontent.com/4687791/106363174-f77bdf00-6361-11eb-898f-d480b8460ab3.png)

After

![image](https://user-images.githubusercontent.com/4687791/106363259-6bb68280-6362-11eb-85a1-ef9262681dd7.png)

Too much space is wasted on the left side. I wanted to make that 0 but it breaks some part with error symbols.

0

![image](https://user-images.githubusercontent.com/4687791/106363287-90aaf580-6362-11eb-88c1-62a8313988a7.png)

After

![image](https://user-images.githubusercontent.com/4687791/106363276-825cd980-6362-11eb-86eb-6f4611b4ab99.png)

3 years agoRollup merge of #81562 - the8472:improve-inplaceiterable-docs, r=sfackler
Jonas Schievink [Sun, 31 Jan 2021 00:47:46 +0000 (01:47 +0100)]
Rollup merge of #81562 - the8472:improve-inplaceiterable-docs, r=sfackler

Clarify that InPlaceIterable guarantees extend to all advancing iterator methods.

A documentation update that should answer a question that came up in [this zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Safety.20guarantees.20of.20InPlaceIterable/near/223743336)

CC `@SkiFire13`

3 years agoRollup merge of #81558 - pickfire:patch-5, r=GuillaumeGomez
Jonas Schievink [Sun, 31 Jan 2021 00:47:44 +0000 (01:47 +0100)]
Rollup merge of #81558 - pickfire:patch-5, r=GuillaumeGomez

Fix ascii art text wrapping in mobile

Fix #81377

Before

![image](https://user-images.githubusercontent.com/4687791/106362405-a1a53800-635d-11eb-87b9-2f40bbd023bf.png)
![image](https://user-images.githubusercontent.com/4687791/106362410-aa960980-635d-11eb-96ee-979251b213a3.png)
![image](https://user-images.githubusercontent.com/4687791/106362562-80911700-635e-11eb-97ee-b19a6ea2fc6d.png)

After

![image](https://user-images.githubusercontent.com/4687791/106362428-b4b80800-635d-11eb-8d5b-e4f51f5501ee.png)
![image](https://user-images.githubusercontent.com/4687791/106362433-bbdf1600-635d-11eb-96af-7043c74b3a0a.png)
![image](https://user-images.githubusercontent.com/4687791/106362570-8f77c980-635e-11eb-928d-ef1d26c13136.png)

Note the second image is scrolled to the back (right), I added some padding for the text block (not the code block) to make it more comfortable to read since the last character is stuck to the last character.

3 years agoRollup merge of #81550 - xfix:replace-mention-of-predecessor, r=jonas-schievink
Jonas Schievink [Sun, 31 Jan 2021 00:47:43 +0000 (01:47 +0100)]
Rollup merge of #81550 - xfix:replace-mention-of-predecessor, r=jonas-schievink

Replace predecessor with range in collections documentation

Fixes #81548.

3 years agoRollup merge of #81547 - pierwill:edit-typeck-mod-docs, r=davidtwco
Jonas Schievink [Sun, 31 Jan 2021 00:47:41 +0000 (01:47 +0100)]
Rollup merge of #81547 - pierwill:edit-typeck-mod-docs, r=davidtwco

Edit rustc_typeck top-level docs

Edit punctuation and wording in note on type variables vs. type parameters.

Also add missing punctuation and two inter-doc links.

3 years agoRollup merge of #81509 - 0yoyoyo:fix-issue-72685-ice-drop-in-place, r=estebank
Jonas Schievink [Sun, 31 Jan 2021 00:47:39 +0000 (01:47 +0100)]
Rollup merge of #81509 - 0yoyoyo:fix-issue-72685-ice-drop-in-place, r=estebank

Add a regression test for ICE of bad_placeholder_type

Add a regression test for #72685. Check the error message is output instead of ICE.

3 years agoRollup merge of #81491 - jryans:rustdoc-deref-ice-81395, r=GuillaumeGomez
Jonas Schievink [Sun, 31 Jan 2021 00:47:38 +0000 (01:47 +0100)]
Rollup merge of #81491 - jryans:rustdoc-deref-ice-81395, r=GuillaumeGomez

Balance sidebar `Deref` cycle check with main content

The `Deref` cycle checks added as part of #80653 were "unbalanced" in the sense
that the main content code path checks for cycles _before_ descending, while the
sidebar checks _after_. Checking _before_ is correct, so this changes the
sidebar path to match the main content path.

Fixes #81395

r? ```@GuillaumeGomez```

3 years agoRollup merge of #81484 - Kogia-sima:perf/optimize-udiv_1e19, r=nagisa
Jonas Schievink [Sun, 31 Jan 2021 00:47:36 +0000 (01:47 +0100)]
Rollup merge of #81484 - Kogia-sima:perf/optimize-udiv_1e19, r=nagisa

Optimize decimal formatting of 128-bit integers

## Description

This PR optimizes the `udivmod_1e19` function, which is used for formatting 128-bit integers, based on the algorithm provided in \[1\]. This optimization improves performance of formatting 128-bit integers, especially on 64-bit architectures. It also slightly reduces the output binary size.

## Assembler comparison

https://godbolt.org/z/YrG5zY

## Performance

#### previous results

```
test fmt::write_u128_max                                        ... bench:         552 ns/iter (+/- 4)
test fmt::write_u128_min                                        ... bench:         125 ns/iter (+/- 2)
```

#### new results

```
test fmt::write_u128_max                                        ... bench:         205 ns/iter (+/- 13)
test fmt::write_u128_min                                        ... bench:         129 ns/iter (+/- 5)
```

## Reference

\[1\] T. Granlund and P. Montgomery, “Division by Invariant Integers Using Multiplication” in Proc. of the SIGPLAN94 Conference on Programming Language Design and Implementation, 1994, pp. 61–72

3 years agoRollup merge of #81472 - Aaron1011:fix/revert-cursor-clone, r=petrochenkov
Jonas Schievink [Sun, 31 Jan 2021 00:47:34 +0000 (01:47 +0100)]
Rollup merge of #81472 - Aaron1011:fix/revert-cursor-clone, r=petrochenkov

Clone entire `TokenCursor` when collecting tokens

Reverts PR #80830
Fixes taiki-e/pin-project#312

We can have an arbitrary number of `None`-delimited group frames pushed
on the stack due to proc-macro invocations, which can legally be exited.
Attempting to account for this would add a lot of complexity for a tiny
performance gain, so let's just use the original strategy.

3 years agoRollup merge of #81422 - estebank:dotdot_sugg, r=davidtwco
Jonas Schievink [Sun, 31 Jan 2021 00:47:33 +0000 (01:47 +0100)]
Rollup merge of #81422 - estebank:dotdot_sugg, r=davidtwco

Account for existing `_` field pattern when suggesting `..`

Follow up to #80017.

3 years agoRollup merge of #81198 - dtolnay:partialeq, r=m-ou-se
Jonas Schievink [Sun, 31 Jan 2021 00:47:31 +0000 (01:47 +0100)]
Rollup merge of #81198 - dtolnay:partialeq, r=m-ou-se

Remove requirement that forces symmetric and transitive PartialEq impls to exist

### Counterexample of symmetry:

If you [have](https://docs.rs/proc-macro2/1.0.24/proc_macro2/struct.Ident.html#impl-PartialEq%3CT%3E) an impl like:

```rust
impl<T> PartialEq<T> for Ident
where
    T: ?Sized + AsRef<str>
```

then Rust will not even allow the symmetric impl to exist.

```console
error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Ident`)
 --> src/main.rs:9:6
  |
9 | impl<T> PartialEq<Ident> for T where T: ?Sized + AsRef<str> {
  |      ^ type parameter `T` must be covered by another type when it appears before the first local type (`Ident`)
  |
  = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type
  = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last
```

<br>

### Counterexample of transitivity:

Consider these two existing impls from `regex` and `clap`:

```rust
// regex

/// An inline representation of `Option<char>`.
pub struct Char(u32);

impl PartialEq<char> for Char {
    fn eq(&self, other: &char) -> bool {
        self.0 == *other as u32
    }
}
```

```rust
// clap

pub(crate) enum KeyType {
    Short(char),
    Long(OsString),
    Position(u64),
}

impl PartialEq<char> for KeyType {
    fn eq(&self, rhs: &char) -> bool {
        match self {
            KeyType::Short(c) => c == rhs,
            _ => false,
        }
    }
}
```

It's nice to be able to add `PartialEq<proc_macro::Punct> for char` in libproc_macro (https://github.com/rust-lang/rust/pull/80595), but it makes no sense to force an `impl PartialEq<Punct> for Char` and `impl PartialEq<Punct> for KeyType` in `regex` and `clap` in code that otherwise has nothing to do with proc macros.

<br>

`@rust-lang/libs`

3 years agoRollup merge of #81048 - yoshuawuyts:stabilize-core-slice-fill-with, r=m-ou-se
Jonas Schievink [Sun, 31 Jan 2021 00:47:29 +0000 (01:47 +0100)]
Rollup merge of #81048 - yoshuawuyts:stabilize-core-slice-fill-with, r=m-ou-se

Stabilize `core::slice::fill_with`

_Tracking issue: https://github.com/rust-lang/rust/issues/79221_

This stabilizes the `slice_fill_with` feature for Rust 1.51, following the stabilization of `slice_fill` in 1.50. This was requested by libs team members in https://github.com/rust-lang/rust/pull/79213.

This PR also adds the "memset" alias for `slice::fill_with`, mirroring the alias set on the `slice::fill` sibling API. This will ensure someone looking for "memset" will find both variants.

r? `@Amanieu`

3 years agoRollup merge of #80945 - sdroege:downcast-send-sync, r=m-ou-se
Jonas Schievink [Sun, 31 Jan 2021 00:47:27 +0000 (01:47 +0100)]
Rollup merge of #80945 - sdroege:downcast-send-sync, r=m-ou-se

Add Box::downcast() for dyn Any + Send + Sync

Looks like a plain omission, but unfortunately I just needed that in my code :)

3 years agoRollup merge of #80470 - SimonSapin:array-intoiter-type, r=m-ou-se
Jonas Schievink [Sun, 31 Jan 2021 00:47:25 +0000 (01:47 +0100)]
Rollup merge of #80470 - SimonSapin:array-intoiter-type, r=m-ou-se

Stabilize by-value `[T; N]` iterator `core::array::IntoIter`

Tracking issue: https://github.com/rust-lang/rust/issues/65798

This is unblocked now that `min_const_generics` has been stabilized in https://github.com/rust-lang/rust/pull/79135.

This PR does *not* include the corresponding `IntoIterator` impl, which is https://github.com/rust-lang/rust/pull/65819. Instead, an iterator can be constructed through the `new` method.

`new` would become unnecessary when `IntoIterator` is implemented and might be deprecated then, although it will stay stable.

3 years agoRollup merge of #80279 - Yaulendil:str-as-mut, r=m-ou-se
Jonas Schievink [Sun, 31 Jan 2021 00:47:23 +0000 (01:47 +0100)]
Rollup merge of #80279 - Yaulendil:str-as-mut, r=m-ou-se

Implement missing `AsMut<str>` for `str`

Allows `&mut str` to be taken by a Generic which requires `T` such that `T: AsMut<str>`. Motivating example:

```rust
impl<'i, T> From<T> for StructImmut<'i> where
    T: AsRef<str> + 'i,
{
    fn from(asref: T) -> Self {
        let string: &str = asref.as_ref();
        //  ...
    }
}

impl<'i, T> From<T> for StructMut<'i> where
    T: AsMut<str> + 'i,
{
    fn from(mut asmut: T) -> Self {
        let string: &mut str = asmut.as_mut();
        //  ...
    }
}
```

The Immutable form of this structure can be constructed by `StructImmut::from(s)` where `s` may be a `&String` or a `&str`, because `AsRef<str>` is implemented for `str`. However, the mutable form of the structure can be constructed in the same way **only** with a `&mut String`, and **not** with a `&mut str`.

This change does have some precedent, because as can be seen in [the Implementors](https://doc.rust-lang.org/std/convert/trait.AsMut.html#implementors), `AsMut<[T]>` is implemented for `[T]` as well as for `Vec<T>`, but `AsMut<str>` is implemented only for `String`. This would complete the symmetry.

As a trait implementation, this should be immediately stable.

3 years agoRollup merge of #80053 - gilescope:include-ignore, r=m-ou-se
Jonas Schievink [Sun, 31 Jan 2021 00:47:22 +0000 (01:47 +0100)]
Rollup merge of #80053 - gilescope:include-ignore, r=m-ou-se

stabilise `cargo test -- --include-ignored`

stabilise `cargo test -- --include-ignored`

On stable there's no way to run ignored tests as well as the normal tests.

An example use case where stabilising this would help:
Exercism has some initial tests and then some additional ignored tests that people run currently with --ignore but currently they can't run all the tests in one go without being on nightly. It would be a little more ergonomic if this flag was stablilised.

( Fixes  #65770 )

I built with ./x.py build -i library/test - but as libtest is a dylib is there an easy way to invoke it manually to check it's working as expected? (I've updated the automated tests.)

3 years agoRollup merge of #79285 - yoshuawuyts:stabilize-arc_mutate_strong_count, r=m-ou-se
Jonas Schievink [Sun, 31 Jan 2021 00:47:20 +0000 (01:47 +0100)]
Rollup merge of #79285 - yoshuawuyts:stabilize-arc_mutate_strong_count, r=m-ou-se

Stabilize Arc::{increment,decrement}_strong_count

Tracking issue: https://github.com/rust-lang/rust/issues/71983

Stabilizes `Arc::{incr,decr}_strong_count`, enabling unsafely incrementing an decrementing the Arc strong count directly with fewer gotchas. This API was first introduced on nightly six months ago, and has not seen any changes since. The initial PR showed two existing pieces of code that would benefit from this API, and included a change inside the stdlib to use this.

Given the small surface area, predictable use, and no changes since introduction, I'd like to propose we stabilize this.

closes https://github.com/rust-lang/rust/issues/71983
r? `@Mark-Simulacrum`

## Links
 * [Initial implementation](https://github.com/rust-lang/rust/pull/70733)
 * [Motivation from #68700](https://github.com/rust-lang/rust/pull/68700#discussion_r396169064)
 * [Real world example in an executor](https://docs.rs/extreme/666.666.666666/src/extreme/lib.rs.html#13)

3 years agoRollup merge of #78044 - oberien:empty-seek, r=m-ou-se
Jonas Schievink [Sun, 31 Jan 2021 00:47:18 +0000 (01:47 +0100)]
Rollup merge of #78044 - oberien:empty-seek, r=m-ou-se

Implement io::Seek for io::Empty

Fix #78029

3 years agoEdit multiple error code Markdown files
pierwill [Sat, 30 Jan 2021 21:32:28 +0000 (13:32 -0800)]
Edit multiple error code Markdown files

Makes small edits to several error code files. Fixes some
missing punctuation. Changes some wording, grammar, and formatting
for clarity and readability.

Adds a link to the rustup book in E0658.

3 years agoAuto merge of #81560 - flip1995:clippyup, r=Manishearth
bors [Sat, 30 Jan 2021 23:55:16 +0000 (23:55 +0000)]
Auto merge of #81560 - flip1995:clippyup, r=Manishearth

Update Clippy

r? `@Manishearth`

Biweekly Clippy update (2 days late)

3 years agoRemove const_in_array_rep_expr
kadmin [Tue, 26 Jan 2021 22:49:30 +0000 (22:49 +0000)]
Remove const_in_array_rep_expr

3 years agoadd suggestion for nested fields
b-naber [Thu, 28 Jan 2021 17:26:31 +0000 (18:26 +0100)]
add suggestion for nested fields

3 years agoimpl Seek for Empty
oberien [Sat, 17 Oct 2020 10:08:59 +0000 (12:08 +0200)]
impl Seek for Empty

Fix #78029

3 years agoBump as_mut_str_for_str stable version.
Mara Bos [Sat, 30 Jan 2021 21:10:25 +0000 (22:10 +0100)]
Bump as_mut_str_for_str stable version.

3 years agoAuto merge of #81565 - nikic:revert, r=nagisa
bors [Sat, 30 Jan 2021 20:46:58 +0000 (20:46 +0000)]
Auto merge of #81565 - nikic:revert, r=nagisa

Revert dist-x86_64-linux update to Clang 11

This reverts commit cb6787ae82d388045cdf6b5dc73787d828d91feb, reversing changes made to 0248c6f178ab3a4d2ec702b7d418ff8375ab0515.

The change causes errors when linking rustc shared objects with the binutils linker.

Fixes #81554.

r? `@Mark-Simulacrum`

3 years agoBump stable version of arc_mutate_strong_count
Mara Bos [Sat, 30 Jan 2021 20:08:30 +0000 (21:08 +0100)]
Bump stable version of arc_mutate_strong_count

3 years agoFix an old FIXME in redundant paren lint
Ömer Sinan Ağacan [Sat, 30 Jan 2021 19:39:52 +0000 (22:39 +0300)]
Fix an old FIXME in redundant paren lint

Referenced bug was fixed a while ago

3 years agoAdd a test for #71202
Ömer Sinan Ağacan [Sat, 30 Jan 2021 18:53:59 +0000 (21:53 +0300)]
Add a test for #71202

Closes #71202

3 years agoUpdate clippy test output for panic macros.
Mara Bos [Sat, 30 Jan 2021 18:33:21 +0000 (19:33 +0100)]
Update clippy test output for panic macros.

3 years agoEdit rustc_typeck top-level docs
pierwill [Sat, 30 Jan 2021 07:03:35 +0000 (23:03 -0800)]
Edit rustc_typeck top-level docs

Edit punctuation and wording in note on type variables
vs. type parameters.

Also add missing punctuation and two inter-doc links.

3 years agoRemove extra trailing spaces
Ivan Tham [Sat, 30 Jan 2021 17:36:15 +0000 (01:36 +0800)]
Remove extra trailing spaces

3 years agoFix docblock short code missing end whitespaces
Ivan Tham [Sat, 30 Jan 2021 17:27:21 +0000 (01:27 +0800)]
Fix docblock short code missing end whitespaces

3 years agoImprove docblock readability on small screen
Ivan Tham [Sat, 30 Jan 2021 17:19:29 +0000 (01:19 +0800)]
Improve docblock readability on small screen

3 years agoClarify that guarantees extend to other advancing iterator methods.
The8472 [Sat, 30 Jan 2021 17:07:48 +0000 (18:07 +0100)]
Clarify that guarantees extend to other advancing iterator methods.

3 years agoMerge commit '95c0459217d1661edfa794c8bb122452b92fb485' into clippyup
flip1995 [Sat, 30 Jan 2021 17:06:34 +0000 (18:06 +0100)]
Merge commit '95c0459217d1661edfa794c8bb122452b92fb485' into clippyup

3 years agoAuto merge of #6654 - flip1995:no_lazy_static_regex, r=flip1995
bors [Sat, 30 Jan 2021 16:49:45 +0000 (16:49 +0000)]
Auto merge of #6654 - flip1995:no_lazy_static_regex, r=flip1995

No lazy static regex

r? `@llogiq`

#6500

regex is unnecessary for this lint (https://github.com/rust-lang/rust-clippy/pull/6500#discussion_r558555071)
lazy_static is unnecessary. The std lazy feature should be  used instead.

changelog: none

3 years agoFix ascii art text wrapping in mobile
Ivan Tham [Sat, 30 Jan 2021 16:45:19 +0000 (00:45 +0800)]
Fix ascii art text wrapping in mobile

Fix #81377

3 years agoRevert "Auto merge of #81489 - nikic:x86-64-dist-update, r=Mark-Simulacrum"
Nikita Popov [Sat, 30 Jan 2021 16:44:49 +0000 (17:44 +0100)]
Revert "Auto merge of #81489 - nikic:x86-64-dist-update, r=Mark-Simulacrum"

This reverts commit cb6787ae82d388045cdf6b5dc73787d828d91feb, reversing
changes made to 0248c6f178ab3a4d2ec702b7d418ff8375ab0515.

3 years agoRemove unknown_clippy_lints allow attribute
flip1995 [Sat, 30 Jan 2021 16:43:20 +0000 (17:43 +0100)]
Remove unknown_clippy_lints allow attribute

3 years agoGet rid of regex and lazy_static dependencies
flip1995 [Sat, 30 Jan 2021 16:43:00 +0000 (17:43 +0100)]
Get rid of regex and lazy_static dependencies

3 years agoAuto merge of #81453 - jumbatm:clashing-extern-decl-perf, r=nagisa
bors [Sat, 30 Jan 2021 16:41:05 +0000 (16:41 +0000)]
Auto merge of #81453 - jumbatm:clashing-extern-decl-perf, r=nagisa

clashing_extern_declarations: Use symbol interning to avoid string alloc.

Use symbol interning as a hack to avoid allocating a string for every symbol name we store in the seen set. This hopefully addresses the minor perf regression described in https://github.com/rust-lang/rust/pull/80009#issuecomment-763526902.

r? `@nagisa`

3 years agoAuto merge of #6653 - flip1995:rustup, r=flip1995
bors [Sat, 30 Jan 2021 14:53:30 +0000 (14:53 +0000)]
Auto merge of #6653 - flip1995:rustup, r=flip1995

Rustup

changelog: Deprecate `unknown_clippy_lints` (integrated in `unknown_lints`)

r? `@ghost`

3 years agoBump nightly version -> 2021-01-30
flip1995 [Sat, 30 Jan 2021 14:52:02 +0000 (15:52 +0100)]
Bump nightly version -> 2021-01-30

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Sat, 30 Jan 2021 14:51:16 +0000 (15:51 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoFix typo in E0759
Steve Heindel [Sat, 30 Jan 2021 00:07:39 +0000 (19:07 -0500)]
Fix typo in E0759

3 years agoBalance sidebar `Deref` cycle check with main content
J. Ryan Stinnett [Thu, 28 Jan 2021 22:03:20 +0000 (22:03 +0000)]
Balance sidebar `Deref` cycle check with main content

The `Deref` cycle checks added as part of #80653 were "unbalanced" in the sense
that the main content code path checks for cycles _before_ descending, while the
sidebar checks _after_. Checking _before_ is correct, so this changes the
sidebar path to match the main content path.

3 years agoReplace predecessor with range in collections documentation
Konrad Borowski [Sat, 30 Jan 2021 13:24:00 +0000 (14:24 +0100)]
Replace predecessor with range in collections documentation

Fixes #81548.

3 years agocodegen: assume constants cannot fail to evaluate
Ralf Jung [Sun, 24 Jan 2021 11:12:08 +0000 (12:12 +0100)]
codegen: assume constants cannot fail to evaluate

also don't submit code to LLVM when the session has errors

3 years agoMisc ip documentation fixes
est31 [Sat, 30 Jan 2021 10:57:36 +0000 (11:57 +0100)]
Misc ip documentation fixes

3 years agoAuto merge of #81545 - JohnTitor:rollup-zlt3tn6, r=JohnTitor
bors [Sat, 30 Jan 2021 10:50:16 +0000 (10:50 +0000)]
Auto merge of #81545 - JohnTitor:rollup-zlt3tn6, r=JohnTitor

Rollup of 16 pull requests

Successful merges:

 - #79023 (Add `core::stream::Stream`)
 - #80562 (Consider Scalar to be a bool only if its unsigned)
 - #80886 (Stabilize raw ref macros)
 - #80959 (Stabilize `unsigned_abs`)
 - #81291 (Support FRU pattern with `[feature(capture_disjoint_fields)]`)
 - #81409 (Slight simplification of chars().count())
 - #81468 (cfg(version): treat nightlies as complete)
 - #81473 (Warn write-only fields)
 - #81495 (rustdoc: Remove unnecessary optional)
 - #81499 (Updated Vec::splice documentation)
 - #81501 (update rustfmt to v1.4.34)
 - #81505 (`fn cold_path` doesn't need to be pub)
 - #81512 (Add missing variants in match binding)
 - #81515 (Fix typo in pat.rs)
 - #81519 (Don't print error output from rustup when detecting default build triple)
 - #81520 (Don't clone LLVM submodule when download-ci-llvm is set)

Failed merges:

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

3 years agoAdd a regression test
0yoyoyo [Fri, 29 Jan 2021 10:23:04 +0000 (19:23 +0900)]
Add a regression test

3 years agoAuto merge of #81521 - nikic:update-dist-various, r=Mark-Simulacrum
bors [Sat, 30 Jan 2021 07:41:19 +0000 (07:41 +0000)]
Auto merge of #81521 - nikic:update-dist-various, r=Mark-Simulacrum

Update dist-various to Ubuntu 20.04

This updates the dist-various-1 and dist-various-2 images to Ubuntu
20.04. This requires some adjustments:

 * `DEBIAN_FRONTEND=noninteractive` required for apt install.
 * `team-gcc-argm-embedded` PPA does not support focal. However,
   we can simply use the distro-provided `gcc-arm-none-eabi`. Per
   the comment, the PPA was only used to get a newer version.
 * rumprun has to be updated to avoid a linker error.
 * We need to build rumrun with `NOGCCERROR`, which disables use
   of `-Werror` and allows building with a newer compiler.
 * We need to install `libtinfo5`, which appears to be a dependency
   of the clang used during the fuchsia build.
 * We need to switch to `g++-8` rather than `g++-7`, as at least
   `g++-7-arm-linux-gnueabi` is not available on focal.
 * We need to upgrade to GCC 6.5 for the Solaris build, as GCC 6.4
   does not support the newer libisl version.

r? `@Mark-Simulacrum`

3 years agoRollup merge of #81520 - jyn514:rustc2, r=Mark-Simulacrum
Yuki Okushi [Sat, 30 Jan 2021 04:37:04 +0000 (13:37 +0900)]
Rollup merge of #81520 - jyn514:rustc2, r=Mark-Simulacrum

Don't clone LLVM submodule when download-ci-llvm is set

Previously, `downloading_llvm` would check `self.build` while it was
still an empty string, and think it was always false. This fixes the
check.

This addresses the worst part of https://github.com/rust-lang/rust/issues/76653. There are still some large submodules being downloaded (in particular, `rustc-by-example` is 146 MB, and all the submodules combined are 311 MB), but this is a lot better than the whopping 1.4 GB before.

3 years agoRollup merge of #81519 - jyn514:rustup-toolchain, r=Mark-Simulacrum
Yuki Okushi [Sat, 30 Jan 2021 04:37:03 +0000 (13:37 +0900)]
Rollup merge of #81519 - jyn514:rustup-toolchain, r=Mark-Simulacrum

Don't print error output from rustup when detecting default build triple

Before, it could print this error if no toolchain was configured:

```
error: no default toolchain configured
error: backtrace:
error: stack backtrace:
   0: error_chain::backtrace::imp::InternalBacktrace::new
   1: rustup::config::Cfg::toolchain_for_dir
   2: rustup_init::run_rustup_inner
   3: rustup_init::main
   4: std::rt::lang_start::{{closure}}
   5: main
   6: __libc_start_main
   7: _start
```

3 years agoRollup merge of #81515 - eltociear:patch-7, r=jonas-schievink
Yuki Okushi [Sat, 30 Jan 2021 04:37:01 +0000 (13:37 +0900)]
Rollup merge of #81515 - eltociear:patch-7, r=jonas-schievink

Fix typo in pat.rs

parentesized -> parenthesized

3 years agoRollup merge of #81512 - GuillaumeGomez:cleanup-fixme-rustdoc, r=bugadani
Yuki Okushi [Sat, 30 Jan 2021 04:37:00 +0000 (13:37 +0900)]
Rollup merge of #81512 - GuillaumeGomez:cleanup-fixme-rustdoc, r=bugadani

Add missing variants in match binding

cc `````@bugadani````` `````@CraftSpider`````
r? `````@camelid`````

3 years agoRollup merge of #81505 - henryboisdequin:cold_path-not-pub, r=sanxiyn
Yuki Okushi [Sat, 30 Jan 2021 04:36:58 +0000 (13:36 +0900)]
Rollup merge of #81505 - henryboisdequin:cold_path-not-pub, r=sanxiyn

`fn cold_path` doesn't need to be pub

Fixes #81429

Note: this PR also fixes a small typo that I found

3 years agoRollup merge of #81501 - calebcartwright:update-rustfmt, r=sanxiyn
Yuki Okushi [Sat, 30 Jan 2021 04:36:56 +0000 (13:36 +0900)]
Rollup merge of #81501 - calebcartwright:update-rustfmt, r=sanxiyn

update rustfmt to v1.4.34

Short summary: Various formatting fixes (several const generic related) and introduction of `imports_granularity` config option

Long summary copied from changelog:

#### Changed
- `merge_imports` configuration has been deprecated in favor of the new `imports_granularity` option. Any existing usage of `merge_imports` will be automatically mapped to the corresponding value on `imports_granularity` with a warning message printed to encourage users to update their config files.

#### Added
- New `imports_granularity` option has been added which succeeds `merge_imports`. This new option supports several additional variants which allow users to merge imports at different levels (crate or module), and even flatten imports to have a single use statement per item. ([PR rust-lang/rustfmt#4634](https://github.com/rust-lang/rustfmt/pull/4634), [PR rust-lang/rustfmt#4639](https://github.com/rust-lang/rustfmt/pull/4639))

See the section on the configuration site for more information
https://rust-lang.github.io/rustfmt/?version=v1.4.33&search=#imports_granularity

#### Fixed
- Fix erroneous removal of `const` keyword on const trait impl ([rust-lang/rustfmt#4084](https://github.com/rust-lang/rustfmt/issues/4084))
- Fix incorrect span usage wit const generics in supertraits ([rust-lang/rustfmt#4204](https://github.com/rust-lang/rustfmt/issues/4204))
- Use correct span for const generic params ([rust-lang/rustfmt#4263](https://github.com/rust-lang/rustfmt/issues/4263))
- Correct span on const generics to include type bounds ([rust-lang/rustfmt#4310](https://github.com/rust-lang/rustfmt/issues/4310))
- Idempotence issue on blocks containing only empty statements ([rust-lang/rustfmt#4627](https://github.com/rust-lang/rustfmt/issues/4627) and [#3868](https://github.com/rust-lang/rustfmt/issues/3868))
- Fix issue with semicolon placement on required functions that have a trailing comment that ends in a line-style comment before the semicolon ([rust-lang/rustfmt#4646](https://github.com/rust-lang/rustfmt/issues/4646))
- Avoid shared interned cfg_if symbol since rustfmt can re-initialize the rustc_ast globals on multiple inputs ([rust-lang/rustfmt#4656](https://github.com/rust-lang/rustfmt/issues/4656))
- Don't insert trailing comma on (base-less) rest in struct literals within macros ([rust-lang/rustfmt#4675](https://github.com/rust-lang/rustfmt/issues/4675))

3 years agoRollup merge of #81499 - SOF3:patch-1, r=sanxiyn
Yuki Okushi [Sat, 30 Jan 2021 04:36:55 +0000 (13:36 +0900)]
Rollup merge of #81499 - SOF3:patch-1, r=sanxiyn

Updated Vec::splice documentation

Replacing with equal number of values does not increase the length of the vec.

Reference: https://stackoverflow.com/a/62559271/3990767

3 years agoRollup merge of #81495 - camelid:rustdoc-output_format-optional, r=GuillaumeGomez
Yuki Okushi [Sat, 30 Jan 2021 04:36:53 +0000 (13:36 +0900)]
Rollup merge of #81495 - camelid:rustdoc-output_format-optional, r=GuillaumeGomez

rustdoc: Remove unnecessary optional

Previously, the HTML output format was represented by both
`Some(OutputFormat::Html)` and `None` so there's no need to have an
optional. Instead, `OutputFormat::Html` is explicitly the default and we
no longer have a "tri-state enum".

r? `````@GuillaumeGomez`````

3 years agoRollup merge of #81473 - sanxiyn:write-only-field, r=oli-obk
Yuki Okushi [Sat, 30 Jan 2021 04:36:52 +0000 (13:36 +0900)]
Rollup merge of #81473 - sanxiyn:write-only-field, r=oli-obk

Warn write-only fields

cc `@Boscop's` example in #49256.

3 years agoRollup merge of #81468 - est31:cfg_version, r=petrochenkov
Yuki Okushi [Sat, 30 Jan 2021 04:36:50 +0000 (13:36 +0900)]
Rollup merge of #81468 - est31:cfg_version, r=petrochenkov

cfg(version): treat nightlies as complete

This PR makes cfg(version) treat the nightlies
for version 1.n.0 as 1.n.0, even though that nightly
version might not have all stabilizations and features
of the released 1.n.0. This is done for greater
convenience for people who want to test a newly
stabilized feature on nightly, or in other words,
give newly stabilized features as many eyeballs
as possible.

For users who wish to pin nightlies, this commit adds
a -Z assume-incomplete-release option that they can
enable if they run into any issues due to this change.
Implements the suggestion in https://github.com/rust-lang/rust/issues/64796#issuecomment-640851454

3 years agoRollup merge of #81409 - gilescope:chars_count, r=joshtriplett
Yuki Okushi [Sat, 30 Jan 2021 04:36:48 +0000 (13:36 +0900)]
Rollup merge of #81409 - gilescope:chars_count, r=joshtriplett

Slight simplification of chars().count()

Slight simplification: No need to call len(), we can just count the number of non continuation bytes.

I can't see any reason not to do this, can you?

3 years agoRollup merge of #81291 - sexxi-goose:fix-struct-update-functional-record-update-synta...
Yuki Okushi [Sat, 30 Jan 2021 04:36:46 +0000 (13:36 +0900)]
Rollup merge of #81291 - sexxi-goose:fix-struct-update-functional-record-update-syntax-error, r=nikomatsakis

Support FRU pattern with `[feature(capture_disjoint_fields)]`

In case of a functional record update syntax for creating a structure, `ExprUseVisitor` to only detect the precise use of some of the field in the `..x` part of the syntax. However, when we start building MIR, we
1. First, build the place for `x`
2. and then, add precise field projections so that only some parts of `x` end up getting read.

When `capture_disjoint_fields` is enabled, and FRU is used within a closure `x` won't be completely captured, and therefore the first step will fail. This PR updates `mir_build` to create a place builder in the first step and then create place from the builder only after applying the field projection.

Closes https://github.com/rust-lang/project-rfc-2229/issues/32
r? ``````@nikomatsakis``````

3 years agoRollup merge of #80959 - jhpratt:unsigned_abs-stabilization, r=m-ou-se
Yuki Okushi [Sat, 30 Jan 2021 04:36:44 +0000 (13:36 +0900)]
Rollup merge of #80959 - jhpratt:unsigned_abs-stabilization, r=m-ou-se

Stabilize `unsigned_abs`

Resolves #74913.

This PR stabilizes the `i*::unsigned_abs()` method, which returns the absolute value of an integer _as its unsigned equivalent_. This has the advantage that it does not overflow on `i*::MIN`.

I have gone ahead and used this in a couple locations throughout the repository.

3 years agoRollup merge of #80886 - RalfJung:stable-raw-ref-macros, r=m-ou-se
Yuki Okushi [Sat, 30 Jan 2021 04:36:43 +0000 (13:36 +0900)]
Rollup merge of #80886 - RalfJung:stable-raw-ref-macros, r=m-ou-se

Stabilize raw ref macros

This stabilizes `raw_ref_macros` (https://github.com/rust-lang/rust/issues/73394), which is possible now that https://github.com/rust-lang/rust/issues/74355 is fixed.

However, as I already said in https://github.com/rust-lang/rust/issues/73394#issuecomment-751342185, I am not particularly happy with the current names of the macros. So I propose we also change them, which means I am proposing to stabilize the following in `core::ptr`:
```rust
pub macro const_addr_of($e:expr) {
    &raw const $e
}

pub macro mut_addr_of($e:expr) {
    &raw mut $e
}
```

The macro name change means we need another round of FCP. Cc `````@rust-lang/libs`````
Fixes #73394

3 years agoRollup merge of #80562 - nagisa:nagisa/bools-are-unsigned, r=eddyb
Yuki Okushi [Sat, 30 Jan 2021 04:36:41 +0000 (13:36 +0900)]
Rollup merge of #80562 - nagisa:nagisa/bools-are-unsigned, r=eddyb

Consider Scalar to be a bool only if its unsigned

This seems right, given that conceptually bools are unsigned, but the
implications of this change may have more action at distance that I'm
not sure how to exhaustively consider.

For instance there are a number of cases where code attaches range
metadata if `scalar.is_bool()` holds. Supposedly it would no longer be
attached to the `repr(i8)` enums? Though I'm not sure why booleans are
being special-cased here in the first place...

Fixes #80556

cc `@eddyb`

3 years agoRollup merge of #79023 - yoshuawuyts:stream, r=KodrAus
Yuki Okushi [Sat, 30 Jan 2021 04:36:39 +0000 (13:36 +0900)]
Rollup merge of #79023 - yoshuawuyts:stream, r=KodrAus

Add `core::stream::Stream`

[[Tracking issue: #79024](https://github.com/rust-lang/rust/issues/79024)]

This patch adds the `core::stream` submodule and implements `core::stream::Stream` in accordance with [RFC2996](https://github.com/rust-lang/rfcs/pull/2996). The RFC hasn't been merged yet, but as requested by the libs team in https://github.com/rust-lang/rfcs/pull/2996#issuecomment-725696389 I'm filing this PR to get the ball rolling.

## Documentatation

The docs in this PR have been adapted from [`std::iter`](https://doc.rust-lang.org/std/iter/index.html), [`async_std::stream`](https://docs.rs/async-std/1.7.0/async_std/stream/index.html), and [`futures::stream::Stream`](https://docs.rs/futures/0.3.8/futures/stream/trait.Stream.html). Once this PR lands my plan is to follow this up with PRs to add helper methods such as `stream::repeat` which can be used to document more of the concepts that are currently missing. That will allow us to cover concepts such as "infinite streams" and "laziness" in more depth.

## Feature gate

The feature gate for `Stream` is `stream_trait`. This matches the `#[lang = "future_trait"]` attribute name. The intention is that only the APIs defined in RFC2996 will use this feature gate, with future additions such as `stream::repeat` using their own feature gates. This is so we can ensure a smooth path towards stabilizing the `Stream` trait without needing to stabilize all the APIs in `core::stream` at once. But also don't start expanding the API until _after_ stabilization, as was the case with `std::future`.

__edit:__ the feature gate has been changed to `async_stream` to match the feature gate proposed in the RFC.

## Conclusion

This PR introduces `core::stream::{Stream, Next}` and re-exports it from `std` as `std::stream::{Stream, Next}`. Landing `Stream` in the stdlib has been a mult-year process; and it's incredibly exciting for this to finally happen!

---

r? `````@KodrAus`````
cc/ `````@rust-lang/wg-async-foundations````` `````@rust-lang/libs`````

3 years agoAuto merge of #81489 - nikic:x86-64-dist-update, r=Mark-Simulacrum
bors [Sat, 30 Jan 2021 04:16:20 +0000 (04:16 +0000)]
Auto merge of #81489 - nikic:x86-64-dist-update, r=Mark-Simulacrum

Update Python and Clang on x86 dist images

LLVM 12 no longer builds with Python 2, so install Python 3 in
preparation for the upgrade (#81451).

However, Clang 10 does not build with Python 3, so we need update
to Clang 11 as well, which supports both.

Unfortunately, doing so results in errors while linking the
libLLVM.so into other binaries:
> __morestack: invalid needed version 2

This is fixed by using LLD instead. Possibly this is due to a binutils
linker bug, but updating to the latest binutils version does not fix
it.

r? `@Mark-Simulacrum`
cc `@cuviper`

3 years agoAuto merge of #81398 - bugadani:rustdoc-perf, r=GuillaumeGomez
bors [Sat, 30 Jan 2021 01:02:18 +0000 (01:02 +0000)]
Auto merge of #81398 - bugadani:rustdoc-perf, r=GuillaumeGomez

rustdoc tweaking

* Reuse memory
* simplify `next_def_id`, avoid multiple hashing and unnecessary lookups
* remove `all_fake_def_ids`, use the global map instead (probably not a good step toward parallelization, though...)
* convert `add_deref_target` to iterative implementation
* use `ArrayVec` where we know the max number of elements
* minor touchups here and there
* avoid building temporary vectors that get appended to other vectors

At most places I may or may not be doing the compiler's job is this PR.