]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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 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.

3 years agorustdoc tweaking
bors [Sat, 30 Jan 2021 01:02:18 +0000 (01:02 +0000)]
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.

3 years agoConsider Scalar to be a bool only if its unsigned
Simonas Kazlauskas [Thu, 31 Dec 2020 16:02:52 +0000 (18:02 +0200)]
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

3 years agoAuto merge of #81534 - RalfJung:miri, r=RalfJung
bors [Fri, 29 Jan 2021 21:42:35 +0000 (21:42 +0000)]
Auto merge of #81534 - RalfJung:miri, r=RalfJung

update Miri

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

3 years agoFixme for closure origin when reborrow is implemented
Aman Arora [Fri, 29 Jan 2021 21:25:01 +0000 (16:25 -0500)]
Fixme for closure origin when reborrow is implemented

3 years agoFix typos
Aman Arora [Fri, 29 Jan 2021 21:01:27 +0000 (16:01 -0500)]
Fix typos

3 years agoupdate Miri
Ralf Jung [Fri, 29 Jan 2021 19:59:53 +0000 (20:59 +0100)]
update Miri

3 years agoAdd fixme for precise path diagnostics
Aman Arora [Tue, 12 Jan 2021 19:54:12 +0000 (14:54 -0500)]
Add fixme for precise path diagnostics

3 years agoFix incorrect use mut diagnostics
Aman Arora [Sun, 13 Dec 2020 05:11:15 +0000 (00:11 -0500)]
Fix incorrect use mut diagnostics

3 years agoFix unused 'mut' warning for capture's root variable
Aman Arora [Wed, 16 Dec 2020 04:00:19 +0000 (23:00 -0500)]
Fix unused 'mut' warning for capture's root variable

3 years agoTest for restricting capture precision
Aman Arora [Mon, 14 Dec 2020 08:09:17 +0000 (03:09 -0500)]
Test for restricting capture precision

3 years agoTest cases for handling mutable references
Aman Arora [Sun, 13 Dec 2020 06:29:20 +0000 (01:29 -0500)]
Test cases for handling mutable references

3 years agoCompute mutability of closure captures
Aman Arora [Wed, 2 Dec 2020 08:03:56 +0000 (03:03 -0500)]
Compute mutability of closure captures

When `capture_disjoint_fields` is not enabled, checking if the root variable
binding is mutable would suffice.

However with the feature enabled, the captured place might be mutable
because it dereferences a mutable reference.

This PR computes the mutability of each capture after capture analysis
in rustc_typeck. We store this in `ty::CapturedPlace` and then use
`ty::CapturedPlace::mutability` in mir_build and borrow_check.

3 years agoRestrict precision of captures with `capture_disjoint_fields` set
Aman Arora [Fri, 4 Dec 2020 04:40:09 +0000 (23:40 -0500)]
Restrict precision of captures with `capture_disjoint_fields` set

- No Derefs in move closure, this 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.

Motivations for these are recorded here: https://hackmd.io/71qq-IOpTNqzMkPpAI1dVg?view

3 years agoResolve DLL imports at CRT startup, not on demand
Arlie Davis [Wed, 27 Jan 2021 20:16:03 +0000 (12:16 -0800)]
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 agoUpdate dist-various to Ubuntu 20.04
Nikita Popov [Fri, 29 Jan 2021 14:08:17 +0000 (15:08 +0100)]
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.

3 years agoDon't clone LLVM submodule when download-ci-llvm is set
Joshua Nelson [Fri, 29 Jan 2021 17:23:36 +0000 (17:23 +0000)]
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.

3 years agoDon't print error output from rustup when detecting default build triple
Joshua Nelson [Fri, 29 Jan 2021 17:04:31 +0000 (17:04 +0000)]
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 agoFix typo in pat.rs
Ikko Ashimine [Fri, 29 Jan 2021 14:30:55 +0000 (23:30 +0900)]
Fix typo in pat.rs

parentesized -> parenthesized

3 years agorename raw_const/mut -> const/mut_addr_of, and stabilize them
Ralf Jung [Sun, 10 Jan 2021 18:35:42 +0000 (19:35 +0100)]
rename raw_const/mut -> const/mut_addr_of, and stabilize them

3 years agoAuto merge of #81470 - tmiasko:remove-allocations, r=matthewjasper
bors [Fri, 29 Jan 2021 13:10:09 +0000 (13:10 +0000)]
Auto merge of #81470 - tmiasko:remove-allocations, r=matthewjasper

Avoid memory allocation when removing dead blocks

Use `reachable_as_bitset` to reuse a bitset from the traversal rather
than allocating it seprately. Additionally check if there are any
unreachable blocks before proceeding.

3 years agoAdd missiong variants in match binding
Guillaume Gomez [Fri, 29 Jan 2021 12:36:49 +0000 (13:36 +0100)]
Add missiong variants in match binding

3 years agofix typo
Henry Boisdequin [Fri, 29 Jan 2021 10:38:49 +0000 (16:08 +0530)]
fix typo

3 years agoAuto merge of #81419 - rylev:canocalize-extern-entries, r=petrochenkov
bors [Fri, 29 Jan 2021 10:11:16 +0000 (10:11 +0000)]
Auto merge of #81419 - rylev:canocalize-extern-entries, r=petrochenkov

Pre-canoncalize ExternLocation::ExactPaths

This stores pre-canacolized paths inside `ExternLocation::ExactPaths` so that we don't need to canoncalize them every time we want to compare them to source lib paths.

This is related to #81414.

3 years agoPre-canoncalize ExternLocation::ExactPaths
Ryan Levick [Tue, 26 Jan 2021 21:27:42 +0000 (22:27 +0100)]
Pre-canoncalize ExternLocation::ExactPaths

3 years ago`fn cold_path` doesn't need to be pub
Henry Boisdequin [Fri, 29 Jan 2021 08:33:01 +0000 (14:03 +0530)]
`fn cold_path` doesn't need to be pub

3 years agoAdd tests
est31 [Thu, 28 Jan 2021 11:54:30 +0000 (12:54 +0100)]
Add tests

3 years agoTreat nightlies for a version as complete
est31 [Thu, 28 Jan 2021 08:24:55 +0000 (09:24 +0100)]
Treat nightlies for a version as complete

This commit 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.

For users who wish to pin nightlies, this commit adds
a -Z assume-incomplete-release option that they can
enable if there are any issues due to this change.

3 years agoAuto merge of #81440 - tmiasko:always-live-locals, r=matthewjasper
bors [Fri, 29 Jan 2021 06:56:29 +0000 (06:56 +0000)]
Auto merge of #81440 - tmiasko:always-live-locals, r=matthewjasper

Visit only statements in always live locals

No functional changes intended.

3 years agoupdate rustfmt to v1.4.34
Caleb Cartwright [Fri, 29 Jan 2021 04:39:38 +0000 (22:39 -0600)]
update rustfmt to v1.4.34