]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #72200 - spastorino:add-prioritize_on-to-triagebot, r=Mark-Simulacrum
Dylan DPC [Thu, 14 May 2020 23:57:22 +0000 (01:57 +0200)]
Rollup merge of #72200 - spastorino:add-prioritize_on-to-triagebot, r=Mark-Simulacrum

Add prioritize_on attribute to triagebot

r? @Mark-Simulacrum

4 years agoRollup merge of #72173 - xliiv:54172-intra-for-trait-impl, r=GuillaumeGomez
Dylan DPC [Thu, 14 May 2020 23:57:20 +0000 (01:57 +0200)]
Rollup merge of #72173 - xliiv:54172-intra-for-trait-impl, r=GuillaumeGomez

Make intra links work inside trait impl block

Closes #54172

4 years agoRollup merge of #72172 - Mark-Simulacrum:check-no-stage, r=alexcrichton
Dylan DPC [Thu, 14 May 2020 23:57:19 +0000 (01:57 +0200)]
Rollup merge of #72172 - Mark-Simulacrum:check-no-stage, r=alexcrichton

Forbid stage arguments to check

Users generally expect that check builds are fast, and that's only true in stage
0 (stages beyond that need us to build a compiler, which is slow).

Closes #69337

r? @alexcrichton

4 years agoRollup merge of #72146 - Mark-Simulacrum:separate-std-asserts, r=alexcrichton
Dylan DPC [Thu, 14 May 2020 23:57:17 +0000 (01:57 +0200)]
Rollup merge of #72146 - Mark-Simulacrum:separate-std-asserts, r=alexcrichton

Provide separate option for std debug asserts

On local one-off benchmarking of libcore metadata-only, debug asserts in std are a significant hit (15s to 20s). Provide an option for compiler developers to disable them. A build with a nightly compiler is around 10s, for reference.

4 years agoRollup merge of #72062 - overdrivenpotato:psp, r=jonas-schievink
Dylan DPC [Thu, 14 May 2020 23:57:15 +0000 (01:57 +0200)]
Rollup merge of #72062 - overdrivenpotato:psp, r=jonas-schievink

Add built in PSP target

This adds a new target, `mipsel-sony-psp`, corresponding to the Sony PSP. The linker script is necessary to handle special sections, which are required by the target. This has been tested with my [rust-psp] crate and I can confirm it works as intended.

The linker script is taken from [here]. It has been slightly adapted to work with rust and LLD.

The `stdarch` submodule was also updated in order for `libcore` to build successfully.

[rust-psp]: https://github.com/overdrivenpotato/rust-psp
[here]: https://github.com/pspdev/pspsdk/blob/master/src/base/linkfile.prx.in

4 years agoRollup merge of #71809 - marmeladema:fix-issue-71104, r=eddyb
Dylan DPC [Thu, 14 May 2020 23:57:07 +0000 (01:57 +0200)]
Rollup merge of #71809 - marmeladema:fix-issue-71104, r=eddyb

Use `LocalDefId` in `DumpVisitor::nest_tables`

This is a partial fix for #71104

4 years agoAdd prioritize_on attribute to triagebot
Santiago Pastorino [Thu, 14 May 2020 16:03:33 +0000 (13:03 -0300)]
Add prioritize_on attribute to triagebot

4 years agoAuto merge of #72202 - Dylan-DPC:rollup-6lbxh1s, r=Dylan-DPC
bors [Thu, 14 May 2020 19:35:24 +0000 (19:35 +0000)]
Auto merge of #72202 - Dylan-DPC:rollup-6lbxh1s, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #71910 (Fix unused_parens false positive when using binary operations)
 - #72087 (Fix hang in lexical_region_resolve)
 - #72126 (Change `WorkProduct::saved_files` to an `Option`.)
 - #72127 (add long error explanation for E0228)
 - #72141 (Warn against thread::sleep in async fn)
 - #72170 (use `require_lang_item` over `unwrap`.)
 - #72191 (Clean up E0589 explanation)
 - #72194 (Don't ICE on missing `Unsize` impl)

Failed merges:

r? @ghost

4 years agoRollup merge of #72194 - doctorn:dispatch-from-dyn-ice, r=estebank
Dylan DPC [Thu, 14 May 2020 16:21:59 +0000 (18:21 +0200)]
Rollup merge of #72194 - doctorn:dispatch-from-dyn-ice, r=estebank

Don't ICE on missing `Unsize` impl

Previously code of the form

```rust
#![feature(unsize, dispatch_from_dyn)]

use std::marker::Unsize;
use std::ops::DispatchFromDyn;

pub struct Foo<'a, T: ?Sized> {
    _inner: &'a &'a T,
}

impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Foo<'a, U>> for Foo<'a, T> {}
```

would generate an ICE due to the missing `Unsize` impl being run through the `suggest_change_mut` suggestion. This PR adds an early exit and a pointer to the appropriate docs regarding `Unsize` instead:

```
error[E0277]: the trait bound `&'a T: std::marker::Unsize<&'a U>` is not satisfied
  --> src/test/ui/issues/issue-71036.rs:11:1
   |
11 | impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Foo<'a, U>> for Foo<'a, T> {}
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Unsize<&'a U>` is not implemented for `&'a T`
   |
   = note: all implementations of `Unsize` are provided automatically by the compiler, see <https://doc.rust-lang.org/stable/std/marker/trait.Unsize.html> for more information
   = note: required because of the requirements on the impl of `std::ops::DispatchFromDyn<&'a &'a U>` for `&'a &'a T`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
```

r? @estebank

Resolves #71036

4 years agoRollup merge of #72191 - GuillaumeGomez:cleanup-e0589, r=Dylan-DPC
Dylan DPC [Thu, 14 May 2020 16:21:57 +0000 (18:21 +0200)]
Rollup merge of #72191 - GuillaumeGomez:cleanup-e0589, r=Dylan-DPC

Clean up E0589 explanation

r? @Dylan-DPC

4 years agoRollup merge of #72170 - lcnr:lang_item, r=oli-obk
Dylan DPC [Thu, 14 May 2020 16:21:55 +0000 (18:21 +0200)]
Rollup merge of #72170 - lcnr:lang_item, r=oli-obk

use `require_lang_item` over `unwrap`.

Does not yet replace all uses of `lang_items\(\)\.*\.unwrap\(\)`, as there are more
than I expected :sweat_smile:

Fixes #72099

r? @RalfJung

*edit: The goal of this this PR is to change ICE from missing lang items to a fatal error.*

4 years agoRollup merge of #72141 - kornelski:dontsleep, r=joshtriplett
Dylan DPC [Thu, 14 May 2020 16:21:53 +0000 (18:21 +0200)]
Rollup merge of #72141 - kornelski:dontsleep, r=joshtriplett

Warn against thread::sleep in async fn

I've seen `thread::sleep` wrecking havoc in async servers. There's already an [issue for clippy](https://github.com/rust-lang/rust-clippy/issues/4377), but the std docs could warn against it too.

4 years agoRollup merge of #72127 - jademcgough:long-error-explanation-E0228, r=petrochenkov
Dylan DPC [Thu, 14 May 2020 16:21:51 +0000 (18:21 +0200)]
Rollup merge of #72127 - jademcgough:long-error-explanation-E0228, r=petrochenkov

add long error explanation for E0228

Add long explanation for the E0228 error code
Part of #61137

Let me know if this is wrong at all (or can be written more clearly), I'm still learning Rust.

4 years agoRollup merge of #72126 - nnethercote:change-WorkProduct-saved_files, r=alexcrichton
Dylan DPC [Thu, 14 May 2020 16:21:50 +0000 (18:21 +0200)]
Rollup merge of #72126 - nnethercote:change-WorkProduct-saved_files, r=alexcrichton

Change `WorkProduct::saved_files` to an `Option`.

Because there is at most one file.

r? @bjorn3

4 years agoRollup merge of #72087 - matthewjasper:regionck-hang, r=nikomatsakis
Dylan DPC [Thu, 14 May 2020 16:21:48 +0000 (18:21 +0200)]
Rollup merge of #72087 - matthewjasper:regionck-hang, r=nikomatsakis

Fix hang in lexical_region_resolve

Regionck was stuck in a loop where a region value was changing between two equal regions.

Closes #72051

4 years agoRollup merge of #71910 - mibac138:necessary-paren, r=cuviper
Dylan DPC [Thu, 14 May 2020 16:21:46 +0000 (18:21 +0200)]
Rollup merge of #71910 - mibac138:necessary-paren, r=cuviper

Fix unused_parens false positive when using binary operations

Fixes #71290

r? @cuviper who provided instructions

4 years agoDon't ICE on missing `Unsize` impl
Nathan Corbyn [Thu, 14 May 2020 10:37:58 +0000 (11:37 +0100)]
Don't ICE on missing `Unsize` impl

4 years agoAuto merge of #72187 - RalfJung:rollup-a7a9jdi, r=RalfJung
bors [Thu, 14 May 2020 12:28:23 +0000 (12:28 +0000)]
Auto merge of #72187 - RalfJung:rollup-a7a9jdi, r=RalfJung

Rollup of 12 pull requests

Successful merges:

 - #71525 (`prefix` should not be mutable.)
 - #71741 (Pointer printing: do not print 0 offset)
 - #71870 (Be slightly more precise about any::type_name()'s guarantees.)
 - #71909 (Document From trait for Option implementations)
 - #71964 (Fix bootstrap failing on win32)
 - #72137 (Clean up E0581 explanation)
 - #72138 (Add doc comment for `rustc_middle::mir::mono::Linkage`)
 - #72150 (Remove UnnormalizedProjection)
 - #72151 (Update books)
 - #72163 (docs: remove comment referencing non-existent method)
 - #72169 (Clean up E0582 explanation)
 - #72183 (Fix Arc::decr_strong_count doc test)

Failed merges:

r? @ghost

4 years agoRewrite link script from scratch
Marko Mijalkovic [Thu, 14 May 2020 10:19:36 +0000 (06:19 -0400)]
Rewrite link script from scratch

This absolves previous licensing issues.

4 years agoClean up E0589 explanation
Guillaume Gomez [Thu, 14 May 2020 09:51:39 +0000 (11:51 +0200)]
Clean up E0589 explanation

4 years agoRollup merge of #72183 - tmiasko:decr-strong-count, r=Mark-Simulacrum
Ralf Jung [Thu, 14 May 2020 08:23:06 +0000 (10:23 +0200)]
Rollup merge of #72183 - tmiasko:decr-strong-count, r=Mark-Simulacrum

Fix Arc::decr_strong_count doc test

4 years agoRollup merge of #72169 - GuillaumeGomez:cleanup-e0582, r=Dylan-DPC
Ralf Jung [Thu, 14 May 2020 08:23:05 +0000 (10:23 +0200)]
Rollup merge of #72169 - GuillaumeGomez:cleanup-e0582, r=Dylan-DPC

Clean up E0582 explanation

r? @Dylan-DPC

4 years agoRollup merge of #72163 - tshepang:nonexistent-link, r=matthewjasper
Ralf Jung [Thu, 14 May 2020 08:23:03 +0000 (10:23 +0200)]
Rollup merge of #72163 - tshepang:nonexistent-link, r=matthewjasper

docs: remove comment referencing non-existent method

4 years agoRollup merge of #72151 - ehuss:update-books, r=ehuss
Ralf Jung [Thu, 14 May 2020 08:23:01 +0000 (10:23 +0200)]
Rollup merge of #72151 - ehuss:update-books, r=ehuss

Update books

## book

2 commits in e37c0e84e2ef73d3a4ebffda8011db6814a3b02d..6247be15a7f7509559f7981ee2209b9e0cc121df
2020-04-26 09:31:36 -0500 to 2020-05-03 10:55:09 -0500
- Fix guessing game listing explanation (rust-lang/book#2321)
- Update ch01-01-installation.md (rust-lang/book#2325)

## edition-guide

1 commits in 8204c1d123472cd17f0c1c5c77300ae802eb0271..49270740c7a4bff2763e6bc730b191d45b7d5167
2020-04-09 18:55:50 -0700 to 2020-05-11 08:50:29 -0500
- Use rust-lang/rust linkchecker on CI. (rust-lang/edition-guide#197)

## embedded-book

1 commits in 40beccdf1bb8eb9184a2e3b42db8b8c6e394247f..366c50a03bed928589771eba8a6f18e0c0c01d23
2020-04-26 17:44:14 +0000 to 2020-05-07 09:04:42 +0000
- Add HAL patterns/guidelines/recommendations  (rust-embedded/book#235)

## nomicon

3 commits in 4d2d275997746d35eabfc4d992dfbdcce2f626ed..d1517d4e3f29264c5c67bce2658516bb5202c800
2020-04-27 10:24:52 -0400 to 2020-05-12 13:47:00 -0400
- Rename Unique::empty to Unique::dangling
- Use simpler link syntax
- Replace catch_panic by catch_unwind

## reference

3 commits in ed22e6fbfcb6ce436e9ea3b4bb4a55b2fb50a57e..892b928b565e35d25b6f9c47faee03b94bc41489
2020-04-24 12:46:22 -0700 to 2020-05-11 11:13:51 -0700
- clarify that str data must still be initialized
- remove language-level UB for non-UTF-8 str
- Replace incorrect term "parent modules" with "ancestor modules". (rust-lang/reference#806)

## rust-by-example

2 commits in ffc99581689fe2455908aaef5f5cf50dd03bb8f5..ab072b14393cbd9e8a1d1d75879bf51e27217bbb
2020-04-24 15:05:04 -0300 to 2020-05-09 08:46:39 -0300
- Fix link of formatting traits (rust-lang/rust-by-example#1346)
- Remove stale footnote (rust-lang/rust-by-example#1345)

4 years agoRollup merge of #72150 - jackh726:unnorm_projection, r=nikomatsakis
Ralf Jung [Thu, 14 May 2020 08:22:59 +0000 (10:22 +0200)]
Rollup merge of #72150 - jackh726:unnorm_projection, r=nikomatsakis

Remove UnnormalizedProjection

This was only used for the old chalk integration with chalk-engine

r? @nikomatsakis

4 years agoRollup merge of #72138 - wesleywiser:add_doc_comment, r=matthewjasper
Ralf Jung [Thu, 14 May 2020 08:22:57 +0000 (10:22 +0200)]
Rollup merge of #72138 - wesleywiser:add_doc_comment, r=matthewjasper

Add doc comment for `rustc_middle::mir::mono::Linkage`

4 years agoRollup merge of #72137 - GuillaumeGomez:cleanup-e0581, r=Dylan-DPC
Ralf Jung [Thu, 14 May 2020 08:22:55 +0000 (10:22 +0200)]
Rollup merge of #72137 - GuillaumeGomez:cleanup-e0581, r=Dylan-DPC

Clean up E0581 explanation

r? @Dylan-DPC

4 years agoRollup merge of #71964 - jcotton42:bootstrap_decode_none_windows, r=Mark-Simulacrum
Ralf Jung [Thu, 14 May 2020 08:22:54 +0000 (10:22 +0200)]
Rollup merge of #71964 - jcotton42:bootstrap_decode_none_windows, r=Mark-Simulacrum

Fix bootstrap failing on win32

```powershell
python x.py -h # or really any x.py command
```
would fail with
```
info: Downloading and building bootstrap before processing --help
      command. See src/bootstrap/README.md for help with common
      commands.
Updating only changed submodules
Submodules updated in 0.15 seconds
Traceback (most recent call last):
  File "x.py", line 11, in <module>
    bootstrap.main()
  File "C:\Users\Joshua\Projects\forks\rust\src\bootstrap\bootstrap.py", line 960, in main
    bootstrap(help_triggered)
  File "C:\Users\Joshua\Projects\forks\rust\src\bootstrap\bootstrap.py", line 925, in bootstrap
    build.build = args.build or build.build_triple()
  File "C:\Users\Joshua\Projects\forks\rust\src\bootstrap\bootstrap.py", line 731, in build_triple
    return default_build_triple()
  File "C:\Users\Joshua\Projects\forks\rust\src\bootstrap\bootstrap.py", line 184, in default_build_triple
    ostype = require(["uname", "-s"], exit=required).decode(default_encoding)
AttributeError: 'NoneType' object has no attribute 'decode'
```

This PR defers the `decode` call until after we're sure `ostype` and `cputype` are not `None`, as they would be on Windows since `uname` doesn't exist

4 years agoRollup merge of #71909 - Dolpheyn:doc-from-trait-for-option, r=steveklabnik
Ralf Jung [Thu, 14 May 2020 08:22:52 +0000 (10:22 +0200)]
Rollup merge of #71909 - Dolpheyn:doc-from-trait-for-option, r=steveklabnik

Document From trait for Option implementations

Add documentation for ```From``` trait for ```std::option::Option``` implementations

This PR solves a part of #51430 ( CC @skade )

This is my first PR ever in contributing for OSS. I'm happy to learn and make any changes if necessary :)

4 years agoRollup merge of #71870 - ltratt:more_specific_type_name_doc, r=kennytm
Ralf Jung [Thu, 14 May 2020 08:22:50 +0000 (10:22 +0200)]
Rollup merge of #71870 - ltratt:more_specific_type_name_doc, r=kennytm

Be slightly more precise about any::type_name()'s guarantees.

The first commit in this PR rephrases the current documentation for `any::type_name()` to be a little more specific about the guarantees (or lack thereof) that this function makes. The second commit explicitly documents that lifetimes are currently not included in the output (since this bit me particularly hard recently).

4 years agoRollup merge of #71741 - RalfJung:pointer-print, r=oli-obk
Ralf Jung [Thu, 14 May 2020 08:22:48 +0000 (10:22 +0200)]
Rollup merge of #71741 - RalfJung:pointer-print, r=oli-obk

Pointer printing: do not print 0 offset

r? @eddyb Cc @oli-obk

4 years agoRollup merge of #71525 - ldm0:intosug, r=Mark-Simulacrum
Ralf Jung [Thu, 14 May 2020 08:22:40 +0000 (10:22 +0200)]
Rollup merge of #71525 - ldm0:intosug, r=Mark-Simulacrum

`prefix` should not be mutable.

Change the process from for loop to find, which makes the `prefix` able to be immutable.

4 years agoAuto merge of #69756 - wesleywiser:simplify_try, r=oli-obk
bors [Thu, 14 May 2020 06:22:40 +0000 (06:22 +0000)]
Auto merge of #69756 - wesleywiser:simplify_try, r=oli-obk

Modify SimplifyArmIdentity so it can trigger on mir-opt-level=1

I also added test cases to make sure the optimization can fire on all of
these cases:

```rust
fn case_1(o: Option<u8>) -> Option<u8> {
  match o {
    Some(u) => Some(u),
    None => None,
  }
}

fn case2(r: Result<u8, i32>) -> Result<u8, i32> {
  match r {
    Ok(u) => Ok(u),
    Err(i) => Err(i),
  }
}

fn case3(r: Result<u8, i32>) -> Result<u8, i32> {
  let u = r?;
  Ok(u)
}

```

Without MIR inlining, this still does not completely optimize away the
`?` operator because the `Try::into_result()`, `From::from()` and
`Try::from_error()` calls still exist. This does move us a bit closer to
that goal though because:

- We can now run the pass on mir-opt-level=1

- We no longer depend on the copy propagation pass running which is
  unlikely to stabilize anytime soon.

Fixes #66855

4 years agoAuto merge of #72058 - RalfJung:no-dist-lldb, r=Mark-Simulacrum
bors [Thu, 14 May 2020 02:50:34 +0000 (02:50 +0000)]
Auto merge of #72058 - RalfJung:no-dist-lldb, r=Mark-Simulacrum

bootstrap: remove lldb dist packaging

The lldb-preview rustup package is missing on every single target, and has never been shipped beyond x86_64-apple-darwin. It was removed in #62592 which landed around a year ago, and there's not been demand that we re-enable it since, so we're now removing support entirely to cleanup the code a bit.

The hope is that this will also kill the useless "lldb-preview" row on https://rust-lang.github.io/rustup-components-history/.

4 years agoFix Arc::decr_strong_count doc test
Tomasz Miąsko [Thu, 14 May 2020 00:00:00 +0000 (00:00 +0000)]
Fix Arc::decr_strong_count doc test

4 years agoAuto merge of #72118 - flip1995:clippyup, r=oli-obk
bors [Wed, 13 May 2020 21:15:09 +0000 (21:15 +0000)]
Auto merge of #72118 - flip1995:clippyup, r=oli-obk

Update Clippy to 43a1777

Updates Clippy to https://github.com/rust-lang/rust-clippy/commit/43a1777b89cf6791f9e20878b4e5e3ae907867a5

We should establish a process on how often and when to update Clippy. (After X feature PRs? Once per week? Only on bug fixes and in the release week? ...?)

r? @oli-obk

4 years agodocs: fix link
Tshepang Lekhonkhobe [Wed, 13 May 2020 21:02:56 +0000 (23:02 +0200)]
docs: fix link

source https://github.com/rust-lang/rust/pull/72163#issuecomment-628234966

4 years agoadd spans to `require_lang_items`
Bastian Kauschke [Wed, 13 May 2020 19:38:58 +0000 (21:38 +0200)]
add spans to `require_lang_items`

4 years agoMake intra links work inside trait impl block
Tymoteusz Jankowski [Wed, 13 May 2020 14:54:16 +0000 (16:54 +0200)]
Make intra links work inside trait impl block

4 years agoForbid stage arguments to check
Mark Rousskov [Wed, 13 May 2020 15:32:43 +0000 (11:32 -0400)]
Forbid stage arguments to check

Users generally expect that check builds are fast, and that's only true in stage
0 (stages beyond that need us to build a compiler, which is slow).

4 years agoAuto merge of #72013 - nnethercote:make-RawVec-grow-mostly-non-generic, r=Amanieu
bors [Wed, 13 May 2020 14:29:56 +0000 (14:29 +0000)]
Auto merge of #72013 - nnethercote:make-RawVec-grow-mostly-non-generic, r=Amanieu

Make `RawVec::grow` mostly non-generic.

`cargo-llvm-lines` shows that, in various benchmarks, `RawVec::grow` is
instantiated 10s or 100s of times and accounts for 1-8% of lines of
generated LLVM IR.

This commit moves most of `RawVec::grow` into a separate function that
isn't parameterized by `T`, which means it doesn't need to be
instantiated many times. This reduces compile time significantly.

r? @ghost

4 years agoUpdate src/libcore/option.rs
Faris Sufyan [Wed, 13 May 2020 13:13:35 +0000 (21:13 +0800)]
Update src/libcore/option.rs

Co-authored-by: Steve Klabnik <steve@steveklabnik.com>
4 years agoUpdate src/libcore/option.rs
Faris Sufyan [Wed, 13 May 2020 13:13:27 +0000 (21:13 +0800)]
Update src/libcore/option.rs

Co-authored-by: Steve Klabnik <steve@steveklabnik.com>
4 years agoUpdate src/libcore/option.rs
Faris Sufyan [Wed, 13 May 2020 13:13:17 +0000 (21:13 +0800)]
Update src/libcore/option.rs

Co-authored-by: Steve Klabnik <steve@steveklabnik.com>
4 years agoUpdate src/libcore/option.rs
Faris Sufyan [Wed, 13 May 2020 13:13:08 +0000 (21:13 +0800)]
Update src/libcore/option.rs

Co-authored-by: Steve Klabnik <steve@steveklabnik.com>
4 years agoUpdate src/libcore/option.rs
Faris Sufyan [Wed, 13 May 2020 13:12:50 +0000 (21:12 +0800)]
Update src/libcore/option.rs

Co-authored-by: Steve Klabnik <steve@steveklabnik.com>
4 years agoUpdate src/libcore/option.rs
Faris Sufyan [Wed, 13 May 2020 13:12:35 +0000 (21:12 +0800)]
Update src/libcore/option.rs

Co-authored-by: Steve Klabnik <steve@steveklabnik.com>
4 years agoUpdate src/libcore/option.rs
Faris Sufyan [Wed, 13 May 2020 13:05:53 +0000 (21:05 +0800)]
Update src/libcore/option.rs

Co-authored-by: Steve Klabnik <steve@steveklabnik.com>
4 years agoUpdate src/libcore/option.rs
Faris Sufyan [Wed, 13 May 2020 13:04:52 +0000 (21:04 +0800)]
Update src/libcore/option.rs

Co-authored-by: Steve Klabnik <steve@steveklabnik.com>
4 years agouse `require_lang_item` over `unwrap`.
Bastian Kauschke [Wed, 13 May 2020 12:46:15 +0000 (14:46 +0200)]
use `require_lang_item` over `unwrap`.

4 years agoClean up E0582 explanation
Guillaume Gomez [Wed, 13 May 2020 11:40:55 +0000 (13:40 +0200)]
Clean up E0582 explanation

4 years agoAuto merge of #71451 - estebank:suggest-super-trait-constraint, r=nikomatsakis
bors [Wed, 13 May 2020 06:54:15 +0000 (06:54 +0000)]
Auto merge of #71451 - estebank:suggest-super-trait-constraint, r=nikomatsakis

Suggest adding super trait constraints

4 years agoAuto merge of #70416 - mzohreva:mz/sgx-test, r=nikomatsakis
bors [Wed, 13 May 2020 03:29:00 +0000 (03:29 +0000)]
Auto merge of #70416 - mzohreva:mz/sgx-test, r=nikomatsakis

Process termination test for SGX

The issue is described in https://github.com/fortanix/rust-sgx/issues/109

cc @jethrogb

4 years agoadd long error explanation for E0228
Jade McGough [Tue, 12 May 2020 00:28:24 +0000 (17:28 -0700)]
add long error explanation for E0228

4 years agoreview comments
Esteban Küber [Tue, 12 May 2020 18:56:11 +0000 (11:56 -0700)]
review comments

4 years agoUpdate books
Eric Huss [Tue, 12 May 2020 18:27:03 +0000 (11:27 -0700)]
Update books

4 years agofix test output after rebase
Esteban Küber [Thu, 7 May 2020 19:54:05 +0000 (12:54 -0700)]
fix test output after rebase

4 years agoIncrease verbosity of bound restriction suggestions
Esteban Küber [Wed, 22 Apr 2020 23:31:58 +0000 (16:31 -0700)]
Increase verbosity of bound restriction suggestions

- Make the bound restriction suggestion `span_suggestion_verbose`.
- Fix whitespace typo.

4 years agoSuggest adding super trait constraints
Esteban Küber [Wed, 22 Apr 2020 23:03:39 +0000 (16:03 -0700)]
Suggest adding super trait constraints

4 years agoProvide separate option for std debug asserts
Mark Rousskov [Tue, 12 May 2020 17:00:10 +0000 (13:00 -0400)]
Provide separate option for std debug asserts

4 years agoMap to -> return.
Laurence Tratt [Tue, 12 May 2020 15:54:29 +0000 (16:54 +0100)]
Map to -> return.

4 years agoWarn against thread::sleep in async fn
Kornel [Tue, 12 May 2020 15:38:02 +0000 (16:38 +0100)]
Warn against thread::sleep in async fn

4 years agoFix bootstrap failing on win32
Joshua Cotton [Thu, 7 May 2020 00:24:40 +0000 (20:24 -0400)]
Fix bootstrap failing on win32

4 years agoAuto merge of #72091 - RalfJung:miri, r=RalfJung
bors [Tue, 12 May 2020 13:59:16 +0000 (13:59 +0000)]
Auto merge of #72091 - RalfJung:miri, r=RalfJung

update miri

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

4 years agoAdd doc comment for `rustc_middle::mir::mono::Linkage`
Wesley Wiser [Tue, 12 May 2020 12:11:58 +0000 (08:11 -0400)]
Add doc comment for `rustc_middle::mir::mono::Linkage`

4 years agoClean up E0581 explanation
Guillaume Gomez [Tue, 12 May 2020 11:36:57 +0000 (13:36 +0200)]
Clean up E0581 explanation

4 years agoPointer printing: do not print 0 offset
Ralf Jung [Fri, 1 May 2020 10:10:06 +0000 (12:10 +0200)]
Pointer printing: do not print 0 offset

4 years agoAuto merge of #72134 - Dylan-DPC:rollup-h3shfz5, r=Dylan-DPC
bors [Tue, 12 May 2020 10:28:08 +0000 (10:28 +0000)]
Auto merge of #72134 - Dylan-DPC:rollup-h3shfz5, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #71737 (Miri: run liballoc tests with threads)
 - #71928 (Add strikethrough support to rustdoc)
 - #72048 (Visit move out of `_0` when visiting `return`)
 - #72096 (Make MIR typeck use `LocalDefId` and fix docs)
 - #72128 (strings do not have to be valid UTF-8 any more)

Failed merges:

r? @ghost

4 years agoRollup merge of #72128 - RalfJung:str-validity, r=oli-obk
Dylan DPC [Tue, 12 May 2020 09:41:15 +0000 (11:41 +0200)]
Rollup merge of #72128 - RalfJung:str-validity, r=oli-obk

strings do not have to be valid UTF-8 any more

Cc https://github.com/rust-lang/reference/pull/792
r? @oli-obk

4 years agoRollup merge of #72096 - jonas-schievink:mirck-docs, r=matthewjasper
Dylan DPC [Tue, 12 May 2020 09:41:13 +0000 (11:41 +0200)]
Rollup merge of #72096 - jonas-schievink:mirck-docs, r=matthewjasper

Make MIR typeck use `LocalDefId` and fix docs

The docs on `fn type_check` were not in sync with the arguments it takes.

r? @matthewjasper

4 years agoRollup merge of #72048 - jonas-schievink:visit-return, r=oli-obk
Dylan DPC [Tue, 12 May 2020 09:41:12 +0000 (11:41 +0200)]
Rollup merge of #72048 - jonas-schievink:visit-return, r=oli-obk

Visit move out of `_0` when visiting `return`

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

4 years agoRollup merge of #71928 - mibac138:strikethrough, r=GuillaumeGomez
Dylan DPC [Tue, 12 May 2020 09:41:10 +0000 (11:41 +0200)]
Rollup merge of #71928 - mibac138:strikethrough, r=GuillaumeGomez

Add strikethrough support to rustdoc

Implements uncontroversial part of #71183.
r? @GuillaumeGomez

4 years agoRollup merge of #71737 - RalfJung:miri-test-threads, r=shepmaster
Dylan DPC [Tue, 12 May 2020 09:41:05 +0000 (11:41 +0200)]
Rollup merge of #71737 - RalfJung:miri-test-threads, r=shepmaster

Miri: run liballoc tests with threads

Miri now supports threads, so we can run these tests. :)

4 years agoChange `WorkProduct::saved_files` to an `Option`.
Nicholas Nethercote [Tue, 12 May 2020 05:56:02 +0000 (15:56 +1000)]
Change `WorkProduct::saved_files` to an `Option`.

Because there is at most one file.

4 years agostrings do not have to be valid UTF-8 any more
Ralf Jung [Tue, 12 May 2020 07:46:41 +0000 (09:46 +0200)]
strings do not have to be valid UTF-8 any more

4 years agoRemove ty::UnnormalizedProjection
Jack Huey [Tue, 12 May 2020 05:56:29 +0000 (01:56 -0400)]
Remove ty::UnnormalizedProjection

4 years agoSplit `RawVec::grow` up.
Nicholas Nethercote [Mon, 11 May 2020 03:17:28 +0000 (13:17 +1000)]
Split `RawVec::grow` up.

The amortized case is much more common than the exact case, and it is
typically instantiated many times.

Also, we can put a chunk of the code into a function that isn't generic
over T, which reduces the amount of LLVM IR generated quite a lot,
improving compile times.

4 years agoRemove `RawVec::double`.
Nicholas Nethercote [Mon, 11 May 2020 02:26:59 +0000 (12:26 +1000)]
Remove `RawVec::double`.

It's only used once, for `VecDeque`, and can easily be replaced by
something else. The commit changes `grow_if_necessary` to `grow` to
avoid some small regressions caused by changed inlining.

The commit also removes `Strategy::Double`, and streamlines the
remaining variants of `Strategy`.

It's a compile time win on some benchmarks because the many
instantations of `RawVec::grow` are a little smaller.

4 years agoModify SimplifyArmIdentity so it can trigger on mir-opt-level=1
Wesley Wiser [Tue, 12 May 2020 00:13:15 +0000 (20:13 -0400)]
Modify SimplifyArmIdentity so it can trigger on mir-opt-level=1

I also added test cases to make sure the optimization can fire on all of
these cases:

```rust
fn case_1(o: Option<u8>) -> Option<u8> {
  match o {
    Some(u) => Some(u),
    None => None,
  }
}

fn case2(r: Result<u8, i32>) -> Result<u8, i32> {
  match r {
    Ok(u) => Ok(u),
    Err(i) => Err(i),
  }
}

fn case3(r: Result<u8, i32>) -> Result<u8, i32> {
  let u = r?;
  Ok(u)
}

```

Without MIR inlining, this still does not completely optimize away the
`?` operator because the `Try::into_result()`, `From::from()` and
`Try::from_error()` calls still exist. This does move us a bit closer to
that goal though because:

- We can now run the pass on mir-opt-level=1

- We no longer depend on the copy propagation pass running which is
  unlikely to stabilize anytime soon.

4 years agoAuto merge of #72120 - Dylan-DPC:rollup-ca0tur2, r=Dylan-DPC
bors [Mon, 11 May 2020 23:14:06 +0000 (23:14 +0000)]
Auto merge of #72120 - Dylan-DPC:rollup-ca0tur2, r=Dylan-DPC

Rollup of 10 pull requests

Successful merges:

 - #72014 (Deprecated emoji)
 - #72019 (Fix debug assertion in error code)
 - #72027 (Use CDN for ci-caches on download)
 - #72044 (use min_specialization for some rustc crates where it requires no changes)
 - #72052 (display `ConstKind::Param`)
 - #72067 (Emit a warning when optimization fuel runs out)
 - #72072 (doc: minus (U+2212) instead of dash (U+002D) for negative infinity)
 - #72077 (Improve E0571 wording)
 - #72107 (Clean up E0579 explanation)
 - #72109 (Fix clippy warnings)

Failed merges:

r? @ghost

4 years agoRemove `RawVec::double_in_place`.
Nicholas Nethercote [Mon, 11 May 2020 01:46:13 +0000 (11:46 +1000)]
Remove `RawVec::double_in_place`.

It's unused.

4 years agoRollup merge of #72109 - matthiaskrgr:cl8ppy, r=Dylan-DPC
Dylan DPC [Mon, 11 May 2020 20:21:08 +0000 (22:21 +0200)]
Rollup merge of #72109 - matthiaskrgr:cl8ppy, r=Dylan-DPC

Fix clippy warnings

Fixes clippy::{cone_on_copy, filter_next, redundant_closure, single_char_pattern, len_zero,redundant_field_names, useless_format, identity_conversion, map_clone, into_iter_on_ref, needless_return, option_as_ref_deref, unused_unit, unnecessary_mut_passed}

r? @Dylan-DPC

4 years agoRollup merge of #72107 - GuillaumeGomez:cleanup-e0579, r=Dylan-DPC
Dylan DPC [Mon, 11 May 2020 20:21:07 +0000 (22:21 +0200)]
Rollup merge of #72107 - GuillaumeGomez:cleanup-e0579, r=Dylan-DPC

Clean up E0579 explanation

r? @Dylan-DPC

4 years agoRollup merge of #72077 - GuillaumeGomez:cleanup-E0571, r=Dylan-DPC
Dylan DPC [Mon, 11 May 2020 20:21:05 +0000 (22:21 +0200)]
Rollup merge of #72077 - GuillaumeGomez:cleanup-E0571, r=Dylan-DPC

Improve E0571 wording

r? @Dylan-DPC

4 years agoRollup merge of #72072 - tspiteri:minus-inf, r=Dylan-DPC
Dylan DPC [Mon, 11 May 2020 20:21:03 +0000 (22:21 +0200)]
Rollup merge of #72072 - tspiteri:minus-inf, r=Dylan-DPC

doc: minus (U+2212) instead of dash (U+002D) for negative infinity

Like #67430, for the new associated constants.

4 years agoRollup merge of #72067 - jonas-schievink:fuel-warn, r=varkor
Dylan DPC [Mon, 11 May 2020 20:21:01 +0000 (22:21 +0200)]
Rollup merge of #72067 - jonas-schievink:fuel-warn, r=varkor

Emit a warning when optimization fuel runs out

`eprintln!` gets swallowed by Cargo too easily.

4 years agoRollup merge of #72052 - lcnr:const_pprint, r=ecstatic-morse
Dylan DPC [Mon, 11 May 2020 20:20:59 +0000 (22:20 +0200)]
Rollup merge of #72052 - lcnr:const_pprint, r=ecstatic-morse

display `ConstKind::Param`

4 years agoRollup merge of #72044 - RalfJung:min-spec, r=matthewjasper
Dylan DPC [Mon, 11 May 2020 20:20:57 +0000 (22:20 +0200)]
Rollup merge of #72044 - RalfJung:min-spec, r=matthewjasper

use min_specialization for some rustc crates where it requires no changes

and add FIXME for the rest

Cc @matthewjasper

4 years agoRollup merge of #72027 - Mark-Simulacrum:ci-caches, r=pietroalbini
Dylan DPC [Mon, 11 May 2020 20:20:55 +0000 (22:20 +0200)]
Rollup merge of #72027 - Mark-Simulacrum:ci-caches, r=pietroalbini

Use CDN for ci-caches on download

This will reduce costs, as well as lays the groundwork for developers to be able
to locally pull the published docker images without needing AWS credentials.

r? @pietroalbini

4 years agoRollup merge of #72019 - matthewjasper:dont-skip-binder, r=davidtwco
Dylan DPC [Mon, 11 May 2020 20:20:54 +0000 (22:20 +0200)]
Rollup merge of #72019 - matthewjasper:dont-skip-binder, r=davidtwco

Fix debug assertion in error code

Closes #70813

4 years agoRollup merge of #72014 - GuillaumeGomez:deprecated-emoji, r=kinnison,ollie27
Dylan DPC [Mon, 11 May 2020 20:20:51 +0000 (22:20 +0200)]
Rollup merge of #72014 - GuillaumeGomez:deprecated-emoji, r=kinnison,ollie27

Deprecated emoji

Fixes #67872.

r? @kinnison

cc @rust-lang/rustdoc

4 years agoFix hang in lexical_region_resolve
Matthew Jasper [Sun, 10 May 2020 20:09:56 +0000 (21:09 +0100)]
Fix hang in lexical_region_resolve

4 years agoUpdate Cargo.lock
flip1995 [Mon, 11 May 2020 19:18:42 +0000 (21:18 +0200)]
Update Cargo.lock

4 years agoMerge commit '43a1777b89cf6791f9e20878b4e5e3ae907867a5' into clippyup
flip1995 [Mon, 11 May 2020 18:23:47 +0000 (20:23 +0200)]
Merge commit '43a1777b89cf6791f9e20878b4e5e3ae907867a5' into clippyup

4 years agoAuto merge of #72089 - Mark-Simulacrum:error-is-really-an-error, r=pietroalbini
bors [Mon, 11 May 2020 16:33:26 +0000 (16:33 +0000)]
Auto merge of #72089 - Mark-Simulacrum:error-is-really-an-error, r=pietroalbini

Fail if I/O error occurs during testing

First known case of this is in https://github.com/rust-lang/rust/pull/72053#issuecomment-626364402 but may have happened before then.

r? @pietroalbini

4 years agoFix clippy warnings
Matthias Krüger [Mon, 11 May 2020 11:01:37 +0000 (13:01 +0200)]
Fix clippy warnings

Fixes clippy::{cone_on_copy, filter_next, redundant_closure, single_char_pattern, len_zero,redundant_field_names, useless_format, identity_conversion, map_clone, into_iter_on_ref, needless_return, option_as_ref_deref, unused_unit, unnecessary_mut_passed}

4 years agoConfigure cache domain for GHA
Mark Rousskov [Mon, 11 May 2020 14:50:53 +0000 (10:50 -0400)]
Configure cache domain for GHA

4 years agofix test_weak_count_locked for Miri
Ralf Jung [Sun, 3 May 2020 10:34:53 +0000 (12:34 +0200)]
fix test_weak_count_locked for Miri

4 years agoClean up E0579 explanation
Guillaume Gomez [Mon, 11 May 2020 11:22:56 +0000 (13:22 +0200)]
Clean up E0579 explanation

4 years agoupdate miri some more
Ralf Jung [Mon, 11 May 2020 10:13:53 +0000 (12:13 +0200)]
update miri some more