Commit Graph

86225 Commits

Author SHA1 Message Date
kennytm
462f63e1bb
Rollup merge of #55597 - alexcrichton:thread-local-inner, r=KodrAus
std: Enable usage of `thread_local!` through imports

The `thread_local!` macro delegated to an internal macro but it didn't
do so in a macros-and-the-module-system compatible fashion, meaning if a
`#![no_std]` crate imported `std` and tried to use `thread_local!` it
would fail due to missing a lookup of an internal macro.

This commit switches the macro to instead use `$crate` to invoke other
macros, ensuring that it'll work when `thread_local!` is imported alone.
2018-11-06 17:08:03 +08:00
Ralf Jung
ba0bab39e0 make sure we only guess field alignment at offset 0 2018-11-06 08:41:56 +01:00
kngwyu
1224e0197a Format BtreeMap::range_mut example 2018-11-06 16:28:42 +09:00
kennytm
1525b0ee82
Rollup merge of #55490 - petrochenkov:resolveice, r=eddyb
resolve: Fix ICE in macro import error recovery

Fixes https://github.com/rust-lang/rust/issues/55457
2018-11-06 15:20:57 +08:00
bors
24e66c2898 Auto merge of #55518 - alexcrichton:smaller-wasm, r=sfackler
std: Improve codegen size of accessing TLS

Some code in the TLS implementation in libstd stores `Some(val)` into an
`&mut Option<T>` (effectively) and then pulls out `&T`, but it currently
uses `.unwrap()` which can codegen into a panic even though it can never
panic. With sufficient optimizations enabled (like LTO) the compiler can
see through this but this commit helps it along in normal mode
(`--release` with Cargo by default) to avoid codegen'ing the panic path.

This ends up improving the optimized codegen on wasm by ensuring that a
call to panic pulling in more file size doesn't stick around.
2018-11-06 04:04:33 +00:00
Alexander Regueiro
a1c4060c9d Moved and renamed ui issue tests. 2018-11-06 01:51:27 +00:00
bors
8aa926729e Auto merge of #55106 - petrhosek:fuchsia-lld, r=alexcrichton
Use lld directly for Fuchsia target

Fuchsia already uses lld as the default linker, so there's no reason
to always invoke it through Clang, instead we can simply invoke lld
directly and pass the set of flags that matches Clang.
2018-11-06 01:20:58 +00:00
Petr Hosek
3d27aca841 Use lld directly for Fuchsia target
Fuchsia already uses lld as the default linker, so there's no reason
to always invoke it through Clang, instead we can simply invoke lld
directly and pass the set of flags that matches Clang.
2018-11-05 15:46:00 -08:00
bors
65e485d8f1 Auto merge of #54922 - murarth:rc-ub-fix, r=alexcrichton
Fix undefined behavior in Rc/Arc allocation

Manually calculate allocation layout for `Rc`/`Arc` to avoid undefined behavior

Closes #54908
2018-11-05 22:20:25 +00:00
bors
13dab66a6f Auto merge of #55410 - nagisa:atomic-align, r=pnkfelix
Correct alignment of atomic types and (re)add Atomic{I,U}128

This is a updated https://github.com/rust-lang/rust/pull/53514 to also make atomic types `repr(C)` as per comment in https://github.com/rust-lang/rust/pull/53514#issuecomment-431042767.

Fixes #39590
Closes #53514

r? @pnkfelix
2018-11-05 19:29:57 +00:00
Murarth
d60290fc63 Fix undefined behavior in Rc/Arc allocation
Manually calculate allocation layout for `Rc`/`Arc` to avoid undefined behavior
2018-11-05 10:33:30 -07:00
Felix S. Klock II
034a0ebb6c This should have been part of PR #54811 (my bad). 2018-11-05 18:06:23 +01:00
Simonas Kazlauskas
99f7dc451f Do not Atomic{I,U}128 in stage0 2018-11-05 18:54:17 +02:00
David Wood
1672c27a7d
Improve predecessor detection.
It is necessary to detect whether we are making the first
assignment into a union. This is checked by looking at the moves and
checking if there are any from locations earlier in the control flow
graph.

This commit improves the detection of this by switching from a naive
method that compared only the statement and basic block indices with
a more robust method that looks at the predecessors of a location.
2018-11-05 17:40:40 +01:00
bors
af791bb8f4 Auto merge of #55451 - estebank:arg-doc, r=pnkfelix
Custom diagnostic when trying to doc comment argument

When writing

```
pub fn f(
    /// Comment
    id: u8,
) {}
```

Produce a targeted diagnostic

```
error: documentation comments cannot be applied to method arguments
  --> $DIR/fn-arg-doc-comment.rs:2:5
   |
LL |     /// Comment
   |     ^^^^^^^^^^^ doc comments are not allowed here
```

Fix #54801.
2018-11-05 16:36:18 +00:00
David Wood
8e7786a2d9
Add run-pass test for reinitialized unions.
This commit adds a run-pass test for the subset of
`src/test/ui/borrowck/borrowck-union-move-assign.rs` that is intended to
pass as the union is reinitialized.
2018-11-05 17:34:53 +01:00
Alex Crichton
842914e486 Add aarch64-pc-windows-msvc to deployed targets
Accidentally forgotten from #54718!
2018-11-05 07:54:38 -08:00
Tom Tromey
4d20dd4b78 Fix emission of niche-filling discriminant values
Bug #55606 points out a regression introduced by #54004; namely that
an assertion can erroneously fire when a niche-filling discriminant
value is emitted.

This fixes the bug by removing the assertion, and furthermore by
arranging for the discriminant value to be masked according to the
size of the niche.  This makes handling the discriminant a bit simpler
for debuggers.

The test case is from Jonathan Turner.

Closes #55606
2018-11-05 08:44:36 -07:00
Felix S. Klock II
fff9ddedce For feature-gate-nll test, turn off testing modes that externally enable NLL. 2018-11-05 16:37:18 +01:00
jsirs
306397774d
add call to tcx.sess.delay_span_bug
add call to tcx.sess.delay_span_bug before returning none to make sure error is presented to user
2018-11-05 17:30:01 +02:00
Felix S. Klock II
b75fbbf540 Make ui/borrowck/borrowck-overloaded-call.rs robust w.r.t. NLL. 2018-11-05 16:29:41 +01:00
Felix S. Klock II
cf71582718 Use // revisions in the dropck-eyepatch tests instead of relying on compare-mode=nll.
NLL has increased precision in its analysis of drop order, and we want
the test annotations to deliberately reflect this by having fewer
ERROR annotations for NLL than for AST-borrowck. The best way to get
this effect is via `// revisions`.

As a drive-by, also added uses of all the borrows just to make it
clear that NLL isn't somehow sidestepping things by using shorter
borrows than you might have otherwise expected. (Of course, the added
uses do not make all that much difference since the relevant types all
declare `impl Drop` and thus those drops have implicit uses anyway.)
2018-11-05 16:19:51 +01:00
Felix S. Klock II
c25319fcfc Update ui/borrowck/borrowck-closures-mut-of-imm.rs robust w.r.t. NLL. 2018-11-05 15:26:02 +01:00
Felix S. Klock II
fe29cd0a3d Add ui/borrowck/borrowck-closures-mut-of-mut.rs.
This is a variant of `ui/borrowck/borrowck-closures-mut-of-imm.rs`
that I used to help identify what changes I needed to make to the
latter file in order to recover its instances of E0524 under NLL.

(Basically this test includes the changes you'd need to make to
`ui/borrowck/borrowck-closures-mut-of-imm.rs` in order to get rid of
occurrences of E0596. And then I realized that one needs to add
invocations of the closures in order to properly extend the mutable
reborrows in a manner such that NLL will roughly match AST-borrowck.)
2018-11-05 15:26:02 +01:00
Felix S. Klock II
f7ded5dcb6 Removed overlapping_spans.{rs,stderr,nll.stderr}.
This is based on the feedback from estebank:

"""
I believe that test can be removed outright. It'd be impossible for a
new change to go through that breaks this kind of output without it
being picked up by multiple other `stderr` tests. This is an artifact
of the transition period to the "new" output style.
"""

see: https://github.com/rust-lang/rust/issues/52663#issuecomment-422155551
2018-11-05 15:26:02 +01:00
Felix S. Klock II
e940801592 Make ui/binop-move-semantics.rs robust w.r.t. NLL. 2018-11-05 15:26:02 +01:00
Felix S. Klock II
62a2bb1294 Remove println!'s from ui/issues/issue-52126-assign-op-invariance.rs
This is not strictly necessary to make this test "more robust with
respect to NLL"; its just an attempt to narrow the scope of the test
and focus on its core.
2018-11-05 15:26:02 +01:00
Felix S. Klock II
41a1ee923e Make ui/unop-move-semantics.rs robust w.r.t. NLL. 2018-11-05 15:26:02 +01:00
Felix S. Klock II
9843a38632 Make ui/borrowck/borrowck-unboxed-closures.rs robust w.r.t. NLL. 2018-11-05 15:26:02 +01:00
Felix S. Klock II
6c7d82e1ca Make ui/borrowck/borrowck-reborrow-from-mut.rs robust w.r.t. NLL. 2018-11-05 15:26:02 +01:00
Felix S. Klock II
9f9bf94b8d Make ui/borrowck/borrowck-overloaded-index-move-index.rs robust w.r.t. NLL. 2018-11-05 15:26:02 +01:00
Felix S. Klock II
affddf68c6 Make ui/issues/issue-17263.rs robust w.r.t. NLL. 2018-11-05 15:26:02 +01:00
Felix S. Klock II
cd52b3c2dc Make ui/span/borrowck-borrow-overloaded-auto-deref-mut.rs robust w.r.t. NLL. 2018-11-05 15:26:02 +01:00
Felix S. Klock II
5f524ed5c4 Switch to using revisions in borrowck-lend-flow-loop.rs
Most of the time we want to robustify tests, but in this case this
test is deliberately encoding artifacts of AST-borrowck.  So instead
of adding artificial uses that would obscure the aspects of
AST-borrowck that are being tests, we instead use revisions and then
mark the cases that apply to NLL as well as AST-borrowck.
2018-11-05 15:26:02 +01:00
Ralf Jung
7b7c6ceb75 add method to obtain the ptr offset of a Scalar 2018-11-05 15:11:28 +01:00
Nikita Popov
3cc8b17451 Remove support for building against LLVM 4
With emscripten removed in #55626, we no longer need to support
building against LLVM 4.
2018-11-05 15:04:26 +01:00
jsirs
87c22f2b14
add test for i32, fix incorrect location 2018-11-05 15:57:07 +02:00
jsirs
9fb2e0618e
update test to include concrete type (i32) 2018-11-05 15:54:10 +02:00
Ralf Jung
a0074cafb1 walk_value: more tracing 2018-11-05 14:36:27 +01:00
jsirs
4a08333c4d
self.associated_item can return none
self.associated_item can return none, replace unwrap with '?' and bubble up None value instead of panicking
2018-11-05 14:37:36 +02:00
jsirs
2a1dc1eff6
Add test
Add test for incompleately implemented add trait, see issue #31076
2018-11-05 14:33:43 +02:00
Matthias Krüger
84775edcc2 -C remark: fix incorrect warning about requiring "--debuginfo" instead of "-C debuginfo=n" 2018-11-05 12:11:05 +01:00
Ralf Jung
a6622c265c note some FIXMEs 2018-11-05 11:20:01 +01:00
Ralf Jung
5ebd077f54 make it more obvious that the size is not relevant 2018-11-05 11:14:21 +01:00
bors
6cfc603395 Auto merge of #55515 - QuietMisdreavus:rustdoc-config, r=GuillaumeGomez
rustdoc: refactor: centralize all command-line argument parsing

This is something i've wanted to do for a while, since we keep having to add new arguments to places like `rust_input` or `core::run_core` whenever we add a new CLI flag or the like. Those functions have inflated up to 11-19, and in some cases hiding away the locations where some CLI flags were being parsed, obscuring their use. Now, we have a central place where all command-line configuration occurs, including argument validation.

One note about the design: i grouped together all the arguments that `html::render::run` needed, so that i could pass them on from compilation in one lump instead of trying to thread through individual items or clone the entire blob ahead of time.

One other thing this adds is that rustdoc also now recognizes all the `-Z` options that rustc does, since we were manually grabbing a few previously. Now we parse a full `DebuggingOptions` struct and hand it directly to rustc when scraping docs.
2018-11-05 09:48:46 +00:00
Ralf Jung
0529dc818f proide ptr_wrapping_offset on Scalars 2018-11-05 10:30:56 +01:00
Ralf Jung
873041009d make ValueVisitor mut-polymorphic 2018-11-05 10:15:25 +01:00
Ralf Jung
7565b5ac67 machine hooks for ptr (de)ref also need layout, and then they do not need the size 2018-11-05 09:59:06 +01:00
Ralf Jung
0d596f29d9 FIXME 2018-11-05 09:59:05 +01:00
Ralf Jung
91cad39614 visit_aggregate with an iterator; fix some comment typos 2018-11-05 09:59:05 +01:00