]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoRollup merge of #54680 - RalfJung:compile-pass, r=pnkfelix
Pietro Albini [Tue, 2 Oct 2018 20:54:32 +0000 (22:54 +0200)]
Rollup merge of #54680 - RalfJung:compile-pass, r=pnkfelix

make run-pass tests with empty main just compile-pass tests

Many run-pass tests have an empty main, so there is not actually any point in running them. This makes them `compile-pass` tests instead, saving some time (generating the binary and then running it).

For now I did this only for `run-pass/issues`; if there is interest I can also do it for the other directories. I used `^\s*fn\s+main\(\s*\)\s*\{\s*\}` as regexp to identify these files.

5 years agoRollup merge of #54648 - alexcrichton:update-cargo, r=nikomatsakis
Pietro Albini [Tue, 2 Oct 2018 20:54:30 +0000 (22:54 +0200)]
Rollup merge of #54648 - alexcrichton:update-cargo, r=nikomatsakis

Update Cargo's submodule

Bring in a few updates and fixes, mostly a standard update.

5 years agoRollup merge of #54603 - davidtwco:issue-54559, r=nikomatsakis
Pietro Albini [Tue, 2 Oct 2018 20:54:29 +0000 (22:54 +0200)]
Rollup merge of #54603 - davidtwco:issue-54559, r=nikomatsakis

Add `crate::` to trait suggestions in Rust 2018.

Fixes #54559.

In the 2018 edition, when suggesting traits to import that implement a
given method that is being invoked, suggestions will now include the
`crate::` prefix if the suggested trait is local to the current crate.

r? @nikomatsakis

5 years agoRollup merge of #54458 - scottmcm:bug-54456, r=nikomatsakis
Pietro Albini [Tue, 2 Oct 2018 20:54:28 +0000 (22:54 +0200)]
Rollup merge of #54458 - scottmcm:bug-54456, r=nikomatsakis

Allow both explicit and elided lifetimes in the same impl header

While still prohibiting explicit and in-band in the same header.

Fixes #54456

As usual, I don't know the broader context of the code I'm changing, so please let me know whatever I can do better.

Pre-existing test that mixing explicit and in-band remains an error: https://github.com/rust-lang/rust/blob/master/src/test/ui/in-band-lifetimes/E0688.rs

5 years agoRollup merge of #54269 - PramodBisht:issue/53840, r=estebank
Pietro Albini [Tue, 2 Oct 2018 20:54:27 +0000 (22:54 +0200)]
Rollup merge of #54269 - PramodBisht:issue/53840, r=estebank

#53840: Consolidate pattern check errors

#53840  on this PR we are aggregating `cannot bind by-move and by-ref in the same pattern` message present on the different lines into one diagnostic message. Here we are first gathering those `spans` on `vector` then we are throwing them with the help of `MultiSpan`
r? @estebank

Addresses: #53480

5 years agomove some more tests
Ralf Jung [Tue, 2 Oct 2018 11:14:19 +0000 (13:14 +0200)]
move some more tests

5 years agoAuto merge of #54742 - Manishearth:clippyup, r=oli-obk
bors [Tue, 2 Oct 2018 10:36:25 +0000 (10:36 +0000)]
Auto merge of #54742 - Manishearth:clippyup, r=oli-obk

Update clippy

r? @oli-obk @kennytm

5 years agoUpdate clippy
Manish Goregaokar [Tue, 2 Oct 2018 09:11:35 +0000 (11:11 +0200)]
Update clippy

5 years agoConsolidate pattern check errors
Pramod Bisht [Tue, 2 Oct 2018 05:51:02 +0000 (05:51 +0000)]
Consolidate pattern check errors

we are consolidating `cannot bind by-move and by-ref in the same
pattern` message present on the different lines into single diagnostic
message.

To do this, we are first gathering those spans into the vector
after that we are throwing them with the help of MultiSpan in
a separate block.

Addresses: #53840

5 years agoAuto merge of #54701 - arielb1:outlives-later, r=nikomatsakis
bors [Tue, 2 Oct 2018 04:22:55 +0000 (04:22 +0000)]
Auto merge of #54701 - arielb1:outlives-later, r=nikomatsakis

normalize param-env type-outlives predicates last

The normalization of type-outlives predicates can depend on misc.
environment predicates, but not the other way around. Inferred lifetime
bounds can propagate type-outlives bounds far and wide, so their
normalization needs to work well.

Fixes #54467

r? @nikomatsakis
beta-nominating because this is required for inferred_outlives_bounds, which is in beta

5 years agoAuto merge of #54694 - csmoe:self_this, r=estebank
bors [Tue, 2 Oct 2018 01:09:36 +0000 (01:09 +0000)]
Auto merge of #54694 - csmoe:self_this, r=estebank

Suggest to use self for fake-self from other languages

Closes https://github.com/rust-lang/rust/issues/54019
r? @estebank

5 years agoAttempt to resolve linking issues.
David Wood [Thu, 27 Sep 2018 22:56:41 +0000 (00:56 +0200)]
Attempt to resolve linking issues.

This commit takes a different approach to add the `crate::` prefix to
item paths than previous commits. Previously, recursion was stopped
after a prelude crate name was pushed to the path. It is theorized that
this was the cause of the linking issues since the same path logic is
used for symbol names and that not recursing meant that details were
being missed that affect symbol names. As of this commit, instead of
ceasing recursion, a flag is passed through to any subsequent recursive
calls so that the same effect can be achieved by checking that flag.

5 years agoMove prelude crate names into `Session`.
David Wood [Thu, 27 Sep 2018 19:38:11 +0000 (21:38 +0200)]
Move prelude crate names into `Session`.

Avoid hardcoding and special-casing the `std` crate name in the item
path logic by moving the prelude crate name logic into the `Session`
type so it can be reused in the item path logic and resolve module.

5 years agoAdd `crate::` to trait suggestions in Rust 2018.
David Wood [Wed, 26 Sep 2018 23:17:54 +0000 (01:17 +0200)]
Add `crate::` to trait suggestions in Rust 2018.

In the 2018 edition, when suggesting traits to import that implement a
given method that is being invoked, suggestions will now include the
`crate::` prefix if the suggested trait is local to the current crate.

5 years agoAuto merge of #54693 - RalfJung:ctfe-scalar-pair-undef, r=oli-obk
bors [Mon, 1 Oct 2018 22:32:26 +0000 (22:32 +0000)]
Auto merge of #54693 - RalfJung:ctfe-scalar-pair-undef, r=oli-obk

do not normalize all non-scalar constants to a ConstValue::ScalarPair

We still need `ConstValue::ScalarPair` for match handling (matching slices and strings), but that will never see anything `Undef`. For non-fat-ptr `ScalarPair`, just point to the allocation like larger data structures do.

Fixes https://github.com/rust-lang/rust/issues/54387

r? @eddyb

5 years agonormalize param-env type-outlives predicates last
Ariel Ben-Yehuda [Sun, 30 Sep 2018 17:09:05 +0000 (20:09 +0300)]
normalize param-env type-outlives predicates last

The normalization of type-outlives predicates can depend on misc.
environment predicates, but not the other way around. Inferred lifetime
bounds can propagate type-outlives bounds far and wide, so their
normalization needs to work well.

Fixes #54467

5 years agoAuto merge of #54667 - RalfJung:maybe-uninit, r=pnkfelix
bors [Mon, 1 Oct 2018 14:58:24 +0000 (14:58 +0000)]
Auto merge of #54667 - RalfJung:maybe-uninit, r=pnkfelix

Panic when using mem::uninitialized or mem::zeroed on an uninhabited type

All code by @japaric. This re-submits one half of https://github.com/rust-lang/rust/pull/53508. This is likely not the one that introduced the perf regression, but just to be sure I'll do a perf run anyway.

5 years agoAuto merge of #54711 - kennytm:rollup, r=kennytm
bors [Mon, 1 Oct 2018 10:16:00 +0000 (10:16 +0000)]
Auto merge of #54711 - kennytm:rollup, r=kennytm

Rollup of 13 pull requests

Successful merges:

 - #53784 (Document that slices cannot be larger than `isize::MAX` bytes)
 - #54308 (Better user experience when attempting to call associated functions with dot notation)
 - #54488 (in which we include attributes in unused `extern crate` suggestion spans)
 - #54544 (Indicate how to move value out of Box in docs.)
 - #54623 (Added help message for `impl_trait_in_bindings` feature gate)
 - #54641 (A few cleanups and minor improvements to rustc/infer)
 - #54656 (Correct doc for WorkQueue<T>::pop().)
 - #54674 (update miri)
 - #54676 (Remove `-Z disable_ast_check_for_mutation_in_guard`)
 - #54679 (Improve bug! message for impossible case in Relate)
 - #54681 (Rename sanitizer runtime libraries on OSX)
 - #54708 (Make ./x.py help <cmd> invoke ./x.py <cmd> -h on its own)
 - #54713 (Add nightly check for tool_lints warning)

5 years agoRollup merge of #54676 - pnkfelix:issue-15287-kill-zflag-disabling-ast-check, r=alexc...
kennytm [Mon, 1 Oct 2018 09:49:33 +0000 (17:49 +0800)]
Rollup merge of #54676 - pnkfelix:issue-15287-kill-zflag-disabling-ast-check, r=alexcrichton

Remove `-Z disable_ast_check_for_mutation_in_guard`

One should use `#![feature(bind_by_move_pattern_guards)]` over `-Z disable_ast_check_for_mutation_in_guard`

cc #15287

5 years agoRollup merge of #54713 - flip1995:tool_lints_nightly, r=Manishearth
kennytm [Mon, 1 Oct 2018 09:49:09 +0000 (17:49 +0800)]
Rollup merge of #54713 - flip1995:tool_lints_nightly, r=Manishearth

Add nightly check for tool_lints warning

cc #54358

Let's add the nightly check, just in case something prevents a stabilization until 1.31.beta.

5 years agoRollup merge of #54674 - RalfJung:miri, r=oli-obk
kennytm [Mon, 1 Oct 2018 09:47:14 +0000 (17:47 +0800)]
Rollup merge of #54674 - RalfJung:miri, r=oli-obk

update miri

5 years agoAdd nightly check for tool_lints warning
flip1995 [Mon, 1 Oct 2018 09:11:58 +0000 (11:11 +0200)]
Add nightly check for tool_lints warning

cc #54358

5 years agoRollup merge of #54708 - collin5:b49475, r=Mark-Simulacrum
kennytm [Mon, 1 Oct 2018 08:13:05 +0000 (16:13 +0800)]
Rollup merge of #54708 - collin5:b49475, r=Mark-Simulacrum

Make ./x.py help <cmd> invoke ./x.py <cmd> -h on its own

Fixes #49475

r? @Mark-Simulacrum

5 years agoRollup merge of #54681 - alexcrichton:san-names, r=kennytm
kennytm [Mon, 1 Oct 2018 08:13:04 +0000 (16:13 +0800)]
Rollup merge of #54681 - alexcrichton:san-names, r=kennytm

Rename sanitizer runtime libraries on OSX

Currently we ship sanitizer libraries as they're built, but these names
unfortunately conflict with the names of the sanitizer libraries
installed on the system. If a crate, for example, links in C code that
wants to use the system sanitizer and the Rust code doesn't use
sanitizers at all, then using `cargo` may accidentally pull in the
Rust-installed sanitizer library due to a conflict in names.

This change is intended to be entirely transparent for Rust users of
sanitizers, it should only hopefully improve our story with other users!

Closes #54134

5 years agoRollup merge of #54679 - phansch:improve_bug_message, r=matthewjasper
kennytm [Mon, 1 Oct 2018 08:13:03 +0000 (16:13 +0800)]
Rollup merge of #54679 - phansch:improve_bug_message, r=matthewjasper

Improve bug! message for impossible case in Relate

Hitting this branch [in Clippy][clippy_issue] and I think it makes sense to print
both values here in case other people hit this branch, too.

(still have to figure out why this branch is hit)

[clippy_issue]: https://github.com/rust-lang-nursery/rust-clippy/issues/2831#issuecomment-424597092

5 years agoRollup merge of #54656 - nieksand:workqueue_doc, r=varkor
kennytm [Mon, 1 Oct 2018 08:13:02 +0000 (16:13 +0800)]
Rollup merge of #54656 - nieksand:workqueue_doc, r=varkor

Correct doc for WorkQueue<T>::pop().

The old function doc looks like copy-pasta from WorkQueue::insert().

WorkQueue::pop() does not enqueue nor does it return a boolean false.  Doc corrected accordingly.

5 years agoRollup merge of #54641 - ljedrz:cleanup_rustc_infer, r=estebank
kennytm [Mon, 1 Oct 2018 08:13:00 +0000 (16:13 +0800)]
Rollup merge of #54641 - ljedrz:cleanup_rustc_infer, r=estebank

A few cleanups and minor improvements to rustc/infer

- use unwrap_or(_else) where applicable
- convert single-branch matches to if-let
- use to_owned instead of to_string with string literals
- improve vector allocations
- readability improvements
- miscellaneous minor code improvements

5 years agoRollup merge of #54623 - alexreg:impl_trait_in_bindings-help, r=estebank
kennytm [Mon, 1 Oct 2018 08:12:59 +0000 (16:12 +0800)]
Rollup merge of #54623 - alexreg:impl_trait_in_bindings-help, r=estebank

Added help message for `impl_trait_in_bindings` feature gate

r? @estebank

CC @Centril

5 years agoRollup merge of #54544 - frewsxcv:frewsxcv-deref, r=GuillaumeGomez
kennytm [Mon, 1 Oct 2018 08:12:58 +0000 (16:12 +0800)]
Rollup merge of #54544 - frewsxcv:frewsxcv-deref, r=GuillaumeGomez

Indicate how to move value out of Box in docs.

Fixes https://github.com/rust-lang/rust/issues/53634.

5 years agoRollup merge of #54488 - zackmdavis:and_the_case_of_the_unused_crate, r=estebank
kennytm [Mon, 1 Oct 2018 08:12:56 +0000 (16:12 +0800)]
Rollup merge of #54488 - zackmdavis:and_the_case_of_the_unused_crate, r=estebank

in which we include attributes in unused `extern crate` suggestion spans

![unused_extern](https://user-images.githubusercontent.com/1076988/45921698-50243e80-be6f-11e8-930a-7b2a33b4935c.png)

Resolves #54400.

r? @estebank

5 years agoRollup merge of #54308 - dsciarra:issue-22692, r=estebank
kennytm [Mon, 1 Oct 2018 08:12:55 +0000 (16:12 +0800)]
Rollup merge of #54308 - dsciarra:issue-22692, r=estebank

Better user experience when attempting to call associated functions with dot notation

Closes #22692

5 years agoRollup merge of #53784 - tbu-:pr_doc_slice_isize_max, r=RalfJung
kennytm [Mon, 1 Oct 2018 08:12:54 +0000 (16:12 +0800)]
Rollup merge of #53784 - tbu-:pr_doc_slice_isize_max, r=RalfJung

Document that slices cannot be larger than `isize::MAX` bytes

Fixes #53676.

5 years agomark fix as MaybeIncorrect
csmoe [Mon, 1 Oct 2018 01:08:26 +0000 (09:08 +0800)]
mark fix as MaybeIncorrect

5 years agoupdate ui test for suggest-self
csmoe [Sun, 30 Sep 2018 12:48:28 +0000 (20:48 +0800)]
update ui test for suggest-self

5 years agolint to use self for this/my
csmoe [Sun, 30 Sep 2018 12:47:15 +0000 (20:47 +0800)]
lint to use self for this/my

5 years agoAuto merge of #54675 - alexcrichton:defaultlibs, r=varkor
bors [Mon, 1 Oct 2018 03:24:02 +0000 (03:24 +0000)]
Auto merge of #54675 - alexcrichton:defaultlibs, r=varkor

rust: Add a `-C default-linker-libraries` option

This commit adds a new codegen option for the compiler which disables
rustc's passing of `-nodefaultlibs` by default on relevant platforms.
Sometimes Rust is linked with C code which fails to link with
`-nodefaultlibs` and is unnecessarily onerous to get linking correctly
with `-nodefaultlibs`.

An example of this is that when you compile C code with sanitizers and
then pass `-fsanitize=address` to the linker, it's incompatible with
`-nodefaultlibs` also being passed to the linker.

In these situations it's easiest to turn off Rust's default passing of
`-nodefaultlibs`, which was more ideological to start with than
anything! Preserving the default is somewhat important but having this
be opt-in shouldn't cause any breakage.

Closes #54237

5 years agoallow use of ./x.py help <cmd> ...
Collins Abitekaniza [Mon, 1 Oct 2018 01:06:58 +0000 (04:06 +0300)]
allow use of ./x.py help <cmd> ...

5 years agoAuto merge of #54662 - matklad:once-perf, r=alexcrichton
bors [Mon, 1 Oct 2018 00:51:19 +0000 (00:51 +0000)]
Auto merge of #54662 - matklad:once-perf, r=alexcrichton

Fix Once perf regression

Because `call_once` is generic, but `is_completed` is not, we need
`#[inline]` annotation to allow LLVM to inline `is_completed` into
`call_once` in downstream crates.

cc https://github.com/rust-lang/rust/pull/53027/files#r221418859

5 years agoAuto merge of #54650 - eddyb:no-extern's-land, r=alexcrichton
bors [Sun, 30 Sep 2018 22:20:16 +0000 (22:20 +0000)]
Auto merge of #54650 - eddyb:no-extern's-land, r=alexcrichton

Don't lint non-extern-prelude extern crate's in Rust 2018.

Fixes #54381 by silencing the lint telling users to remove `extern crate` when `use` doesn't work.

r? @alexcrichton cc @petrochenkov @nikomatsakis @Centril

5 years agoAdded help message for `impl_trait_in_bindings` feature gate.
Alexander Regueiro [Thu, 27 Sep 2018 21:34:19 +0000 (22:34 +0100)]
Added help message for `impl_trait_in_bindings` feature gate.

5 years agoAuto merge of #53255 - orium:fix-bug-overflow-send, r=arielb1
bors [Sun, 30 Sep 2018 19:41:07 +0000 (19:41 +0000)]
Auto merge of #53255 - orium:fix-bug-overflow-send, r=arielb1

Add a per-tree error cache to the obligation forest

This implements part of what @nikomatsakis mentioned in  https://github.com/rust-lang/rust/pull/30533#issuecomment-170705871:

> 1. If you find that a new obligation is a duplicate of one already in the tree, the proper processing is:
>      * if that other location is your parent, you should abort with a cycle error (or accept it, if coinductive)
>      * if that other location is not an ancestor, you can safely ignore the new obligation

In particular it implements the "if that other location is your parent accept it, if coinductive" part.  This fixes #40827.

I have to say that I'm not 100% confident that this is rock solid.  This is my first pull request :tada:, and I didn't know anything about the trait resolver before this.  In particular I'm not totally sure that comparing predicates is enough (for instance, do we need to compare `param_env` as well?).  Also, I'm not sure what @nikomatsakis mentions [here](https://github.com/rust-lang/rust/issues/30977#issue-127091096), but it might be something that affects this PR:

> In particular, I am wary of getting things wrong around inference variables! We can always add things to the set in their current state, and if unifications occur then the obligation is just kind of out-of-date, but I want to be sure we don't accidentally fail to notice that something is our ancestor. I decided this was subtle enough to merit its own PR.

Anyway, go ahead and review :slightly_smiling_face:.

Ref #30977.

# Performance

We are now copying vectors around, so I decided to do some benchmarking.  A simple benchmark shows that this does not seem to affect performance in a measurable way:

I ran `cargo clean && cargo build` 20 times on actix-web (84b27db) and these are the results:

```text
rustc master:

            Mean        Std.Dev.    Min         Median      Max
real        66.637      2.996       57.220      67.714      69.314
user        307.293     14.741      258.093     312.209     320.702
sys         12.524      0.653       10.499      12.726      13.193

rustc fix-bug-overflow-send:

            Mean        Std.Dev.    Min         Median      Max
real        66.297      4.310       53.532      67.516      70.348
user        306.812     22.371      236.917     314.748     326.229
sys         12.757      0.952       9.671       13.125      13.544
```

I will do a more comprehensive benchmark (compiling rustc stage1) and post the results.

r? @nikomatsakis, @nnethercote

PS: It is better to review this commit-by-commit.

5 years agoDeduplicate errors in the obligation forest.
Diogo Sousa [Sun, 30 Sep 2018 01:41:49 +0000 (02:41 +0100)]
Deduplicate errors in the obligation forest.

Fixes #40827.

5 years agoTypos and style fixes.
Diogo Sousa [Fri, 10 Aug 2018 17:13:43 +0000 (18:13 +0100)]
Typos and style fixes.

5 years agothe test requires unwinding so we don't run it on the wasm32-bare target
Jorge Aparicio [Fri, 21 Sep 2018 21:40:00 +0000 (23:40 +0200)]
the test requires unwinding so we don't run it on the wasm32-bare target

5 years agoadd codegen test
Jorge Aparicio [Thu, 20 Sep 2018 18:57:25 +0000 (20:57 +0200)]
add codegen test

5 years agomake the nil-enum test work again
Jorge Aparicio [Sat, 1 Sep 2018 18:13:13 +0000 (20:13 +0200)]
make the nil-enum test work again

5 years agoadapt to change in Session API
Jorge Aparicio [Thu, 23 Aug 2018 14:18:28 +0000 (16:18 +0200)]
adapt to change in Session API

5 years agoallow dead_code
Jorge Aparicio [Sat, 22 Sep 2018 22:37:08 +0000 (00:37 +0200)]
allow dead_code

5 years agoadd empty enum to the test cases
Jorge Aparicio [Thu, 23 Aug 2018 14:49:35 +0000 (16:49 +0200)]
add empty enum to the test cases

5 years agoimprove the run-pass test
Jorge Aparicio [Thu, 23 Aug 2018 14:49:00 +0000 (16:49 +0200)]
improve the run-pass test

5 years agomove our check to reuse a previous computation
Jorge Aparicio [Thu, 23 Aug 2018 14:39:03 +0000 (16:39 +0200)]
move our check to reuse a previous computation

5 years agoimprove panic message
Jorge Aparicio [Thu, 23 Aug 2018 14:36:51 +0000 (16:36 +0200)]
improve panic message

5 years agouse is_uninhabited in more places
Jorge Aparicio [Thu, 23 Aug 2018 14:34:38 +0000 (16:34 +0200)]
use is_uninhabited in more places

5 years agopanic when instantiating an uninhabited type via mem::{uninitialized,zeroed}
Jorge Aparicio [Sun, 19 Aug 2018 15:36:04 +0000 (17:36 +0200)]
panic when instantiating an uninhabited type via mem::{uninitialized,zeroed}

5 years agoAuto merge of #54622 - matthewjasper:more-nll-mode, r=pnkfelix
bors [Sun, 30 Sep 2018 14:38:47 +0000 (14:38 +0000)]
Auto merge of #54622 - matthewjasper:more-nll-mode, r=pnkfelix

Enable NLL compare mode for more tests

Most of these tests were disabled due to NLL bugs that have since been fixed. A few needed updating for NLL.

r? @nikomatsakis

5 years agoadd test for fake self
csmoe [Sun, 30 Sep 2018 11:09:34 +0000 (19:09 +0800)]
add test for fake self

5 years agomake run-pass tests with empty main just compile-pass tests
Ralf Jung [Sun, 30 Sep 2018 12:27:26 +0000 (14:27 +0200)]
make run-pass tests with empty main just compile-pass tests

5 years agoAuto merge of #54596 - mjbshaw:drop, r=RalfJung
bors [Sun, 30 Sep 2018 12:00:45 +0000 (12:00 +0000)]
Auto merge of #54596 - mjbshaw:drop, r=RalfJung

Make core::mem::needs_drop a const fn

This fixes #51929.

5 years agomove ScalarMaybeUndef into the miri engine
Ralf Jung [Sun, 30 Sep 2018 11:09:26 +0000 (13:09 +0200)]
move ScalarMaybeUndef into the miri engine

5 years agodo not normalize non-scalar constants to a ConstValue::ScalarPair
Ralf Jung [Sun, 30 Sep 2018 10:37:00 +0000 (12:37 +0200)]
do not normalize non-scalar constants to a ConstValue::ScalarPair

5 years agoAuto merge of #53816 - zackmdavis:elided_lifetimes_in_paths_field_day, r=nikomatsakis
bors [Sun, 30 Sep 2018 09:22:31 +0000 (09:22 +0000)]
Auto merge of #53816 - zackmdavis:elided_lifetimes_in_paths_field_day, r=nikomatsakis

don't elide lifetimes in paths in librustc/

In light of the "Apply to rustc" checkbox on #44524 and @nikomatsakis's [recent comment about regularly wanting visual indication of elided lifetimes in types](https://github.com/rust-lang/rust/issues/44524#issuecomment-414663773), I was curious to see what it would look like if we turned the `elided_lifetimes_in_path` lint on in at least one crate in the codebase (I chose librustc). Given that I couldn't figure out how to get `cargo fix` work with the build system, this arguably wasn't a very efficient use of my time, but once I started, the conjunction of moral law and the sunk cost fallacy forced me to continue.

This is mostly applying the `<'_>` suggestions issued by the lint, but there were a few places where I named the lifetimes (_e.g._, `<'a, 'gcx, 'tcx>` on `TyCtxt`) in order to match style with surrounding code.

r? @nikomatsakis

5 years agoAuto merge of #54639 - nagisa:lets-alias-for-now, r=eddyb
bors [Sun, 30 Sep 2018 06:44:13 +0000 (06:44 +0000)]
Auto merge of #54639 - nagisa:lets-alias-for-now, r=eddyb

Do not put noalias annotations by default

This will be re-enabled sooner or later depending on results of further
investigation.

Fixes #54462

Beta backport is: #54640

r? @nikomatsakis

5 years agodon't elide lifetimes in paths in librustc/
Zack M. Davis [Thu, 30 Aug 2018 05:02:42 +0000 (22:02 -0700)]
don't elide lifetimes in paths in librustc/

This seemed like a good way to kick the tires on the
elided-lifetimes-in-paths lint (#52069)—seems to work! This was also
pretty tedious—it sure would be nice if `cargo fix` worked on this
codebase (#53896)!

5 years agoMerge branch 'master' into drop
Michael Bradshaw [Sun, 30 Sep 2018 02:51:09 +0000 (19:51 -0700)]
Merge branch 'master' into drop

5 years agoFix ui/run-pass/union/union-nodrop.rs test
Michael Bradshaw [Sun, 30 Sep 2018 02:49:17 +0000 (19:49 -0700)]
Fix ui/run-pass/union/union-nodrop.rs test

5 years agoAuto merge of #54601 - cuviper:prep-1.31, r=Mark-Simulacrum
bors [Sun, 30 Sep 2018 01:45:50 +0000 (01:45 +0000)]
Auto merge of #54601 - cuviper:prep-1.31, r=Mark-Simulacrum

Bump to 1.31.0 and bootstrap from 1.30 beta

Closes #54594.

5 years agoCorrect doc for WorkQueue<T>::pop().
Niek Sanders [Sat, 29 Sep 2018 22:24:37 +0000 (00:24 +0200)]
Correct doc for WorkQueue<T>::pop().

5 years agoAuto merge of #54591 - ljedrz:cleanup_typeck_rest, r=zackmdavis
bors [Sat, 29 Sep 2018 22:20:01 +0000 (22:20 +0000)]
Auto merge of #54591 - ljedrz:cleanup_typeck_rest, r=zackmdavis

A few cleanups and minor improvements to typeck

This PR complements https://github.com/rust-lang/rust/pull/54533, which was limited to `check`.

- change a few `push` loops to `extend`s
- prefer `to_owned` to `to_string` for string literals
- prefer `if let` to `match` where only one branch matters
- a few other minor improvements
- whitespace fixes

5 years agoRename sanitizer runtime libraries on OSX
Alex Crichton [Sat, 29 Sep 2018 19:37:12 +0000 (12:37 -0700)]
Rename sanitizer runtime libraries on OSX

Currently we ship sanitizer libraries as they're built, but these names
unfortunately conflict with the names of the sanitizer libraries
installed on the system. If a crate, for example, links in C code that
wants to use the system sanitizer and the Rust code doesn't use
sanitizers at all, then using `cargo` may accidentally pull in the
Rust-installed sanitizer library due to a conflict in names.

This change is intended to be entirely transparent for Rust users of
sanitizers, it should only hopefully improve our story with other users!

Closes #54134

5 years agoImprove bug! message for impossible case in Relate
Philipp Hansch [Sat, 29 Sep 2018 06:04:34 +0000 (08:04 +0200)]
Improve bug! message for impossible case in Relate

Hitting this branch in Clippy and I think it makes sense to print
both values here in case other people hit this branch, too.

5 years agoAuto merge of #54240 - csmoe:nonzero_from, r=alexcrichton
bors [Sat, 29 Sep 2018 19:38:12 +0000 (19:38 +0000)]
Auto merge of #54240 - csmoe:nonzero_from, r=alexcrichton

Impl From<NonZero<T>> for T

Closes https://github.com/rust-lang/rust/issues/54171

r? @SimonSapin

5 years agoImprove ux when calling associated functions with dot notation
Donato Sciarra [Mon, 17 Sep 2018 21:37:20 +0000 (23:37 +0200)]
Improve ux when calling associated functions with dot notation

Issue: 22692

5 years agorust: Add a `-C default-linker-libraries` option
Alex Crichton [Sat, 29 Sep 2018 18:03:59 +0000 (11:03 -0700)]
rust: Add a `-C default-linker-libraries` option

This commit adds a new codegen option for the compiler which disables
rustc's passing of `-nodefaultlibs` by default on relevant platforms.
Sometimes Rust is linked with C code which fails to link with
`-nodefaultlibs` and is unnecessarily onerous to get linking correctly
with `-nodefaultlibs`.

An example of this is that when you compile C code with sanitizers and
then pass `-fsanitize=address` to the linker, it's incompatible with
`-nodefaultlibs` also being passed to the linker.

In these situations it's easiest to turn off Rust's default passing of
`-nodefaultlibs`, which was more ideological to start with than
anything! Preserving the default is somewhat important but having this
be opt-in shouldn't cause any breakage.

Closes #54237

5 years agoupdate miri
Ralf Jung [Sat, 29 Sep 2018 17:43:15 +0000 (19:43 +0200)]
update miri

5 years agoAuto merge of #54599 - nikomatsakis:issue-54593-impl-Trait, r=eddyb
bors [Sat, 29 Sep 2018 15:07:59 +0000 (15:07 +0000)]
Auto merge of #54599 - nikomatsakis:issue-54593-impl-Trait, r=eddyb

use closure def-id in returns, but base def-id in locals

The refactorings to  handle `let x: impl Trait`  wound up breaking `impl Trait` in closure return types. I think there are some deeper problems with the code in question, but this a least should make @eddyb's example work.

Fixes #54593

r? @eddyb

5 years agorustc/infer: miscellaneous minor code improvements
ljedrz [Fri, 28 Sep 2018 15:38:02 +0000 (17:38 +0200)]
rustc/infer: miscellaneous minor code improvements

5 years agorustc/infer: readability improvements
ljedrz [Fri, 28 Sep 2018 15:35:31 +0000 (17:35 +0200)]
rustc/infer: readability improvements

5 years agorustc/infer: improve vector allocations
ljedrz [Fri, 28 Sep 2018 15:32:22 +0000 (17:32 +0200)]
rustc/infer: improve vector allocations

5 years agorustc/infer: use to_owned instead of to_string with string literals
ljedrz [Fri, 28 Sep 2018 15:28:47 +0000 (17:28 +0200)]
rustc/infer: use to_owned instead of to_string with string literals

5 years agorustc/infer: convert single-branch matches to if-let
ljedrz [Fri, 28 Sep 2018 15:26:10 +0000 (17:26 +0200)]
rustc/infer: convert single-branch matches to if-let

5 years agorustc/infer: use unwrap_or(_else) where applicable
ljedrz [Fri, 28 Sep 2018 15:20:37 +0000 (17:20 +0200)]
rustc/infer: use unwrap_or(_else) where applicable

5 years agoAuto merge of #54660 - kennytm:rollup, r=kennytm
bors [Sat, 29 Sep 2018 12:35:39 +0000 (12:35 +0000)]
Auto merge of #54660 - kennytm:rollup, r=kennytm

Rollup of 8 pull requests

Successful merges:

 - #54564 (Add 1.29.1 release notes)
 - #54567 (Include path in stamp hash for debuginfo tests)
 - #54577 (rustdoc: give proc-macros their own pages)
 - #54590 (std: Don't let `rust_panic` get inlined)
 - #54598 (Remove useless lifetimes from `Pin` `impl`s.)
 - #54604 (Added help message for `self_in_typedefs` feature gate)
 - #54635 (Improve docs for std::io::Seek)
 - #54645 (Compute Android gdb version in compiletest)

5 years agoDo not put noalias annotations by default
Simonas Kazlauskas [Fri, 28 Sep 2018 14:40:06 +0000 (17:40 +0300)]
Do not put noalias annotations by default

This will be re-enabled sooner or later depending on results of further
investigation.

Fixes #54462

5 years agoAuto merge of #54554 - RalfJung:maybe-uninit, r=nagisa
bors [Sat, 29 Sep 2018 09:58:09 +0000 (09:58 +0000)]
Auto merge of #54554 - RalfJung:maybe-uninit, r=nagisa

Revert most of MaybeUninit, except for the new API itself

This reverts most of https://github.com/rust-lang/rust/pull/53508/ for perf reasons (first commit reverts that entire PR), except for the new API itself (added back in 2nd commit).

5 years agoA few cleanups and minor improvements to typeck
ljedrz [Wed, 26 Sep 2018 15:32:23 +0000 (17:32 +0200)]
A few cleanups and minor improvements to typeck

5 years agoRollup merge of #54577 - QuietMisdreavus:docs-for-procs, r=GuillaumeGomez
kennytm [Sat, 29 Sep 2018 08:46:30 +0000 (16:46 +0800)]
Rollup merge of #54577 - QuietMisdreavus:docs-for-procs, r=GuillaumeGomez

rustdoc: give proc-macros their own pages

related to https://github.com/rust-lang/rust/issues/49553 but i don't think it'll fix it

Currently, rustdoc doesn't expose proc-macros all that well. In the source crate, only their definition function is exposed, but when re-exported, they're treated as a macro! This is an awkward situation in all accounts. This PR checks functions to see whether they have any of `#[proc_macro]`, `#[proc_macro_attribute]`, or `#[proc_macro_derive]`, and exposes them as macros instead. In addition, attributes and derives are exposed differently than other macros, getting their own item-type, CSS class, and module heading.

![image](https://user-images.githubusercontent.com/5217170/46044803-6df8da00-c0e1-11e8-8c3b-25d2c3beb55c.png)

Function-like proc-macros are lumped in with `macro_rules!` macros, but they get a different declaration block (i'm open to tweaking this, it's just what i thought of given how function-proc-macros operate):

![image](https://user-images.githubusercontent.com/5217170/46044828-84069a80-c0e1-11e8-9cc4-127e5477c395.png)

Proc-macro attributes and derives get their own pages, with a representative declaration block. Derive macros also show off their helper attributes:

![image](https://user-images.githubusercontent.com/5217170/46094583-ef9f4500-c17f-11e8-8f71-fa0a7895c9f6.png)

![image](https://user-images.githubusercontent.com/5217170/46101529-cab3cd80-c191-11e8-857a-946897750da1.png)

There's one wrinkle which this PR doesn't address, which is why i didn't mark this as fixing the linked issue. Currently, proc-macros don't expose their attributes or source span across crates, so while rustdoc knows they exist, that's about all the information it gets. This leads to an "inlined" macro that has absolutely no docs on it, and no `[src]` link to show you where it was declared.

The way i got around it was to keep proc-macro re-export disabled, since we do get enough information across crates to properly link to the source page:

![image](https://user-images.githubusercontent.com/5217170/46045074-2cb4fa00-c0e2-11e8-81bc-33a8205fbd03.png)

Until we can get a proc-macro's docs (and ideally also its source span) across crates, i believe this is the best way forward.

5 years agoRollup merge of #54645 - tromey:android-gdb-version, r=alexcrichton
kennytm [Sat, 29 Sep 2018 05:21:21 +0000 (13:21 +0800)]
Rollup merge of #54645 - tromey:android-gdb-version, r=alexcrichton

Compute Android gdb version in compiletest

compiletest has special code for running gdb for Android targets.  In
particular it computes a different path to gdb.  However, this gdb is
not used for the version test, which results in some tests being run
when they should not be.  You can see this in #54004.

This patch moves the special case to analyze_gdb and a new helper
function to decide whether the case applies.  This causes the version
check to work properly.

Note that the bulk of the runtest.rs change is just reindentation
caused by moving from a "match" to an "if" -- but there is a (small)
change buried in there.

5 years agoRollup merge of #54635 - neoeinstein:seek-docs, r=alexcrichton
kennytm [Sat, 29 Sep 2018 05:21:18 +0000 (13:21 +0800)]
Rollup merge of #54635 - neoeinstein:seek-docs, r=alexcrichton

Improve docs for std::io::Seek

Fixes #54562

5 years agoRollup merge of #54604 - alexreg:self_in_typedefs-help, r=estebank
kennytm [Sat, 29 Sep 2018 05:21:17 +0000 (13:21 +0800)]
Rollup merge of #54604 - alexreg:self_in_typedefs-help, r=estebank

Added help message for `self_in_typedefs` feature gate

Fixes #54563.

CC @Centril @estebank @leonardo-m

5 years agoRollup merge of #54598 - pthariensflame:patch-1, r=sfackler
kennytm [Sat, 29 Sep 2018 05:21:16 +0000 (13:21 +0800)]
Rollup merge of #54598 - pthariensflame:patch-1, r=sfackler

Remove useless lifetimes from `Pin` `impl`s.

These were evidently left in by accident when the new API was switched over to.

5 years agoRollup merge of #54590 - alexcrichton:inline-never-rust-panic, r=dtolnay
kennytm [Sat, 29 Sep 2018 05:21:15 +0000 (13:21 +0800)]
Rollup merge of #54590 - alexcrichton:inline-never-rust-panic, r=dtolnay

std: Don't let `rust_panic` get inlined

It's meant for breakpoints, so if it gets inlined we can't set a
breakpoint on it easily!

Will hopefully help fix at least one aspect of https://github.com/rust-lang/rust/issues/49013

5 years agoFix Once perf regression
Aleksey Kladov [Sat, 29 Sep 2018 08:07:48 +0000 (11:07 +0300)]
Fix Once perf regression

Because `call_once` is generic, but `is_completed` is not, we need
`#[inline]` annotation to allow LLVM to inline `is_completed` into
`call_once` in downstream crates.

5 years agoadd MaybeUninit
Jorge Aparicio [Sun, 19 Aug 2018 13:51:35 +0000 (15:51 +0200)]
add MaybeUninit

5 years agoRevert "Auto merge of #53508 - japaric:maybe-uninit, r=RalfJung"
Ralf Jung [Tue, 25 Sep 2018 13:07:27 +0000 (15:07 +0200)]
Revert "Auto merge of #53508 - japaric:maybe-uninit, r=RalfJung"

This reverts commit c6e3d7fa3113aaa64602507f39d4627c427742ff, reversing
changes made to 4591a245c7eec9f70d668982b1383cd2a6854af5.

5 years agoAuto merge of #54576 - froydnj:non-x86-abi-adjustment, r=alexcrichton
bors [Sat, 29 Sep 2018 07:23:00 +0000 (07:23 +0000)]
Auto merge of #54576 - froydnj:non-x86-abi-adjustment, r=alexcrichton

ignore {std,fast,vector,this}call on non-x86 windows

MSVC ignores these keywords for C/C++ and uses the standard system
calling convention.  Rust should do so as well.

Fixes #54569.

5 years agoRollup merge of #54567 - tromey:paths-in-stamp-hashes, r=Mark-Simulacrum
kennytm [Sat, 29 Sep 2018 05:21:12 +0000 (13:21 +0800)]
Rollup merge of #54567 - tromey:paths-in-stamp-hashes, r=Mark-Simulacrum

Include path in stamp hash for debuginfo tests

The debuginfo tests are exposed to the environment in a couple of
ways: the path to the gdb executable matters, as does the Python path
used when loading lldb.

This patch incorporates these paths into the hash that is written to
the stamp file, so that changing the path will cause the tests to be
re-run.

5 years agoRollup merge of #54564 - alexcrichton:new-notes, r=kennytm
kennytm [Sat, 29 Sep 2018 05:21:10 +0000 (13:21 +0800)]
Rollup merge of #54564 - alexcrichton:new-notes, r=kennytm

Add 1.29.1 release notes

Forward-port of #54397, should have included it earlier!

5 years agoAuto merge of #54278 - eddyb:spanned-generic-predicates, r=nikomatsakis
bors [Sat, 29 Sep 2018 03:42:38 +0000 (03:42 +0000)]
Auto merge of #54278 - eddyb:spanned-generic-predicates, r=nikomatsakis

rustc: keep a Span for each predicate in ty::GenericPredicates.

This should allow finer-grained diagnostics, including migration suggestions for #54090.
(Note that I haven't changed most of the users of `predicates_of` to use the new spans)

r? @nikomatsakis

5 years agoIndicate how to move value out of Box in docs.
Corey Farwell [Tue, 25 Sep 2018 01:55:54 +0000 (21:55 -0400)]
Indicate how to move value out of Box in docs.

Fixes https://github.com/rust-lang/rust/issues/53634.

5 years agoAuto merge of #53013 - zackmdavis:infer_outlints, r=nikomatsakis
bors [Sat, 29 Sep 2018 01:09:07 +0000 (01:09 +0000)]
Auto merge of #53013 - zackmdavis:infer_outlints, r=nikomatsakis

in which inferable outlives-requirements are linted

RFC 2093 (tracking issue #44493) lets us leave off these
commonsensically inferable `T: 'a` outlives requirements. (A separate
feature-gate was split off for the case of 'static lifetimes, for
which questions still remain.) Detecting these was requested as an
idioms-2018 lint.

Resolves #52042, an item under the fabulous metaïssue #52047.

It's plausible that this shouldn't land until after `infer_outlives_requirements` has been stabilized ([final comment period started](https://github.com/rust-lang/rust/issues/44493#issuecomment-408852946) 4 days ago), but I think there's also a strong case to not-wait in order to maximize the time that [Edition Preview 2](https://internals.rust-lang.org/t/rust-2018-release-schedule-and-extended-beta/8076) users have to kick at it. (It's allow by default, so there's no impact unless you explicitly turn it or the rust-2018-idioms group up to `warn` or higher.)

Questions—

 * Is `explicit-outlives-requirements` a good name? (I chose it as an [RFC 344](https://github.com/rust-lang/rfcs/blob/master/text/0344-conventions-galore.md#lints)-compliant "inversion" of the feature-gate name, `infer_outlives_requirements`, but I could imagine someone arguing that the word `struct` should be part of the name somewhere, for specificity.)

 * Are there any false-positives or false-negatives? @nikomatsakis [said that](https://github.com/rust-lang/rust/issues/52042#issuecomment-406409795) getting this right would be "fairly hard", which makes me nervous that I'm missing something. The UI test in the initial submission of this pull request just exercises the examples [given in the Edition Guide](https://rust-lang-nursery.github.io/edition-guide/2018/transitioning/ownership-and-lifetimes/struct-inference.html).

![infer_outlints](https://user-images.githubusercontent.com/1076988/43625740-6bf43dca-96a3-11e8-9dcf-793ac83d424d.png)

r? @alexcrichton