Commit graph

91799 commits

Author SHA1 Message Date
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
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
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
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
Mazdak Farrokhzad
eb3215e523
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
2019-04-04 01:49:12 +02:00
Mazdak Farrokhzad
c87cce6fa4
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
2019-04-04 01:49:11 +02:00
Mazdak Farrokhzad
b4686ca958
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
2019-04-04 01:49:09 +02:00
Mazdak Farrokhzad
b78cbe6ddd
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
2019-04-04 01:49:08 +02:00
Mazdak Farrokhzad
dcccab56ba
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
2019-04-04 01:49:07 +02:00
bors
314a79cd80 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.
2019-04-03 23:42:23 +00:00
Mazdak Farrokhzad
fba110c805 reduce repetition in librustc(_lint) wrt. impl LintPass 2019-04-03 23:37:31 +02:00
Philipp Hansch
da99f46711
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.
2019-04-03 21:37:45 +02:00
Petr Hosek
86d1678403 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-03 11:21:40 -07:00
flip1995
c81ce069b4
Compare Tys directly instead of their TyKinds 2019-04-03 19:18:07 +02:00
flip1995
076abfa0f3
Deny internal lints on two more crates
- libfmt_macros
- librustdoc
2019-04-03 19:18:07 +02:00
flip1995
51a792d01b
Add trait_object_dummy_self to CommonTypes 2019-04-03 19:18:07 +02:00
flip1995
dd7483c750
Remove TyKind arg from report_bin_hex_error function 2019-04-03 19:18:07 +02:00
flip1995
4d2a3bb13b
Deny internal lints on librustc_typeck 2019-04-03 19:18:07 +02:00
flip1995
e4b87f5edb
Deny internal lints on librustc_mir 2019-04-03 19:18:07 +02:00
flip1995
d2bc99135f
Deny internal lints on librustc_lint 2019-04-03 18:24:22 +02:00
flip1995
818d300451
Deny internal lints on librustc_interface 2019-04-03 18:24:21 +02:00
flip1995
d3f0cb9b62
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
2019-04-03 18:24:21 +02:00
flip1995
69f74df429
Deny internal lints in librustc 2019-04-03 18:24:21 +02:00
flip1995
dfcd1ef102
Add unstable-options flag to stage!=0 2019-04-03 18:22:19 +02:00
flip1995
2045dfed24
Update tests 2019-04-03 18:22:19 +02:00
flip1995
28a5c414c3
Check for unstable-options flag before register internals 2019-04-03 18:22:19 +02:00
flip1995
e536037af3
Deduplicate code in TyKind lint 2019-04-03 18:22:19 +02:00
flip1995
5a788f0ff7
Fix bug in TyKind lint 2019-04-03 18:22:19 +02:00
flip1995
9b2bf70851
Make internal lints allow-by-default 2019-04-03 18:22:19 +02:00
flip1995
16acf7d618
use check_path instead of check_expr 2019-04-03 18:22:19 +02:00
flip1995
157e7974af
Fix rebase fallout 2019-04-03 18:22:18 +02:00
flip1995
a2a8c44106
Add register_internals function to rustc_lint 2019-04-03 18:22:18 +02:00
flip1995
4c9fb9361a
Uplift match_def_path from Clippy 2019-04-03 18:22:18 +02:00
flip1995
5c0656789d
Add internal lints default_hash_types and usage_of_ty_tykind 2019-04-03 18:22:18 +02:00
flip1995
c796b1f46a
Add tests for internal lints 2019-04-03 18:22:18 +02:00
O01eg
5b292ecdb1
Revert rust-lld place changes. 2019-04-03 18:55:37 +03:00
bors
f8673e0ad8 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.
2019-04-03 14:23:13 +00:00
Hugues de Valon
e83349975b 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.
2019-04-03 15:02:13 +01:00
Christian
7e37b46d20 Updated the environment description in rustc. 2019-04-03 15:50:20 +02:00
Christian
becee90cfd Updated the reference in core::hint::spin_loop to the correct relative path. 2019-04-03 15:47:38 +02:00
bors
0ba7d41b83 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`.
2019-04-03 11:27:38 +00:00
Christian
ab3b657373 Updated the documentation of core::hints::spin_loop and core::sync::spin_loop_hint 2019-04-03 10:54:07 +02:00
Aleksey Kladov
1cfed0d452 be more direct about borrow requirenments 2019-04-03 11:41:24 +03:00
bors
546cb21f58 Auto merge of #59657 - Centril:rollup-w5p98mc, r=Centril
Rollup of 4 pull requests

Successful merges:

 - #55448 (Add 'partition_at_index/_by/_by_key' for slices.)
 - #59186 (improve worst-case performance of BTreeSet intersection v3)
 - #59514 (Remove adt_def from projections and downcasts in MIR)
 - #59630 (Shrink `mir::Statement`.)

Failed merges:

r? @ghost
2019-04-03 05:30:20 +00:00
Mazdak Farrokhzad
d31d80b7d4
Rollup merge of #59630 - nnethercote:shrink-mir-Statement, r=pnkfelix
Shrink `mir::Statement`.

The `InlineAsm` variant is extremely rare, and `mir::Statement` often
contributes significantly to peak memory usage.
2019-04-03 04:36:14 +02:00
Mazdak Farrokhzad
a96e3883c1
Rollup merge of #59514 - tmandry:remove-adt-def-from-projection-elem, r=eddyb
Remove adt_def from projections and downcasts in MIR

As part of optimizing generator layouts in MIR, we'd like to allow downcasting generators to variants which do not have a corresponding `def_id`, since they are created by the compiler.

This refactor hopes to allow that, without regressing perf.

r? @eddyb
2019-04-03 04:36:12 +02:00
Mazdak Farrokhzad
9898182b47
Rollup merge of #59186 - ssomers:btreeset_intersection_revisited_again, r=KodrAus
improve worst-case performance of BTreeSet intersection v3

Variation of [#59078](https://github.com/rust-lang/rust/pull/59078) with `Intersection` remaining a struct

r? @scottmcm
2019-04-03 04:36:11 +02:00
Mazdak Farrokhzad
2f37c5a358
Rollup merge of #55448 - Mokosha:SortAtIndex, r=bluss
Add 'partition_at_index/_by/_by_key' for slices.

This is an analog to C++'s std::nth_element (a.k.a. quickselect).

Corresponds to tracking bug #55300.
2019-04-03 04:36:09 +02:00