]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoupdate the stdsimd submodule
Jorge Aparicio [Tue, 24 Jul 2018 16:08:11 +0000 (11:08 -0500)]
update the stdsimd submodule

to bring in the doc generation fix

5 years agoAuto merge of #52597 - oli-obk:promotion_simplify, r=nagisa
bors [Tue, 24 Jul 2018 13:10:06 +0000 (13:10 +0000)]
Auto merge of #52597 - oli-obk:promotion_simplify, r=nagisa

Promoteds are statics and statics have a place, not just a value

r? @eddyb

This makes everything around promoteds a little simpler

6 years agoAuto merge of #52189 - cuviper:static-box-leak, r=bluss
bors [Tue, 24 Jul 2018 10:46:21 +0000 (10:46 +0000)]
Auto merge of #52189 - cuviper:static-box-leak, r=bluss

doc: Clarify the lifetime returned by `Box::leak`

`Box::leak` mentions that it can return a `'static` reference, but it
wasn't immediately clear to me why it doesn't always do so.  This is
because of the `T: 'a` constraint needed to form a valid reference, and
in general we want to be more flexible than requiring `T: 'static`.
This patch tries to clarify the relationship between `T` and `'a`.

6 years agoAuto merge of #52646 - ljedrz:single_char_pattern, r=michaelwoerister
bors [Tue, 24 Jul 2018 08:24:11 +0000 (08:24 +0000)]
Auto merge of #52646 - ljedrz:single_char_pattern, r=michaelwoerister

Change single char str patterns to chars

A `char` is faster.

6 years agoAuto merge of #52655 - kennytm:rollup, r=kennytm
bors [Tue, 24 Jul 2018 03:01:11 +0000 (03:01 +0000)]
Auto merge of #52655 - kennytm:rollup, r=kennytm

Rollup of 10 pull requests

Successful merges:

 - #52538 (Remove obsolete flags in the i586_musl Dockerfile)
 - #52548 (Cursor: update docs to clarify Cursor only works with in-memory buffers)
 - #52605 (Do not suggest using `to_owned()` on `&str += &str`)
 - #52621 (Fix color detection for Windows msys terminals.)
 - #52622 (Use MultiSpan in E0707 and E709)
 - #52627 (Compile rustc before building tests for rustdoc)
 - #52637 (Don't use NonNull::dangling as sentinel value in Rc, Arc)
 - #52640 (Forget Waker when cloning LocalWaker)
 - #52641 (Simplify 2 functions in rustc_mir/dataflow)
 - #52642 (Replace a few expect+format combos with unwrap_or_else+panic)

Failed merges:

r? @ghost

6 years agoRollup merge of #52642 - ljedrz:expect_fun_call, r=Mark-Simulacrum
kennytm [Tue, 24 Jul 2018 01:50:00 +0000 (09:50 +0800)]
Rollup merge of #52642 - ljedrz:expect_fun_call, r=Mark-Simulacrum

Replace a few expect+format combos with unwrap_or_else+panic

That way the error strings won't be created if the related errors are not triggered.

6 years agoRollup merge of #52641 - ljedrz:mir_dataflow_misc, r=cramertj
kennytm [Tue, 24 Jul 2018 01:49:59 +0000 (09:49 +0800)]
Rollup merge of #52641 - ljedrz:mir_dataflow_misc, r=cramertj

Simplify 2 functions in rustc_mir/dataflow

- `graphviz::outgoing`: the `enumerate` only provides indices; use a range instead
- `DataflowState::interpret_set`: change a push loop to an iterator and remove the `each_bit` helper function

6 years agoRollup merge of #52640 - Thomasdezeeuw:fix-localwaker-clone, r=cramertj
kennytm [Tue, 24 Jul 2018 01:49:58 +0000 (09:49 +0800)]
Rollup merge of #52640 - Thomasdezeeuw:fix-localwaker-clone, r=cramertj

Forget Waker when cloning LocalWaker

Since NonNull is Copy the inner field of the cloned Waker was copied for
use in the new LocalWaker, however this left Waker to be dropped. Which
means that when cloning LocalWaker would also erroneously call drop_raw.

This change forgets the Waker, rather then dropping it, leaving the
inner field to be used by the returned LocalWaker.

Closes #52629.

6 years agoRollup merge of #52637 - RalfJung:rc, r=joshtriplett
kennytm [Tue, 24 Jul 2018 01:49:56 +0000 (09:49 +0800)]
Rollup merge of #52637 - RalfJung:rc, r=joshtriplett

Don't use NonNull::dangling as sentinel value in Rc, Arc

Instead, rely on alignment and use usize::MAX as sentinel.

Cc #52508

r? @joshtriplett

6 years agoRollup merge of #52627 - Mark-Simulacrum:rustdoc-test-correct, r=alexcrichton
kennytm [Tue, 24 Jul 2018 01:49:55 +0000 (09:49 +0800)]
Rollup merge of #52627 - Mark-Simulacrum:rustdoc-test-correct, r=alexcrichton

Compile rustc before building tests for rustdoc

r? @alexcrichton

6 years agoRollup merge of #52622 - estebank:lifetime-multispan, r=nikomatsakis
kennytm [Tue, 24 Jul 2018 01:49:54 +0000 (09:49 +0800)]
Rollup merge of #52622 - estebank:lifetime-multispan, r=nikomatsakis

Use MultiSpan in E0707 and E709

6 years agoRollup merge of #52621 - ehuss:atty-fix, r=alexcrichton
kennytm [Tue, 24 Jul 2018 01:49:53 +0000 (09:49 +0800)]
Rollup merge of #52621 - ehuss:atty-fix, r=alexcrichton

Fix color detection for Windows msys terminals.

Updates atty to pull in the fix softprops/atty#28.  Closes rust-lang/cargo#5724.

6 years agoRollup merge of #52605 - estebank:str-plus-eq, r=oli-obk
kennytm [Tue, 24 Jul 2018 01:49:52 +0000 (09:49 +0800)]
Rollup merge of #52605 - estebank:str-plus-eq, r=oli-obk

Do not suggest using `to_owned()` on `&str += &str`

 - Don't provide incorrect suggestion for `&str += &str` (fix #52410)
 - On `&str + String` suggest `&str.to_owned() + &String` as a single suggestion

6 years agoRollup merge of #52548 - tko:cursor-doc, r=sfackler
kennytm [Tue, 24 Jul 2018 01:49:50 +0000 (09:49 +0800)]
Rollup merge of #52548 - tko:cursor-doc, r=sfackler

Cursor: update docs to clarify Cursor only works with in-memory buffers

Reduce misconceptions about Cursor being more general than it really is.

Fixes: #52470
6 years agoRollup merge of #52538 - ljedrz:old_musl_i586_flags, r=kennytm
kennytm [Tue, 24 Jul 2018 01:49:49 +0000 (09:49 +0800)]
Rollup merge of #52538 - ljedrz:old_musl_i586_flags, r=kennytm

Remove obsolete flags in the i586_musl Dockerfile

Resolves an [outdated FIXME](https://github.com/rust-lang/rust/blob/ab8b961677ac5c74762dcea955aa0ff4d7fe4915/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile#L45) in the Dockerfile for dist-i586-gnu-i586-i686-musl.

6 years agoAuto merge of #52618 - alexcrichton:capture-more, r=petrochenkov
bors [Tue, 24 Jul 2018 00:50:15 +0000 (00:50 +0000)]
Auto merge of #52618 - alexcrichton:capture-more, r=petrochenkov

rustc: Implement tokenization of nested items

Ever plagued by #43081 the compiler can return surprising spans in situations
related to procedural macros. This is exhibited by #47983 where whenever a
procedural macro is invoked in a nested item context it would fail to have
correct span information.

While #43230 provided a "hack" to cache the token stream used for each item in
the compiler it's not a full-blown solution. This commit continues to extend
this "hack" a bit more to work for nested items.

Previously in the parser the `parse_item` method would collect the tokens for an
item into a cache on the item itself. It turned out, however, that nested items
were parsed through the `parse_item_` method, so they didn't receive similar
treatment. To remedy this situation the hook for collecting tokens was moved
into `parse_item_` instead of `parse_item`.

Afterwards the token collection scheme was updated to support nested collection
of tokens. This is implemented by tracking `TokenStream` tokens instead of
`TokenTree` to allow for collecting items into streams at intermediate layers
and having them interleaved in the upper layers.

All in all, this...

Closes #47983

6 years agoAuto merge of #52175 - fpoli:testsuite-callsite-span, r=petrochenkov
bors [Mon, 23 Jul 2018 21:44:37 +0000 (21:44 +0000)]
Auto merge of #52175 - fpoli:testsuite-callsite-span, r=petrochenkov

Match errors using the callsite of macro expansions

Fix for issue #51848

6 years agoAuto merge of #50494 - F001:as_cell, r=alexcrichton
bors [Mon, 23 Jul 2018 19:43:36 +0000 (19:43 +0000)]
Auto merge of #50494 - F001:as_cell, r=alexcrichton

Implement rfc 1789: Conversions from `&mut T` to `&Cell<T>`

I'm surprised that RFC 1789 has not been implemented for several months. Tracking issue: https://github.com/rust-lang/rust/issues/43038

Please note: when I was writing tests for `&Cell<[i32]>`, I found it is not easy to get the length of the contained slice. So I designed a `get_with` method which might be useful for similar cases. This method is not designed in the RFC, and it certainly needs to be reviewed by core team. I think it has some connections with `Cell::update` https://github.com/rust-lang/rust/issues/50186 , which is also in design phase.

6 years agoAuto merge of #52566 - pnkfelix:buffer-nll-errors-for-z-borrowck-migrate, r=nikomatsakis
bors [Mon, 23 Jul 2018 17:45:34 +0000 (17:45 +0000)]
Auto merge of #52566 - pnkfelix:buffer-nll-errors-for-z-borrowck-migrate, r=nikomatsakis

Buffer NLL errors

Buffer the errors generated during MIR-borrowck (aka NLL).

This is the first big step towards resolving issue #46908.

6 years agoAuto merge of #52639 - oli-obk:clippyup, r=kennytm
bors [Mon, 23 Jul 2018 15:38:46 +0000 (15:38 +0000)]
Auto merge of #52639 - oli-obk:clippyup, r=kennytm

Update the clippy submodule

r? @kennytm

cc @nrc @Manishearth

6 years agoAuto merge of #52506 - alexcrichton:dont-duplicate-wasm-sections, r=michaelwoerister
bors [Mon, 23 Jul 2018 13:42:23 +0000 (13:42 +0000)]
Auto merge of #52506 - alexcrichton:dont-duplicate-wasm-sections, r=michaelwoerister

rustc: Work around an upstream wasm ThinLTO bug

This commit implements a workaround for an [upstream LLVM bug][1] where custom
sections were accidentally duplicated amongst codegen units when ThinLTO passes
were performed. This is due to the fact that custom sections for wasm are stored
as metadata nodes which are automatically imported into modules when ThinLTO
happens. The fix here is to forcibly delete the metadata node from imported
modules before LLVM has a chance to try to copy it over.

[1]: https://bugs.llvm.org/show_bug.cgi?id=38184

6 years agoChange single char str patterns to chars
ljedrz [Mon, 23 Jul 2018 13:32:57 +0000 (15:32 +0200)]
Change single char str patterns to chars

6 years agouse inherent method instead
F001 [Mon, 23 Jul 2018 11:20:50 +0000 (19:20 +0800)]
use inherent method instead

6 years agoReplace a few expect+format combos with unwrap_or_else+panic
ljedrz [Mon, 23 Jul 2018 12:47:13 +0000 (14:47 +0200)]
Replace a few expect+format combos with unwrap_or_else+panic

6 years agoMatch errors using the callsite of macro expansions
Federico Poli [Thu, 19 Jul 2018 12:15:43 +0000 (14:15 +0200)]
Match errors using the callsite of macro expansions

6 years agoThread the `errors_buffer` down through the NLL region_infer code.
Felix S. Klock II [Wed, 18 Jul 2018 21:23:21 +0000 (23:23 +0200)]
Thread the `errors_buffer` down through the NLL region_infer code.

6 years agoSeparate the construction of a generic bound failure from its emission.
Felix S. Klock II [Wed, 18 Jul 2018 21:17:22 +0000 (23:17 +0200)]
Separate the construction of a generic bound failure from its emission.

6 years agothread the `errors_buffer` down into `nll::type_check`.
Felix S. Klock II [Wed, 18 Jul 2018 20:34:01 +0000 (22:34 +0200)]
thread the `errors_buffer` down into `nll::type_check`.

Right now its solely used for `check_local`, which ... I guess is not surprising?

6 years agoBuffer errors in MIR borrow check
Santiago Pastorino [Wed, 18 Jul 2018 21:10:08 +0000 (18:10 -0300)]
Buffer errors in MIR borrow check

(pnkfelix updated to address tidy, and to change the buffer from
`Vec<DiagnosticBuilder<'errs>>` to a `Vec<Diagnostic>` in order to
avoid painful lifetime maintenance.)

6 years agoSimplify 2 functions in rustc_mir/dataflow
ljedrz [Mon, 23 Jul 2018 12:10:31 +0000 (14:10 +0200)]
Simplify 2 functions in rustc_mir/dataflow

6 years agoForget Waker when cloning LocalWaker
Thomas de Zeeuw [Mon, 23 Jul 2018 11:39:21 +0000 (13:39 +0200)]
Forget Waker when cloning LocalWaker

Since NonNull is Copy the inner field of the cloned Waker was copied for
use in the new LocalWaker, however this left Waker to be dropped. Which
means that when cloning LocalWaker would also erroneously call drop_raw.

This change forgets the Waker, rather then dropping it, leaving the
inner field to be used by the returned LocalWaker.

Closes #52629.

6 years agoAuto merge of #52589 - petrochenkov:derlint, r=alexcrichton
bors [Mon, 23 Jul 2018 11:39:50 +0000 (11:39 +0000)]
Auto merge of #52589 - petrochenkov:derlint, r=alexcrichton

Attach deprecation lint `proc_macro_derive_resolution_fallback` to a specific node id

So it can be `allow`-ed from inside the derive.

cc https://github.com/rust-lang/rust/pull/51952

6 years agoRemove redundant outlives declarations
Santiago Pastorino [Thu, 19 Jul 2018 21:29:26 +0000 (18:29 -0300)]
Remove redundant outlives declarations

6 years agoRemove wrong allow(dead_code) directive
Santiago Pastorino [Wed, 18 Jul 2018 20:52:49 +0000 (17:52 -0300)]
Remove wrong allow(dead_code) directive

6 years agoRemove unneded lifetimes relations declaration
Santiago Pastorino [Wed, 18 Jul 2018 19:53:46 +0000 (16:53 -0300)]
Remove unneded lifetimes relations declaration

6 years agoLet mir reference lifetime be inferred
Santiago Pastorino [Wed, 18 Jul 2018 19:33:30 +0000 (16:33 -0300)]
Let mir reference lifetime be inferred

6 years agoLet lifetimes on find be inferred
Santiago Pastorino [Wed, 18 Jul 2018 19:21:17 +0000 (16:21 -0300)]
Let lifetimes on find be inferred

6 years agoRemove unused lifetime annotation
Santiago Pastorino [Tue, 17 Jul 2018 20:59:11 +0000 (17:59 -0300)]
Remove unused lifetime annotation

6 years agogcx outlives tcx which outlives a, no need to explicitly do gcx: a
Santiago Pastorino [Mon, 9 Jul 2018 22:22:09 +0000 (19:22 -0300)]
gcx outlives tcx which outlives a, no need to explicitly do gcx: a

6 years agoRemove duplicated report word in docs
Santiago Pastorino [Fri, 6 Jul 2018 20:25:40 +0000 (17:25 -0300)]
Remove duplicated report word in docs

6 years agoUpdate the clippy submodule
Oliver Schneider [Mon, 23 Jul 2018 11:01:44 +0000 (13:01 +0200)]
Update the clippy submodule

6 years agotypos
Ralf Jung [Mon, 23 Jul 2018 10:53:37 +0000 (12:53 +0200)]
typos

6 years agoAuto merge of #52211 - bjorn3:misc_rustdoc_changes, r=QuietMisdreavus
bors [Mon, 23 Jul 2018 09:37:03 +0000 (09:37 +0000)]
Auto merge of #52211 - bjorn3:misc_rustdoc_changes, r=QuietMisdreavus

Misc rustdoc changes

6 years agoDon't use NonNull::dangling as sentinel value
Ralf Jung [Mon, 23 Jul 2018 09:13:20 +0000 (11:13 +0200)]
Don't use NonNull::dangling as sentinel value

Instead, rely on alignment and use usize::MAX as sentinel.

6 years agoUpdate mir-opt to promoted changes
Oliver Schneider [Sun, 22 Jul 2018 12:53:35 +0000 (14:53 +0200)]
Update mir-opt to promoted changes

6 years agoTeach new error messages in MIR borrowck about promoted places
Oliver Schneider [Sun, 22 Jul 2018 11:30:16 +0000 (13:30 +0200)]
Teach new error messages in MIR borrowck about promoted places

6 years agoA promoted has a place and can thus be equal to itself
Oliver Schneider [Sun, 22 Jul 2018 10:20:50 +0000 (12:20 +0200)]
A promoted has a place and can thus be equal to itself

6 years agoMark an unreachable case as a bug instead of attempting to show an error to the user
Oliver Schneider [Sun, 22 Jul 2018 10:17:35 +0000 (12:17 +0200)]
Mark an unreachable case as a bug instead of attempting to show an error to the user

6 years agoFix tidy
Oliver Schneider [Sun, 22 Jul 2018 10:16:12 +0000 (12:16 +0200)]
Fix tidy

6 years agoExplain promoted extraction for simd shuffle
Oliver Schneider [Sun, 22 Jul 2018 10:15:04 +0000 (12:15 +0200)]
Explain promoted extraction for simd shuffle

6 years agoPromoteds are statics and statics have a place, not just a value
Oliver Schneider [Sat, 21 Jul 2018 23:01:07 +0000 (01:01 +0200)]
Promoteds are statics and statics have a place, not just a value

6 years agoAuto merge of #52612 - matthewjasper:remove-unnecessary-flow, r=nikomatsakis
bors [Mon, 23 Jul 2018 06:44:15 +0000 (06:44 +0000)]
Auto merge of #52612 - matthewjasper:remove-unnecessary-flow, r=nikomatsakis

Don't keep the possibly initialized flow around longer than needed

The possibly initialized flow isn't used after liveness is computed, so don't keep it around. Locally this is about a 10% time win for tuple-stress (which is spending a lot of time calculating flows now that it's not spending so much on liveness).

r? @nikomatsakis

6 years agoAuto merge of #52571 - oli-obk:promotion_abort, r=nagisa
bors [Mon, 23 Jul 2018 03:06:08 +0000 (03:06 +0000)]
Auto merge of #52571 - oli-obk:promotion_abort, r=nagisa

Abort if a promoted fails to be const evaluable and its runtime checks didn't trigger

r? @eddyb

cc @RalfJung @nagisa

cc https://github.com/rust-lang/rust/issues/49760

6 years agoAuto merge of #52568 - oli-obk:span_bug_error, r=varkor
bors [Mon, 23 Jul 2018 01:02:32 +0000 (01:02 +0000)]
Auto merge of #52568 - oli-obk:span_bug_error, r=varkor

Fix loop label resolution around constants

And make `delay_span_bug` a little more helpful

r? @varkor

fixes #52442
fixes #52443

6 years agoAuto merge of #52564 - pnkfelix:issue-52126-lhs-of-assign-op-is-invariant, r=eddyb
bors [Sun, 22 Jul 2018 23:05:11 +0000 (23:05 +0000)]
Auto merge of #52564 - pnkfelix:issue-52126-lhs-of-assign-op-is-invariant, r=eddyb

LHS of assign op is invariant

This addresses a bug injected by #45435. That PR changed the way we type-check `LHS <op> RHS` to coerce the LHS to the expected supertype in much the same way that we coerce the RHS.

The problem is that when we have a case of `LHS <op>= RHS`, we do not want to coerce to a supertype; we need the type to remain invariant. Otherwise we risk leaking a value with short-lifetimes into a expression context that needs to satisfy a long lifetime.

Fix #52126

6 years agoAuto merge of #52069 - zackmdavis:elided_states_of_america—and_to_the_re-pub-lic...
bors [Sun, 22 Jul 2018 20:54:05 +0000 (20:54 +0000)]
Auto merge of #52069 - zackmdavis:elided_states_of_america—and_to_the_re-pub-lic, r=nikomatsakis

add structured suggestions and fix false-positive for elided-lifetimes-in-paths lint

This adds structured suggestions to the elided-lifetimes-in-paths lint (introduced in Nov. 2017's #46254), prevents it from emitting a false-positive on anonymous (underscore) lifetimes (!), and adds it to the idioms-2018 group (#52041).

~~As an aside, "elided-lifetimes-in-paths" seems like an unfortunate name, because it's not clear exactly what "elided" means. The motivation for this lint (see original issue #45992, and [RFC 2115](https://github.com/rust-lang/rfcs/blob/e978a8d3017a01d632f916140c98802505cd1324/text/2115-argument-lifetimes.md#motivation)) seems to be specifically about not supplying angle-bracketed lifetime arguments to non-`&` types, but (1) the phrase "lifetime elision" has historically also referred to the ability to not supply a lifetime name to `&` references, and (2) an `is_elided` method in the HIR returns true for anoymous/underscore lifetimes, which is _not_ what we're trying to lint here. (That naming confusion is almost certainly what led to the false positive addressed here.) Given that the lint is relatively new and is allow-by-default, is it too late to rename it ... um, _again_ (#50879)?~~

~~This does _not_ address a couple of other false positives discovered in https://github.com/rust-lang/rust/issues/52041#issuecomment-402547901.~~

![elided_states](https://user-images.githubusercontent.com/1076988/42302137-2bf9479c-7fce-11e8-8bd0-f29aefc802b6.png)

r? @nikomatsakis
cc @nrc @petrochenkov

6 years agoCompile rustc before building tests for rustdoc
Mark Rousskov [Sat, 21 Jul 2018 21:54:54 +0000 (15:54 -0600)]
Compile rustc before building tests for rustdoc

6 years agoUse MultiSpan in E0707 and E709
Esteban Küber [Sun, 22 Jul 2018 19:19:34 +0000 (12:19 -0700)]
Use MultiSpan in E0707 and E709

6 years agoAuto merge of #52616 - kennytm:rollup, r=kennytm
bors [Sun, 22 Jul 2018 18:51:46 +0000 (18:51 +0000)]
Auto merge of #52616 - kennytm:rollup, r=kennytm

Rollup of 11 pull requests

Successful merges:

 - #51807 (Deprecation of str::slice_unchecked(_mut))
 - #52051 (mem::swap the obvious way for types smaller than the SIMD optimization's block size)
 - #52465 (Add CI test harness for `thumb*` targets. [IRR-2018-embedded])
 - #52507 (Reword when `_` couldn't be inferred)
 - #52508 (Document that Unique::empty() and NonNull::dangling() aren't sentinel values)
 - #52521 (Fix links in rustdoc book.)
 - #52581 (Avoid using `#[macro_export]` for documenting builtin macros)
 - #52582 (Typo)
 - #52587 (Add missing backtick in UniversalRegions doc comment)
 - #52594 (Run the error index tool against the sysroot libdir)
 - #52615 (Added new lines to .gitignore.)

6 years agoFix color detection for Windows msys terminals.
Eric Huss [Sun, 22 Jul 2018 18:19:44 +0000 (11:19 -0700)]
Fix color detection for Windows msys terminals.

6 years agoRollup merge of #52051 - scottmcm:swap-directly, r=alexcrichton
kennytm [Sun, 22 Jul 2018 17:02:41 +0000 (01:02 +0800)]
Rollup merge of #52051 - scottmcm:swap-directly, r=alexcrichton

mem::swap the obvious way for types smaller than the SIMD optimization's block size

LLVM isn't able to remove the alloca for the unaligned block in the post-SIMD tail in some cases, so doing this helps SRoA work in cases where it currently doesn't.  Found in the `replace_with` RFC discussion.

Examples of the improvements:
<details>
 <summary>swapping `[u16; 3]` takes 1/3 fewer instructions and no stackalloc</summary>

```rust
type Demo = [u16; 3];
pub fn swap_demo(x: &mut Demo, y: &mut Demo) {
    std::mem::swap(x, y);
}
```

nightly:
```asm
_ZN4blah9swap_demo17ha1732a9b71393a7eE:
.seh_proc _ZN4blah9swap_demo17ha1732a9b71393a7eE
sub rsp, 32
.seh_stackalloc 32
.seh_endprologue
movzx eax, word ptr [rcx + 4]
mov word ptr [rsp + 4], ax
mov eax, dword ptr [rcx]
mov dword ptr [rsp], eax
movzx eax, word ptr [rdx + 4]
mov word ptr [rcx + 4], ax
mov eax, dword ptr [rdx]
mov dword ptr [rcx], eax
movzx eax, word ptr [rsp + 4]
mov word ptr [rdx + 4], ax
mov eax, dword ptr [rsp]
mov dword ptr [rdx], eax
add rsp, 32
ret
.seh_handlerdata
.section .text,"xr",one_only,_ZN4blah9swap_demo17ha1732a9b71393a7eE
.seh_endproc
```

this PR:
```asm
_ZN4blah9swap_demo17ha1732a9b71393a7eE:
mov r8d, dword ptr [rcx]
movzx r9d, word ptr [rcx + 4]
movzx eax, word ptr [rdx + 4]
mov word ptr [rcx + 4], ax
mov eax, dword ptr [rdx]
mov dword ptr [rcx], eax
mov word ptr [rdx + 4], r9w
mov dword ptr [rdx], r8d
ret
```
</details>

<details>
 <summary>`replace_with` optimizes down much better</summary>

Inspired by https://github.com/rust-lang/rfcs/pull/2490,

```rust
fn replace_with<T, F>(x: &mut Option<T>, f: F)
    where F: FnOnce(Option<T>) -> Option<T>
{
    *x = f(x.take());
}

pub fn inc_opt(mut x: &mut Option<i32>) {
    replace_with(&mut x, |i| i.map(|j| j + 1));
}
```

Rust 1.26.0:
```asm
_ZN4blah7inc_opt17heb0acb64c51777cfE:
mov rax, qword ptr [rcx]
movabs r8, 4294967296
add r8, rax
shl rax, 32
movabs rdx, -4294967296
and rdx, r8
xor r8d, r8d
test rax, rax
cmove rdx, rax
setne r8b
or rdx, r8
mov qword ptr [rcx], rdx
ret
```

Nightly (better thanks to ScalarPair, maybe?):
```asm
_ZN4blah7inc_opt17h66df690be0b5899dE:
mov r8, qword ptr [rcx]
mov rdx, r8
shr rdx, 32
xor eax, eax
test r8d, r8d
setne al
add edx, 1
mov dword ptr [rcx], eax
mov dword ptr [rcx + 4], edx
ret
```

This PR:
```asm
_ZN4blah7inc_opt17h1426dc215ecbdb19E:
xor eax, eax
cmp dword ptr [rcx], 0
setne al
mov dword ptr [rcx], eax
add dword ptr [rcx + 4], 1
ret
```

Where that add is beautiful -- using an addressing mode to not even need to explicitly go through a register -- and the remaining imperfection is well-known (https://github.com/rust-lang/rust/pull/49420#issuecomment-376805721).
</details>

6 years agoRollup merge of #52615 - davidtwco:add-to-gitignore, r=nikomatsakis,Mark-Simulacrum
kennytm [Sun, 22 Jul 2018 14:10:21 +0000 (22:10 +0800)]
Rollup merge of #52615 - davidtwco:add-to-gitignore, r=nikomatsakis,Mark-Simulacrum

Added new lines to .gitignore.

There are a handful of files that I often find in my local working directories that I never want to commit that aren't covered in the `.gitignore` file:

`/mir_dump`:
Default output location from `-Z mir-dump=all` for a specific test, I can't think of a reason why this should ever be commited.

`tags*`/`TAGS*`:
I use `vim-gutentags` which outputs `tags` and `tags.temp` which I don't want commited. I also collapsed the `TAGS`, `TAGS.vi`, `TAGS.emacs` into `TAGS*`.

`Session.vim`:
I use `vim-obsession` to save my current session in Vim, it outputs a `Session.vim` file, this also shouldn't be commited.

6 years agoRollup merge of #52594 - Mark-Simulacrum:error-index-stage0, r=alexcrichton
kennytm [Sun, 22 Jul 2018 14:10:20 +0000 (22:10 +0800)]
Rollup merge of #52594 - Mark-Simulacrum:error-index-stage0, r=alexcrichton

Run the error index tool against the sysroot libdir

Previously when building the error index tool in stage 0 we would
attempt to use stage 0 libraries, but because it depends on rustdoc,
those don't exist: rustdoc is built against stage 1 libraries.

This patch aligns those two and passes the stage 1 libdir to the error
index.

@GuillaumeGomez discovered that this hasn't worked (presumably for a long time now, but not sure).

r? @alexcrichton

6 years agoRollup merge of #52587 - csmoe:doc, r=kennytm
kennytm [Sun, 22 Jul 2018 14:10:18 +0000 (22:10 +0800)]
Rollup merge of #52587 - csmoe:doc, r=kennytm

Add missing backtick in UniversalRegions doc comment

r? @QuietMisdreavus

6 years agoRollup merge of #52582 - felixrabe:patch-2, r=pietroalbini
kennytm [Sun, 22 Jul 2018 14:10:17 +0000 (22:10 +0800)]
Rollup merge of #52582 - felixrabe:patch-2, r=pietroalbini

Typo

6 years agoRollup merge of #52581 - petrochenkov:bmacrodoc, r=alexcrichton
kennytm [Sun, 22 Jul 2018 14:10:16 +0000 (22:10 +0800)]
Rollup merge of #52581 - petrochenkov:bmacrodoc, r=alexcrichton

Avoid using `#[macro_export]` for documenting builtin macros

Use a special `rustc_*` attribute instead.

cc https://github.com/rust-lang/rust/pull/52234

6 years agoAuto merge of #52572 - davidtwco:issue-51027, r=nikomatsakis
bors [Sun, 22 Jul 2018 16:48:09 +0000 (16:48 +0000)]
Auto merge of #52572 - davidtwco:issue-51027, r=nikomatsakis

NLL diagnostics replaced nice closure errors w/ indecipherable free region errors

Fixes #51027.

r? @nikomatsakis

6 years agorustc: Implement tokenization of nested items
Alex Crichton [Sun, 22 Jul 2018 15:48:29 +0000 (08:48 -0700)]
rustc: Implement tokenization of nested items

Ever plagued by #43081 the compiler can return surprising spans in situations
related to procedural macros. This is exhibited by #47983 where whenever a
procedural macro is invoked in a nested item context it would fail to have
correct span information.

While #43230 provided a "hack" to cache the token stream used for each item in
the compiler it's not a full-blown solution. This commit continues to extend
this "hack" a bit more to work for nested items.

Previously in the parser the `parse_item` method would collect the tokens for an
item into a cache on the item itself. It turned out, however, that nested items
were parsed through the `parse_item_` method, so they didn't receive similar
treatment. To remedy this situation the hook for collecting tokens was moved
into `parse_item_` instead of `parse_item`.

Afterwards the token collection scheme was updated to support nested collection
of tokens. This is implemented by tracking `TokenStream` tokens instead of
`TokenTree` to allow for collecting items into streams at intermediate layers
and having them interleaved in the upper layers.

All in all, this...

Closes #47983

6 years agoin which the elided-lifetimes-in-paths lint undergoes a revolution
Zack M. Davis [Tue, 17 Jul 2018 07:30:53 +0000 (00:30 -0700)]
in which the elided-lifetimes-in-paths lint undergoes a revolution

The existing elided-lifetimes-in-paths lint (introduced in Nov. 2017's
accd997b5 / #46254) lacked stuctured suggestions and—much more
alarmingly—produced false positives on associated functions (like
`Ref::clone`) and on anonymous '_ lifetimes (!!—yes, the very
anonymous lifetimes that we meant to suggest "instead"). That this
went apparently unnoticed for so long maybe tells you something about
how many people actually bother to flip on allow-by-default lints.

After many hours of good old-fashioned American elbow grease—and a
little help from expert reviewers—it turns out that getting the right
answer is a lot easier if we fire the lint while lowering the Higher
Intermediate Representation.

The lint is promoted to the idioms-2018 group.

Also, in the matter of test filenames, "elided" only has one 'l' (see,
e.g., https://en.wiktionary.org/wiki/elide).

Resolves #52041.

6 years agoRollup merge of #52521 - ehuss:rustdoc-passes-doc, r=kennytm
kennytm [Sun, 22 Jul 2018 14:10:14 +0000 (22:10 +0800)]
Rollup merge of #52521 - ehuss:rustdoc-passes-doc, r=kennytm

Fix links in rustdoc book.

Due to a change in how mdbook generates section anchors, headers
with non-alphabetic characters now start with "a".

6 years agoRollup merge of #52508 - joshtriplett:dangling-not-sentinel, r=Mark-Simulacrum
kennytm [Sun, 22 Jul 2018 14:10:13 +0000 (22:10 +0800)]
Rollup merge of #52508 - joshtriplett:dangling-not-sentinel, r=Mark-Simulacrum

Document that Unique::empty() and NonNull::dangling() aren't sentinel values

The documentation of Unique::empty() and NonNull::dangling() could
potentially suggest that they work as sentinel values indicating a
not-yet-initialized pointer. However, they both declare a non-null
pointer equal to the alignment of the type, which could potentially
reference a valid value of that type (specifically, the first such valid
value in memory). Explicitly document that the return value of these
functions does not work as a sentinel value.

6 years agoRollup merge of #52507 - estebank:infer-type, r=nikomatsakis
kennytm [Sun, 22 Jul 2018 14:10:11 +0000 (22:10 +0800)]
Rollup merge of #52507 - estebank:infer-type, r=nikomatsakis

Reword when `_` couldn't be inferred

r? @nikomatsakis

6 years agoRollup merge of #52465 - sekineh:add-ci-thumb, r=alexcrichton
kennytm [Sun, 22 Jul 2018 14:10:10 +0000 (22:10 +0800)]
Rollup merge of #52465 - sekineh:add-ci-thumb, r=alexcrichton

Add CI test harness for `thumb*` targets. [IRR-2018-embedded]

This pull request will do the following (rather trivial) changes:
- Fix #52163. In other words, we enabled `./x.py test src/test/run-make` for `no_std` targets.
- Modify `dist-various-1` Dockerfile.
  - CI now performs `run-make` test run on the targets below:
    - `thumbv6m-none-eabi`
    - `thumbv7m-none-eabi`
    - `thumbv7em-none-eabi`
    - `thumbv7em-none-eabihf`.
- ~~Add `thumb-none` Dockerfile.~~
  - ~~Initially, `thumbv7m-none-eabi`, `thumbv7em-none-eabi` and `thumbv7em-none-eabihf` are included as the tested target. `thumbv6m-none-eabi` is disabled for now because LLVM support is not certain.~~
- ~~Add `thumb-none` to .travis.yml~~

Note:
- `run-make` tests are not implemented yet. This PR is test harness only.

The amount of change is very small, but I'd like to open the pull request while the change is trivial.
Because I'm not very used to pull request process, I want to make a small progress first.  This PR will be a foundation for later additions.

CC @kennytm @jamesmunns @nerdyvaishali

6 years agoRollup merge of #51807 - newpavlov:deprecate_str_slice, r=alexcrichton
kennytm [Sun, 22 Jul 2018 14:10:09 +0000 (22:10 +0800)]
Rollup merge of #51807 - newpavlov:deprecate_str_slice, r=alexcrichton

Deprecation of str::slice_unchecked(_mut)

Closes #51715

I am not sure if 1.28.0 or 1.29.0 should be used for deprecation version, for now it's 1.28.0.

Additionally I've replaced `slice_unchecked` uses with `get_unchecked`. The only places where this method is still used are `src/liballoc/tests/str.rs` and `src/liballoc/tests/str.rs`.

6 years agoAdded new lines to .gitignore.
David Wood [Sun, 22 Jul 2018 12:14:06 +0000 (13:14 +0100)]
Added new lines to .gitignore.

6 years agoUse correct exclusion comment
Oliver Schneider [Sun, 22 Jul 2018 12:44:17 +0000 (14:44 +0200)]
Use correct exclusion comment

6 years agoFallback to general error handling in ICE cases.
David Wood [Sat, 21 Jul 2018 14:50:06 +0000 (15:50 +0100)]
Fallback to general error handling in ICE cases.

6 years agoModified how constraint classification happens to upvars, can now handle function...
David Wood [Sat, 21 Jul 2018 14:03:47 +0000 (15:03 +0100)]
Modified how constraint classification happens to upvars, can now handle function call case.

6 years agoImproved is_upvar_field_projection - no longer need recurse parameter.
David Wood [Sat, 21 Jul 2018 13:16:25 +0000 (14:16 +0100)]
Improved is_upvar_field_projection - no longer need recurse parameter.

6 years agoImproved documentation of functions in new module.
David Wood [Sat, 21 Jul 2018 12:10:33 +0000 (13:10 +0100)]
Improved documentation of functions in new module.

6 years agoImproved closure errors.
David Wood [Fri, 20 Jul 2018 16:30:31 +0000 (17:30 +0100)]
Improved closure errors.

6 years agoClassify aggregate rvalues as assignments.
David Wood [Fri, 20 Jul 2018 11:32:58 +0000 (12:32 +0100)]
Classify aggregate rvalues as assignments.

6 years agoAuto merge of #52368 - GuillaumeGomez:intra_doc_link_resolution_failure-documented...
bors [Sun, 22 Jul 2018 10:48:15 +0000 (10:48 +0000)]
Auto merge of #52368 - GuillaumeGomez:intra_doc_link_resolution_failure-documented, r=QuietMisdreavus

Add "self" intra-link support

Fixes #49583.

r? @QuietMisdreavus

6 years agoDon't keep the possibly init flow around longer than needed
Matthew Jasper [Sun, 22 Jul 2018 10:02:59 +0000 (11:02 +0100)]
Don't keep the possibly init flow around longer than needed

6 years agoAuto merge of #52359 - matthewjasper:combine-move-error-reporting, r=pnkfelix
bors [Sun, 22 Jul 2018 08:52:05 +0000 (08:52 +0000)]
Auto merge of #52359 - matthewjasper:combine-move-error-reporting, r=pnkfelix

[NLL] Small move error reporting improvements

* Use a MirBorrowckContext when reporting errors to be more uniform with other error reporting
* Add a special message for the case of trying to move from capture variables in `Fn` and `FnMut` closures.

part of #51028

6 years agoAuto merge of #52394 - estebank:println, r=oli-obk
bors [Sun, 22 Jul 2018 06:52:48 +0000 (06:52 +0000)]
Auto merge of #52394 - estebank:println, r=oli-obk

Improve suggestion for missing fmt str in println

Avoid using `concat!(fmt, "\n")` to improve the diagnostics being
emitted when the first `println!()` argument isn't a formatting string
literal.

Fix #52347.

6 years agoOnly run the test on x86_64
Scott McMurray [Sun, 22 Jul 2018 06:12:46 +0000 (23:12 -0700)]
Only run the test on x86_64

Smaller platforms don't merge the loads the same way.

6 years agoDo not suggest using `to_owned()` on `&str += &str`
Esteban Küber [Sun, 22 Jul 2018 05:33:32 +0000 (22:33 -0700)]
Do not suggest using `to_owned()` on `&str += &str`

6 years agoDon't use SIMD in mem::swap for types smaller than the block size
Scott McMurray [Wed, 4 Jul 2018 09:48:30 +0000 (02:48 -0700)]
Don't use SIMD in mem::swap for types smaller than the block size

LLVM isn't able to remove the alloca for the unaligned block in the SIMD tail in some cases, so doing this helps SRoA work in cases where it currently doesn't.  Found in the `replace_with` RFC discussion.

6 years agofix test
Esteban Küber [Sun, 22 Jul 2018 03:48:15 +0000 (20:48 -0700)]
fix test

6 years agoAuto merge of #52250 - nnethercote:no-SparseBitMatrix, r=nikomatsakis
bors [Sun, 22 Jul 2018 02:43:57 +0000 (02:43 +0000)]
Auto merge of #52250 - nnethercote:no-SparseBitMatrix, r=nikomatsakis

Speed up `SparseBitMatrix` use in `RegionValues`.

In practice, these matrices range from 10% to 90%+ full once they are
filled in, so the dense representation is better.

This reduces the runtime of Check Nll builds of `inflate` by 32%, and
several other benchmarks by 1--5%.

It also increases max-rss of `clap-rs` by 30% and a couple of others by
up to 5%, while decreasing max-rss of `coercions` by 14%. I think the
speed-ups justify the max-rss increases.

r? @nikomatsakis

6 years agofix tidy ~ again
Esteban Küber [Sun, 22 Jul 2018 01:24:10 +0000 (18:24 -0700)]
fix tidy ~ again

6 years agoDon't use the new `eprintln` for stage0 and stage1
Esteban Küber [Sun, 22 Jul 2018 00:59:17 +0000 (17:59 -0700)]
Don't use the new `eprintln` for stage0 and stage1

I'm not entirely sure why (or if) this is needed.

6 years agoFix tidy by adding new feature gate test
Esteban Küber [Sun, 22 Jul 2018 00:35:09 +0000 (17:35 -0700)]
Fix tidy by adding new feature gate test

6 years agofix logic bug
Esteban Küber [Sun, 22 Jul 2018 00:17:49 +0000 (17:17 -0700)]
fix logic bug

6 years agoAuto merge of #51485 - estebank:dehighlight-secondary-msgs, r=GuillaumeGomez
bors [Sat, 21 Jul 2018 23:50:28 +0000 (23:50 +0000)]
Auto merge of #51485 - estebank:dehighlight-secondary-msgs, r=GuillaumeGomez

Remove highlighting from secondary messages

Deemphasize the secondary messages so that all other highlights stand
out more.

<img width="684" alt="" src="https://user-images.githubusercontent.com/1606434/41261199-7b4fe96e-6d8f-11e8-8619-04d170617df2.png">

6 years agoRemove dependency on `libsyntax`
Esteban Küber [Sat, 21 Jul 2018 23:18:06 +0000 (16:18 -0700)]
Remove dependency on `libsyntax`

6 years agoChange `eprintln!()`
Esteban Küber [Sat, 21 Jul 2018 22:56:37 +0000 (15:56 -0700)]
Change `eprintln!()`

Address #30143 as well. `writeln!()` hasn't been changed.

6 years agoGate `format_args_nll` behind feature flag
Esteban Küber [Sat, 21 Jul 2018 22:50:46 +0000 (15:50 -0700)]
Gate `format_args_nll` behind feature flag

6 years agoAdd "self" intra-link support
Guillaume Gomez [Thu, 12 Jul 2018 20:00:57 +0000 (22:00 +0200)]
Add "self" intra-link support