Commit graph

91857 commits

Author SHA1 Message Date
bors
acd8dd6a50 Auto merge of #59500 - crlf0710:boxed-closure-impls, r=cramertj
Unsized rvalues: implement boxed closure impls. (2nd try)

This is a rebase of S-blocked-closed PR #55431 to current master. LLVM has moved forward since then, so maybe we can check whether the new LLVM 8.0 version unblocked this work.
2019-04-05 17:45:43 +00:00
bors
20dbf28624 Auto merge of #59076 - dtolnay:comma, r=alexcrichton
Include trailing comma in multiline Debug representation

This PR changes the behavior of [`Formatter::debug_struct`](https://doc.rust-lang.org/std/fmt/struct.Formatter.html#method.debug_struct), [`debug_tuple`](https://doc.rust-lang.org/std/fmt/struct.Formatter.html#method.debug_tuple), [`debug_list`](https://doc.rust-lang.org/std/fmt/struct.Formatter.html#method.debug_list), [`debug_set`](https://doc.rust-lang.org/std/fmt/struct.Formatter.html#method.debug_set), and [`debug_map`](https://doc.rust-lang.org/std/fmt/struct.Formatter.html#method.debug_map) to render trailing commas in `{:#?}` mode, which is the dominant style in modern Rust code.

#### Before:

```console
Language {
    name: "Rust",
    trailing_commas: false
}
```

#### After:

```console
Language {
    name: "Rust",
    trailing_commas: true,
}
```
2019-04-05 15:01:07 +00:00
David Tolnay
cfd31fb4df
Include trailing comma in multiline Debug representation
This commit changes the behavior of Formatter::debug_struct,
debug_tuple, debug_list, debug_set, and debug_map to render trailing
commas in {:#?} mode, which is the dominant style in modern Rust code.

Before:

    Language {
        name: "Rust",
        trailing_commas: false
    }

After:

    Language {
        name: "Rust",
        trailing_commas: true,
    }
2019-04-05 06:45:40 -07:00
bors
4d7defb265 Auto merge of #59721 - Centril:rollup-ieam9ke, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #59665 (improve worst-case performance of HashSet.is_subset)
 - #59687 (cleanup shebang handling in the lexer)
 - #59690 (Mark unix::ffi::OsStrExt methods as inline)
 - #59702 (Use declare_lint_pass! and impl_lint_pass! in more places)
 - #59712 (wasm32: Default to a "static" relocation model)

Failed merges:

r? @ghost
2019-04-05 12:13:52 +00:00
Mazdak Farrokhzad
7249036de5
Rollup merge of #59712 - alexcrichton:wasm-static-not-pic, r=eddyb
wasm32: Default to a "static" relocation model

LLVM 9 is adding support for a "pic" relocation model for wasm code,
which is quite different than the current model. In order to preserve
the mode of compilation that we have today default to "static" to ensure
that we don't accidentally start creating experimental relocatable
binaries.
2019-04-05 12:46:53 +02:00
Mazdak Farrokhzad
c0ed443fdd
Rollup merge of #59702 - hgallagher1993:origin, r=Centril
Use declare_lint_pass! and impl_lint_pass! in more places

Fixes #59683
2019-04-05 12:46:52 +02:00
Mazdak Farrokhzad
c392832195
Rollup merge of #59690 - xfix:patch-17, r=cramertj
Mark unix::ffi::OsStrExt methods as inline

This is a small change, but I found it surprising it's not inlined looking at the assembly.
2019-04-05 12:46:51 +02:00
Mazdak Farrokhzad
2e7be1ed6c
Rollup merge of #59687 - matklad:shebang, r=petrochenkov
cleanup shebang handling in the lexer
2019-04-05 12:46:49 +02:00
Mazdak Farrokhzad
a3122e12d8
Rollup merge of #59665 - ssomers:hashset_revisited, r=KodrAus
improve worst-case performance of HashSet.is_subset

One more simple optimization opportunity for HashSet that was applied in BTreeSet in #59186 (and wasn't in #57043). Already covered by the existing unit test.

r? @KodrAus
2019-04-05 12:46:48 +02:00
bors
a781c47243 Auto merge of #59681 - dtolnay:cargo, r=alexcrichton
Update cargo

20 commits in
63231f438a2b5b84ccf319a5de22343ee0316323..6f3e9c367abb497c64f360c3839dab5e74928d5c
2019-03-27 12:26:45 +0000 to 2019-04-04 14:11:33 +0000
- Fix Init for Fossil SCM project (rust-lang/cargo#6792)
- Fix member_manifest_version_error accessing the network (rust-lang/cargo#6799)
- Don't include email if it is empty (rust-lang/cargo#6802)
- Fix unused import warning (rust-lang/cargo#6807)
- Add some help and documentation for unstable flags (rust-lang/cargo#6791)
- Allow `cargo doc --open` with multiple packages (rust-lang/cargo#6803)
- Allow `cargo install --path P` to load config from P (rust-lang/cargo#6804)
- Add more suggestions on how to deal with excluding a package from a workspace (rust-lang/cargo#6805)
- Warn on version req with metadata (rust-lang/cargo#6806)
- cargo install: Be more restrictive about cli flags (rust-lang/cargo#6801)
- Support force-pushed repos with git-fetch-with-cli (rust-lang/cargo#6800)
- Cargo clippy (rust-lang/cargo#6759)
- Don't include metadata in wasm binary examples (rust-lang/cargo#6812)
- Update glossary for `feature` (rust-lang/cargo#6809)
- Include proc-macros in `build-override` (rust-lang/cargo#6811)
- Resolver: A dep is equivalent to one of the things it can resolve to (rust-lang/cargo#6776)
- Add some docs for `Downloads` (rust-lang/cargo#6815)
- Resolve: Be less strict while offline (rust-lang/cargo#6814)
- Accept trailing comma in test of impl Debug for PackageId (rust-lang/cargo#6818)
- Fix doc link (rust-lang/cargo#6820)

<br>

I specifically care about "Accept trailing comma in test of impl Debug for PackageId (rust-lang/cargo#6818)" to unblock https://github.com/rust-lang/rust/pull/59076.

Mentioning @ehuss.
2019-04-05 09:30:13 +00:00
Charles Lew
812d89c87d Fix expectations on some ui test in nll compare mode. 2019-04-05 14:47:20 +08:00
bors
a11083e3c6 Auto merge of #59643 - alexcrichton:wasi-symbols, r=sanxiyn
std: Upgrade `compiler_builtins` to fix wasi linkage

Turns out we needed to exclude a number of math functions on the
`wasm32-unknown-wasi` target, and this was fixed in 0.1.9 of
compiler-builtins and this is pulling in the fix to libstd's own build.
2019-04-05 05:16:45 +00:00
bors
8e2faa0041 Auto merge of #59704 - alexcrichton:fix-freebsd, r=pietroalbini
ci: Update FreeBSD tarball downloads

These appear to have disappeared from the original server, so I acquired
the contents from a different mirror and uploaded them to our S3 bucket
2019-04-05 02:32:20 +00:00
Alex Crichton
471db2b84b wasm32: Default to a "static" relocation model
LLVM 9 is adding support for a "pic" relocation model for wasm code,
which is quite different than the current model. In order to preserve
the mode of compilation that we have today default to "static" to ensure
that we don't accidentally start creating experimental relocatable
binaries.
2019-04-04 13:23:42 -07:00
Alex Crichton
fcc8b8cef2 ci: Update FreeBSD tarball downloads
These appear to have disappeared from the original server, so I acquired
the contents from a different mirror and uploaded them to our S3 bucket
2019-04-04 11:40:21 -07:00
Masaki Hara
7a63c7f010 Add ignore to doc code 2019-04-05 02:32:30 +08:00
Masaki Hara
440e873a47 Simplify fnbox docs. 2019-04-05 02:32:29 +08:00
Charles Lew
ecc3e89dd0 Stabilize boxed_closure_impls in 1.35.0. 2019-04-05 02:32:21 +08:00
Masaki Hara
45c0b28bcb Remove FnBox specialization of impl FnOnce for Box<impl FnOnce>. 2019-04-05 02:27:05 +08:00
Masaki Hara
a38f29272e We already have unsized_locals in stage0. 2019-04-05 02:27:03 +08:00
Masaki Hara
4dcd6cc208 Fix failing tests. 2019-04-05 02:27:01 +08:00
Masaki Hara
e55d82c8a3 Fix expectations on some ui tests involving FnOnce. 2019-04-05 02:26:59 +08:00
Masaki Hara
219097ecf6 Add unstable-book articles on fnbox and boxed_closure_impls. 2019-04-05 02:26:56 +08:00
Masaki Hara
480dcb403c Add tests for boxed_closure_impls. 2019-04-05 02:26:54 +08:00
Masaki Hara
059ec76d9b Add Fn* blanket impls for Box. 2019-04-05 02:26:51 +08:00
Masaki Hara
79941973af Make FnBox a subtrait of FnOnce. 2019-04-05 02:26:49 +08:00
Alex Crichton
1bf04c9ad7 std: Upgrade compiler_builtins to fix wasi linkage
Turns out we needed to exclude a number of math functions on the
`wasm32-unknown-wasi` target, and this was fixed in 0.1.9 of
compiler-builtins and this is pulling in the fix to libstd's own build.
2019-04-04 11:24:53 -07:00
bors
53f2165c54 Auto merge of #59676 - alexcrichton:osx-deadlock, r=sfackler
std: Avoid usage of `Once` in `Instant`

This commit removes usage of `Once` from the internal implementation of
time utilities on OSX and Windows. It turns out that we accidentally hit
a deadlock today (#59020) via events that look like:

* A thread invokes `park_timeout`
* Internally, only on OSX, `park_timeout` calls `Instant::elapsed`
* Inside of `Instant::elapsed` on OSX we enter a `Once` to initialize
  global timer data
* Inside of `Once`, it attempts to `park`

This means on the same stack frame, when there's contention, we're
calling `park` from inside `park_timeout`, causing a deadlock!

The solution implemented in this commit was to remove usage of `Once`
and instead just do a small dance with atomics. There's no real need we
need to guarantee that the global information is only learned once, only
that it's only *stored* once. This implementation may have multiple
threads invoke `mach_timebase_info`, but only one will store the global
information which will amortize the cost for all other threads.

A similar fix has been applied to windows to be uniform across our
implementations, but looking at the code on Windows no deadlock was
possible. This is purely just a consistency update for Windows and in
theory a slightly leaner implementation.

Closes #59020
2019-04-04 18:22:34 +00:00
David Tolnay
d6b91fe18f
Update cargo 2019-04-04 10:39:23 -07:00
hgallagher1993
a96492112c Use declare_lint_pass! and impl_lint_pass! in more places 2019-04-04 13:23:11 -04:00
bors
52980d0fb3 Auto merge of #59695 - Centril:rollup-88qffc2, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #59470 (Document std::fs::File close behavior ignoring errors)
 - #59555 (update miri)
 - #59556 (update stdsimd)
 - #59596 (Forward formatter settings to bounds of `Range<T>` in `fmt::Debug` impl)
 - #59639 (Never return uninhabited values at all)
 - #59671 (Make some of lexer's API private)
 - #59685 (Add description for -Os and -Oz in rustc.1)
 - #59686 (Temporarily disable stack probing for gnux32.)

Failed merges:

r? @ghost
2019-04-04 15:36:17 +00:00
Alex Crichton
cb57484dca std: Avoid usage of Once in Instant
This commit removes usage of `Once` from the internal implementation of
time utilities on OSX and Windows. It turns out that we accidentally hit
a deadlock today (#59020) via events that look like:

* A thread invokes `park_timeout`
* Internally, only on OSX, `park_timeout` calls `Instant::elapsed`
* Inside of `Instant::elapsed` on OSX we enter a `Once` to initialize
  global timer data
* Inside of `Once`, it attempts to `park`

This means on the same stack frame, when there's contention, we're
calling `park` from inside `park_timeout`, causing a deadlock!

The solution implemented in this commit was to remove usage of `Once`
and instead just do a small dance with atomics. There's no real need we
need to guarantee that the global information is only learned once, only
that it's only *stored* once. This implementation may have multiple
threads invoke `mach_timebase_info`, but only one will store the global
information which will amortize the cost for all other threads.

A similar fix has been applied to windows to be uniform across our
implementations, but looking at the code on Windows no deadlock was
possible. This is purely just a consistency update for Windows and in
theory a slightly leaner implementation.

Closes #59020
2019-04-04 07:19:14 -07:00
Mazdak Farrokhzad
31c2f5d228
Rollup merge of #59686 - crlf0710:disable_gnux32_stackprobe, r=luqmana
Temporarily disable stack probing for gnux32.
2019-04-04 15:09:08 +02:00
Mazdak Farrokhzad
4954cae241
Rollup merge of #59685 - lzutao:patch-1, r=GuillaumeGomez
Add description for -Os and -Oz in rustc.1
2019-04-04 15:09:07 +02:00
Mazdak Farrokhzad
c18c194518
Rollup merge of #59671 - matklad:lexer, r=eddyb
Make some of lexer's API private

Lexer is a `pub` type, so it feels wrong that its fields are just pub (I guess it wasn't exported initially), so let's minimize visibility.

Context: I am looking into extracting rust-lexer into a library, which can be shared by rust-analyzer and rustc. I hope that a simple interface like `fn next_token(src: &str) -> (TokenKind, usize)` would work, but to try this out I need to understand what is the current API of the lexer.
2019-04-04 15:09:06 +02:00
Mazdak Farrokhzad
05c31baf83
Rollup merge of #59639 - cuviper:ignore-uninhabited, r=eddyb
Never return uninhabited values at all

Functions with uninhabited return values are already marked `noreturn`,
but we were still generating return instructions for this. When running
with `-C passes=lint`, LLVM prints:

    Unusual: Return statement in function with noreturn attribute

The LLVM manual makes a stronger statement about `noreturn` though:

> This produces undefined behavior at runtime if the function ever does
dynamically return.

We now emit an `abort` anywhere that would have tried to return an
uninhabited value.

Fixes #48227
cc #7463 #48229

r? @eddyb
2019-04-04 15:09:04 +02:00
Mazdak Farrokhzad
56328a5952
Rollup merge of #59596 - LukasKalbertodt:fix-range-fmt, r=Kimundi
Forward formatter settings to bounds of `Range<T>` in `fmt::Debug` impl

Before this change, formatter settings were lost when printing a `Range`. For example, printing a `Range<f32>` with `{:.2?}` would not apply the precision modifier when printing the floats. Now the `Debug` impls look a bit more verbose, but modifier are not lost.

---

I assume the exact output of `Debug` impls in `std` cannot be relied on by users and thus can change, right?
2019-04-04 15:09:03 +02:00
Mazdak Farrokhzad
9f8f89105c
Rollup merge of #59556 - RalfJung:stdsimd, r=gnzlbg
update stdsimd

Cc @gnzlbg
2019-04-04 15:09:02 +02:00
Mazdak Farrokhzad
2074c9687f
Rollup merge of #59555 - RalfJung:miri, r=oli-obk
update miri

r? @oli-obk

Fixes https://github.com/rust-lang/rust/issues/59477
2019-04-04 15:09:00 +02:00
Mazdak Farrokhzad
886456deab
Rollup merge of #59470 - czipperz:document-fs-file-close, r=dtolnay
Document std::fs::File close behavior ignoring errors

Resolves #52685
2019-04-04 15:08:59 +02:00
bors
2d065712cf Auto merge of #59619 - alexcrichton:wasi-fs, r=fitzgen
wasi: Implement more of the standard library

This commit fills out more of the `wasm32-unknown-wasi` target's standard library, notably the `std::fs` module and all of its internals. A few tweaks were made along the way to non-`fs` modules, but the last commit contains the bulk of the work which is to wire up all APIs to their equivalent on WASI targets instead of unconditionally returning "unsupported". After this some basic filesystem operations and such should all be working in WASI!
2019-04-04 12:46:20 +00:00
Aleksey Kladov
fdb8752850 cleanup shebang handling in the lexer 2019-04-04 13:31:53 +03:00
Konrad Borowski
a37c33b926 Mark unix::ffi::OsStrExt methods as inline 2019-04-04 10:55:31 +02:00
bors
e43f99ce57 Auto merge of #59517 - Zoxc:new-queries, r=oli-obk
Move query definitions over to the proc macro

r? @oli-obk
2019-04-04 08:26:18 +00:00
CrLF0710
42d652ecd6 Disable stack probing for gnux32. 2019-04-04 14:39:33 +08:00
bors
f717b58dd7 Auto merge of #59089 - petrhosek:llvm-unwind, r=petrhosek
Support using LLVM's libunwind as the unwinder implementation

This avoids the dependency on host libraries such as libgcc_s which
may be undesirable in some deployment environments where these aren't
available.
2019-04-04 05:24:54 +00:00
lzutao
4c9c2cf160
Add description for -Os and -Oz in rustc.1 2019-04-04 12:20:53 +07:00
Chris Gregory
a969d40987 File: Add documentation about dropping to sync_all 2019-04-03 23:21:10 -04:00
bors
a5dfdc589a Auto merge of #59684 - Centril:rollup-n7pnare, r=Centril
Rollup of 6 pull requests

Successful merges:

 - #59316 (Internal lints take 2)
 - #59663 (Be more direct about borrow contract)
 - #59664 (Updated the documentation of spin_loop and spin_loop_hint)
 - #59666 (Updated the environment description in rustc.)
 - #59669 (Reduce repetition in librustc(_lint) wrt. impl LintPass by using macros)
 - #59677 (rustfix coverage: Skip UI tests with non-json error-format)

Failed merges:

r? @ghost
2019-04-04 02:31:46 +00:00
Mazdak Farrokhzad
231bd482c6
Rollup merge of #59677 - phansch:rustfix_coverage_handle_other_error_formats, r=oli-obk
rustfix coverage: Skip UI tests with non-json error-format

When using the `rustfix-coverage` flag, some tests currently fail
because they define a different error-format than `json`.

The current implementation crashes when encountering those tests. Since
we don't care about non-json test output when collecting the coverage
data, we handle those tests by returning an empty `Vec` instead.

r? @oli-obk
2019-04-04 01:49:13 +02:00