]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #63872 - marmistrz:readdir, r=jonas-schievink
Mazdak Farrokhzad [Sun, 15 Sep 2019 17:35:58 +0000 (19:35 +0200)]
Rollup merge of #63872 - marmistrz:readdir, r=jonas-schievink

Document platform-specific behavior of the iterator returned by std::fs::read_dir

4 years agoAuto merge of #64483 - petrochenkov:expectattr2, r=Centril
bors [Sun, 15 Sep 2019 12:24:32 +0000 (12:24 +0000)]
Auto merge of #64483 - petrochenkov:expectattr2, r=Centril

resolve: Tweak some "cannot find" wording for macros

4 years agoresolve: Remove `!` from "cannot find" diagnostics for macros
Vadim Petrochenkov [Sun, 15 Sep 2019 10:12:14 +0000 (13:12 +0300)]
resolve: Remove `!` from "cannot find" diagnostics for macros

4 years agoresolve: Tweak "cannot find" wording for attributes
Vadim Petrochenkov [Sun, 15 Sep 2019 09:55:18 +0000 (12:55 +0300)]
resolve: Tweak "cannot find" wording for attributes

4 years agoAuto merge of #64469 - matthewjasper:increase-hygiene-use, r=petrochenkov
bors [Sun, 15 Sep 2019 08:17:57 +0000 (08:17 +0000)]
Auto merge of #64469 - matthewjasper:increase-hygiene-use, r=petrochenkov

Cleanup handling of hygiene for built-in macros

This makes most identifiers generated by built-in macros use def-site hygiene, not only the ones that previously used gensyms.

* `ExtCtxt::ident_of` now takes a `Span` and is preferred to `Ident::{from_str, from_str_and_span}`
* Remove `Span::with_legacy_ctxt`
    * `assert` now uses call-site hygiene because it needs to resolve `panic` unhygienically.
    * `concat_idents` now uses call-site hygiene because it wouldn't be very useful with def-site hygiene.
    * everything else is moved to def-site hygiene

r? @petrochenkov

4 years agoRemove `with_legacy_ctxt`
Matthew Jasper [Sat, 14 Sep 2019 20:17:11 +0000 (21:17 +0100)]
Remove `with_legacy_ctxt`

4 years agoGive more `Idents` spans
Matthew Jasper [Sat, 14 Sep 2019 20:16:51 +0000 (21:16 +0100)]
Give more `Idents` spans

4 years agoAvoid some unnecessary `&str` to `Ident` conversions
Matthew Jasper [Sat, 14 Sep 2019 20:14:03 +0000 (21:14 +0100)]
Avoid some unnecessary `&str` to `Ident` conversions

4 years agoPrefer `Symbol` to `Ident` when there's no sensible `Span`
Matthew Jasper [Sat, 14 Sep 2019 20:10:12 +0000 (21:10 +0100)]
Prefer `Symbol` to `Ident` when there's no sensible `Span`

4 years agoAuto merge of #64478 - Centril:rollup-bnt51w1, r=Centril
bors [Sun, 15 Sep 2019 03:59:08 +0000 (03:59 +0000)]
Auto merge of #64478 - Centril:rollup-bnt51w1, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #64457 (def_collector: Do not ICE on attributes on unnamed fields)
 - #64463 (resolve: Tweak some expected/found wording)
 - #64471 (Warn on no_start, crate_id attribute use)
 - #64473 (Use try_fold instead of manually carrying an accumulator)
 - #64475 (simplify the initialization)

Failed merges:

r? @ghost

4 years agoRollup merge of #64475 - guanqun:use-same-name, r=Centril
Mazdak Farrokhzad [Sun, 15 Sep 2019 00:29:49 +0000 (02:29 +0200)]
Rollup merge of #64475 - guanqun:use-same-name, r=Centril

simplify the initialization

4 years agoRollup merge of #64473 - spastorino:use-try-fold, r=Centril
Mazdak Farrokhzad [Sun, 15 Sep 2019 00:29:47 +0000 (02:29 +0200)]
Rollup merge of #64473 - spastorino:use-try-fold, r=Centril

Use try_fold instead of manually carrying an accumulator

r? @RalfJung

4 years agoRollup merge of #64471 - Mark-Simulacrum:warn-depr-attr, r=Centril
Mazdak Farrokhzad [Sun, 15 Sep 2019 00:29:46 +0000 (02:29 +0200)]
Rollup merge of #64471 - Mark-Simulacrum:warn-depr-attr, r=Centril

Warn on no_start, crate_id attribute use

These attributes are now deprecated; they don't have any use anymore.

`no_start` stopped being applicable in 3ee916e50bd86768cb2a9141f9b2c52d2601b412 as part of #18967. Ideally we would've removed it pre-1.0, but since that didn't happen let's at least mark it deprecated.

`crate_id` was renamed to `crate_name` in 50ee1ec1b4f107122d8037ac7b0b312afa6eb0ac as part of #15319. Ideally we would've followed that up with a removal of crate_id itself as well, but that didn't happen; this PR finally marks it as deprecated at least.

Fixes https://github.com/rust-lang/rust/issues/43142 and resolves https://github.com/rust-lang/rust/issues/43144.

4 years agoRollup merge of #64463 - petrochenkov:expectattr, r=Centril
Mazdak Farrokhzad [Sun, 15 Sep 2019 00:29:44 +0000 (02:29 +0200)]
Rollup merge of #64463 - petrochenkov:expectattr, r=Centril

resolve: Tweak some expected/found wording

4 years agoRollup merge of #64457 - petrochenkov:macunfield, r=matthewjasper
Mazdak Farrokhzad [Sun, 15 Sep 2019 00:29:43 +0000 (02:29 +0200)]
Rollup merge of #64457 - petrochenkov:macunfield, r=matthewjasper

def_collector: Do not ICE on attributes on unnamed fields

The primary issue here is that the expansion infra needs to visit a field in isolation, and fields don't know their own indices during expansion, so they have to be kept in some other place (e.g. `struct Definitions`).

Fixes https://github.com/rust-lang/rust/issues/64385

4 years agoAuto merge of #60584 - jonas-schievink:ice-panic-hook, r=oli-obk
bors [Sun, 15 Sep 2019 00:10:08 +0000 (00:10 +0000)]
Auto merge of #60584 - jonas-schievink:ice-panic-hook, r=oli-obk

Use `panic::set_hook` to print the ICE message

This allows custom frontends and backends to override the hook with their own, for example to point people to a different issue tracker.

ICE messages are printed in a slightly different order now. Nightly prints:

```
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:347:21
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: aborting due to 2 previous errors

Some errors have detailed explanations: E0277, E0658.
For more information about an error, try `rustc --explain E0277`.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.36.0-nightly (08bfe1612 2019-05-02) running on x86_64-unknown-linux-gnu
```

After this PR, rustc prints:

```
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:347:21
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.36.0-dev running on x86_64-unknown-linux-gnu

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0277, E0658.
For more information about an error, try `rustc --explain E0277`.
```

4 years agoWarn on no_start, crate_id attribute use
Mark Rousskov [Sat, 14 Sep 2019 21:53:14 +0000 (17:53 -0400)]
Warn on no_start, crate_id attribute use

These attributes are now deprecated; they don't have any use anymore.

4 years agosimply the initialization
Guanqun Lu [Tue, 10 Sep 2019 14:18:24 +0000 (22:18 +0800)]
simply the initialization

4 years agoUse try_fold instead of manually carrying an accumulator
Santiago Pastorino [Sat, 14 Sep 2019 22:51:40 +0000 (19:51 -0300)]
Use try_fold instead of manually carrying an accumulator

4 years agoTry to fix the test output normalization
Jonas Schievink [Sat, 14 Sep 2019 21:02:22 +0000 (23:02 +0200)]
Try to fix the test output normalization

4 years agoAuto merge of #64466 - Centril:rollup-s3nlb9e, r=Centril
bors [Sat, 14 Sep 2019 20:16:54 +0000 (20:16 +0000)]
Auto merge of #64466 - Centril:rollup-s3nlb9e, r=Centril

Rollup of 4 pull requests

Successful merges:

 - #61797 (Stabilise weak_ptr_eq)
 - #64290 (Provide a span if main function is not present in crate)
 - #64406 (Ban non-extern rust intrinsics)
 - #64462 (feature_gate: Remove dead code from attribute checking)

Failed merges:

r? @ghost

4 years agoRollup merge of #64462 - petrochenkov:remattr, r=Centril
Mazdak Farrokhzad [Sat, 14 Sep 2019 20:16:07 +0000 (22:16 +0200)]
Rollup merge of #64462 - petrochenkov:remattr, r=Centril

feature_gate: Remove dead code from attribute checking

https://github.com/rust-lang/rust/pull/63468 is merged, so all attributes go through name resolution now, so we can remove code that previously performed some checks for attributes not going through resolution.

4 years agoRollup merge of #64406 - Mark-Simulacrum:error-unknown-intrinsic, r=Centril
Mazdak Farrokhzad [Sat, 14 Sep 2019 20:16:06 +0000 (22:16 +0200)]
Rollup merge of #64406 - Mark-Simulacrum:error-unknown-intrinsic, r=Centril

Ban non-extern rust intrinsics

Intrinsics can only be defined by the compiler.

Fixes https://github.com/rust-lang/rust/issues/36979

4 years agoRollup merge of #64290 - Mark-Simulacrum:span-no-main, r=estebank
Mazdak Farrokhzad [Sat, 14 Sep 2019 20:16:05 +0000 (22:16 +0200)]
Rollup merge of #64290 - Mark-Simulacrum:span-no-main, r=estebank

Provide a span if main function is not present in crate

Unfortunately, the diagnostic machinery does not cope well with an empty
span which can happen if the crate is empty, in which case we merely set
a spanless note.

Tests are already updated for this change, so a dedicated test is not added.

Resolves #36561.

4 years agoRollup merge of #61797 - Thomasdezeeuw:stablise-weak_ptr_eq, r=RalfJung
Mazdak Farrokhzad [Sat, 14 Sep 2019 20:16:03 +0000 (22:16 +0200)]
Rollup merge of #61797 - Thomasdezeeuw:stablise-weak_ptr_eq, r=RalfJung

Stabilise weak_ptr_eq

Implemented in #55987.

Closes #55981.

4 years agoresolve: Tweak some expected/found wording
Vadim Petrochenkov [Sat, 14 Sep 2019 19:36:58 +0000 (22:36 +0300)]
resolve: Tweak some expected/found wording

4 years agofeature_gate: Eliminate `check::Context`
Vadim Petrochenkov [Sat, 14 Sep 2019 18:54:16 +0000 (21:54 +0300)]
feature_gate: Eliminate `check::Context`

Use `PostExpansionVisitor` directly instead

4 years agofeature_gate: Merge various attribute gating functions
Vadim Petrochenkov [Sat, 14 Sep 2019 18:29:59 +0000 (21:29 +0300)]
feature_gate: Merge various attribute gating functions

4 years agofeature_gate: Remove dead code from attribute checking
Vadim Petrochenkov [Sat, 14 Sep 2019 16:36:41 +0000 (19:36 +0300)]
feature_gate: Remove dead code from attribute checking

Same checks are performed during name resolution, and all attributes go through name resolution now

4 years agoBan non-extern rust intrinsics
Mark Rousskov [Thu, 12 Sep 2019 14:46:49 +0000 (10:46 -0400)]
Ban non-extern rust intrinsics

Intrinsics can only be defined by the compiler.

4 years agoProvide a span if main function is not present in crate
Mark Rousskov [Sun, 8 Sep 2019 17:06:49 +0000 (13:06 -0400)]
Provide a span if main function is not present in crate

Unfortunately, the diagnotic machinery does not cope well with an empty
span which can happen if the crate is empty, in which case we merely set
a spanless note.

4 years agoAuto merge of #64456 - Centril:rollup-ytqdwaq, r=Centril
bors [Sat, 14 Sep 2019 14:43:32 +0000 (14:43 +0000)]
Auto merge of #64456 - Centril:rollup-ytqdwaq, r=Centril

Rollup of 17 pull requests

Successful merges:

 - #63846 (Added table containing the system calls used by Instant and SystemTime.)
 - #64116 (Fix minor typo in docs.)
 - #64203 (A few cosmetic improvements to code & comments in liballoc and libcore)
 - #64302 (Shrink `ObligationCauseCode`)
 - #64372 (use randSecure and randABytes)
 - #64374 (Box `DiagnosticBuilder`.)
 - #64375 (Fast path for vec.clear/truncate )
 - #64378 (Fix inconsistent link formatting.)
 - #64384 (Trim rustc-workspace-hack)
 - #64393 ( declare EnvKey before use to fix build error)
 - #64420 (Inline `mark_neighbours_as_waiting_from`.)
 - #64422 (Remove raw string literal quotes from error index descriptions)
 - #64423 (Add self to .mailmap)
 - #64425 (typo fix)
 - #64431 (fn ptr is structural match)
 - #64435 (codegen: use "_N" (like for other locals) instead of "argN", for argument names.)
 - #64439 (fix #64430, confusing `owned_box` error message in no_std build)

Failed merges:

r? @ghost

4 years agoRollup merge of #64439 - 12101111:fix-owned-box, r=Centril
Mazdak Farrokhzad [Sat, 14 Sep 2019 14:42:42 +0000 (16:42 +0200)]
Rollup merge of #64439 - 12101111:fix-owned-box, r=Centril

fix #64430, confusing `owned_box` error message in no_std build

Fixes #64430

4 years agoRollup merge of #64435 - eddyb:arguments-against-arg, r=rkruppe
Mazdak Farrokhzad [Sat, 14 Sep 2019 14:42:40 +0000 (16:42 +0200)]
Rollup merge of #64435 - eddyb:arguments-against-arg, r=rkruppe

codegen: use "_N" (like for other locals) instead of "argN", for argument names.

Based on #64408 (second commit is new), fixing something I mentioned in #64408 (which turned to be an immediate blocker for unifying relevant codepaths).

Closes #64408 (by containing it).

r? @rkruppe

4 years agoRollup merge of #64431 - pnkfelix:issue-63479-fnptr-is-structural-match, r=varkor
Mazdak Farrokhzad [Sat, 14 Sep 2019 14:42:39 +0000 (16:42 +0200)]
Rollup merge of #64431 - pnkfelix:issue-63479-fnptr-is-structural-match, r=varkor

fn ptr is structural match

Make fn ptr always structural match, regardless of whether the formal parameter types or return type are.

Fix #63479.

4 years agoRollup merge of #64425 - guanqun:typo-fix, r=matthewjasper
Mazdak Farrokhzad [Sat, 14 Sep 2019 14:42:38 +0000 (16:42 +0200)]
Rollup merge of #64425 - guanqun:typo-fix, r=matthewjasper

typo fix

4 years agoRollup merge of #64423 - ollie27:mailmap, r=Mark-Simulacrum
Mazdak Farrokhzad [Sat, 14 Sep 2019 14:42:36 +0000 (16:42 +0200)]
Rollup merge of #64423 - ollie27:mailmap, r=Mark-Simulacrum

Add self to .mailmap

4 years agoRollup merge of #64422 - ollie27:error_index_generator_stringify, r=Mark-Simulacrum
Mazdak Farrokhzad [Sat, 14 Sep 2019 14:42:35 +0000 (16:42 +0200)]
Rollup merge of #64422 - ollie27:error_index_generator_stringify, r=Mark-Simulacrum

Remove raw string literal quotes from error index descriptions

The error index has unnecessary `r##"` and `"##` around the descriptions from #63721. Removing the `stringify` call removes them.

r? @Mark-Simulacrum

4 years agoRollup merge of #64420 - nnethercote:inline-mark_neighbours_as_waiting_from, r=Mark...
Mazdak Farrokhzad [Sat, 14 Sep 2019 14:42:33 +0000 (16:42 +0200)]
Rollup merge of #64420 - nnethercote:inline-mark_neighbours_as_waiting_from, r=Mark-Simulacrum

Inline `mark_neighbours_as_waiting_from`.

This function is very hot, doesn't get inlined because it's recursive,
and the function calls are significant.

This commit splits it into inlined and uninlined variants, and uses the
inlined variant for the hot call site. This wins several percent on a
few benchmarks.

r? @nikomatsakis

4 years agoRollup merge of #64393 - Wind-River:master_002_envKey, r=alexcrichton
Mazdak Farrokhzad [Sat, 14 Sep 2019 14:42:32 +0000 (16:42 +0200)]
Rollup merge of #64393 - Wind-River:master_002_envKey, r=alexcrichton

 declare EnvKey before use to fix build error

r? @alexcrichton

4 years agoRollup merge of #64384 - mati865:tools_hack, r=alexcrichton
Mazdak Farrokhzad [Sat, 14 Sep 2019 14:42:31 +0000 (16:42 +0200)]
Rollup merge of #64384 - mati865:tools_hack, r=alexcrichton

Trim rustc-workspace-hack

Those dependencies seem no longer necessary.
`./x.py test` and `x86_64-gnu-tools` container passed locally so I think this won't hurt.

4 years agoRollup merge of #64378 - Rosto75:master, r=jonas-schievink
Mazdak Farrokhzad [Sat, 14 Sep 2019 14:42:29 +0000 (16:42 +0200)]
Rollup merge of #64378 - Rosto75:master, r=jonas-schievink

Fix inconsistent link formatting.

4 years agoRollup merge of #64375 - kornelski:vecdrop, r=rkruppe
Mazdak Farrokhzad [Sat, 14 Sep 2019 14:42:28 +0000 (16:42 +0200)]
Rollup merge of #64375 - kornelski:vecdrop, r=rkruppe

Fast path for vec.clear/truncate

For trivial types like `u8`, `vec.truncate()`/`vec.clear()` relies on the optimizer to remove the loop. This means more work in debug builds, and more work for the optimizer.

Avoiding this busywork is exactly what `mem::needs_drop::<T>()` is for.

4 years agoRollup merge of #64374 - nnethercote:box-DiagnosticBuilder, r=zackmdavis
Mazdak Farrokhzad [Sat, 14 Sep 2019 14:42:26 +0000 (16:42 +0200)]
Rollup merge of #64374 - nnethercote:box-DiagnosticBuilder, r=zackmdavis

Box `DiagnosticBuilder`.

It's a large type -- 176 bytes on 64-bit. And it's passed around and
returned from a lot of functions, including within `PResult`.

This commit boxes it, which reduces memory traffic. In particular,
`PResult` shrinks to 16 bytes in the best case; this reduces instruction
counts by up to 2% on various workloads. The commit touches a lot of
lines but it's almost all trivial plumbing changes.

4 years agoRollup merge of #64372 - Wind-River:master, r=alexcrichton
Mazdak Farrokhzad [Sat, 14 Sep 2019 14:42:25 +0000 (16:42 +0200)]
Rollup merge of #64372 - Wind-River:master, r=alexcrichton

use randSecure and randABytes

r? @alexcrichton

cc @n-salim

4 years agoRollup merge of #64302 - nnethercote:shrink-ObligationCauseCode, r=zackmdavis
Mazdak Farrokhzad [Sat, 14 Sep 2019 14:42:23 +0000 (16:42 +0200)]
Rollup merge of #64302 - nnethercote:shrink-ObligationCauseCode, r=zackmdavis

Shrink `ObligationCauseCode`

These commits reduce the size of `ObligationCauseCode` from 56 bytes to 32 bytes on 64-bit. This reduces instruction counts on various benchmarks by up to 1%, due to less `memcpy`ing.

4 years agoRollup merge of #64203 - alexreg:rush-pr-2, r=centril
Mazdak Farrokhzad [Sat, 14 Sep 2019 14:42:22 +0000 (16:42 +0200)]
Rollup merge of #64203 - alexreg:rush-pr-2, r=centril

A few cosmetic improvements to code & comments in liballoc and libcore

Factored out from hacking on rustc for work on the REPL.

r? @Centril

4 years agoRollup merge of #64116 - ZeGentzy:patch-1, r=oli-obk
Mazdak Farrokhzad [Sat, 14 Sep 2019 14:42:20 +0000 (16:42 +0200)]
Rollup merge of #64116 - ZeGentzy:patch-1, r=oli-obk

Fix minor typo in docs.

This comment is prolly refering to the comment in [const_eval_raw_provider](https://github.com/rust-lang/rust/pull/64116/files#diff-e0b58bb6712edaa8595ad7237542c958R616), not itself.

4 years agoRollup merge of #63846 - DevQps:32626-document-time-system-calls, r=rkruppe
Mazdak Farrokhzad [Sat, 14 Sep 2019 14:42:19 +0000 (16:42 +0200)]
Rollup merge of #63846 - DevQps:32626-document-time-system-calls, r=rkruppe

Added table containing the system calls used by Instant and SystemTime.

# Description
See #32626 for a discussion on documenting system calls used by Instant and SystemTime.

## Changes
- Added a table containing the system calls used by each platform.

EDIT: If I can format this table better (due to the large links) please let me know.
I'd also be happy to learn a quick command to generate the docs on my host machine! Currently I am using: `python x.py doc --stage 0 src/libstd` but that gives me some `unrecognized intrinsic` errors. Advice is always welcome :)

closes #32626

4 years agodef_collector: Factor out common field handling code
Vadim Petrochenkov [Sat, 14 Sep 2019 14:36:27 +0000 (17:36 +0300)]
def_collector: Factor out common field handling code

4 years agodef_collector: Do not ICE on attributes on unnamed fields
Vadim Petrochenkov [Sat, 14 Sep 2019 10:56:44 +0000 (13:56 +0300)]
def_collector: Do not ICE on attributes on unnamed fields

4 years agoUpdate src/liballoc/raw_vec.rs
Alexander Regueiro [Sat, 14 Sep 2019 14:26:50 +0000 (15:26 +0100)]
Update src/liballoc/raw_vec.rs

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
4 years agoAuto merge of #64080 - estebank:parse-format-comma, r=zackmdavis
bors [Sat, 14 Sep 2019 06:10:08 +0000 (06:10 +0000)]
Auto merge of #64080 - estebank:parse-format-comma, r=zackmdavis

Be accurate on `format!` parse error expectations

Fix https://github.com/rust-lang/rust/issues/57277.

4 years agoUpdate value.rs
Hal Gentz [Sat, 14 Sep 2019 02:37:38 +0000 (20:37 -0600)]
Update value.rs

4 years agoadd trailing newline
12101111 [Fri, 13 Sep 2019 19:23:58 +0000 (03:23 +0800)]
add trailing newline

4 years agoadd ui test for #64430
12101111 [Fri, 13 Sep 2019 19:13:51 +0000 (03:13 +0800)]
add ui test for #64430

4 years agofix #64430
12101111 [Fri, 13 Sep 2019 18:40:20 +0000 (02:40 +0800)]
fix #64430

4 years agocodegen: use "_N" (like for other locals) instead of "argN", for argument names.
Eduard-Mihai Burtescu [Fri, 13 Sep 2019 16:25:05 +0000 (19:25 +0300)]
codegen: use "_N" (like for other locals) instead of "argN", for argument names.

4 years agoAuto merge of #63420 - spastorino:place2_5, r=oli-obk
bors [Fri, 13 Sep 2019 15:37:15 +0000 (15:37 +0000)]
Auto merge of #63420 - spastorino:place2_5, r=oli-obk

[Place 2.0] Convert Place's projection to a boxed slice

This is still work in progress, it's not compiling right now I need to review a bit more to see what's going on but wanted to open the PR to start discussing it.

r? @oli-obk

4 years agoRegression tests for fn ptr and `#[structural_match]` as discussed in #63479.
Felix S. Klock II [Fri, 13 Sep 2019 15:08:01 +0000 (17:08 +0200)]
Regression tests for fn ptr and `#[structural_match]` as discussed in #63479.

4 years agoMake fn ptr always structural match, regardless of whether formal types are.
Felix S. Klock II [Fri, 13 Sep 2019 15:06:09 +0000 (17:06 +0200)]
Make fn ptr always structural match, regardless of whether formal types are.

Fix #63479.

4 years agoUpdate src/libstd/time.rs
Christian Veenman [Fri, 13 Sep 2019 14:29:06 +0000 (16:29 +0200)]
Update src/libstd/time.rs

Co-Authored-By: Robin Kruppe <robin.kruppe@gmail.com>
4 years agoMake all projection base names be proj_base
Santiago Pastorino [Thu, 12 Sep 2019 20:33:38 +0000 (17:33 -0300)]
Make all projection base names be proj_base

4 years agoUse if let here
Santiago Pastorino [Thu, 12 Sep 2019 19:21:47 +0000 (16:21 -0300)]
Use if let here

4 years agoFix style in comments
Santiago Pastorino [Thu, 12 Sep 2019 19:20:20 +0000 (16:20 -0300)]
Fix style in comments

4 years agoAvoid math and use patterns to grab projection base
Santiago Pastorino [Thu, 12 Sep 2019 19:16:43 +0000 (16:16 -0300)]
Avoid math and use patterns to grab projection base

4 years agoAdd self to .mailmap
Oliver Middleton [Fri, 13 Sep 2019 10:42:31 +0000 (11:42 +0100)]
Add self to .mailmap

4 years agoRemove raw string literal quotes from error index descriptions
Oliver Middleton [Fri, 13 Sep 2019 10:37:29 +0000 (11:37 +0100)]
Remove raw string literal quotes from error index descriptions

4 years agotypo fix
Guanqun Lu [Mon, 9 Sep 2019 15:44:11 +0000 (23:44 +0800)]
typo fix

4 years agoAuto merge of #64254 - aleksijuvani:fix-macos-sysroot, r=alexcrichton
bors [Fri, 13 Sep 2019 09:19:43 +0000 (09:19 +0000)]
Auto merge of #64254 - aleksijuvani:fix-macos-sysroot, r=alexcrichton

Fix sysroot on macOS when cross-compiling and SDKROOT is set

Fixes rust-lang/cargo#7283
Closes rust-lang/cargo#7284

r? @alexcrichton

4 years agoInline `mark_neighbours_as_waiting_from`.
Nicholas Nethercote [Fri, 13 Sep 2019 00:46:05 +0000 (10:46 +1000)]
Inline `mark_neighbours_as_waiting_from`.

This function is very hot, doesn't get inlined because it's recursive,
and the function calls are significant.

This commit splits it into inlined and uninlined variants, and uses the
inlined variant for the hot call site. This wins several percent on a
few benchmarks.

4 years agoAuto merge of #64361 - ehuss:update-cargo, r=alexcrichton
bors [Fri, 13 Sep 2019 01:07:51 +0000 (01:07 +0000)]
Auto merge of #64361 - ehuss:update-cargo, r=alexcrichton

Update cargo

11 commits in fe0e5a48b75da2b405c8ce1ba2674e174ae11d5d..9655d70af8a6dddac238e3afa2fec75088c9226f
2019-09-04 00:51:27 +0000 to 2019-09-10 18:16:11 +0000
- Home docs: fix broken links, misspellings, style fixes, clarifications. (rust-lang/cargo#7348)
- add readme key to cargos manifest. (rust-lang/cargo#7347)
- Explicitly ignore some results (rust-lang/cargo#7340)
- Don't resolve std's optional dependencies (rust-lang/cargo#7337)
- Add `alloc` and `proc_macro` to libstd crates (rust-lang/cargo#7336)
- doc: capitalization change for consistency. (rust-lang/cargo#7334)
- Fix test for changes in plugin API. (rust-lang/cargo#7335)
- Fix some man pages where the files weren't rebuilt. (rust-lang/cargo#7332)
- guide: add section about the cargo home (rust-lang/cargo#7314)
- `map_dependencies` is doing a deep clone, so lets make it cheaper (rust-lang/cargo#7326)
- don't need to copy this string (rust-lang/cargo#7324)

4 years agoAuto merge of #64360 - varkor:foreign-items-diagnostic-const-generics, r=cramertj
bors [Thu, 12 Sep 2019 21:20:06 +0000 (21:20 +0000)]
Auto merge of #64360 - varkor:foreign-items-diagnostic-const-generics, r=cramertj

Correct the polymorphic extern fn error for const parameters

Before, any polymorphism on extern functions was assumed to be type polymorphism.

4 years agoDestructure instead of using split_at
Santiago Pastorino [Thu, 12 Sep 2019 19:03:38 +0000 (16:03 -0300)]
Destructure instead of using split_at

4 years agoUse fold
Santiago Pastorino [Thu, 12 Sep 2019 18:25:33 +0000 (15:25 -0300)]
Use fold

4 years agocodegen: be more explicit about setting giving names to allocas.
Eduard-Mihai Burtescu [Thu, 12 Sep 2019 16:04:30 +0000 (19:04 +0300)]
codegen: be more explicit about setting giving names to allocas.

4 years agoIgnore linker env vars set for macOS on iOS targets
Aleksi Juvani [Thu, 12 Sep 2019 12:23:59 +0000 (15:23 +0300)]
Ignore linker env vars set for macOS on iOS targets

4 years agoAuto merge of #64359 - varkor:opaque-ty-in-extern, r=estebank
bors [Thu, 12 Sep 2019 12:40:31 +0000 (12:40 +0000)]
Auto merge of #64359 - varkor:opaque-ty-in-extern, r=estebank

Forbid opaque types in `extern "C"` blocks

Fixes #64338.

4 years agoTrim rustc-workspace-hack
Mateusz Mikuła [Wed, 11 Sep 2019 18:50:53 +0000 (20:50 +0200)]
Trim rustc-workspace-hack

4 years agoRemove env vars instead of setting them to an empty string
Aleksi Juvani [Thu, 12 Sep 2019 10:47:17 +0000 (13:47 +0300)]
Remove env vars instead of setting them to an empty string

4 years agoAuto merge of #64328 - Mark-Simulacrum:rustdoc-find-rustc, r=GuillaumeGomez
bors [Thu, 12 Sep 2019 08:29:55 +0000 (08:29 +0000)]
Auto merge of #64328 - Mark-Simulacrum:rustdoc-find-rustc, r=GuillaumeGomez

rustdoc: change doctests locating rustc binary

We previously used the "naive" approach of replacing the `current_exe()`'s file name with rustc, but now load from the sysroot by default (`$sysroot/bin/rustc`). The functionality of locating the sysroot overlaps/is the same as the functionality used by codegen backend loading; this ensures that any failure cases we've introduced are not exceeding those, and that improvements to finding the sysroot for loading codegen backends likewise enhance rustdoc.

The second commit adds an unstable `--test-builder` flag to rustdoc, and is largely separate (I can split into separate PR, but it's a simple and related change). This is largely intended for "advanced" users at this point (I'm not sure if we'll ever stabilize it); it permits use of a different rustc binary for rustdoc compilation of doctests than the rustdoc binary used when loading. Note, that this may not be what you want as the parsers and such differ (and rustdoc uses its own libsyntax, etc.). However, I've been told that running doctests in miri may be assisted by this change, so I've implemented it; I'll file a tracking issue for it if there's interest in it (and we land this PR).

4 years agoAuto merge of #64303 - nnethercote:avoid-more-Symbol-to-string-operations, r=petrochenkov
bors [Thu, 12 Sep 2019 04:15:27 +0000 (04:15 +0000)]
Auto merge of #64303 - nnethercote:avoid-more-Symbol-to-string-operations, r=petrochenkov

Avoid more `Symbol`-to-string operations

These commits avoid various `Symbol`-to-string conversions, by doing more operations directly on `Symbol`s. This requires adding a few more static `Symbol`s to the binary.

r? @petrochenkov

4 years agoMerge pull request #22 from Wind-River/master_002
Baoshan [Thu, 12 Sep 2019 02:34:23 +0000 (19:34 -0700)]
Merge pull request #22 from Wind-River/master_002

declare EnvKey before use to fix build error

4 years agoAuto merge of #64334 - jyao1:i686-master, r=joshtriplett
bors [Wed, 11 Sep 2019 22:40:11 +0000 (22:40 +0000)]
Auto merge of #64334 - jyao1:i686-master, r=joshtriplett

Add i686-unknown-uefi target

This adds a new rustc target-configuration called 'i686-unknown_uefi'.
This is similar to existing x86_64-unknown_uefi target.

The i686-unknown-uefi target can be used to build Intel Architecture
32bit UEFI application. The ABI defined in UEFI environment (aka IA32)
is similar to cdecl.

We choose i686-unknown-uefi-gnu instead of i686-unknown-uefi to avoid
the intrinsics generated by LLVM. The detail of root-cause and solution
analysis is added as comment in the code.
For x86_64-unknown-uefi, we cannot use -gnu, because the ABI between
MSVC and GNU is totally different, and UEFI chooses ABI similar to MSVC.
For i686-unknown-uefi, the UEFI chooses cdecl ABI, which is same as
MSVC and GNU. According to LLVM code, the only differences between MSVC
and GNU are fmodf(f32), longjmp() and TLS, which have no impact to UEFI.
As such, using i686-unknown-uefi-gnu is the simplest way to pass the build.

Adding the undefined symbols, such as _aulldiv() to rust compiler-builtins
is out of scope. But it may be considered later.

The scope of this patch is limited to support target-configuration.

No standard library support is added in this patch. Such work can be
done in future enhancement.

Cc: Josh Triplett <josh.triplett@intel.com>
Reviewed-by: Josh Triplett <josh.triplett@intel.com>
4 years agoBox `DiagnosticBuilder`.
Nicholas Nethercote [Wed, 11 Sep 2019 22:29:17 +0000 (08:29 +1000)]
Box `DiagnosticBuilder`.

It's a large type -- 176 bytes on 64-bit. And it's passed around and
returned from a lot of functions, including within PResult.

This commit boxes it, which reduces memory traffic. In particular,
`PResult` shrinks to 16 bytes in the best case; this reduces instruction
counts by up to 2% on various workloads.

4 years agoMake Place Boxed on Statement to reduce size from 64 bytes to 32 bytes
Santiago Pastorino [Wed, 11 Sep 2019 19:05:45 +0000 (16:05 -0300)]
Make Place Boxed on Statement to reduce size from 64 bytes to 32 bytes

4 years agoGuarantee vec.clear/truncate is O(1) for trivial types
Kornel [Wed, 11 Sep 2019 10:46:53 +0000 (11:46 +0100)]
Guarantee vec.clear/truncate is O(1) for trivial types

4 years agoAuto merge of #64271 - Centril:non-exhaustive-peel-refs, r=estebank
bors [Wed, 11 Sep 2019 18:46:18 +0000 (18:46 +0000)]
Auto merge of #64271 - Centril:non-exhaustive-peel-refs, r=estebank

check_match: refactor + improve non-exhaustive diagnostics for default binding modes

Refactor `check_match` a bit with more code-reuse and improve the diagnostics for a non-exhaustive pattern match by peeling off any references from the scrutinee type so that the "defined here" label is added in more cases. For example:

```rust
error[E0004]: non-exhaustive patterns: `&mut &B` not covered
 --> foo.rs:4:11
  |
1 | enum E { A, B }
  | ---------------
  | |           |
  | |           not covered
  | `E` defined here
...
4 |     match x {
  |           ^ pattern `&mut &B` not covered
  |
  = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
```

Moreover, wrt. "defined here", we give irrefutable pattern matching (i.e. in `let`, `for`, and `fn` parameters) a more consistent treatment in line with `match`.

r? @estebank

4 years agoAuto merge of #64154 - alexcrichton:std-backtrace, r=sfackler
bors [Wed, 11 Sep 2019 14:46:08 +0000 (14:46 +0000)]
Auto merge of #64154 - alexcrichton:std-backtrace, r=sfackler

std: Add a `backtrace` module

This commit adds a `backtrace` module to the standard library, as
designed in [RFC 2504]. The `Backtrace` type is intentionally very
conservative, effectively only allowing capturing it and printing it.

Additionally this commit also adds a `backtrace` method to the `Error`
trait which defaults to returning `None`, as specified in [RFC 2504].
More information about the design here can be found in [RFC 2504] and in
the [tracking issue].

Implementation-wise this is all based on the `backtrace` crate and very
closely mirrors the `backtrace::Backtrace` type on crates.io. Otherwise
it's pretty standard in how it handles everything internally.

[RFC 2504]: https://github.com/rust-lang/rfcs/blob/master/text/2504-fix-error.md
[tracking issue]: https://github.com/rust-lang/rust/issues/53487

cc #53487

4 years agoFix inconsistent link formatting.
Tomasz Różański [Wed, 11 Sep 2019 12:03:40 +0000 (14:03 +0200)]
Fix inconsistent link formatting.

4 years agodeclare EnvKey before use to fix build error
Baoshan Pang [Wed, 11 Sep 2019 04:35:01 +0000 (21:35 -0700)]
declare EnvKey before use to fix build error

4 years agoMerge pull request #21 from rust-lang/master
Baoshan [Wed, 11 Sep 2019 04:21:48 +0000 (21:21 -0700)]
Merge pull request #21 from rust-lang/master

Sync with rust-lang/rust master branch

4 years agoAvoid two `Symbol::as_str()` calls.
Nicholas Nethercote [Thu, 5 Sep 2019 01:54:01 +0000 (11:54 +1000)]
Avoid two `Symbol::as_str()` calls.

4 years agoUse `Symbol` in `external_path()`.
Nicholas Nethercote [Thu, 5 Sep 2019 01:43:05 +0000 (11:43 +1000)]
Use `Symbol` in `external_path()`.

4 years agoUse `Symbol` in `weak_lang_items!`.
Nicholas Nethercote [Thu, 5 Sep 2019 01:35:39 +0000 (11:35 +1000)]
Use `Symbol` in `weak_lang_items!`.

4 years agoUse `ast::Name` in `report_ambiguous_associated_type()`.
Nicholas Nethercote [Thu, 5 Sep 2019 01:26:51 +0000 (11:26 +1000)]
Use `ast::Name` in `report_ambiguous_associated_type()`.

4 years agoUse `Symbol` in `Linker`.
Nicholas Nethercote [Thu, 5 Sep 2019 01:23:45 +0000 (11:23 +1000)]
Use `Symbol` in `Linker`.

4 years agoStore `InternedString`s in `AssertModuleSource::available_cgus`.
Nicholas Nethercote [Thu, 5 Sep 2019 00:36:30 +0000 (10:36 +1000)]
Store `InternedString`s in `AssertModuleSource::available_cgus`.

4 years agoMerge pull request #20 from Wind-River/rand
Baoshan [Wed, 11 Sep 2019 00:53:54 +0000 (17:53 -0700)]
Merge pull request #20 from Wind-River/rand

use randSecure and randABytes

4 years agoAuto merge of #64369 - Centril:rollup-g875ozi, r=Centril
bors [Wed, 11 Sep 2019 00:39:40 +0000 (00:39 +0000)]
Auto merge of #64369 - Centril:rollup-g875ozi, r=Centril

Rollup of 6 pull requests

Successful merges:

 - #64060 (Improve hygiene of `alloc::format!`)
 - #64072 (Replace file_stem by file_name in rustdoc markdown)
 - #64129 (vxWorks: set DEFAULT_MIN_STACK_SIZE to 256K and use min_stack to pass initial stack size to rtpSpawn)
 - #64188 (rustc: Allow the cdylib crate type with wasm32-wasi)
 - #64326 (Fixed documentation within c_str::from_ptr)
 - #64349 (documentation for AtomicPtr CAS operations)

Failed merges:

r? @ghost