Commit Graph

81456 Commits

Author SHA1 Message Date
Pietro Albini
f52ef3b839
Rollup merge of #52835 - GuillaumeGomez:ice-rustdoc-links, r=eddyb
Fix Alias intra doc ICE

Fixes #52611.

cc @QuietMisdreavus

r? @varkor
2018-08-01 21:46:27 +02:00
Pietro Albini
d5fcd27eb9
Rollup merge of #52834 - matthewjasper:allow-zst-conflicts, r=pnkfelix
[NLL] Allow conflicting borrows of promoted length zero arrays

This is currently overkill as there's no way to create two conflicting borrows of any promoted.
It is possible that the following code might not fail due to const eval in the future (@oli-obk?). In which case either the array marked needs to not be promoted, or to be checked for conflicts

```rust
static mut A: () = {
    let mut y = None;
    let z;
    let mut done_y = false;
    loop {
        let x = &mut [1];  // < this array
        if done_y {
            z = x;
            break;
        }
        y = Some(x);
        done_y = true;
    }
    some_const_fn(y, z); // some_const_fn expects that y to not alias z.
};
```

r? @pnkfelix  @nikomatsakis

closes #52671
cc #51823
2018-08-01 21:46:26 +02:00
Pietro Albini
4d1ddfe983
Rollup merge of #52809 - davidtwco:issue-49579, r=pnkfelix
Add test for unexpected region for local data ReStatic

Fixes #49579.

r? @pnkfelix @nikomatsakis
2018-08-01 21:46:25 +02:00
Pietro Albini
42243f82f4
Rollup merge of #52799 - Mark-Simulacrum:attr-id-bitvecs, r=michaelwoerister
Use BitVector for global sets of AttrId
2018-08-01 21:46:23 +02:00
Pietro Albini
334da29e98
Rollup merge of #52793 - davidtwco:issue-49824, r=pnkfelix
Add test for NLL: unexpected "free region `` does not outlive" error

Fixes #49824.

r? @pnkfelix @nikomatsakis
2018-08-01 21:46:22 +02:00
David Wood
8bbf0422d4
Added test for #49824. 2018-08-01 17:30:01 +02:00
Mark Rousskov
9bc4fbb10a Split out growth functionality into BitVector type 2018-08-01 06:50:40 -06:00
Mark Rousskov
1d64b241cd Switch syntax attribute tracking to BitVector 2018-08-01 06:48:42 -06:00
bors
11f812aa7d Auto merge of #52474 - alexcrichton:better-lto-error, r=eddyb
rustc: Handle linker diagnostics from LLVM

Previously linker diagnostic were being hidden when two modules were linked
together but failed to link. This commit fixes the situation by ensuring that we
have a diagnostic handler installed and also adds support for handling linker
diagnostics.
2018-08-01 11:38:20 +00:00
bors
8c069ceba8 Auto merge of #52937 - pietroalbini:rollup, r=pietroalbini
Rollup of 30 pull requests

Successful merges:

 - #52340 (Document From trait implementations for OsStr, OsString, CString, and CStr)
 - #52628 (Cleanup some rustdoc code)
 - #52732 (Remove unstable and deprecated APIs)
 - #52745 (Update clippy to latest master)
 - #52771 (Clarify thread::park semantics)
 - #52778 (Improve readability of serialize.rs)
 - #52810 ([NLL] Don't make "fake" match variables mutable)
 - #52821 (pretty print for std::collections::vecdeque)
 - #52822 (Fix From<LocalWaker>)
 - #52824 (Fix -Wpessimizing-move warnings in rustllvm/PassWrapper)
 - #52825 (Make sure #47772 does not regress)
 - #52831 (remove references to AUTHORS.txt file)
 - #52842 (update comment)
 - #52846 (Add timeout to use of `curl` in bootstrap.py.)
 - #52851 (Make the tool_lints actually usable)
 - #52853 (Improve bootstrap help on stages)
 - #52859 (Use Vec::extend in SmallVec::extend when applicable)
 - #52861 (Add targets for HermitCore (https://hermitcore.org) to the Rust compiler and port libstd to it.)
 - #52867 (releases.md: fix 2 typos)
 - #52870 (Implement Unpin for FutureObj and LocalFutureObj)
 - #52876 (run-pass/const-endianness: negate before to_le())
 - #52878 (Fix wrong issue number in the test name)
 - #52883 (Include lifetime in mutability suggestion in NLL messages)
 - #52888 (Use suggestions for shell format arguments)
 - #52904 (NLL: sort diagnostics by span)
 - #52905 (Fix a typo in unsize.rs)
 - #52907 (NLL: On "cannot move out of type" error, print original before rewrite)
 - #52914 (Only run the sparc-abi test on sparc)
 - #52918 (Backport 1.27.2 release notes)
 - #52929 (Update compatibility note for 1.28.0 to be correct)

Failed merges:

r? @ghost
2018-08-01 08:41:36 +00:00
Pietro Albini
850b613b60
Rollup merge of #52929 - Havvy:patch-1, r=alexcrichton
Update compatibility note for 1.28.0 to be correct

You can still put implementations on `dyn Trait + Send + Send`, but it'd be the same as putting them on `dyn Trait + Send`. This is why the error is that there are duplicate definitions in the example.
2018-08-01 10:13:10 +02:00
Pietro Albini
7759199b3f
Rollup merge of #52918 - pietroalbini:1.27.2-notes, r=Mark-Simulacrum
Backport 1.27.2 release notes

r? @Mark-Simulacrum
2018-08-01 10:13:08 +02:00
Pietro Albini
52b52f3d1a
Rollup merge of #52914 - nagisa:sparc-is-sparc’s-own-business, r=alexcrichton
Only run the sparc-abi test on sparc

It is not required for LLVM to have SPARC target support, so it is
necessary to only run this test when LLVM does support SPARC. Sadly, it
isn’t possible to specify exactly this constraint. Instead, we specify
that this test should run on SPARC host only (it surely is sane
assumption to make that compiler running on a SPARC can generate
SPARC, right?)

Since you cannot specify multiple `only-*` to have it run on both 32-bit
and 64-bit SPARC we pick 64-bit SPARC, because it is exactly what is
being tested by this test.

Fixes #52881
2018-08-01 10:13:07 +02:00
Pietro Albini
14546cd501
Rollup merge of #52907 - pnkfelix:issue-52877-original-source-should-precede-suggestions, r=petrochenkov
NLL: On "cannot move out of type" error, print original before rewrite

NLL: On "cannot move out of type" error, print original source before rewrite.

 * Arguably this change is sometimes injecting noise into the output  (namely in the cases where the suggested rewrite is inline with the   suggestion and we end up highlighting the original source code).   I would not be opposed to something more aggressive/dynamic, like   revising the suggestion code to automatically print the original  source when necessary (e.g. when the error does not have a span   that includes the span of the suggestion).

 * Also, as another note on this change: The doc comment for `Diagnostic::span_suggestion`  says:
```rust
    /// The message
    ///
    /// * should not end in any punctuation (a `:` is added automatically)
    /// * should not be a question
    /// * should not contain any parts like "the following", "as shown"
```
  *  but the `:` is *not* added when the emitted line appears  out-of-line relative to the suggestion. I find that to be an  unfortunate UI experience.

----

As a drive-by fix, also changed code to combine multiple suggestions for a pattern into a single multipart suggestion (which vastly improves user experience IMO).

----

Includes the updates to expected NLL diagnostics.

Fix #52877
2018-08-01 10:13:06 +02:00
Pietro Albini
ac2b3c3712
Rollup merge of #52905 - pravic:unsize-typo, r=alexcrichton
Fix a typo in unsize.rs

RfC -> RFC
2018-08-01 10:13:05 +02:00
Pietro Albini
2d29c44a5e
Rollup merge of #52904 - pnkfelix:issue-51167-sort-by-span, r=petrochenkov
NLL: sort diagnostics by span

Sorting the output diagnostics by span is a long planned revision to the NLL diagnostics that we hope will yield a less surprising user experience in some case.

Once we got them buffered, it was trivial to implement. (The hard part is skimming the resulting changes to the diagnostics to make sure nothing broke... Note that I largely rubber-stamped the `#[rustc_regions]` output change.)

Fix #51167
2018-08-01 10:13:04 +02:00
Pietro Albini
a8ed6033a6
Rollup merge of #52888 - estebank:shell-sugg, r=oli-obk
Use suggestions for shell format arguments

Follow up to #52649.
2018-08-01 10:13:02 +02:00
Pietro Albini
312f18c2ea
Rollup merge of #52883 - estebank:nll-diag-mut, r=oli-obk
Include lifetime in mutability suggestion in NLL messages

Fix #52880.
2018-08-01 10:13:01 +02:00
Pietro Albini
9443dd519d
Rollup merge of #52878 - mikhail-m1:master, r=kennytm
Fix wrong issue number in the test name

I made a mistake in previous PR #52620, second issue number was wrong, changing from #52133 to #52113

r? @kennytm
2018-08-01 10:13:00 +02:00
Pietro Albini
b3d6050358
Rollup merge of #52876 - cuviper:const-endianness-be, r=kennytm
run-pass/const-endianness: negate before to_le()

`const LE_I128` needs parentheses to negate the value *before* calling
`to_le()`, otherwise it doesn't match the operations performed in the
black-boxed part of the test.  This only makes a tangible difference on
big-endian targets.
2018-08-01 10:12:58 +02:00
Pietro Albini
341f882462
Rollup merge of #52870 - cramertj:unpin-futureobj, r=aturon
Implement Unpin for FutureObj and LocalFutureObj

cc @MajorBreakfast

r? @aturon
2018-08-01 10:12:57 +02:00
Pietro Albini
51e744bdd6
Rollup merge of #52867 - matthiaskrgr:release_typos, r=Mark-Simulacrum
releases.md: fix 2 typos
2018-08-01 10:12:56 +02:00
Pietro Albini
f47a76477d
Rollup merge of #52861 - ColinFinck:master, r=alexcrichton
Add targets for HermitCore (https://hermitcore.org) to the Rust compiler and port libstd to it.

As a start, the port uses the simplest possible configuration (no jemalloc, abort on panic) and makes use of existing Unix-specific code wherever possible.
It adds targets for x86_64 (current main HermitCore platform) and aarch64 (HermitCore platform under development).

Together with the patches to "liblibc" (https://github.com/rust-lang/libc/pull/1048) and llvm (https://github.com/rust-lang/llvm/pull/122), this enables HermitCore applications to be written in Rust.
2018-08-01 10:12:55 +02:00
Pietro Albini
eb71c3589a
Rollup merge of #52859 - ljedrz:smallvec_true_extend, r=Mark-Simulacrum
Use Vec::extend in SmallVec::extend when applicable

As calculated in #52738, `Vec::extend` is much faster than `push`ing to it in a loop. We can take advantage of this method in `SmallVec` too - at least in cases when its underlying object is an `AccumulateVec::Heap`.

~~This approach also accidentally improves the `push` loop of the `AccumulateVec::Array` variant, because it doesn't utilize `SmallVec::push` which performs `self.reserve(1)` with every iteration; this is unnecessary, because we're already reserving the whole space we will be needing by performing `self.reserve(iter.size_hint().0)` at the beginning.~~
2018-08-01 10:12:54 +02:00
Pietro Albini
6767886238
Rollup merge of #52853 - RalfJung:bootstrap-help, r=alexcrichton
Improve bootstrap help on stages

Cc @eddyb
2018-08-01 10:12:52 +02:00
Pietro Albini
5fb7c65f54
Rollup merge of #52851 - flip1995:tool_lints, r=oli-obk
Make the tool_lints actually usable

cc #44690

Necessary for rust-lang-nursery/rust-clippy#2955 and rust-lang-nursery/rust-clippy#2977

This PR makes it possible for lint tools (at the moment only for Clippy) to implement the `tool_lints`, like it was documented in #52018.

Because the `declare_lint` macro is pretty cluttered right now, there was not really a good way to add the `tool_name` as an additional argument of the macro. That's why I chose to introduce the new `declare_tool_lint` macro.

The switch from `&str` to `String` in the `lint_groups` `FxHashMap` is because I got weird error messages in the `check_lint_name` method. And the `by_name` field of the `LintStore` also uses `String`.

### What comes with this PR:

If this PR lands and Clippy switches to the `tool_lints`, the currently used methods
```rust
#[cfg_attr(feature = "cargo-clippy", allow(clippy_lint))]
#[allow(unknown_lints, clippy_lint)]
```
to `allow`/`warn`/`deny`/`forbid` Clippy lints, won't have any effects anymore, but also won't produce a warning. That is because the name of `clippy_lint` will then be `clippy::clippy_lint`. (Maybe we can add a clippy lint to search for `cfg_attr` appearances with the `cargo-clippy` feature?)

r? @oli-obk
2018-08-01 10:12:51 +02:00
Pietro Albini
c9aca0343f
Rollup merge of #52846 - kennytm:bootstrap-curl-timeout, r=Mark-Simulacrum
Add timeout to use of `curl` in bootstrap.py.

Recently we've seen a lot of "30 minutes no output" spurious errors while downloading the bootstrap compiler. This added several timeout options so if the "30 minutes no output" errors were caused by connection or transfer issue, we could fail quicker for curl to retry.
2018-08-01 10:12:50 +02:00
Pietro Albini
a819a6ce38
Rollup merge of #52842 - toidiu:ak-commentUpdate, r=estebank
update comment

r? @joshtriplett

Addressing comment: https://github.com/rust-lang/rust/pull/52761#pullrequestreview-141323066
2018-08-01 10:12:48 +02:00
Pietro Albini
8b31f00401
Rollup merge of #52831 - dsciarra:rm-ref-to-author-file, r=alexcrichton
remove references to AUTHORS.txt file

Rust does not ship an AUTHORS.txt file anymore.
2018-08-01 10:12:47 +02:00
Pietro Albini
fe4358a34f
Rollup merge of #52825 - RalfJung:codegen, r=alexcrichton
Make sure #47772 does not regress

Mostly to make my life in https://github.com/rust-lang/rust/pull/52206 harder.^^

Or should I just add that test there?
2018-08-01 10:12:46 +02:00
Pietro Albini
61b9a516d3
Rollup merge of #52824 - varkor:fix-llvm-ret-move-warnings, r=rkruppe
Fix -Wpessimizing-move warnings in rustllvm/PassWrapper

These are producing warnings when building rustc (`warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]`).
2018-08-01 10:12:45 +02:00
Pietro Albini
9e43ebda53
Rollup merge of #52822 - MajorBreakfast:fix-from-local-waker, r=cramertj
Fix From<LocalWaker>

This is a follow-up to https://github.com/rust-lang/rust/pull/52640

Fixes `From<LocalWaker>` which is affected by the same accidental drop bug (unless I'm totally mistaken)

r? @cramertj
2018-08-01 10:12:44 +02:00
Pietro Albini
39406ee241
Rollup merge of #52821 - fukatani:gdb-vecdeque-print, r=michaelwoerister
pretty print for std::collections::vecdeque

I want pretty print function for VecDeque like Vec.

```rust
use std::collections::VecDeque;

fn main() {
    let mut d: VecDeque<i32> = VecDeque::new();
    d.push_back(4);
    d.push_back(4);
    d.push_back(6);
    let mut v: Vec<i32> = Vec::new();
    v.push(4);
    v.push(4);
    v.push(6);
}
```

```
(gdb) p v
$1 = Vec<i32>(len: 3, cap: 4) = {4, 4, 6}
(gdb) p d
$2 = VecDeque<i32>(len: 3, cap: 8) = {4, 4, 6}
```

Thanks.
2018-08-01 10:12:42 +02:00
Pietro Albini
333d8c456c
Rollup merge of #52810 - matthewjasper:more-immutablity, r=pnkfelix
[NLL] Don't make "fake" match variables mutable

These variables can't be mutated by the user, but since they have names the unused-mut lint thinks that it should check them.
2018-08-01 10:12:41 +02:00
Pietro Albini
714fd37b8b
Rollup merge of #52778 - ljedrz:readable_serialize, r=kennytm
Improve readability of serialize.rs
2018-08-01 10:12:40 +02:00
Pietro Albini
06b91a4901
Rollup merge of #52771 - matklad:patch-1, r=kennytm
Clarify thread::park semantics

It took me quite some time to realize that the example is not actually racy, so let's clarify it? :-)
2018-08-01 10:12:38 +02:00
Pietro Albini
dafe33524a
Rollup merge of #52745 - commandline:master, r=oli-obk
Update clippy to latest master

r? @oli-obk

There is a regression in the version in current nightly that falsely lints `println!` and `writeln!` that use named arguments, thinking all rhs values for the argument expressions are literals even when they are not. This update includes the fix for that.
2018-08-01 10:12:37 +02:00
Pietro Albini
acff794b68
Rollup merge of #52732 - SimonSapin:spring, r=Mark-Simulacrum
Remove unstable and deprecated APIs
2018-08-01 10:12:36 +02:00
Pietro Albini
03df573c57
Rollup merge of #52628 - Mark-Simulacrum:rustdoc-cleanup-1, r=QuietMisdreavus
Cleanup some rustdoc code

Commits are mostly individual though some do depend on others.
2018-08-01 10:12:35 +02:00
Pietro Albini
b7ee110ea2
Rollup merge of #52340 - cypher:document-from-trait-in-ffi, r=steveklabnik
Document From trait implementations for OsStr, OsString, CString, and CStr

As part of issue #51430 (cc @skade).

The allocation and copy claims should be double-checked.

r? @steveklabnik
2018-08-01 10:12:32 +02:00
bors
c63bb1d6a7 Auto merge of #52756 - alexcrichton:cap-applicable, r=oli-obk
rustc: Disallow machine applicability in foreign macros

Recent changes to lints disallowed lints from being emitted against code located
in foreign macros, except for future-incompatible lints. For a future
incompatible lint, however, the automatic suggestions may not be applicable!

This commit updates this code path to force all applicability suggestions made
to foreign macros to never be `MachineApplicable`. This should avoid rustfix
actually attempting fixing these suggestions, causing non-compiling code to be
produced.

Closes rust-lang/cargo#5799
2018-08-01 06:44:09 +00:00
Ryan Scheel
bcab7e28b4
Update compatibility note for 1.28.0 to be correct 2018-07-31 18:31:15 -07:00
Mark Rousskov
0f680b38d0 Fixup test case 2018-07-31 17:55:12 -06:00
Mark Rousskov
4cd004775c Add dyn to Write 2018-07-31 17:55:12 -06:00
Mark Rousskov
8e65a46268 Cleanup highlighting code
Removes some unused code and de-publicizes structs
2018-07-31 17:55:12 -06:00
Mark Rousskov
7bea518d3a Remove global derive_id and reset_ids functions
Previously these functions relied on TLS but we can instead thread the
relevant state through explicitly.
2018-07-31 17:55:12 -06:00
Esteban Küber
75ff0ddb43 Use suggestions for shell format arguments 2018-07-31 14:16:36 -07:00
Pietro Albini
6b138f5167
Backport 1.27.2 release notes 2018-07-31 23:13:41 +02:00
Felix S. Klock II
779792ff38 address review feedback (sort_by_key is so much cleaner here than sort_by!). 2018-07-31 23:00:01 +02:00
bors
e94df4acb4 Auto merge of #52234 - petrochenkov:macuse2, r=Mark-Simulacrum
resolve: Modularize crate-local `#[macro_export] macro_rules`

Based on https://github.com/rust-lang/rust/pull/50911, cc https://github.com/rust-lang/rust/pull/50911#issuecomment-401151270

`#[macro_export] macro_rules` items are collected from the whole crate and are planted into the root module as items, so the external view of the crate is symmetric with its internal view and something like `$crate::my_macro` where `my_macro` is `#[macro_export] macro_rules` works both locally and from other crates.

Closes https://github.com/rust-lang/rust/issues/52726
2018-07-31 20:52:14 +00:00