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

5 years agoDeny internal lints on librustc_lint
flip1995 [Sun, 31 Mar 2019 21:48:48 +0000 (23:48 +0200)]
Deny internal lints on librustc_lint

5 years agoDeny internal lints on librustc_interface
flip1995 [Sun, 31 Mar 2019 21:29:35 +0000 (23:29 +0200)]
Deny internal lints on librustc_interface

5 years agoDeny internal lints on non conflicting crates
flip1995 [Sun, 31 Mar 2019 21:18:22 +0000 (23:18 +0200)]
Deny internal lints on non conflicting crates

- libarena
- librustc_allocator
- librustc_borrowck
- librustc_codegen_ssa
- librustc_codegen_utils
- librustc_driver
- librustc_errors
- librustc_incremental
- librustc_metadata
- librustc_passes
- librustc_privacy
- librustc_resolve
- librustc_save_analysis
- librustc_target
- librustc_traits
- libsyntax
- libsyntax_ext
- libsyntax_pos

5 years agoDeny internal lints in librustc
flip1995 [Sun, 31 Mar 2019 13:01:46 +0000 (15:01 +0200)]
Deny internal lints in librustc

5 years agoAdd unstable-options flag to stage!=0
flip1995 [Sun, 31 Mar 2019 12:57:18 +0000 (14:57 +0200)]
Add unstable-options flag to stage!=0

5 years agoUpdate tests
flip1995 [Thu, 21 Mar 2019 16:10:25 +0000 (17:10 +0100)]
Update tests

5 years agoCheck for unstable-options flag before register internals
flip1995 [Thu, 21 Mar 2019 16:09:04 +0000 (17:09 +0100)]
Check for unstable-options flag before register internals

5 years agoDeduplicate code in TyKind lint
flip1995 [Thu, 21 Mar 2019 16:03:45 +0000 (17:03 +0100)]
Deduplicate code in TyKind lint

5 years agoFix bug in TyKind lint
flip1995 [Tue, 19 Mar 2019 21:46:45 +0000 (22:46 +0100)]
Fix bug in TyKind lint

5 years agoMake internal lints allow-by-default
flip1995 [Sat, 16 Mar 2019 13:59:34 +0000 (14:59 +0100)]
Make internal lints allow-by-default

5 years agouse check_path instead of check_expr
flip1995 [Thu, 28 Feb 2019 16:34:01 +0000 (17:34 +0100)]
use check_path instead of check_expr

5 years agoFix rebase fallout
flip1995 [Sun, 24 Feb 2019 16:54:53 +0000 (17:54 +0100)]
Fix rebase fallout

5 years agoAdd register_internals function to `rustc_lint`
flip1995 [Thu, 6 Dec 2018 13:03:12 +0000 (14:03 +0100)]
Add register_internals function to `rustc_lint`

5 years agoUplift match_def_path from Clippy
flip1995 [Thu, 6 Dec 2018 13:02:21 +0000 (14:02 +0100)]
Uplift match_def_path from Clippy

5 years agoAdd internal lints default_hash_types and usage_of_ty_tykind
flip1995 [Thu, 6 Dec 2018 12:50:04 +0000 (13:50 +0100)]
Add internal lints default_hash_types and usage_of_ty_tykind

5 years agoAdd tests for internal lints
flip1995 [Thu, 6 Dec 2018 12:49:26 +0000 (13:49 +0100)]
Add tests for internal lints

5 years agoRevert rust-lld place changes.
O01eg [Wed, 3 Apr 2019 15:55:37 +0000 (18:55 +0300)]
Revert rust-lld place changes.

5 years agomake StringReader methods private
Aleksey Kladov [Wed, 3 Apr 2019 15:33:54 +0000 (18:33 +0300)]
make StringReader methods private

5 years agomake StringReader fields private
Aleksey Kladov [Wed, 3 Apr 2019 15:20:50 +0000 (18:20 +0300)]
make StringReader fields private

5 years agowasi: Fill out `std::fs` module for WASI
Alex Crichton [Fri, 29 Mar 2019 22:57:14 +0000 (15:57 -0700)]
wasi: Fill out `std::fs` module for WASI

This commit fills out the `std::fs` module and implementation for WASI.
Not all APIs are implemented, such as permissions-related ones and
`canonicalize`, but all others APIs have been implemented and very
lightly tested so far. We'll eventually want to run a more exhaustive
test suite!

For now the highlights of this commit are:

* The `std::fs::File` type is now backed by `WasiFd`, a raw WASI file
  descriptor.
* All APIs in `std::fs` (except permissions/canonicalize) have
  implementations for the WASI target.
* A suite of unstable extension traits were added to
  `std::os::wasi::fs`. These traits expose the raw filesystem
  functionality of WASI, namely `*at` syscalls (opening a file relative
  to an already opened one, for example). Additionally metadata only
  available on wasi is exposed through these traits.

Perhaps one of the most notable parts is the implementation of
path-taking APIs. WASI actually has no fundamental API that just takes a
path, but rather everything is relative to a previously opened file
descriptor. To allow existing APIs to work (that only take a path) WASI
has a few syscalls to learn about "pre opened" file descriptors by the
runtime. We use these to build a map of existing directory names to file
descriptors, and then when using a path we try to anchor it at an
already-opened file.

This support is very rudimentary though and is intended to be shared
with C since it's likely to be so tricky. For now though the C library
doesn't expose quite an API for us to use, so we implement it for now
and will swap it out as soon as one is available.

5 years agoAuto merge of #59182 - hug-dev:armv8m-base-hf, r=alexcrichton
bors [Wed, 3 Apr 2019 14:23:13 +0000 (14:23 +0000)]
Auto merge of #59182 - hug-dev:armv8m-base-hf, r=alexcrichton

Add dist builder for Armv8-M Baseline and HF

This commit adds the Armv8-M Baseline and Armv8-M Mainline with
FPU targets in the list of targets that
get their dist components built. It also update the build-manifest
so that this target gets also its dist components uploaded.

Made possible with the recent change merged in `compiler-builtins`:
rust-lang-nursery/compiler-builtins#276

A new `compiler-builtins` might be necessary for successfull compilation of the artefacts of those targets.

5 years agoAdd dist builder for Armv8-M Baseline and HF
Hugues de Valon [Tue, 12 Mar 2019 13:58:05 +0000 (13:58 +0000)]
Add dist builder for Armv8-M Baseline and HF

This commit adds the Armv8-M Baseline and Armv8-M Mainline with
FPU targets in the list of targets that
get their dist components built. It also update the build-manifest
so that this target gets also its dist components uploaded.

5 years agoUpdated the environment description in rustc.
Christian [Wed, 3 Apr 2019 13:50:20 +0000 (15:50 +0200)]
Updated the environment description in rustc.

5 years agoUpdated the reference in core::hint::spin_loop to the correct relative path.
Christian [Wed, 3 Apr 2019 13:47:38 +0000 (15:47 +0200)]
Updated the reference in core::hint::spin_loop to the correct relative path.

5 years agoupdate miri
Ralf Jung [Wed, 3 Apr 2019 13:05:45 +0000 (14:05 +0100)]
update miri

5 years agotry to fix rand feature flags
Ralf Jung [Sun, 31 Mar 2019 14:18:45 +0000 (16:18 +0200)]
try to fix rand feature flags

5 years agoupdate miri
Ralf Jung [Sat, 30 Mar 2019 11:55:20 +0000 (12:55 +0100)]
update miri

5 years agoAuto merge of #58458 - nnethercote:tweak-Span-encoding, r=petrochenkov
bors [Wed, 3 Apr 2019 11:27:38 +0000 (11:27 +0000)]
Auto merge of #58458 - nnethercote:tweak-Span-encoding, r=petrochenkov

Tweak `Span` encoding.

Failing to fit `base` is more common than failing to fit `len`.