]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoAuto merge of #59760 - Centril:rollup-4b9x7ue, r=Centril
bors [Sat, 6 Apr 2019 21:34:12 +0000 (21:34 +0000)]
Auto merge of #59760 - Centril:rollup-4b9x7ue, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #59738 (Move match_path from DefId to lint::LateContext)
 - #59740 (Use for_each to extend collections)
 - #59751 (Tiny docs fix)
 - #59754 (Update books)
 - #59755 (Update miri)

Failed merges:

r? @ghost

5 years agoRollup merge of #59755 - matthewjasper:update-miri, r=RalfJung
Mazdak Farrokhzad [Sat, 6 Apr 2019 20:52:49 +0000 (22:52 +0200)]
Rollup merge of #59755 - matthewjasper:update-miri, r=RalfJung

Update miri

r? @RalfJung

5 years agoRollup merge of #59754 - ehuss:update-books, r=frewsxcv
Mazdak Farrokhzad [Sat, 6 Apr 2019 20:52:48 +0000 (22:52 +0200)]
Rollup merge of #59754 - ehuss:update-books, r=frewsxcv

Update books

## nomicon

1 commits in f1ff93b66844493a7b03101c7df66ac958c62418..c02e0e7754a76886e55b976a3a4fac20100cd35d
2019-02-26 13:37:28 -0500 to 2019-03-25 16:52:56 -0400
- dropck: The drop order is now defined (rust-lang-nursery/nomicon#113)

## reference

3 commits in 27ad493a10364e907ec476e2ad61e8a1614b57e1..98f90ff4de8e588f651f0fb493b5c7496551cd59
2019-03-26 02:06:15 +0100 to 2019-04-06 09:29:08 -0700
- Document repr packed(N). (rust-lang-nursery/reference#553)
- Fix broken link in glossary. (rust-lang-nursery/reference#558)
- Typo fixes (rust-lang-nursery/reference#556)

## embedded-book

2 commits in 07fd3880ea0874d82b1d9ed30ad3427ec98b4e8a..7989c723607ef5b13b57208022259e6c771e11d0
2019-03-27 15:40:52 +0000 to 2019-04-04 12:14:37 +0000
- fix rust-embedded/book#182  (rust-embedded/book#183)
- Add openocd to list of installable packages  (rust-embedded/book#179)

5 years agoRollup merge of #59751 - tbu-:pr_doc_fix_format, r=Centril
Mazdak Farrokhzad [Sat, 6 Apr 2019 20:52:47 +0000 (22:52 +0200)]
Rollup merge of #59751 - tbu-:pr_doc_fix_format, r=Centril

Tiny docs fix

5 years agoRollup merge of #59740 - cuviper:folded-extend, r=scottmcm
Mazdak Farrokhzad [Sat, 6 Apr 2019 20:52:46 +0000 (22:52 +0200)]
Rollup merge of #59740 - cuviper:folded-extend, r=scottmcm

Use for_each to extend collections

This updates the `Extend` implementations to use `for_each` for many
collections: `BinaryHeap`, `BTreeMap`, `BTreeSet`, `LinkedList`, `Path`,
`TokenStream`, `VecDeque`, and `Wtf8Buf`.

Folding with `for_each` enables better performance than a `for`-loop for
some iterators, especially if they can just forward to internal
iterators, like `Chain` and `FlatMap` do.

5 years agoRollup merge of #59738 - flip1995:match_path_move, r=eddyb,Manishearth
Mazdak Farrokhzad [Sat, 6 Apr 2019 20:52:45 +0000 (22:52 +0200)]
Rollup merge of #59738 - flip1995:match_path_move, r=eddyb,Manishearth

Move match_path from DefId to lint::LateContext

cc https://github.com/rust-lang/rust/pull/59316#discussion_r272351353

r? @eddyb

5 years agoUpdate miri
Matthew Jasper [Sat, 6 Apr 2019 17:34:06 +0000 (18:34 +0100)]
Update miri

5 years agoUpdate books
Eric Huss [Sat, 6 Apr 2019 17:06:51 +0000 (10:06 -0700)]
Update books

5 years agoTiny docs fix
Tobias Bucher [Sat, 6 Apr 2019 15:27:00 +0000 (17:27 +0200)]
Tiny docs fix

5 years agoAuto merge of #59710 - alexcrichton:llvm-9-compat, r=sanxiyn
bors [Sat, 6 Apr 2019 13:14:23 +0000 (13:14 +0000)]
Auto merge of #59710 - alexcrichton:llvm-9-compat, r=sanxiyn

rustc: Start implementing compat with LLVM 9

This commit doesn't actually migrate to LLVM 9, but it brings our own
C++ bindings in line with LLVM 9 and able to compile against tip of
tree. The changes made were:

* The `MainSubprogram` flag for debuginfo moved between flag types.
* Iteration of archive members was tweaked slightly and we have to
  construct the two iterators before constructing the returned
  `RustArchiveIterator` value.
* The `getOrInsertFunction` binding now returns a wrapper which we use
  `getCallee()` on to get the value we're interested in.

5 years agoAuto merge of #59745 - cwhakes:master, r=sanxiyn
bors [Sat, 6 Apr 2019 10:03:38 +0000 (10:03 +0000)]
Auto merge of #59745 - cwhakes:master, r=sanxiyn

Change `copytest` parameter name from `y` to `sign`

This should help clarify ambiguity with whether `a.copysign(b)` applies the sign of `a` to `b` or `b` to `a`.

r? @Centril

5 years agoAuto merge of #59744 - cuviper:output-errors, r=sanxiyn
bors [Sat, 6 Apr 2019 07:21:41 +0000 (07:21 +0000)]
Auto merge of #59744 - cuviper:output-errors, r=sanxiyn

Show better errors for LLVM IR output

I was trying to output LLVM IR directly to the console:

    $ rustc hello.rs --emit=llvm-ir -o /dev/stdout
    LLVM ERROR: IO failure on output stream: Bad file descriptor

Now `LLVMRustPrintModule` returns an error, and we print:

    error: failed to write LLVM IR to /dev/stdout.hello.7rcbfp3g-cgu.0.rcgu.ll: Permission denied

... which is more informative.

5 years agoAuto merge of #59723 - Zoxc:rem-noforce, r=michaelwoerister
bors [Sat, 6 Apr 2019 04:14:13 +0000 (04:14 +0000)]
Auto merge of #59723 - Zoxc:rem-noforce, r=michaelwoerister

Remove no_force from coherent_trait

r? @michaelwoerister

5 years agoChange `copytest` parameter name from `y` to `sign`
Will Hakes [Sat, 6 Apr 2019 02:30:45 +0000 (20:30 -0600)]
Change `copytest` parameter name from `y` to `sign`

5 years agoShow better errors for LLVM IR output
Josh Stone [Sat, 6 Apr 2019 00:48:23 +0000 (17:48 -0700)]
Show better errors for LLVM IR output

I was trying to output LLVM IR directly to the console:

    $ rustc hello.rs --emit=llvm-ir -o /dev/stdout
    LLVM ERROR: IO failure on output stream: Bad file descriptor

Now `LLVMRustPrintModule` returns an error, and we print:

    error: failed to write LLVM IR to /dev/stdout.hello.7rcbfp3g-cgu.0.rcgu.ll: Permission denied

... which is more informative.

5 years agoAuto merge of #59741 - Centril:rollup-3us4b8q, r=Centril
bors [Fri, 5 Apr 2019 22:56:15 +0000 (22:56 +0000)]
Auto merge of #59741 - Centril:rollup-3us4b8q, r=Centril

Rollup of 6 pull requests

Successful merges:

 - #58894 (Fix invalid bounds string generation in rustdoc)
 - #59599 (Updated RELEASES.md for 1.34.0)
 - #59624 (SGX target: Use linker option to avoid code CGU assignment kludge)
 - #59696 (Remove invalid assertion back::link::from add_upstream_rust_crates().)
 - #59707 (Add missing tryfrom example)
 - #59727 (wasi: Use shared API for preopened fds)

Failed merges:

r? @ghost

5 years agoRollup merge of #59727 - alexcrichton:wasi-apis, r=fitzgen
Mazdak Farrokhzad [Fri, 5 Apr 2019 22:14:47 +0000 (00:14 +0200)]
Rollup merge of #59727 - alexcrichton:wasi-apis, r=fitzgen

wasi: Use shared API for preopened fds

This commit updates the wasi target with supported added in
CraneStation/wasi-sysroot#10. That function allows both C and Rust to
cooperate in how preopened files are managed, enabling us to learn about
propened files through the same interface. The `open_parent` function in
the wasi `fs` module was updated to avoid its own initialization of a
global preopened map and instead delegate to libc to perform this
functionality.

This should both be more robust into the future in terms of handling
path logic as well as ensuring the propened map is correctly set up at
process boot time. This does currently require some unfortunate
allocations on our side, but if that becomes an issue we can always
paper over those in time!

5 years agoRollup merge of #59707 - GuillaumeGomez:GuillaumeGomez-patch-1, r=Centril
Mazdak Farrokhzad [Fri, 5 Apr 2019 22:14:46 +0000 (00:14 +0200)]
Rollup merge of #59707 - GuillaumeGomez:GuillaumeGomez-patch-1, r=Centril

Add missing tryfrom example

r? @rust-lang/docs

5 years agoRollup merge of #59696 - michaelwoerister:fix-issue-59137, r=alexcrichton
Mazdak Farrokhzad [Fri, 5 Apr 2019 22:14:44 +0000 (00:14 +0200)]
Rollup merge of #59696 - michaelwoerister:fix-issue-59137, r=alexcrichton

Remove invalid assertion back::link::from add_upstream_rust_crates().

This removes a misplaced assertion. The function containing the assertion is actually only ever called for upstream crates that are not considered for LTO, so we don't care whether upstream code has been merged in by LTO or not.

Fixes #59137

r? @alexcrichton

5 years agoRollup merge of #59624 - jethrogb:jb/sgx-unwind-syms, r=alexcrichton
Mazdak Farrokhzad [Fri, 5 Apr 2019 22:14:43 +0000 (00:14 +0200)]
Rollup merge of #59624 - jethrogb:jb/sgx-unwind-syms, r=alexcrichton

SGX target: Use linker option to avoid code CGU assignment kludge

cc @VardhanThigle @faern

5 years agoRollup merge of #59599 - XAMPPRocky:master, r=Mark-Simulacrum
Mazdak Farrokhzad [Fri, 5 Apr 2019 22:14:41 +0000 (00:14 +0200)]
Rollup merge of #59599 - XAMPPRocky:master, r=Mark-Simulacrum

Updated RELEASES.md for 1.34.0

[Rendered](https://github.com/XAMPPRocky/rust/blob/master/RELEASES.md)

This also corrects an omission in the previous 1.33.0 release.

r? @Mark-Simulacrum

cc @rust-lang/release

5 years agoRollup merge of #58894 - GuillaumeGomez:invalid-lifetime-bounds, r=estebank
Mazdak Farrokhzad [Fri, 5 Apr 2019 22:14:40 +0000 (00:14 +0200)]
Rollup merge of #58894 - GuillaumeGomez:invalid-lifetime-bounds, r=estebank

Fix invalid bounds string generation in rustdoc

Fixes #58737.

Very weird and I'm not sure this is the best fix around. However, trying to fix it beforehand seems overly complicated compared to the gain (in `clean`, it wouldn't change anything since we **have to** return something so that wouldn't work, and in `hir`, I'm afraid I'd break something else for very little gain).

Also, I wasn't able to make a small code to reproduce the issue. The only way to test is to document `crossbeam` directly and check the `Scope` struct...

r? @QuietMisdreavus

5 years agoUse for_each to extend collections
Josh Stone [Fri, 5 Apr 2019 21:51:07 +0000 (14:51 -0700)]
Use for_each to extend collections

This updates the `Extend` implementations to use `for_each` for many
collections: `BinaryHeap`, `BTreeMap`, `BTreeSet`, `LinkedList`, `Path`,
`TokenStream`, `VecDeque`, and `Wtf8Buf`.

Folding with `for_each` enables better performance than a `for`-loop for
some iterators, especially if they can just forward to internal
iterators, like `Chain` and `FlatMap` do.

5 years agoMove match_path from DefId to lint::LateContext
flip1995 [Fri, 5 Apr 2019 21:04:56 +0000 (23:04 +0200)]
Move match_path from DefId to lint::LateContext

5 years agoAuto merge of #59500 - crlf0710:boxed-closure-impls, r=cramertj
bors [Fri, 5 Apr 2019 17:45:43 +0000 (17:45 +0000)]
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.

5 years agoUpdate RELEASES.md
Mazdak Farrokhzad [Fri, 5 Apr 2019 17:38:24 +0000 (19:38 +0200)]
Update RELEASES.md

Co-Authored-By: XAMPPRocky <4464295+XAMPPRocky@users.noreply.github.com>
5 years agowasi: Use shared API for preopened fds
Alex Crichton [Fri, 5 Apr 2019 13:37:03 +0000 (06:37 -0700)]
wasi: Use shared API for preopened fds

This commit updates the wasi target with supported added in
CraneStation/wasi-sysroot#10. That function allows both C and Rust to
cooperate in how preopened files are managed, enabling us to learn about
propened files through the same interface. The `open_parent` function in
the wasi `fs` module was updated to avoid its own initialization of a
global preopened map and instead delegate to libc to perform this
functionality.

This should both be more robust into the future in terms of handling
path logic as well as ensuring the propened map is correctly set up at
process boot time. This does currently require some unfortunate
allocations on our side, but if that becomes an issue we can always
paper over those in time!

5 years agoAdd missing tryfrom example
Guillaume Gomez [Fri, 29 Mar 2019 22:22:11 +0000 (23:22 +0100)]
Add missing tryfrom example

5 years agorustc: Start implementing compat with LLVM 9
Alex Crichton [Thu, 4 Apr 2019 20:05:41 +0000 (13:05 -0700)]
rustc: Start implementing compat with LLVM 9

This commit doesn't actually migrate to LLVM 9, but it brings our own
C++ bindings in line with LLVM 9 and able to compile against tip of
tree. The changes made were:

* The `MainSubprogram` flag for debuginfo moved between flag types.
* Iteration of archive members was tweaked slightly and we have to
  construct the two iterators before constructing the returned
  `RustArchiveIterator` value.
* The `getOrInsertFunction` binding now returns a wrapper which we use
  `getCallee()` on to get the value we're interested in.

5 years agoAuto merge of #59076 - dtolnay:comma, r=alexcrichton
bors [Fri, 5 Apr 2019 15:01:07 +0000 (15:01 +0000)]
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,
}
```

5 years agoInclude trailing comma in multiline Debug representation
David Tolnay [Wed, 3 Apr 2019 14:30:08 +0000 (07:30 -0700)]
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,
    }

5 years agoAuto merge of #59721 - Centril:rollup-ieam9ke, r=Centril
bors [Fri, 5 Apr 2019 12:13:52 +0000 (12:13 +0000)]
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

5 years agoRemove no_force from coherent_trait
John Kåre Alsaker [Fri, 5 Apr 2019 11:25:24 +0000 (13:25 +0200)]
Remove no_force from coherent_trait

5 years agoRollup merge of #59712 - alexcrichton:wasm-static-not-pic, r=eddyb
Mazdak Farrokhzad [Fri, 5 Apr 2019 10:46:53 +0000 (12:46 +0200)]
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.

5 years agoRollup merge of #59702 - hgallagher1993:origin, r=Centril
Mazdak Farrokhzad [Fri, 5 Apr 2019 10:46:52 +0000 (12:46 +0200)]
Rollup merge of #59702 - hgallagher1993:origin, r=Centril

Use declare_lint_pass! and impl_lint_pass! in more places

Fixes #59683

5 years agoRollup merge of #59690 - xfix:patch-17, r=cramertj
Mazdak Farrokhzad [Fri, 5 Apr 2019 10:46:51 +0000 (12:46 +0200)]
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.

5 years agoRollup merge of #59687 - matklad:shebang, r=petrochenkov
Mazdak Farrokhzad [Fri, 5 Apr 2019 10:46:49 +0000 (12:46 +0200)]
Rollup merge of #59687 - matklad:shebang, r=petrochenkov

cleanup shebang handling in the lexer

5 years agoRollup merge of #59665 - ssomers:hashset_revisited, r=KodrAus
Mazdak Farrokhzad [Fri, 5 Apr 2019 10:46:48 +0000 (12:46 +0200)]
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

5 years agoAdd regression test for #59137.
Michael Woerister [Fri, 5 Apr 2019 09:32:45 +0000 (11:32 +0200)]
Add regression test for #59137.

5 years agoAuto merge of #59681 - dtolnay:cargo, r=alexcrichton
bors [Fri, 5 Apr 2019 09:30:13 +0000 (09:30 +0000)]
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.

5 years agoFix expectations on some ui test in nll compare mode.
Charles Lew [Fri, 5 Apr 2019 04:06:29 +0000 (12:06 +0800)]
Fix expectations on some ui test in nll compare mode.

5 years agoAuto merge of #59643 - alexcrichton:wasi-symbols, r=sanxiyn
bors [Fri, 5 Apr 2019 05:16:45 +0000 (05:16 +0000)]
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.

5 years agoAuto merge of #59704 - alexcrichton:fix-freebsd, r=pietroalbini
bors [Fri, 5 Apr 2019 02:32:20 +0000 (02:32 +0000)]
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

5 years agowasm32: Default to a "static" relocation model
Alex Crichton [Thu, 4 Apr 2019 20:23:42 +0000 (13:23 -0700)]
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.

5 years agoci: Update FreeBSD tarball downloads
Alex Crichton [Thu, 4 Apr 2019 18:40:21 +0000 (11:40 -0700)]
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

5 years agoAdd ignore to doc code
Masaki Hara [Mon, 11 Feb 2019 07:32:42 +0000 (16:32 +0900)]
Add ignore to doc code

5 years agoSimplify fnbox docs.
Masaki Hara [Mon, 11 Feb 2019 02:09:41 +0000 (11:09 +0900)]
Simplify fnbox docs.

5 years agoStabilize boxed_closure_impls in 1.35.0.
Charles Lew [Mon, 11 Feb 2019 02:09:26 +0000 (11:09 +0900)]
Stabilize boxed_closure_impls in 1.35.0.

5 years agoRemove FnBox specialization of impl FnOnce for Box<impl FnOnce>.
Masaki Hara [Mon, 11 Feb 2019 01:34:24 +0000 (10:34 +0900)]
Remove FnBox specialization of impl FnOnce for Box<impl FnOnce>.

5 years agoWe already have unsized_locals in stage0.
Masaki Hara [Sun, 10 Feb 2019 10:25:56 +0000 (19:25 +0900)]
We already have unsized_locals in stage0.

5 years agoFix failing tests.
Masaki Hara [Sun, 3 Feb 2019 13:08:34 +0000 (22:08 +0900)]
Fix failing tests.

5 years agoFix expectations on some ui tests involving FnOnce.
Masaki Hara [Sun, 28 Oct 2018 08:53:43 +0000 (17:53 +0900)]
Fix expectations on some ui tests involving FnOnce.

5 years agoAdd unstable-book articles on fnbox and boxed_closure_impls.
Masaki Hara [Sun, 28 Oct 2018 06:36:58 +0000 (15:36 +0900)]
Add unstable-book articles on fnbox and boxed_closure_impls.

5 years agoAdd tests for boxed_closure_impls.
Masaki Hara [Sun, 28 Oct 2018 06:28:47 +0000 (15:28 +0900)]
Add tests for boxed_closure_impls.

5 years agoAdd Fn* blanket impls for Box.
Masaki Hara [Sun, 28 Oct 2018 06:28:15 +0000 (15:28 +0900)]
Add Fn* blanket impls for Box.

5 years agoMake FnBox a subtrait of FnOnce.
Masaki Hara [Sun, 28 Oct 2018 06:27:29 +0000 (15:27 +0900)]
Make FnBox a subtrait of FnOnce.

5 years agostd: Upgrade `compiler_builtins` to fix wasi linkage
Alex Crichton [Tue, 2 Apr 2019 20:38:51 +0000 (13:38 -0700)]
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.

5 years agoAuto merge of #59676 - alexcrichton:osx-deadlock, r=sfackler
bors [Thu, 4 Apr 2019 18:22:34 +0000 (18:22 +0000)]
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

5 years agoUpdate cargo
David Tolnay [Thu, 4 Apr 2019 17:39:23 +0000 (10:39 -0700)]
Update cargo

5 years agoUse declare_lint_pass! and impl_lint_pass! in more places
hgallagher1993 [Thu, 4 Apr 2019 17:23:11 +0000 (13:23 -0400)]
Use declare_lint_pass! and impl_lint_pass! in more places

5 years agoAuto merge of #59695 - Centril:rollup-88qffc2, r=Centril
bors [Thu, 4 Apr 2019 15:36:17 +0000 (15:36 +0000)]
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

5 years agostd: Avoid usage of `Once` in `Instant`
Alex Crichton [Wed, 3 Apr 2019 19:18:38 +0000 (12:18 -0700)]
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

5 years agoRollup merge of #59686 - crlf0710:disable_gnux32_stackprobe, r=luqmana
Mazdak Farrokhzad [Thu, 4 Apr 2019 13:09:08 +0000 (15:09 +0200)]
Rollup merge of #59686 - crlf0710:disable_gnux32_stackprobe, r=luqmana

Temporarily disable stack probing for gnux32.

5 years agoRollup merge of #59685 - lzutao:patch-1, r=GuillaumeGomez
Mazdak Farrokhzad [Thu, 4 Apr 2019 13:09:07 +0000 (15:09 +0200)]
Rollup merge of #59685 - lzutao:patch-1, r=GuillaumeGomez

Add description for -Os and -Oz in rustc.1

5 years agoRollup merge of #59671 - matklad:lexer, r=eddyb
Mazdak Farrokhzad [Thu, 4 Apr 2019 13:09:06 +0000 (15:09 +0200)]
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.

5 years agoRollup merge of #59639 - cuviper:ignore-uninhabited, r=eddyb
Mazdak Farrokhzad [Thu, 4 Apr 2019 13:09:04 +0000 (15:09 +0200)]
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

5 years agoRollup merge of #59596 - LukasKalbertodt:fix-range-fmt, r=Kimundi
Mazdak Farrokhzad [Thu, 4 Apr 2019 13:09:03 +0000 (15:09 +0200)]
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?

5 years agoRollup merge of #59556 - RalfJung:stdsimd, r=gnzlbg
Mazdak Farrokhzad [Thu, 4 Apr 2019 13:09:02 +0000 (15:09 +0200)]
Rollup merge of #59556 - RalfJung:stdsimd, r=gnzlbg

update stdsimd

Cc @gnzlbg

5 years agoRollup merge of #59555 - RalfJung:miri, r=oli-obk
Mazdak Farrokhzad [Thu, 4 Apr 2019 13:09:00 +0000 (15:09 +0200)]
Rollup merge of #59555 - RalfJung:miri, r=oli-obk

update miri

r? @oli-obk

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

5 years agoRollup merge of #59470 - czipperz:document-fs-file-close, r=dtolnay
Mazdak Farrokhzad [Thu, 4 Apr 2019 13:08:59 +0000 (15:08 +0200)]
Rollup merge of #59470 - czipperz:document-fs-file-close, r=dtolnay

Document std::fs::File close behavior ignoring errors

Resolves #52685

5 years agoRemove invalid assertion back::link::from add_upstream_rust_crates().
Michael Woerister [Thu, 4 Apr 2019 13:04:37 +0000 (15:04 +0200)]
Remove invalid assertion back::link::from add_upstream_rust_crates().

5 years agoAuto merge of #59619 - alexcrichton:wasi-fs, r=fitzgen
bors [Thu, 4 Apr 2019 12:46:20 +0000 (12:46 +0000)]
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!

5 years agocleanup shebang handling in the lexer
Aleksey Kladov [Thu, 4 Apr 2019 07:55:30 +0000 (10:55 +0300)]
cleanup shebang handling in the lexer

5 years agoMark unix::ffi::OsStrExt methods as inline
Konrad Borowski [Thu, 4 Apr 2019 08:51:18 +0000 (10:51 +0200)]
Mark unix::ffi::OsStrExt methods as inline

5 years agoAuto merge of #59517 - Zoxc:new-queries, r=oli-obk
bors [Thu, 4 Apr 2019 08:26:18 +0000 (08:26 +0000)]
Auto merge of #59517 - Zoxc:new-queries, r=oli-obk

Move query definitions over to the proc macro

r? @oli-obk

5 years agoDisable stack probing for gnux32.
CrLF0710 [Thu, 4 Apr 2019 06:15:51 +0000 (14:15 +0800)]
Disable stack probing for gnux32.

5 years agoAuto merge of #59089 - petrhosek:llvm-unwind, r=petrhosek
bors [Thu, 4 Apr 2019 05:24:54 +0000 (05:24 +0000)]
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.

5 years agoAdd description for -Os and -Oz in rustc.1
lzutao [Thu, 4 Apr 2019 05:20:53 +0000 (12:20 +0700)]
Add description for -Os and -Oz in rustc.1

5 years agoFile: Add documentation about dropping to sync_all
Chris Gregory [Thu, 4 Apr 2019 03:21:10 +0000 (23:21 -0400)]
File: Add documentation about dropping to sync_all

5 years agoAuto merge of #59684 - Centril:rollup-n7pnare, r=Centril
bors [Thu, 4 Apr 2019 02:31:46 +0000 (02:31 +0000)]
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

5 years agoRollup merge of #59677 - phansch:rustfix_coverage_handle_other_error_formats, r=oli-obk
Mazdak Farrokhzad [Wed, 3 Apr 2019 23:49:13 +0000 (01:49 +0200)]
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

5 years agoRollup merge of #59669 - Centril:lint-pass-macro, r=oli-obk
Mazdak Farrokhzad [Wed, 3 Apr 2019 23:49:12 +0000 (01:49 +0200)]
Rollup merge of #59669 - Centril:lint-pass-macro, r=oli-obk

Reduce repetition in librustc(_lint) wrt. impl LintPass by using macros

r? @oli-obk
cc @Zoxc

5 years agoRollup merge of #59666 - DevQps:update-rustc-environment-descriptions, r=GuillaumeGomez
Mazdak Farrokhzad [Wed, 3 Apr 2019 23:49:11 +0000 (01:49 +0200)]
Rollup merge of #59666 - DevQps:update-rustc-environment-descriptions, r=GuillaumeGomez

Updated the environment description in rustc.

# Description

- Updated the "environment" description in the `rustc` man pages

The old wording suggested that all the mentioned flags influenced the output of the compiler,
where this was not the case.

closes #59504

5 years agoRollup merge of #59664 - DevQps:improve-yield-spinlock-docs, r=alexcrichton
Mazdak Farrokhzad [Wed, 3 Apr 2019 23:49:09 +0000 (01:49 +0200)]
Rollup merge of #59664 - DevQps:improve-yield-spinlock-docs, r=alexcrichton

Updated the documentation of spin_loop and spin_loop_hint

# Description

- Updated the description of `core::hints::spin_loop`
- Updated the description of `core::async::spin_loop_hint`

Both documentation is rewritten to better reflect when one should prefer using a busy-wait spin-loop (and the `spin_loop` and `spin_loop_hint` functions) over `yield_now`. It also dives a little bit deeper on what the function actually does.

closes #55418

5 years agoRollup merge of #59663 - matklad:borrow, r=dtolnay
Mazdak Farrokhzad [Wed, 3 Apr 2019 23:49:08 +0000 (01:49 +0200)]
Rollup merge of #59663 - matklad:borrow, r=dtolnay

Be more direct about borrow contract

I always was confused by the difference between Borrow and AsRef, despite the fact that I've read all available docs at least a dozen of times.

I finally grokked the difference between the two when I realized the Borrow invariant:

> If you implement Borrow, you **must** make sure that Eq, Ord and Hash implementations are equivalent for borrowed and owned data

My problem was that this invariant is not stated explicitly in documentation, and instead some  vague and philosophical notions are used.

So I suggest to mention the requirements of `Borrow` very explicitly: instead of "use Borrow when X and use AsRef when Y", let's phrase this as `Borrow` differs from `AsRef` in `W`, so that's why `Borrow` is for `X` and `AsRef` is for `Y`.

Note that this change could be seen as tightening contract of the Borrow. Let's say Alice has written the following code:

```rust
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)]
struct Person {
    first_name: String,
    last_name: String,
}

impl Borrow<str> for Person {
      fn borrow(&self) -> &str { self.first_name.as_str() }
}
```

Now Bob uses this `Person` struct, puts it into `HashMap` and tries to look it up using `&str` for the first name. Bob's code naturally fails.

The question is, who is to blame: Alice, who has written the impl, or Bob, who uses the HashMap. If I read the current docs literally, I would say that `Bob` is to blame: `Eq` and `Hash` bounds appear on HashMap, so it is the HashMap which requires that they are consistent. By using a type for which the `Borrow` impl does not yield well-behaved `Eq`, Bob is violating contract of HashMap.

If, as this PR proposes, we unconditionally require that Eq & friends for borrow should be valid, then the blame shifts to Alice, which I think is more reasonable.

closes https://github.com/rust-lang/rust/issues/44868

5 years agoRollup merge of #59316 - flip1995:internal_lints_take_2, r=oli-obk
Mazdak Farrokhzad [Wed, 3 Apr 2019 23:49:07 +0000 (01:49 +0200)]
Rollup merge of #59316 - flip1995:internal_lints_take_2, r=oli-obk

Internal lints take 2

cc #58701
cc #49509

TODO: Add `#![warn(internal)]` to crates (and fix violations)

Crates depending on `rustc_data_structures`

- [x] librustc_resolve
- [x] librustc_driver
- [x] librustc_passes
- [x] librustc_metadata
- [x] librustc_interface
- [x] librustc_save_analysis
- [x] librustc_lint
- [x] librustc
- [x] librustc_incremental
- [x] librustc_codegen_utils
- [x] libarena
- [x] librustc_target
- [x] librustc_allocator
- [x] librustc_privacy
- [x] librustc_traits
- [x] librustc_borrowck
- [x] libsyntax
- [x] librustc_codegen_ssa
- [x] libsyntax_ext
- [x] librustc_errors
- [x] librustc_mir
- [x] libsyntax_pos
- [x] librustc_typeck

Crates with `feature(rustc_private)`
Excluding crates, which are already in the list above. Also excluding tools and tests.

- [ ] ~~libstd~~
- [x] libfmt_macros
- [x] librustdoc

r? @oli-obk

5 years agoAuto merge of #59672 - o01eg:fix-59661, r=oli-obk
bors [Wed, 3 Apr 2019 23:42:23 +0000 (23:42 +0000)]
Auto merge of #59672 - o01eg:fix-59661, r=oli-obk

Revert rust-lld place changes

Fixes #59661.

Instead of https://github.com/rust-lang/rust/pull/59668 it reverts only failed part.

5 years agoNever return uninhabited values at all
Josh Stone [Wed, 3 Apr 2019 22:44:49 +0000 (15:44 -0700)]
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.

5 years agoreduce repetition in librustc(_lint) wrt. impl LintPass
Mazdak Farrokhzad [Wed, 3 Apr 2019 14:05:40 +0000 (16:05 +0200)]
reduce repetition in librustc(_lint) wrt. impl LintPass

5 years agoUpdate cargo
David Tolnay [Wed, 3 Apr 2019 21:10:58 +0000 (14:10 -0700)]
Update cargo

5 years agoAdd test from #59033
Guillaume Gomez [Wed, 3 Apr 2019 20:18:41 +0000 (22:18 +0200)]
Add test from #59033

5 years agoFix explicit_predicates_of
Guillaume Gomez [Wed, 3 Apr 2019 20:13:12 +0000 (22:13 +0200)]
Fix explicit_predicates_of

5 years agorustfix coverage: Skip UI tests with non-json error-format
Philipp Hansch [Wed, 3 Apr 2019 19:30:57 +0000 (21:30 +0200)]
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.

5 years agoSupport using LLVM's libunwind as the unwinder implementation
Petr Hosek [Mon, 11 Mar 2019 02:27:59 +0000 (19:27 -0700)]
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.

5 years agoCompare `Ty`s directly instead of their `TyKind`s
flip1995 [Wed, 3 Apr 2019 14:08:04 +0000 (16:08 +0200)]
Compare `Ty`s directly instead of their `TyKind`s

5 years agoDeny internal lints on two more crates
flip1995 [Wed, 3 Apr 2019 13:53:36 +0000 (15:53 +0200)]
Deny internal lints on two more crates

- libfmt_macros
- librustdoc

5 years agoAdd trait_object_dummy_self to CommonTypes
flip1995 [Wed, 3 Apr 2019 09:46:40 +0000 (11:46 +0200)]
Add trait_object_dummy_self to CommonTypes

5 years agoRemove TyKind arg from report_bin_hex_error function
flip1995 [Tue, 2 Apr 2019 14:57:12 +0000 (16:57 +0200)]
Remove TyKind arg from report_bin_hex_error function

5 years agoDeny internal lints on librustc_typeck
flip1995 [Sun, 31 Mar 2019 22:10:48 +0000 (00:10 +0200)]
Deny internal lints on librustc_typeck

5 years agoDeny internal lints on librustc_mir
flip1995 [Sun, 31 Mar 2019 22:02:46 +0000 (00:02 +0200)]
Deny internal lints on librustc_mir