]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoAuto merge of #53815 - F001:if-let-guard, r=petrochenkov
bors [Sat, 1 Sep 2018 20:31:29 +0000 (20:31 +0000)]
Auto merge of #53815 - F001:if-let-guard, r=petrochenkov

refactor match guard

This is the first step to implement RFC 2294: if-let-guard. Tracking issue: https://github.com/rust-lang/rust/issues/51114

The second step should be introducing another variant `IfLet` in the Guard enum. I separated them into 2 PRs for the convenience of reviewers.

r? @petrochenkov

5 years agoAuto merge of #53533 - withoutboats:error-source, r=withoutboats
bors [Sat, 1 Sep 2018 18:08:45 +0000 (18:08 +0000)]
Auto merge of #53533 - withoutboats:error-source, r=withoutboats

Add Error::source method per RFC 2504.

This implements part of RFC 2504.

* Adds `Error::source`, a replacement for `Error::cause` with the "right" signature, which will be instantly stable.
* Deprecates `Error::cause` in 1.33 (this choice was based on the precedent in #52994, which we haven't finalized).
* Redefines `Error::cause` to delegate to `Error::source` (the delegation can only go in this direction, not the other).

@rfcbot fcp merge

5 years agoAuto merge of #53884 - kennytm:rollup, r=kennytm
bors [Sat, 1 Sep 2018 15:48:21 +0000 (15:48 +0000)]
Auto merge of #53884 - kennytm:rollup, r=kennytm

Rollup of 9 pull requests

Successful merges:

 - #53076 (set cfg(rustdoc) when rustdoc is running on a crate)
 - #53622 (cleanup: Add main functions to some UI tests)
 - #53769 (Also link Clippy repo in the CONTRIBUTING.md file)
 - #53774 (Add rust-gdbgui script.)
 - #53781 (bench: libcore: fix build failure of any.rs benchmark (use "dyn Any"))
 - #53782 (Make Arc cloning mechanics clearer in module docs)
 - #53790 (Add regression test for issue #52060)
 - #53801 (Prevent duplicated impl on foreign types)
 - #53850 (Nuke the `const_to_allocation` query)

5 years agoRollup merge of #53076 - QuietMisdreavus:cfg-rustdoc, r=GuillaumeGomez
kennytm [Sat, 1 Sep 2018 15:18:41 +0000 (23:18 +0800)]
Rollup merge of #53076 - QuietMisdreavus:cfg-rustdoc, r=GuillaumeGomez

set cfg(rustdoc) when rustdoc is running on a crate

When using `#[doc(cfg)]` to document platform-specific items, it's a little cumbersome to get all the platforms' items to appear all at once. For example, the standard library adds `--cfg dox` to rustdoc's command line whenever it builds docs, and the documentation for `#![feature(doc_cfg)]` suggests using a Cargo feature to approximate the same thing. This is a little awkward, because you always need to remember to set `--features dox` whenever you build documentation.

This PR proposes making rustdoc set `#[cfg(rustdoc)]` whenever it runs on a crate, to provide an officially-sanctioned version of this that is set automatically. This way, there's a standardized way to declare that a certain version of an item is specifically when building docs.

To try to prevent the spread of this feature from happening too quickly, this PR also restricts the use of this flag to whenever `#![feature(doc_cfg)]` is active. I'm sure there are other uses for this, but right now i'm tying it to this feature. (If it makes more sense to give this its own feature, i can easily do that.)

5 years agoRollup merge of #53850 - csmoe:const_to_alloc, r=RalfJung
kennytm [Sat, 1 Sep 2018 13:14:16 +0000 (21:14 +0800)]
Rollup merge of #53850 - csmoe:const_to_alloc, r=RalfJung

Nuke the `const_to_allocation` query

Closes https://github.com/rust-lang/rust/issues/53847
r? @RalfJung
`./x.py check` works anyway, let's checkout tests from ci.

5 years agoRollup merge of #53801 - GuillaumeGomez:duplicated-foreign-type-impls, r=QuietMisdreavus
kennytm [Sat, 1 Sep 2018 13:14:15 +0000 (21:14 +0800)]
Rollup merge of #53801 - GuillaumeGomez:duplicated-foreign-type-impls, r=QuietMisdreavus

Prevent duplicated impl on foreign types

Fixes #53689.

r? @QuietMisdreavus

5 years agoRollup merge of #53790 - zilbuz:issue-52060, r=nikomatsakis
kennytm [Sat, 1 Sep 2018 13:14:14 +0000 (21:14 +0800)]
Rollup merge of #53790 - zilbuz:issue-52060, r=nikomatsakis

Add regression test for issue #52060

Fix #52060

5 years agoRollup merge of #53782 - rask:task/arc-docs-adjustment, r=cramertj
kennytm [Sat, 1 Sep 2018 13:14:13 +0000 (21:14 +0800)]
Rollup merge of #53782 - rask:task/arc-docs-adjustment, r=cramertj

Make Arc cloning mechanics clearer in module docs

Add some more wording to module documentation regarding how
`Arc::clone()` works, as some users have assumed cloning Arc's
to work via dereferencing to inner value as follows:

    use std::sync::Arc;

    let myarc = Arc::new(1);
    let myarcref = myarc.clone();

    assert!(1 == myarcref);

Instead of the actual mechanic of referencing the existing
Arc value:

    use std::sync::Arg;

    let myarc = Arc::new(1);
    let myarcref = myarc.clone();

    assert!(myarcref == &myarc); // not sure if assert could assert this in the real world

5 years agoRollup merge of #53781 - matthiaskrgr:fix_any_bench, r=kennytm
kennytm [Sat, 1 Sep 2018 13:14:11 +0000 (21:14 +0800)]
Rollup merge of #53781 - matthiaskrgr:fix_any_bench, r=kennytm

bench: libcore: fix build failure of any.rs benchmark (use "dyn Any")

fixes
````
error: trait objects without an explicit `dyn` are deprecated
  --> libcore/../libcore/benches/any.rs:18:36
   |
18 |         let mut y = &mut x as &mut Any;
   |                                    ^^^ help: use `dyn`: `dyn Any`
   |
   = note: requested on the command line with `-D bare-trait-objects`
````

5 years agoRollup merge of #53774 - PhilipDaniels:master, r=tromey
kennytm [Sat, 1 Sep 2018 13:14:10 +0000 (21:14 +0800)]
Rollup merge of #53774 - PhilipDaniels:master, r=tromey

Add rust-gdbgui script.

This script invokes the [gdbgui](https://gdbgui.com/) graphical GDB front-end with the Rust pretty printers loaded. The script does not install gdbgui, that must be done manually.

As an escapee from Visual Studio it is nice to have a point-and-click debugger. This script invokes `gdbgui` similarly to the way that `rust-gdb` invokes `gdb` - I copied that script as a starting point.

Because it is a wrapper around a wrapper you don't have as much flexibility in passing arguments to GDB and I could not find a way to eliminate the single quotes you have to use when you want to pass arguments to your program (`gdbgui` supposedly supports an `--args` option which I think should allow this, but I couldn't get it to work, my shell-fu is weak). Still, I find this very usable for debugging programs, and it is a lot more approachable than gdb in the terminal.

5 years agoRollup merge of #53769 - flip1995:patch-1, r=kennytm
kennytm [Sat, 1 Sep 2018 13:14:09 +0000 (21:14 +0800)]
Rollup merge of #53769 - flip1995:patch-1, r=kennytm

Also link Clippy repo in the CONTRIBUTING.md file

r? @steveklabnik

5 years agoRollup merge of #53622 - petrochenkov:nomain, r=oli-obk
kennytm [Sat, 1 Sep 2018 13:14:07 +0000 (21:14 +0800)]
Rollup merge of #53622 - petrochenkov:nomain, r=oli-obk

cleanup: Add main functions to some UI tests

5 years agoAuto merge of #53604 - oli-obk:min_const_fn, r=Centril,varkor
bors [Sat, 1 Sep 2018 11:26:24 +0000 (11:26 +0000)]
Auto merge of #53604 - oli-obk:min_const_fn, r=Centril,varkor

Implement the `min_const_fn` feature gate

cc @RalfJung @eddyb

r? @Centril

implements the feature gate for #53555

I added a hack so the `const_fn` feature gate also enables the `min_const_fn` feature gate. This ensures that nightly users of `const_fn` don't have to touch their code at all.

The `min_const_fn` checks are run first, and if they succeeded, the `const_fn` checks are run additionally to ensure we didn't miss anything.

5 years agobug! instead of panic!
csmoe [Sat, 1 Sep 2018 10:13:28 +0000 (18:13 +0800)]
bug! instead of panic!

5 years agoAuto merge of #53822 - dvc94ch:riscv, r=japaric
bors [Sat, 1 Sep 2018 06:58:16 +0000 (06:58 +0000)]
Auto merge of #53822 - dvc94ch:riscv, r=japaric

[RISCV] Use lld as the default linker; Enable C extension; Add riscv32imc-unknown-none-elf target

The riscv32imc-unknown-none-elf target is intended for soft cores.

The riscv32imc target is supported by the following popular soft cores:

picorv32: https://github.com/cliffordwolf/picorv32
vexriscv: https://github.com/SpinalHDL/VexRiscv
pulp riscy: https://github.com/pulp-platform/riscv
pulp zero-riscy: https://github.com/pulp-platform/zero-riscy

5 years agoAuto merge of #53762 - flip1995:tool_lints, r=Manishearth
bors [Sat, 1 Sep 2018 03:27:42 +0000 (03:27 +0000)]
Auto merge of #53762 - flip1995:tool_lints, r=Manishearth

Backwards compatibility for tool/clippy lints

cc #44690
cc https://github.com/rust-lang-nursery/rust-clippy/pull/2977#issuecomment-409706557

This is the next step towards `tool_lints`.

This makes Clippy lints still work without scoping, but will warn and suggest the new scoped name. This warning will only appear if the code is checked with Clippy itself.

There is still an issue with using the old lint name in inner attributes. For inner attributes the warning gets emitted twice. I'm currently not really sure why this happens, but will try to fix this ASAP.

r? @Manishearth

5 years agoimprove panic message
csmoe [Sat, 1 Sep 2018 01:49:24 +0000 (09:49 +0800)]
improve panic message

5 years agoAuto merge of #53611 - alexcrichton:update-llvm, r=nikomatsakis
bors [Sat, 1 Sep 2018 01:07:31 +0000 (01:07 +0000)]
Auto merge of #53611 - alexcrichton:update-llvm, r=nikomatsakis

Update LLVM submodule

This commit updates the LLVM submodule to the current trunk of LLVM itself. This
brings a few notable improvements for the wasm target:

* Support for wasm atomic instructions is greatly improved
* Renamed memory wasm intrinsics are fully supported
* LLD has fixed a quadratic execution bug with large numbers of relocations in
  wasm files.

The compiler-rt submodule has been updated in tandem as well.

5 years agoUpdate LLVM submodule
Alex Crichton [Wed, 22 Aug 2018 18:17:36 +0000 (11:17 -0700)]
Update LLVM submodule

This commit updates the LLVM submodule to the current trunk of LLVM itself. This
brings a few notable improvements for the wasm target:

* Support for wasm atomic instructions is greatly improved
* Renamed memory wasm intrinsics are fully supported
* LLD has fixed a quadratic execution bug with large numbers of relocations in
  wasm files.

The compiler-rt submodule has been updated in tandem as well.

5 years agoAuto merge of #53755 - llogiq:fix-unsound-16bit-range, r=nagisa
bors [Fri, 31 Aug 2018 22:44:17 +0000 (22:44 +0000)]
Auto merge of #53755 - llogiq:fix-unsound-16bit-range, r=nagisa

fix u32 steps_between for 16-bit systems

This fixes #48006.

5 years agouse cfg(rustdoc) instead of cfg(dox) in std and friends
QuietMisdreavus [Sat, 4 Aug 2018 23:29:47 +0000 (18:29 -0500)]
use cfg(rustdoc) instead of cfg(dox) in std and friends

5 years agofeature(doc_cfg): add docs for cfg(rustdoc)
QuietMisdreavus [Sat, 4 Aug 2018 23:28:36 +0000 (18:28 -0500)]
feature(doc_cfg): add docs for cfg(rustdoc)

5 years agofeature(doc_cfg): set cfg(rustdoc) when rustdoc is running
QuietMisdreavus [Sat, 4 Aug 2018 23:12:38 +0000 (18:12 -0500)]
feature(doc_cfg): set cfg(rustdoc) when rustdoc is running

5 years agoAuto merge of #51384 - QuietMisdreavus:extern-version, r=GuillaumeGomez
bors [Fri, 31 Aug 2018 17:39:28 +0000 (17:39 +0000)]
Auto merge of #51384 - QuietMisdreavus:extern-version, r=GuillaumeGomez

rustdoc: add flag to control the html_root_url of dependencies

The `--extern-html-root-url` flag in this PR allows one to override links to crates whose docs are not already available locally in the doc bundle. Docs.rs currently uses a version of this to make sure links to other crates go into that crate's docs.rs page. See the included test for intended use, but the idea is as follows:

Calling rustdoc with `--extern-html-root-url crate=https://some-url.com` will cause rustdoc to override links that point to that crate to instead be replaced with a link rooted at `https://some-url.com/`. (e.g. for docs.rs this would be `https://docs.rs/crate/0.1.0` or the like.) Cheekily, rustup could use these options to redirect links to std/core/etc to instead point to locally-downloaded docs, if it so desired.

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

5 years agocleanup: Add main functions to some UI tests
Vadim Petrochenkov [Wed, 22 Aug 2018 23:19:38 +0000 (02:19 +0300)]
cleanup: Add main functions to some UI tests

5 years agoAuto merge of #53699 - oli-obk:promotion_stability_hole, r=nikomatsakis
bors [Fri, 31 Aug 2018 14:06:14 +0000 (14:06 +0000)]
Auto merge of #53699 - oli-obk:promotion_stability_hole, r=nikomatsakis

Fix promotion stability hole in old borrowck

r? @nikomatsakis

I screwed up the promotion stability checks. Big time. They were basically nonexistant. We had tests for it. I also screwed up said tests. This is in stable already :(

Basically stability checks of promotion only worked if you tried to use a const fn defined in the same crate.

cc @eddyb

5 years agoAuto merge of #53403 - spastorino:move-out-lazily, r=nikomatsakis
bors [Fri, 31 Aug 2018 11:25:53 +0000 (11:25 +0000)]
Auto merge of #53403 - spastorino:move-out-lazily, r=nikomatsakis

Do not used Move data flow analysis, make it lazy instead

Close #53394

5 years agoextract allocation info from byref
csmoe [Fri, 31 Aug 2018 10:31:15 +0000 (18:31 +0800)]
extract allocation info from byref

5 years agotrip const_to_alloc query
csmoe [Fri, 31 Aug 2018 10:30:38 +0000 (18:30 +0800)]
trip const_to_alloc query

5 years agoGet rid of token passing
Oliver Schneider [Fri, 31 Aug 2018 09:47:45 +0000 (11:47 +0200)]
Get rid of token passing

5 years agoAdd clearer wording to Arc clone example code
Otto Rask [Fri, 31 Aug 2018 08:21:01 +0000 (11:21 +0300)]
Add clearer wording to Arc clone example code

5 years agoFix typo and small mistake
flip1995 [Thu, 30 Aug 2018 08:28:18 +0000 (10:28 +0200)]
Fix typo and small mistake

5 years agoUpdate tests
flip1995 [Thu, 30 Aug 2018 08:27:35 +0000 (10:27 +0200)]
Update tests

5 years agoAdd hint for cfg_attr and fix test
flip1995 [Wed, 29 Aug 2018 22:12:47 +0000 (00:12 +0200)]
Add hint for cfg_attr and fix test

5 years agoImplement backwards compatibility for tool_lints
flip1995 [Mon, 27 Aug 2018 21:25:31 +0000 (23:25 +0200)]
Implement backwards compatibility for tool_lints

5 years agoAdd deprecated_name argument to the register lint group functions
flip1995 [Mon, 27 Aug 2018 21:24:42 +0000 (23:24 +0200)]
Add deprecated_name argument to the register lint group functions

5 years agoAdd tests for backward compat
flip1995 [Mon, 27 Aug 2018 21:22:47 +0000 (23:22 +0200)]
Add tests for backward compat

5 years agoMake `Condvar::new` and `RWLock::new` min const fn for cloudabi
Oliver Schneider [Thu, 30 Aug 2018 08:45:05 +0000 (10:45 +0200)]
Make `Condvar::new` and `RWLock::new` min const fn for cloudabi

5 years agoAdd test that min const fns can't call unstable min const fns even with the feature...
Oliver Schneider [Thu, 30 Aug 2018 08:39:41 +0000 (10:39 +0200)]
Add test that min const fns can't call unstable min const fns even with the feature gate active

5 years agoRestrict most uses of `const_fn` to `min_const_fn`
Oliver Schneider [Wed, 29 Aug 2018 11:20:43 +0000 (13:20 +0200)]
Restrict most uses of `const_fn` to `min_const_fn`

5 years agoLibstd only has `min_const_fn` const fns
Oliver Schneider [Wed, 29 Aug 2018 11:00:14 +0000 (13:00 +0200)]
Libstd only has `min_const_fn` const fns

5 years agoImplement the `min_const_fn` feature gate
Oliver Schneider [Wed, 22 Aug 2018 13:56:37 +0000 (15:56 +0200)]
Implement the `min_const_fn` feature gate

5 years agoAuto merge of #53832 - pietroalbini:rollup, r=pietroalbini
bors [Fri, 31 Aug 2018 03:35:33 +0000 (03:35 +0000)]
Auto merge of #53832 - pietroalbini:rollup, r=pietroalbini

Rollup of 20 pull requests

Successful merges:

 - #51760 (Add another PartialEq example)
 - #53113 (Add example for Cow)
 - #53129 (remove `let x = baz` which was obscuring the real error)
 - #53389 (document effect of join on memory ordering)
 - #53472 (Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.)
 - #53476 (Add partialeq implementation for TryFromIntError type)
 - #53513 (Force-inline `shallow_resolve` at its hottest call site.)
 - #53655 (set applicability)
 - #53702 (Fix stabilisation version for macro_vis_matcher.)
 - #53727 (Do not suggest dereferencing in macro)
 - #53732 (save-analysis: Differentiate foreign functions and statics.)
 - #53740 (add llvm-readobj to llvm-tools-preview)
 - #53743 (fix a typo: taget_env -> target_env)
 - #53747 (Rustdoc fixes)
 - #53753 (expand keep-stage --help text)
 - #53756 (Fix typo in comment)
 - #53768 (move file-extension based .gitignore down to src/)
 - #53785 (Fix a comment in src/libcore/slice/mod.rs)
 - #53786 (Replace usages of 'bad_style' with 'nonstandard_style'.)
 - #53806 (Fix UI issues on Implementations on Foreign types)

Failed merges:

r? @ghost

5 years agoAuto merge of #53779 - RalfJung:miri-refactor, r=oli-obk
bors [Fri, 31 Aug 2018 01:18:42 +0000 (01:18 +0000)]
Auto merge of #53779 - RalfJung:miri-refactor, r=oli-obk

Miri refactor: Final round

Tying up some loose ends that I noticed in the previous PRs -- and finally getting argument passing into a shape where @eddyb says it is "okay", which is a big improvement over the previous verdict that I cannot quote in public. ;)

Also move a bunch of useful helpers to construct `Scalar` from miri to here.

Cc @eddyb
r? @oli-obk

5 years agoAuto merge of #53828 - alexcrichton:dist-llvm-shared, r=japaric
bors [Thu, 30 Aug 2018 22:54:34 +0000 (22:54 +0000)]
Auto merge of #53828 - alexcrichton:dist-llvm-shared, r=japaric

rustbuild: Distribute libLLVM.so with rustc

A recent change (#53245) started to build LLVM with ThinLTO enabled and to
ensure that compile times are kept down it builds LLVM dynamically by default to
ensure that all the various LLVM tools aren't redoing all that optimization
work. This means, however, that all LLVM tools depend on LLVM's dynamic library
by default.

While the LLVM tools and LLDB components were updated to include the shared
library we accidentally forgot about LLD, included with the main rustc
component. LLD also links dynamically to LLVM and ships a non-working binary
right now because of this!

This commit updates our distribution to ship the LLVM dynamic library with the
compiler libraries.  While not technically needed for rustc itself to operate
(right now) it may be needed for LLD, and otherwise it serves as a good basis
for the other LLVM tools components to work with as well.

This should...

Closes #53813

5 years agoRun rustfmt
Santiago Pastorino [Thu, 30 Aug 2018 18:06:27 +0000 (15:06 -0300)]
Run rustfmt

5 years agoMake move out computation lazy
Santiago Pastorino [Thu, 30 Aug 2018 21:54:32 +0000 (18:54 -0300)]
Make move out computation lazy

5 years agoFix direction of slashes in the help text example.
Philip Daniels [Thu, 30 Aug 2018 19:23:41 +0000 (20:23 +0100)]
Fix direction of slashes in the help text example.

5 years ago[RISCV] Disable atomics for riscv32imc-unknown-none-elf.
David Craven [Thu, 30 Aug 2018 18:35:36 +0000 (20:35 +0200)]
[RISCV] Disable atomics for riscv32imc-unknown-none-elf.

5 years agoRollup merge of #53806 - GuillaumeGomez:fix-ui-issues-foreign-type-impls, r=QuietMisd...
Pietro Albini [Thu, 30 Aug 2018 18:15:48 +0000 (20:15 +0200)]
Rollup merge of #53806 - GuillaumeGomez:fix-ui-issues-foreign-type-impls, r=QuietMisdreavus

Fix UI issues on Implementations on Foreign types

Fixes #53800.

<img width="1440" alt="screen shot 2018-08-29 at 22 06 35" src="https://user-images.githubusercontent.com/3050060/44814733-e9986180-abdd-11e8-97e0-0e3c1816ca04.png">

r? @QuietMisdreavus

5 years agoRollup merge of #53786 - frewsxcv:frewsxcv-bad-style, r=Manishearth
Pietro Albini [Thu, 30 Aug 2018 18:15:47 +0000 (20:15 +0200)]
Rollup merge of #53786 - frewsxcv:frewsxcv-bad-style, r=Manishearth

Replace usages of 'bad_style' with 'nonstandard_style'.

`bad_style` is being deprecated in favor of `nonstandard_style`:

- https://github.com/rust-lang/rust/issues/41646

5 years agoRollup merge of #53785 - tbu-:pr_comment, r=Mark-Simulacrum
Pietro Albini [Thu, 30 Aug 2018 18:15:46 +0000 (20:15 +0200)]
Rollup merge of #53785 - tbu-:pr_comment, r=Mark-Simulacrum

Fix a comment in src/libcore/slice/mod.rs

5 years agoRollup merge of #53768 - RalfJung:gitignore, r=nikomatsakis
Pietro Albini [Thu, 30 Aug 2018 18:15:44 +0000 (20:15 +0200)]
Rollup merge of #53768 - RalfJung:gitignore, r=nikomatsakis

move file-extension based .gitignore down to src/

Currently, it for example ignores `*.rlib` files in the repository root -- which I think is wrong; I sometimes get these files when I call rustc directly and I do want them cleaned up, not ignored. No such files are created during the normal build process.

5 years agoRollup merge of #53756 - dmerejkowsky:fix-comment, r=KodrAus
Pietro Albini [Thu, 30 Aug 2018 18:15:43 +0000 (20:15 +0200)]
Rollup merge of #53756 - dmerejkowsky:fix-comment, r=KodrAus

Fix typo in comment

5 years agoRollup merge of #53753 - RalfJung:keep-stage, r=nikomatsakis
Pietro Albini [Thu, 30 Aug 2018 18:15:42 +0000 (20:15 +0200)]
Rollup merge of #53753 - RalfJung:keep-stage, r=nikomatsakis

expand keep-stage --help text

5 years agoRollup merge of #53747 - GuillaumeGomez:rustdoc-fixes, r=QuietMisdreavus
Pietro Albini [Thu, 30 Aug 2018 18:15:40 +0000 (20:15 +0200)]
Rollup merge of #53747 - GuillaumeGomez:rustdoc-fixes, r=QuietMisdreavus

Rustdoc fixes

Fixes rustdoc not scrolling to given lines and invalid unstable display:

<img width="1440" alt="screen shot 2018-08-27 at 23 28 47" src="https://user-images.githubusercontent.com/3050060/44687252-06535e80-aa51-11e8-8512-d7d34d1cb963.png">

r? @QuietMisdreavus

5 years agoRollup merge of #53743 - oconnor663:target_env, r=kennytm
Pietro Albini [Thu, 30 Aug 2018 18:15:39 +0000 (20:15 +0200)]
Rollup merge of #53743 - oconnor663:target_env, r=kennytm

fix a typo: taget_env -> target_env

This typo was introduced in https://github.com/rust-lang/rust/pull/47334. A couple tests bitrotted as a result, so we fix those too, and move them to a more sensible place.

Is there some lint we could turn on that would've caught this? It's a drag that cfg typos can silently pass through the compiler.

5 years agoRollup merge of #53740 - japaric:readobj, r=alexcrichton
Pietro Albini [Thu, 30 Aug 2018 18:15:38 +0000 (20:15 +0200)]
Rollup merge of #53740 - japaric:readobj, r=alexcrichton

add llvm-readobj to llvm-tools-preview

Similar to readelf but supports more object formats (it seems). Particularly useful to inspect in detail sections (e.g. their flags) and symbols (e.g. their types).

r? @alexcrichton
cc @dvc94ch

5 years agoRollup merge of #53732 - emilio:foreign-fn, r=nrc
Pietro Albini [Thu, 30 Aug 2018 18:15:37 +0000 (20:15 +0200)]
Rollup merge of #53732 - emilio:foreign-fn, r=nrc

save-analysis: Differentiate foreign functions and statics.

5 years agoRollup merge of #53727 - estebank:incorrect-deref-suggestion, r=nikomatsakis
Pietro Albini [Thu, 30 Aug 2018 18:15:35 +0000 (20:15 +0200)]
Rollup merge of #53727 - estebank:incorrect-deref-suggestion, r=nikomatsakis

Do not suggest dereferencing in macro

Fix #52783.

5 years agoRollup merge of #53702 - jkozlowski:correct_version_for_macro_vis_matcher, r=cramertj
Pietro Albini [Thu, 30 Aug 2018 18:15:34 +0000 (20:15 +0200)]
Rollup merge of #53702 - jkozlowski:correct_version_for_macro_vis_matcher, r=cramertj

Fix stabilisation version for macro_vis_matcher.

r? @cramertj

5 years agoRollup merge of #53655 - jcpst:with_applicability, r=estebank
Pietro Albini [Thu, 30 Aug 2018 18:15:33 +0000 (20:15 +0200)]
Rollup merge of #53655 - jcpst:with_applicability, r=estebank

set applicability

Update a few more calls as described in #50723

r? @estebank

5 years agoRollup merge of #53513 - nnethercote:inline-shallow_resolve, r=varkor
Pietro Albini [Thu, 30 Aug 2018 18:15:31 +0000 (20:15 +0200)]
Rollup merge of #53513 - nnethercote:inline-shallow_resolve, r=varkor

Force-inline `shallow_resolve` at its hottest call site.

It's a ~1% win on `keccak` and `inflate`.

5 years agoRollup merge of #53476 - GuillaumeGomez:try-from-int-error-partial-eq, r=KodrAus
Pietro Albini [Thu, 30 Aug 2018 18:15:30 +0000 (20:15 +0200)]
Rollup merge of #53476 - GuillaumeGomez:try-from-int-error-partial-eq, r=KodrAus

Add partialeq implementation for TryFromIntError type

Fixes #53458.

5 years agoRollup merge of #53472 - eddyb:fx-pls, r=pnkfelix
Pietro Albini [Thu, 30 Aug 2018 18:15:29 +0000 (20:15 +0200)]
Rollup merge of #53472 - eddyb:fx-pls, r=pnkfelix

Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.

Most of the compiler uses the `Fx` hasher but some places ended up with the default one.

5 years agoRollup merge of #53389 - RalfJung:thread-join, r=sfackler
Pietro Albini [Thu, 30 Aug 2018 18:15:27 +0000 (20:15 +0200)]
Rollup merge of #53389 - RalfJung:thread-join, r=sfackler

document effect of join on memory ordering

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

5 years agoRollup merge of #53129 - nikomatsakis:issue-51172-tweak-test, r=pnkfelix
Pietro Albini [Thu, 30 Aug 2018 18:15:26 +0000 (20:15 +0200)]
Rollup merge of #53129 - nikomatsakis:issue-51172-tweak-test, r=pnkfelix

remove `let x = baz` which was obscuring the real error

fixes #51172

5 years agoRollup merge of #53113 - kpp:more_docs_for_cow, r=GuillaumeGomez
Pietro Albini [Thu, 30 Aug 2018 18:15:25 +0000 (20:15 +0200)]
Rollup merge of #53113 - kpp:more_docs_for_cow, r=GuillaumeGomez

Add example for Cow

Add one more example that shows how to keep `Cow` in a struct.

Link to playground: https://play.rust-lang.org/?gist=a9256bdd034b44bc3cdd0044bbcdbb7c&version=stable&mode=debug&edition=2015

Users ask this question in [ruRust](https://gitter.im/ruRust/general) chat time to time and it is not obvious to add `ToOwned<Owned=Target>` to requirements of generic params.

5 years agoRollup merge of #51760 - GuillaumeGomez:add-another-partialeq-example, r=QuietMisdreavus
Pietro Albini [Thu, 30 Aug 2018 18:15:23 +0000 (20:15 +0200)]
Rollup merge of #51760 - GuillaumeGomez:add-another-partialeq-example, r=QuietMisdreavus

Add another PartialEq example

r? @steveklabnik

5 years agoAuto merge of #53803 - pietroalbini:fix-manifest-2, r=alexcrichton
bors [Thu, 30 Aug 2018 17:29:13 +0000 (17:29 +0000)]
Auto merge of #53803 - pietroalbini:fix-manifest-2, r=alexcrichton

Fix manifests for broken tools: take 2

This is a follow up of #53715, to avoid stripping unavailable components from the extensions list. This time I also figured out how to test the changes, so the produced manifest is correct.

Along with the fix I added a README with instructions on how to test the tool, and a new `BUILD_MANIFEST_DISABLE_SIGNING` env var to avoid dealing with gpg while testing the tool. I chose an env var instead of a flag because it's more difficult to have it slip in by accident on CI, and there is also another protection that panics if that env var is set on CI, just to be sure we don't release unsigned artifacts.

r? @alexcrichton
cc https://github.com/rust-lang-nursery/rustup.rs/issues/1486

5 years agorustbuild: Distribute libLLVM.so with rustc
Alex Crichton [Thu, 30 Aug 2018 16:43:15 +0000 (09:43 -0700)]
rustbuild: Distribute libLLVM.so with rustc

A recent change (#53245) started to build LLVM with ThinLTO enabled and to
ensure that compile times are kept down it builds LLVM dynamically by default to
ensure that all the various LLVM tools aren't redoing all that optimization
work. This means, however, that all LLVM tools depend on LLVM's dynamic library
by default.

While the LLVM tools and LLDB components were updated to include the shared
library we accidentally forgot about LLD, included with the main rustc
component. LLD also links dynamically to LLVM and ships a non-working binary
right now because of this!

This commit updates our distribution to ship the LLVM dynamic library with the
compiler libraries.  While not technically needed for rustc itself to operate
(right now) it may be needed for LLD, and otherwise it serves as a good basis
for the other LLVM tools components to work with as well.

This should...

Closes #53813

5 years agoAuto merge of #53535 - TheDarkula:master, r=oli-obk
bors [Thu, 30 Aug 2018 14:18:22 +0000 (14:18 +0000)]
Auto merge of #53535 - TheDarkula:master, r=oli-obk

Made std::intrinsics::transmute() const fn.

r? @oli-obk

tracking issue: #53605

5 years ago[RISCV] Add riscv32imc-unknown-none-elf target.
David Craven [Thu, 30 Aug 2018 12:19:48 +0000 (14:19 +0200)]
[RISCV] Add riscv32imc-unknown-none-elf target.

5 years ago[RISCV] Enable C extension.
David Craven [Thu, 30 Aug 2018 12:19:02 +0000 (14:19 +0200)]
[RISCV] Enable C extension.

5 years ago[RISCV] Use lld as the default linker.
David Craven [Thu, 30 Aug 2018 12:14:07 +0000 (14:14 +0200)]
[RISCV] Use lld as the default linker.

5 years agobuild-manifest: package docs only for tier 1 platforms
Pietro Albini [Thu, 30 Aug 2018 12:41:01 +0000 (14:41 +0200)]
build-manifest: package docs only for tier 1 platforms

5 years agoMade std::intrinsics::transmute() const fn.
thedarkula [Mon, 20 Aug 2018 18:51:48 +0000 (19:51 +0100)]
Made std::intrinsics::transmute() const fn.

5 years agoAuto merge of #53757 - oli-obk:validation, r=RalfJung
bors [Thu, 30 Aug 2018 10:41:41 +0000 (10:41 +0000)]
Auto merge of #53757 - oli-obk:validation, r=RalfJung

Use partial but correct vtable layout

r? @RalfJung who suggested to also do this change for nightly, not just beta

5 years agofix u32 steps_between for 16-bit systems
Andre Bogus [Tue, 28 Aug 2018 10:47:46 +0000 (12:47 +0200)]
fix u32 steps_between for 16-bit systems

5 years agoassert sanity in memory
Ralf Jung [Thu, 30 Aug 2018 09:39:40 +0000 (11:39 +0200)]
assert sanity in memory

5 years agoAdd regression test for issue #52060
Basile Desloges [Wed, 29 Aug 2018 15:45:55 +0000 (17:45 +0200)]
Add regression test for issue #52060

5 years agoRephrase Arc documentation changes regarding clones
Otto Rask [Thu, 30 Aug 2018 09:20:41 +0000 (12:20 +0300)]
Rephrase Arc documentation changes regarding clones

Make it clearer that `Arc::clone()` in fact creates a whole new
Arc with the internal pointer pointing to the same location as
the source Arc.

5 years agoAuto merge of #53733 - nnethercote:avoid-unroll_place, r=nikomatsakis
bors [Thu, 30 Aug 2018 08:20:20 +0000 (08:20 +0000)]
Auto merge of #53733 - nnethercote:avoid-unroll_place, r=nikomatsakis

Avoid calling `unroll_place()` in a common case.

This reduces the execution time for `ucd-check` by 25%.

r? @nikomatsakis

5 years agointroduce Guard enum
F001 [Thu, 30 Aug 2018 04:18:11 +0000 (12:18 +0800)]
introduce Guard enum

5 years agoAuto merge of #53685 - alexcrichton:more-keywords, r=varkor
bors [Thu, 30 Aug 2018 03:30:23 +0000 (03:30 +0000)]
Auto merge of #53685 - alexcrichton:more-keywords, r=varkor

Generalize `async_idents` to all new keywords

This commit generalizes the existing `async_idents` lint to easily encompass
other identifiers that will be keywords in future editions. The new lint is
called `keyword_idents` and the old `async_idents` lint is registered as renamed
to this new lint.

As a proof of concept the `try` keyword was added to this list as it looks to be
listed as a keyword in the 2018 edition only. The `await` keyword was not added
as it's not listed as a keyword yet.

Closes #53077

5 years agoAuto merge of #53479 - joshtriplett:underscore-means-unused, r=eddyb
bors [Thu, 30 Aug 2018 00:07:15 +0000 (00:07 +0000)]
Auto merge of #53479 - joshtriplett:underscore-means-unused, r=eddyb

Don't emit "unused extern crate" warnings for `extern crate foo as _;`

When importing a crate and renaming it to an underscore-prefixed name,
suppress "unused extern crate" warnings (but not idiom lints).

5 years agoPrevent duplicated impl on foreign types
Guillaume Gomez [Wed, 29 Aug 2018 21:01:57 +0000 (23:01 +0200)]
Prevent duplicated impl on foreign types

5 years agobuild-manifest: include extensions marked as unavailable
Pietro Albini [Wed, 29 Aug 2018 20:57:40 +0000 (22:57 +0200)]
build-manifest: include extensions marked as unavailable

5 years agobuild-manifest: add instructions to test the tool locally
Pietro Albini [Wed, 29 Aug 2018 20:51:27 +0000 (22:51 +0200)]
build-manifest: add instructions to test the tool locally

5 years agoFix UI issues on Implementations on Foreign types
Guillaume Gomez [Wed, 29 Aug 2018 20:48:37 +0000 (22:48 +0200)]
Fix UI issues on Implementations on Foreign types

5 years agoAuto merge of #53564 - MaloJaffre:vecdeque, r=gnzlbg
bors [Wed, 29 Aug 2018 20:08:16 +0000 (20:08 +0000)]
Auto merge of #53564 - MaloJaffre:vecdeque, r=gnzlbg

Reoptimize VecDeque::append

~Unfortunately, I don't know if these changes fix the unsoundness mentioned in #53529, so it is stil a WIP.
This is also completely untested.
The VecDeque code contains other unsound code: one example : [reading unitialized memory](https://play.rust-lang.org/?gist=6ff47551769af61fd8adc45c44010887&version=nightly&mode=release&edition=2015) (detected by MIRI), so I think this code will need a bigger refactor to make it clearer and safer.~

Note: this is based on #53571.
r? @SimonSapin
Cc: #53529 #52553 @YorickPeterse @jonas-schievink @Pazzaz @shepmaster.
5 years agoGeneralize `async_idents` to all new keywords
Alex Crichton [Fri, 24 Aug 2018 20:48:20 +0000 (13:48 -0700)]
Generalize `async_idents` to all new keywords

This commit generalizes the existing `async_idents` lint to easily encompass
other identifiers that will be keywords in future editions. The new lint is
called `keyword_idents` and the old `async_idents` lint is registered as renamed
to this new lint.

As a proof of concept the `try` keyword was added to this list as it looks to be
listed as a keyword in the 2018 edition only. The `await` keyword was not added
as it's not listed as a keyword yet.

Closes #53077

5 years agoDon't emit "unused extern crate" warnings for `extern crate foo as _;`
Josh Triplett [Sat, 18 Aug 2018 23:20:25 +0000 (16:20 -0700)]
Don't emit "unused extern crate" warnings for `extern crate foo as _;`

When importing a crate and renaming it to an underscore-prefixed name,
suppress "unused extern crate" warnings (but not idiom lints).

5 years agoReplace usages of 'bad_style' with 'nonstandard_style'.
Corey Farwell [Wed, 29 Aug 2018 13:21:01 +0000 (08:21 -0500)]
Replace usages of 'bad_style' with 'nonstandard_style'.

`bad_style` is being deprecated in favor of `nonstandard_style`:

- https://github.com/rust-lang/rust/issues/41646

5 years agoAuto merge of #53758 - oli-obk:clippy, r=kennytm
bors [Wed, 29 Aug 2018 13:35:25 +0000 (13:35 +0000)]
Auto merge of #53758 - oli-obk:clippy, r=kennytm

Update clippy submodule

r? @Manishearth @nrc @kennytm

5 years agoFix a comment in src/libcore/slice/mod.rs
Tobias Bucher [Wed, 29 Aug 2018 13:23:06 +0000 (15:23 +0200)]
Fix a comment in src/libcore/slice/mod.rs

5 years agoAdd another assert
MaloJaffre [Wed, 29 Aug 2018 11:39:57 +0000 (13:39 +0200)]
Add another assert

5 years agoAdd more features to the workspace so that all tools pick up on it
Oliver Schneider [Wed, 29 Aug 2018 11:17:48 +0000 (13:17 +0200)]
Add more features to the workspace so that all tools pick up on it

5 years agoUpdate clippy submodule
Oliver Schneider [Tue, 28 Aug 2018 11:19:01 +0000 (13:19 +0200)]
Update clippy submodule

5 years agoAuto merge of #53245 - michaelwoerister:thinlto-rust-llvm, r=alexcrichton
bors [Wed, 29 Aug 2018 10:55:27 +0000 (10:55 +0000)]
Auto merge of #53245 - michaelwoerister:thinlto-rust-llvm, r=alexcrichton

[experimental]: Build LLVM with ThinLTO enabled (2nd attempt)

This is https://github.com/rust-lang/rust/pull/51207 revived. This time, I'd like to run actual performance tests to see if it improves compile times.