]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoAuto merge of #52194 - steveklabnik:remove-plugins, r=QuietMisdreavus,GuillaumeGomez
bors [Thu, 12 Jul 2018 04:12:19 +0000 (04:12 +0000)]
Auto merge of #52194 - steveklabnik:remove-plugins, r=QuietMisdreavus,GuillaumeGomez

Remove rustdoc's plugins feature

This fixes CVE-2018-1000622.

https://cve.mitre.org/cgi-bin/cvename.cgi?name=%20CVE-2018-1000622

r? @QuietMisdreavus @GuillaumeGomez

6 years agoAuto merge of #52089 - eddyb:issue-51907, r=nagisa
bors [Thu, 12 Jul 2018 01:20:19 +0000 (01:20 +0000)]
Auto merge of #52089 - eddyb:issue-51907, r=nagisa

rustc_codegen_llvm: replace the first argument early in FnType::new_vtable.

Fixes #51907 by removing the vtable pointer before the `ArgType` is even created.
This allows any ABI to support trait object method calls, regardless of how it passes `*dyn Trait`.

r? @nikomatsakis

6 years agoAuto merge of #52172 - oli-obk:clippy_in_rls, r=nrc
bors [Wed, 11 Jul 2018 21:54:44 +0000 (21:54 +0000)]
Auto merge of #52172 - oli-obk:clippy_in_rls, r=nrc

Inject clippy into the rls again

Also makes sure we actually point to the local rustfmt

r? @nrc

cc @Manishearth

6 years agoAuto merge of #52268 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
bors [Wed, 11 Jul 2018 19:50:14 +0000 (19:50 +0000)]
Auto merge of #52268 - Mark-Simulacrum:rollup, r=Mark-Simulacrum

Rollup of 14 pull requests

Successful merges:

 - #51614 (Correct suggestion for println)
 - #51952 ( hygiene: Decouple transparencies from expansion IDs)
 - #52193 (step_by: leave time of item skip unspecified)
 - #52207 (improve error message shown for unsafe operations)
 - #52223 (Deny bare trait objects in in src/liballoc)
 - #52224 (Deny bare trait objects in in src/libsyntax)
 - #52239 (Remove sync::Once::call_once 'static bound)
 - #52247 (Deny bare trait objects in in src/librustc)
 - #52248 (Deny bare trait objects in in src/librustc_allocator)
 - #52252 (Deny bare trait objects in in src/librustc_codegen_llvm)
 - #52253 (Deny bare trait objects in in src/librustc_data_structures)
 - #52254 (Deny bare trait objects in in src/librustc_metadata)
 - #52261 (Deny bare trait objects in in src/libpanic_unwind)
 - #52265 (Deny bare trait objects in in src/librustc_codegen_utils)

Failed merges:

r? @ghost

6 years agoRollup merge of #52265 - ljedrz:dyn_librustc_codegen_utils, r=oli-obk
Mark Rousskov [Wed, 11 Jul 2018 18:38:49 +0000 (12:38 -0600)]
Rollup merge of #52265 - ljedrz:dyn_librustc_codegen_utils, r=oli-obk

Deny bare trait objects in in src/librustc_codegen_utils

Enforce `#![deny(bare_trait_objects)]` in `src/librustc_codegen_utils`.

6 years agoRollup merge of #52261 - ljedrz:dyn_libpanic_unwind, r=alexcrichton
Mark Rousskov [Wed, 11 Jul 2018 18:38:47 +0000 (12:38 -0600)]
Rollup merge of #52261 - ljedrz:dyn_libpanic_unwind, r=alexcrichton

Deny bare trait objects in in src/libpanic_unwind

Enforce `#![deny(bare_trait_objects)]` in `src/libpanic_unwind`.

6 years agoRollup merge of #52254 - ljedrz:dyn_librustc_metadata, r=cramertj
Mark Rousskov [Wed, 11 Jul 2018 18:38:46 +0000 (12:38 -0600)]
Rollup merge of #52254 - ljedrz:dyn_librustc_metadata, r=cramertj

Deny bare trait objects in in src/librustc_metadata

Enforce `#![deny(bare_trait_objects)]` in `src/librustc_metadata`.

6 years agoRollup merge of #52253 - ljedrz:dyn_librustc_data_structures, r=cramertj
Mark Rousskov [Wed, 11 Jul 2018 18:38:45 +0000 (12:38 -0600)]
Rollup merge of #52253 - ljedrz:dyn_librustc_data_structures, r=cramertj

Deny bare trait objects in in src/librustc_data_structures

Enforce `#![deny(bare_trait_objects)]` in `src/librustc_data_structures`.

6 years agoRollup merge of #52252 - ljedrz:dyn_librustc_codegen_llvm, r=varkor
Mark Rousskov [Wed, 11 Jul 2018 18:38:44 +0000 (12:38 -0600)]
Rollup merge of #52252 - ljedrz:dyn_librustc_codegen_llvm, r=varkor

Deny bare trait objects in in src/librustc_codegen_llvm

Enforce `#![deny(bare_trait_objects)]` in `src/librustc_codegen_llvm`.

6 years agoRollup merge of #52248 - ljedrz:dyn_librustc_allocator, r=oli-obk
Mark Rousskov [Wed, 11 Jul 2018 18:38:42 +0000 (12:38 -0600)]
Rollup merge of #52248 - ljedrz:dyn_librustc_allocator, r=oli-obk

Deny bare trait objects in in src/librustc_allocator

Enforce `#![deny(bare_trait_objects)]` in `src/librustc_allocator`.

6 years agoRollup merge of #52247 - ljedrz:dyn_librustc, r=oli-obk
Mark Rousskov [Wed, 11 Jul 2018 18:38:41 +0000 (12:38 -0600)]
Rollup merge of #52247 - ljedrz:dyn_librustc, r=oli-obk

Deny bare trait objects in in src/librustc

Enforce `#![deny(bare_trait_objects)]` in `src/librustc`.

6 years agoRollup merge of #52239 - CAD97:patch-1, r=alexcrichton
Mark Rousskov [Wed, 11 Jul 2018 18:38:40 +0000 (12:38 -0600)]
Rollup merge of #52239 - CAD97:patch-1, r=alexcrichton

Remove sync::Once::call_once 'static bound

See https://internals.rust-lang.org/t/sync-once-per-instance/7918 for more context.

Suggested r is @alexcrichton, the one who added the `'static` bound back in 2014. I don't want to officially r? though, if the system would even let me. I'd rather let the system choose the appropriate member since it knows more than I do.

`git blame` history for `sync::Once::call_once`'s signature:

- [std: Second pass stabilization of sync](https://github.com/rust-lang/rust/commit/f3a7ec7028c76b3a1c6051131328f372b068e33a) (Dec 2014)

    ```diff
    -    pub fn doit<F>(&'static self, f: F) where F: FnOnce() {
    +    #[stable]
    +    pub fn call_once<F>(&'static self, f: F) where F: FnOnce() {
    ```

- [libstd: use unboxed closures](https://github.com/rust-lang/rust/commit/cdbb3ca9b776b066e2c93acfb60da8537d2b1c9b) (Dec 2014)

    ```diff
    -    pub fn doit(&'static self, f: ||) {
    +    pub fn doit<F>(&'static self, f: F) where F: FnOnce() {
    ```

- [std: Rewrite the `sync` module](https://github.com/rust-lang/rust/commit/71d4e77db8ad4b6d821da7e5d5300134ac95974e) (Nov 2014)

    ```diff
    -    pub fn doit(&self, f: ||) {
    +    pub fn doit(&'static self, f: ||) {
    ```

    > ```text
    >  The second layer is the layer provided by `std::sync` which is intended to be
    >  the thinnest possible layer on top of `sys_common` which is entirely safe to
    >  use. There are a few concerns which need to be addressed when making these
    >  system primitives safe:
    >
    >    * Once used, the OS primitives can never be **moved**. This means that they
    >      essentially need to have a stable address. The static primitives use
    >      `&'static self` to enforce this, and the non-static primitives all use a
    >      `Box` to provide this guarantee.
    > ```

The author of this diff is @alexcrichton. `sync::Once` now contains only a pointer to (privately hidden) `Waiter`s, which are all stack-allocated. The `'static` bound to `sync::Once` is thus unnecessary to guarantee that any OS primitives are non-relocatable.

As the `'static` bound is not required for `sync::Once`'s operation, removing it is strictly more useful. As an example, it allows attaching a one-time operation to instances rather than only to global singletons.

6 years agoRollup merge of #52224 - ljedrz:dyn_libsyntax, r=oli-obk
Mark Rousskov [Wed, 11 Jul 2018 18:38:39 +0000 (12:38 -0600)]
Rollup merge of #52224 - ljedrz:dyn_libsyntax, r=oli-obk

Deny bare trait objects in in src/libsyntax

Enforce `#![deny(bare_trait_objects)]` in `src/libsyntax`.

6 years agoRollup merge of #52223 - ljedrz:dyn_liballoc, r=cramertj
Mark Rousskov [Wed, 11 Jul 2018 18:38:37 +0000 (12:38 -0600)]
Rollup merge of #52223 - ljedrz:dyn_liballoc, r=cramertj

Deny bare trait objects in in src/liballoc

Enforce #![deny(bare_trait_objects)] in src/liballoc.

6 years agoRollup merge of #52207 - RalfJung:unsafety-errors, r=estebank
Mark Rousskov [Wed, 11 Jul 2018 18:38:36 +0000 (12:38 -0600)]
Rollup merge of #52207 - RalfJung:unsafety-errors, r=estebank

improve error message shown for unsafe operations

Add a short explanation saying why undefined behavior could arise. In particular, the error many people got for "creating a pointer to a packed field requires unsafe block" was not worded great -- it lead to people just adding the unsafe block without considering if what they are doing follows the rules.

I am not sure if a "note" is the right thing, but that was the easiest thing to add...

Inspired by @gnzlbg at https://github.com/rust-lang/rust/issues/46043#issuecomment-381544673

6 years agoRollup merge of #52193 - Emerentius:step_by_note, r=alexcrichton
Mark Rousskov [Wed, 11 Jul 2018 18:38:34 +0000 (12:38 -0600)]
Rollup merge of #52193 - Emerentius:step_by_note, r=alexcrichton

step_by: leave time of item skip unspecified

This gives us some leeway when optimizing. `StepBy<RangeFrom<_>>` is one case where this is needed.

6 years agoRollup merge of #51952 - petrochenkov:transmark, r=alexcrichton
Mark Rousskov [Wed, 11 Jul 2018 18:38:33 +0000 (12:38 -0600)]
Rollup merge of #51952 - petrochenkov:transmark, r=alexcrichton

 hygiene: Decouple transparencies from expansion IDs

And remove fallback to parent modules during resolution of names in scope.

This is a breaking change for users of unstable macros 2.0 (both procedural and declarative), code like this:
```rust
#![feature(decl_macro)]

macro m($S: ident) {
    struct $S;
    mod m {
        type A = $S;
    }
}

fn main() {
    m!(S);
}
```
or equivalent
```rust
#![feature(decl_macro)]

macro m($S: ident) {
    mod m {
        type A = $S;
    }
}

fn main() {
    struct S;
    m!(S);
}
```
stops working due to module boundaries being properly enforced.

For proc macro derives this is still reported as a compatibility warning to give `actix_derive`, `diesel_derives` and `palette_derive` time to fix their issues.

Fixes https://github.com/rust-lang/rust/issues/50504 in accordance with [this comment](https://github.com/rust-lang/rust/issues/50504#issuecomment-399764767).

6 years agoRollup merge of #51614 - csmoe:lit_sugg, r=estebank
Mark Rousskov [Wed, 11 Jul 2018 18:38:32 +0000 (12:38 -0600)]
Rollup merge of #51614 - csmoe:lit_sugg, r=estebank

Correct suggestion for println

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

6 years agoAuto merge of #51702 - ecstatic-morse:infinite-loop-detection, r=oli-obk
bors [Wed, 11 Jul 2018 16:24:46 +0000 (16:24 +0000)]
Auto merge of #51702 - ecstatic-morse:infinite-loop-detection, r=oli-obk

Infinite loop detection for const evaluation

Resolves #50637.

An `EvalContext` stores the transient state (stack, heap, etc.) of the MIRI virtual machine while it executing code. As long as MIRI only executes pure functions, we can detect if a program is in a state where it will never terminate by periodically taking a "snapshot" of this transient state and comparing it to previous ones. If any two states are exactly equal, the machine must be in an infinite loop.

Instead of fully cloning a snapshot every time the detector is run, we store a snapshot's hash. Only when a hash collision occurs do we fully clone the interpreter state. Future snapshots which cause a collision will be compared against this clone, causing the interpreter to abort if they are equal.

At the moment, snapshots are not taken until MIRI has progressed a certain amount. After this threshold, snapshots are taken every `DETECTOR_SNAPSHOT_PERIOD` steps. This means that an infinite loop with period `P` will be detected after a maximum of `2 * P * DETECTOR_SNAPSHOT_PERIOD` interpreter steps. The factor of 2 arises because we only clone a snapshot after it causes a hash collision.

6 years agoDeny bare trait objects in in src/librustc_codegen_utils
ljedrz [Wed, 11 Jul 2018 15:39:49 +0000 (17:39 +0200)]
Deny bare trait objects in in src/librustc_codegen_utils

6 years agoDeny bare trait objects in in src/libpanic_unwind
ljedrz [Wed, 11 Jul 2018 15:11:08 +0000 (17:11 +0200)]
Deny bare trait objects in in src/libpanic_unwind

6 years agoAuto merge of #51553 - jD91mZM2:uds, r=sfackler
bors [Wed, 11 Jul 2018 14:15:01 +0000 (14:15 +0000)]
Auto merge of #51553 - jD91mZM2:uds, r=sfackler

Unix sockets on redox

This is done using the ipcd daemon. It's not exactly like unix sockets because there is not actually a physical file for the path, but it's close enough for a basic implementation :)
This allows mio-uds and tokio-uds to work with a few modifications as well, which is exciting!

6 years agoadd a missing `dyn`
ljedrz [Wed, 11 Jul 2018 14:08:38 +0000 (16:08 +0200)]
add a missing `dyn`

6 years agoDeny bare trait objects in in src/librustc_metadata
ljedrz [Wed, 11 Jul 2018 12:49:00 +0000 (14:49 +0200)]
Deny bare trait objects in in src/librustc_metadata

6 years agoEnforce #![deny(bare_trait_objects)] in src/librustc_data_structures tests
ljedrz [Wed, 11 Jul 2018 12:21:26 +0000 (14:21 +0200)]
Enforce #![deny(bare_trait_objects)] in src/librustc_data_structures tests

6 years agoAuto merge of #51230 - nikic:no-verify-lto, r=pnkfelix
bors [Wed, 11 Jul 2018 12:12:13 +0000 (12:12 +0000)]
Auto merge of #51230 - nikic:no-verify-lto, r=pnkfelix

Disable LLVM verification by default

Currently -Z no-verify only controls IR verification prior to LLVM codegen, while verification is performed unconditionally both before and after linking with (Thin)LTO.

Also wondering what the sentiment is on disabling verification by default (and e.g. only enabling it on ALT builds with assertions). This does not seem terribly useful outside of rustc development and it does seem to show up in profiles (at something like 3%).

**EDIT:** A table showing the various configurations and what is enabled when.

| Configuration | Dynamic verification performed | LLVM static assertions compiled in |
| --- | --- | --- |
| alt builds | | yes |
| nightly builds | | no |
| stable builds | | no |
| CI builds | | |
| dev builds in a checkout | | |

6 years agoDeny bare trait objects in in src/librustc_data_structures
ljedrz [Wed, 11 Jul 2018 11:58:27 +0000 (13:58 +0200)]
Deny bare trait objects in in src/librustc_data_structures

6 years agosuggest on new snippet
csmoe [Wed, 11 Jul 2018 00:50:21 +0000 (08:50 +0800)]
suggest on new snippet

6 years agoDeny bare trait objects in in src/librustc_codegen_llvm
ljedrz [Wed, 11 Jul 2018 10:49:11 +0000 (12:49 +0200)]
Deny bare trait objects in in src/librustc_codegen_llvm

6 years agoDeny bare trait objects in in src/librustc_allocator
ljedrz [Wed, 11 Jul 2018 10:08:49 +0000 (12:08 +0200)]
Deny bare trait objects in in src/librustc_allocator

6 years agoDeny bare trait objects in in src/librustc
ljedrz [Wed, 11 Jul 2018 10:05:10 +0000 (12:05 +0200)]
Deny bare trait objects in in src/librustc

6 years agoAuto merge of #52245 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Wed, 11 Jul 2018 10:00:30 +0000 (10:00 +0000)]
Auto merge of #52245 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 5 pull requests

Successful merges:

 - #51701 (Better docs for copy_from_slice & clone_from_slice)
 - #52231 (Fix typo in error message E0277)
 - #52233 (Improve lint handling in rustdoc)
 - #52238 (Avoid unwrapping in PanicInfo doc example.)
 - #52241 (Fix typo in E0433 docs)

Failed merges:

r? @ghost

6 years agofix typo
Ralf Jung [Wed, 11 Jul 2018 09:58:10 +0000 (11:58 +0200)]
fix typo

6 years agoRemove unused variable
Oliver Schneider [Wed, 11 Jul 2018 08:35:49 +0000 (10:35 +0200)]
Remove unused variable

6 years agoHitchhike with rls into stable
Oliver Schneider [Wed, 11 Jul 2018 08:35:09 +0000 (10:35 +0200)]
Hitchhike with rls into stable

6 years agoRevert borked changes in last commit.
ljedrz [Wed, 11 Jul 2018 08:19:54 +0000 (10:19 +0200)]
Revert borked changes in last commit.

6 years agoRollup merge of #52241 - felixrabe:patch-1, r=oli-obk
Guillaume Gomez [Wed, 11 Jul 2018 08:02:04 +0000 (10:02 +0200)]
Rollup merge of #52241 - felixrabe:patch-1, r=oli-obk

Fix typo in E0433 docs

6 years agoRollup merge of #52238 - frewsxcv:frewsxcv-unwrap, r=GuillaumeGomez
Guillaume Gomez [Wed, 11 Jul 2018 08:02:03 +0000 (10:02 +0200)]
Rollup merge of #52238 - frewsxcv:frewsxcv-unwrap, r=GuillaumeGomez

Avoid unwrapping in PanicInfo doc example.

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

6 years agoRollup merge of #52233 - GuillaumeGomez:rustdoc-lint-handling, r=oli-obk
Guillaume Gomez [Wed, 11 Jul 2018 08:02:01 +0000 (10:02 +0200)]
Rollup merge of #52233 - GuillaumeGomez:rustdoc-lint-handling, r=oli-obk

Improve lint handling in rustdoc

r? @oli-obk

6 years agoRollup merge of #52231 - lqd:error_mesg, r=GuillaumeGomez
Guillaume Gomez [Wed, 11 Jul 2018 08:02:00 +0000 (10:02 +0200)]
Rollup merge of #52231 - lqd:error_mesg, r=GuillaumeGomez

Fix typo in error message E0277

Fix a typo we stumbled upon by accident :)

r? @estebank

6 years agoRollup merge of #51701 - anirudhb:master, r=frewsxcv
Guillaume Gomez [Wed, 11 Jul 2018 08:01:58 +0000 (10:01 +0200)]
Rollup merge of #51701 - anirudhb:master, r=frewsxcv

Better docs for copy_from_slice & clone_from_slice

I copy-pasted the text from clone_from_slice to copy_from_slice :smile:

@steveklabnik feel free to suggest changes.

edit: closes #49769

6 years agoAuto merge of #51966 - alexcrichton:llvm7, r=michaelwoerister
bors [Wed, 11 Jul 2018 07:20:14 +0000 (07:20 +0000)]
Auto merge of #51966 - alexcrichton:llvm7, r=michaelwoerister

Upgrade to LLVM's master branch (LLVM 7)

### Current status

~~Blocked on a [performance regression](https://github.com/rust-lang/rust/pull/51966#issuecomment-402320576). The performance regression has an [upstream LLVM issue](https://bugs.llvm.org/show_bug.cgi?id=38047) and has also [been bisected](https://reviews.llvm.org/D44282) to an LLVM revision.~~

Ready to merge!

---

This commit upgrades the main LLVM submodule to LLVM's current master branch.
The LLD submodule is updated in tandem as well as compiler-builtins.

Along the way support was also added for LLVM 7's new features. This primarily
includes the support for custom section concatenation natively in LLD so we now
add wasm custom sections in LLVM IR rather than having custom support in rustc
itself for doing so.

Some other miscellaneous changes are:

* We now pass `--gc-sections` to `wasm-ld`
* The optimization level is now passed to `wasm-ld`
* A `--stack-first` option is passed to LLD to have stack overflow always cause
  a trap instead of corrupting static data
* The wasm target for LLVM switched to `wasm32-unknown-unknown`.
* The syntax for aligned pointers has changed in LLVM IR and tests are updated
  to reflect this.
* ~~The `thumbv6m-none-eabi` target is disabled due to an [LLVM bug][llbug]~~

Nowadays we've been mostly only upgrading whenever there's a major release of
LLVM but enough changes have been happening on the wasm target that there's been
growing motivation for quite some time now to upgrade out version of LLD. To
upgrade LLD, however, we need to upgrade LLVM to avoid needing to build yet
another version of LLVM on the builders.

The revision of LLVM in use here is arbitrarily chosen. We will likely need to
continue to update it over time if and when we discover bugs. Once LLVM 7 is
fully released we can switch to that channel as well.

[llbug]: https://bugs.llvm.org/show_bug.cgi?id=37382

cc #50543

6 years agoFix typo in E0433 docs
Felix Rabe [Wed, 11 Jul 2018 05:43:10 +0000 (07:43 +0200)]
Fix typo in E0433 docs

6 years agoremove sync::Once::call_once 'static
Christopher Durham [Wed, 11 Jul 2018 02:47:59 +0000 (22:47 -0400)]
remove sync::Once::call_once 'static

- [std: Rewrite the `sync` modulehttps://github.com/rust-lang/rust/commit/71d4e77db8ad4b6d821da7e5d5300134ac95974e) (Nov 2014)

    ```diff
    -    pub fn doit(&self, f: ||) {
    +    pub fn doit(&'static self, f: ||) {
    ```

    > ```text
    >  The second layer is the layer provided by `std::sync` which is intended to be
    >  the thinnest possible layer on top of `sys_common` which is entirely safe to
    >  use. There are a few concerns which need to be addressed when making these
    >  system primitives safe:
    >
    >    * Once used, the OS primitives can never be **moved**. This means that they
    >      essentially need to have a stable address. The static primitives use
    >      `&'static self` to enforce this, and the non-static primitives all use a
    >      `Box` to provide this guarantee.
    > ```

The author of this diff is @alexcrichton. `sync::Once` contains only a pointer to (privately hidden) `Waiter`s, which are all stack-allocated. The `'static` bound to `sync::Once` is thus unnecessary to guarantee that any OS primitives are non-relocatable.

See https://internals.rust-lang.org/t/sync-once-per-instance/7918 for more context.

6 years agoAvoid unwrapping in PanicInfo doc example.
Corey Farwell [Wed, 11 Jul 2018 02:25:38 +0000 (22:25 -0400)]
Avoid unwrapping in PanicInfo doc example.

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

6 years agoAuto merge of #52232 - arielb1:ill-adjusted-tuples, r=pnkfelix
bors [Wed, 11 Jul 2018 00:37:25 +0000 (00:37 +0000)]
Auto merge of #52232 - arielb1:ill-adjusted-tuples, r=pnkfelix

 use the adjusted type for cat_pattern in tuple patterns

This looks like a typo introduced in #51686.

Fixes #52213.

r? @pnkfelix

beta + stable nominating because regression + unsoundness.

6 years agoAuto merge of #52229 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Tue, 10 Jul 2018 22:40:17 +0000 (22:40 +0000)]
Auto merge of #52229 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 7 pull requests

Successful merges:

 - #51612 (NLL: fix E0594 "change to mutable ref" suggestion)
 - #51722 (Updated RELEASES for 1.28.0)
 - #52064 (Clarifying how the alignment of the struct works)
 - #52149 (Add #[repr(transparent)] to Atomic* types)
 - #52151 (Trait impl settings)
 - #52171 (Correct some codegen stats counter inconsistencies)
 - #52195 (rustc: Avoid /tmp/ in graphviz writing)

Failed merges:

 - #52164 (use proper footnote syntax for references)

r? @ghost

6 years agoImprove lint handling in rustdoc
Guillaume Gomez [Tue, 10 Jul 2018 22:36:31 +0000 (00:36 +0200)]
Improve lint handling in rustdoc

6 years agoadd test for #52213
Ariel Ben-Yehuda [Tue, 10 Jul 2018 22:11:59 +0000 (01:11 +0300)]
add test for #52213

6 years agoadd a debug log for more MC failures
Ariel Ben-Yehuda [Tue, 10 Jul 2018 22:09:48 +0000 (01:09 +0300)]
add a debug log for more MC failures

I don't see why MC should fail on well-formed code, so it might be a
better idea to just add a `delay_span_bug` there (anyone remember the
`cat_expr Errd` bug from the 1.0 days?).

However, I don't think this is a good idea to backport a new delay_span_bug
into stable and this code is going away soon-ish anyway.

6 years agouse the adjusted type for cat_pattern in tuple patterns
Ariel Ben-Yehuda [Tue, 10 Jul 2018 22:08:15 +0000 (01:08 +0300)]
use the adjusted type for cat_pattern in tuple patterns

This looks like a typo introduced in #51686.

Fixes #52213.

6 years agoFix typo in error message E0277
Rémy Rakic [Tue, 10 Jul 2018 21:10:13 +0000 (23:10 +0200)]
Fix typo in error message E0277

6 years agoRollup merge of #52195 - alexcrichton:no-tmp, r=pnkfelix
Guillaume Gomez [Tue, 10 Jul 2018 20:56:43 +0000 (22:56 +0200)]
Rollup merge of #52195 - alexcrichton:no-tmp, r=pnkfelix

rustc: Avoid /tmp/ in graphviz writing

This issue was reported to security@rust-lang.org by Sebastien Marie following
our recent [security advisory][1]. Because `/tmp` is typically globally writable
it's possible for one user to place symlinks in `/tmp` pointing to files in
another user's directories, causing `rustc` to overwrite the contents of
innocent files by accident.

This patch instead defaults the output path here to the cwd which should avoid
this issue.

[1]: https://blog.rust-lang.org/2018/07/06/security-advisory-for-rustdoc.html

6 years agoRollup merge of #52171 - bharrisau:fsub-count, r=estebank
Guillaume Gomez [Tue, 10 Jul 2018 20:56:42 +0000 (22:56 +0200)]
Rollup merge of #52171 - bharrisau:fsub-count, r=estebank

Correct some codegen stats counter inconsistencies

I noticed some possible typos/inconsistencies in the codegen counters. For example, `fsub` was getting counted as an integer `sub`, whereas `fadd` was counted as an add. And `addincoming` was only being counted on the initial call.

https://github.com/rust-lang/rust/blob/dbd10f81758381339f98994b8d31814cf5e98707/src/librustc_codegen_llvm/builder.rs#L831-L841

Only remaining inconsistencies I can see are things like `fadd_fast` are counted as `fadd`. But the vector versions like `vector_reduce_fmax_fast` are counted as `vector.reduce.fmax_fast` not as their 'base' versions (`vector_reduce_fmax` is counted as `vector.reduce.fmax`).

6 years agoRollup merge of #52151 - GuillaumeGomez:trait-impl-settings, r=QuietMisdreavus
Guillaume Gomez [Tue, 10 Jul 2018 20:56:40 +0000 (22:56 +0200)]
Rollup merge of #52151 - GuillaumeGomez:trait-impl-settings, r=QuietMisdreavus

Trait impl settings

Fixes #51797.

r? @QuietMisdreavus

PS: I was annoyed by some intra link failures so I fixed them as well.

6 years agoRollup merge of #52149 - willmo:transparent-atomics, r=cramertj
Guillaume Gomez [Tue, 10 Jul 2018 20:56:39 +0000 (22:56 +0200)]
Rollup merge of #52149 - willmo:transparent-atomics, r=cramertj

Add #[repr(transparent)] to Atomic* types

This allows them to be used in `#[repr(C)]` structs without warnings. Since rust-lang/rfcs#1649 and rust-lang/rust#35603 they are already documented to have "the same in-memory representation as" their corresponding primitive types. This just makes that explicit.

This was briefly part of #51395, but was controversial and therefore dropped. But it turns out that it's essentially already documented (which I had forgotten).

6 years agoRollup merge of #52064 - Valloric:patch-1, r=cramertj
Guillaume Gomez [Tue, 10 Jul 2018 20:56:38 +0000 (22:56 +0200)]
Rollup merge of #52064 - Valloric:patch-1, r=cramertj

Clarifying how the alignment of the struct works

The docs were not specifying how to compute the alignment of the struct, so I had to spend some time trying to figure out how that works. Found the answer [on this page](http://camlorn.net/posts/April%202017/rust-struct-field-reordering.html):

> The total size of this struct is 5, but the most-aligned field is b with alignment 2, so we round up to 6 and give the struct an alignment of 2 bytes.

6 years agoRollup merge of #51722 - Aaronepower:master, r=Mark-Simulacrum
Guillaume Gomez [Tue, 10 Jul 2018 20:56:36 +0000 (22:56 +0200)]
Rollup merge of #51722 - Aaronepower:master, r=Mark-Simulacrum

Updated RELEASES for 1.28.0

[Rendered](https://github.com/Aaronepower/rust/blob/master/RELEASES.md)
r? @Mark-Simulacrum
cc @rust-lang/release

6 years agoRollup merge of #51612 - ashtneoi:51515-missing-first-char, r=pnkfelix
Guillaume Gomez [Tue, 10 Jul 2018 20:56:35 +0000 (22:56 +0200)]
Rollup merge of #51612 - ashtneoi:51515-missing-first-char, r=pnkfelix

NLL: fix E0594 "change to mutable ref" suggestion

Fix #51515.
Fix #51879.

Questions:
- [x] Is this the right place to fix this? It feels brittle, being so close to the frontend. **It's probably fine.**
- [ ] Have I missed any other cases that trigger this behavior?
- [x] Is it okay to use HELP and SUGGESTION in the UI test? **Yes.**
- [x] Do I need more tests for this? **No.**

6 years agoUpgrade to LLVM's master branch (LLVM 7)
Alex Crichton [Fri, 1 Jun 2018 17:20:00 +0000 (10:20 -0700)]
Upgrade to LLVM's master branch (LLVM 7)

This commit upgrades the main LLVM submodule to LLVM's current master branch.
The LLD submodule is updated in tandem as well as compiler-builtins.

Along the way support was also added for LLVM 7's new features. This primarily
includes the support for custom section concatenation natively in LLD so we now
add wasm custom sections in LLVM IR rather than having custom support in rustc
itself for doing so.

Some other miscellaneous changes are:

* We now pass `--gc-sections` to `wasm-ld`
* The optimization level is now passed to `wasm-ld`
* A `--stack-first` option is passed to LLD to have stack overflow always cause
  a trap instead of corrupting static data
* The wasm target for LLVM switched to `wasm32-unknown-unknown`.
* The syntax for aligned pointers has changed in LLVM IR and tests are updated
  to reflect this.
* The `thumbv6m-none-eabi` target is disabled due to an [LLVM bug][llbug]

Nowadays we've been mostly only upgrading whenever there's a major release of
LLVM but enough changes have been happening on the wasm target that there's been
growing motivation for quite some time now to upgrade out version of LLD. To
upgrade LLD, however, we need to upgrade LLVM to avoid needing to build yet
another version of LLVM on the builders.

The revision of LLVM in use here is arbitrarily chosen. We will likely need to
continue to update it over time if and when we discover bugs. Once LLVM 7 is
fully released we can switch to that channel as well.

[llbug]: https://bugs.llvm.org/show_bug.cgi?id=37382

6 years agoAuto merge of #51612 - ashtneoi:51515-missing-first-char, r=pnkfelix
bors [Tue, 10 Jul 2018 20:36:13 +0000 (20:36 +0000)]
Auto merge of #51612 - ashtneoi:51515-missing-first-char, r=pnkfelix

NLL: fix E0594 "change to mutable ref" suggestion

Fix #51515.
Fix #51879.

Questions:
- [x] Is this the right place to fix this? It feels brittle, being so close to the frontend. **It's probably fine.**
- [ ] Have I missed any other cases that trigger this behavior?
- [x] Is it okay to use HELP and SUGGESTION in the UI test? **Yes.**
- [x] Do I need more tests for this? **No.**

6 years agoAdd missing dyn in liballoc
ljedrz [Tue, 10 Jul 2018 20:32:19 +0000 (22:32 +0200)]
Add missing dyn in liballoc

6 years agoPacify tidy
ljedrz [Tue, 10 Jul 2018 19:58:16 +0000 (21:58 +0200)]
Pacify tidy

6 years agoDeny bare trait objects in in src/libsyntax
ljedrz [Tue, 10 Jul 2018 19:06:26 +0000 (21:06 +0200)]
Deny bare trait objects in in src/libsyntax

6 years agoDeny bare trait objects in in src/liballoc
ljedrz [Tue, 10 Jul 2018 18:45:16 +0000 (20:45 +0200)]
Deny bare trait objects in in src/liballoc

6 years agoChange wording for {copy, clone}_from_slice
Anirudh Balaji [Tue, 10 Jul 2018 17:56:58 +0000 (10:56 -0700)]
Change wording for {copy, clone}_from_slice

6 years agoAuto merge of #52196 - ollie27:rustdoc_ctor_imports, r=QuietMisdreavus
bors [Tue, 10 Jul 2018 17:29:30 +0000 (17:29 +0000)]
Auto merge of #52196 - ollie27:rustdoc_ctor_imports, r=QuietMisdreavus

rustdoc: Hide struct and enum variant constructor imports

This is fallout from #51425. The duplicate variant imports can be seen [here](https://doc.rust-lang.org/nightly/std/prelude/v1/index.html) for example.

This is fixing a regression so could be backported to beta.

r? @QuietMisdreavus

6 years agoAuto merge of #52191 - SimonSapin:alloc_error_handler, r=alexcrichton
bors [Tue, 10 Jul 2018 15:20:17 +0000 (15:20 +0000)]
Auto merge of #52191 - SimonSapin:alloc_error_handler, r=alexcrichton

Implement #[alloc_error_handler]

This to-be-stable attribute is equivalent to `#[lang = "oom"]`. It is required when using the `alloc` crate without the `std` crate. It is called by `handle_alloc_error`, which is in turned called by "infallible" allocations APIs such as `Vec::push`.

6 years agoRemove rustdoc plugins
steveklabnik [Tue, 10 Jul 2018 14:41:39 +0000 (10:41 -0400)]
Remove rustdoc plugins

See CVE-2018-1000622.

6 years agoAuto merge of #52168 - nikomatsakis:nll-region-name, r=estebank
bors [Tue, 10 Jul 2018 11:19:31 +0000 (11:19 +0000)]
Auto merge of #52168 - nikomatsakis:nll-region-name, r=estebank

find and highlight the `&` or `'_` in `region_name`

Before:

```
   --> $DIR/dyn-trait-underscore.rs:18:5
    |
 LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
-   |         ----- lifetime `'1` appears in this argument
 LL |     Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime
    |     ^^^^^^^^^^^^^^^^^^^^^^ cast requires that `'1` must outlive `'static`
```

After:

```
   --> $DIR/dyn-trait-underscore.rs:18:5
    |
 LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
+   |                - let's call the lifetime of this reference `'1`
 LL |     Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime
    |     ^^^^^^^^^^^^^^^^^^^^^^ cast requires that `'1` must outlive `'static`
```

Not intended as the final end point necessarily in any sense. I intentionally left some to-do points to fill in later:

- Does not apply to upvars in closures yet (should be relatively easy)
- Does not handle the case where we can't find a precise match very well
- And of course we can still tweak wording

but shows the basic idea of how to make the `Ty` and `hir::Ty` to find a good spot to highlight.

r? @estebank
cc @davidtwco

6 years agoAuto merge of #52204 - zackmdavis:and_the_crate_of_the_missing_module, r=oli-obk
bors [Tue, 10 Jul 2018 09:05:46 +0000 (09:05 +0000)]
Auto merge of #52204 - zackmdavis:and_the_crate_of_the_missing_module, r=oli-obk

correct import suggestions for edition 2018

For #52202.

6 years agoimprove error message shown for unsafe operations: explain why undefined behavior...
Ralf Jung [Tue, 10 Jul 2018 08:52:05 +0000 (10:52 +0200)]
improve error message shown for unsafe operations: explain why undefined behavior could arise

Inspired by @gnzlbg at https://github.com/rust-lang/rust/issues/46043#issuecomment-381544673

6 years agoAuto merge of #52177 - ljedrz:bare_gcc_warning, r=alexcrichton
bors [Tue, 10 Jul 2018 06:52:20 +0000 (06:52 +0000)]
Auto merge of #52177 - ljedrz:bare_gcc_warning, r=alexcrichton

Warn windows-gnu users that the bundled gcc can't compile

Add a `DO NOT USE THIS gcc.exe FOR COMPILATION.txt` file to `lib\rustlib\*-pc-windows-gnu\bin` folders in `windows-gnu` installations in order to warn against attempting to use the bundled `gcc.exe` as a C compiler. I'm pretty sure that location is usually found manually, so this should be easily noticeable.

This mistake has been made plenty of times and has lead to misunderstandings:
Rust: [Bundled gcc (windows x64) is unable to build any c file](https://github.com/rust-lang/rust/issues/24418)
gtk-rs:    [Compiling on windows](https://github.com/gtk-rs/gtk/issues/625)
bzip2-rs: [Build failure at gcc level: blocksort.c not found](https://github.com/alexcrichton/bzip2-rs/issues/30)

Alternatives: rename the bundled `gcc.exe` to e.g. `rustc-gcc.exe` or `gcc-linker.exe`. This might require a more comprehensive change or break crates already using it as a linker.

r? @alexcrichton

6 years agoin which `use` suggestions meet edition 2018
Zack M. Davis [Tue, 10 Jul 2018 05:13:47 +0000 (22:13 -0700)]
in which `use` suggestions meet edition 2018

The intent here is to resolve #52202.

6 years agoAuto merge of #51583 - cuviper:packed_pair-bool, r=Mark-Simulacrum
bors [Tue, 10 Jul 2018 03:08:47 +0000 (03:08 +0000)]
Auto merge of #51583 - cuviper:packed_pair-bool, r=Mark-Simulacrum

Store scalar pair bools as i8 in memory

We represent `bool` as `i1` in a `ScalarPair`, unlike other aggregates,
to optimize IR for checked operators and the like.  With this patch, we
still do so when the pair is an immediate value, but we use the `i8`
memory type when the value is loaded or stored as an LLVM aggregate.

So `(bool, bool)` looks like an `{ i1, i1 }` immediate, but `{ i8, i8 }`
in memory.  When a pair is a direct function argument, `PassMode::Pair`,
it is still passed using the immediate `i1` type, but as a return value
it will use the `i8` memory type.  Also, `bool`-like` enum tags will now
use scalar pairs when possible, where they were previously excluded due
to optimization issues.

Fixes #51516.
Closes #51566.

r? @eddyb
cc @nox

6 years agoAuto merge of #52100 - nielx:fix/rust_driver-stacklimit, r=cramertj
bors [Tue, 10 Jul 2018 01:07:23 +0000 (01:07 +0000)]
Auto merge of #52100 - nielx:fix/rust_driver-stacklimit, r=cramertj

Haiku: work around the lack of setrlimit

The default Unix codepath fails, because Haiku does not implement
setrlimit for stack size. Thus we create an additional path.

By default, Haiku has the desired 16 MB stack, therefore in general
we do not have to spawn a new thread. The code has been written in
such a way that any changes in Haiku or in Rust will be adapted to.

6 years agostep_by: leave time of item skip unspecified
Emerentius [Mon, 9 Jul 2018 22:00:51 +0000 (00:00 +0200)]
step_by: leave time of item skip unspecified

this gives us some leeway when optimizing

6 years agorustdoc: Hide struct and enum variant constructor imports
Oliver Middleton [Mon, 9 Jul 2018 23:16:18 +0000 (00:16 +0100)]
rustdoc: Hide struct and enum variant constructor imports

6 years agoAuto merge of #51899 - gnzlbg:llvm501, r=alexcrichton
bors [Mon, 9 Jul 2018 23:08:51 +0000 (23:08 +0000)]
Auto merge of #51899 - gnzlbg:llvm501, r=alexcrichton

bump minimum LLVM version to 5.0

Closes #51878 .

r? @alexcrichton

--

cc @cuviper @infinity0

6 years agorustc: Avoid /tmp/ in graphviz writing
Alex Crichton [Mon, 9 Jul 2018 22:26:57 +0000 (15:26 -0700)]
rustc: Avoid /tmp/ in graphviz writing

This issue was reported to security@rust-lang.org by Sebastien Marie following
our recent [security advisory][1]. Because `/tmp` is typically globally writable
it's possible for one user to place symlinks in `/tmp` pointing to files in
another user's directories, causing `rustc` to overwrite the contents of
innocent files by accident.

This patch instead defaults the output path here to the cwd which should avoid
this issue.

[1]: https://blog.rust-lang.org/2018/07/06/security-advisory-for-rustdoc.html

6 years agoImplement #[alloc_error_handler]
Simon Sapin [Fri, 6 Jul 2018 13:49:52 +0000 (15:49 +0200)]
Implement #[alloc_error_handler]

This to-be-stable attribute is equivalent to `#[lang = "oom"]`.
It is required when using the alloc crate without the std crate.
It is called by `handle_alloc_error`, which is in turned called
by "infallible" allocations APIs such as `Vec::push`.

6 years agoAdd a test for the default allocation error hook
Simon Sapin [Tue, 19 Jun 2018 22:49:59 +0000 (00:49 +0200)]
Add a test for the default allocation error hook

6 years agoRemove `extern` on the `pub fn rust_oom` lang item in libstd, to match ABI of the...
Simon Sapin [Sun, 8 Jul 2018 14:07:08 +0000 (16:07 +0200)]
Remove `extern` on the `pub fn rust_oom` lang item in libstd, to match ABI of the declaration in liballoc

This turned out to be important on Windows.
Calling `handle_alloc_error(Layout::new::<[u8; 42]>())` caused:

```
Exception thrown at 0x00007FF7C70DC399 in a.exe: 0xC0000005:
Access violation reading location 0x000000000000002A.
```

0x2A equals 42, so it looks like the `Layout::size` field of type `usize`
was interpreted as a pointer to read from.

6 years agoAuto merge of #50250 - csmoe:wf_traitref, r=scalexm
bors [Mon, 9 Jul 2018 21:01:58 +0000 (21:01 +0000)]
Auto merge of #50250 - csmoe:wf_traitref, r=scalexm

Chalk lowering rule: WellFormed-TraitRef

Address chalk lowering "Implemented-From-Env" as part of #49177.
r? @nikomatsakis

6 years agoAdd "or destination" to {copy, clone}_from_slice example
Anirudh Balaji [Mon, 9 Jul 2018 20:41:46 +0000 (13:41 -0700)]
Add "or destination" to {copy, clone}_from_slice example

6 years agoFix issue #51515 and update test
ashtneoi [Mon, 9 Jul 2018 20:33:57 +0000 (13:33 -0700)]
Fix issue #51515 and update test

6 years agoAdd test case from issue #51515
ashtneoi [Mon, 9 Jul 2018 20:16:02 +0000 (13:16 -0700)]
Add test case from issue #51515

6 years agoChange gcc warning file name, remove unnecessary reference
ljedrz [Mon, 9 Jul 2018 19:25:16 +0000 (21:25 +0200)]
Change gcc warning file name, remove unnecessary reference

6 years agoChange wording
scalexm [Mon, 9 Jul 2018 19:20:26 +0000 (21:20 +0200)]
Change wording

6 years agoAuto merge of #51956 - GuillaumeGomez:shutdown-doc-lints, r=oli-obk
bors [Mon, 9 Jul 2018 18:50:37 +0000 (18:50 +0000)]
Auto merge of #51956 - GuillaumeGomez:shutdown-doc-lints, r=oli-obk

Fix rustdoc run failures by shutting down definitely some lints

Fixes #51661.

cc @oli-obk @arielb1 @eddyb

6 years agoadd comment about lints whitelisting
Guillaume Gomez [Mon, 9 Jul 2018 16:10:08 +0000 (18:10 +0200)]
add comment about lints whitelisting

6 years agorevert travis-ci changes
gnzlbg [Mon, 9 Jul 2018 15:25:00 +0000 (17:25 +0200)]
revert travis-ci changes

6 years agoAuto merge of #52159 - SimonSapin:alloc-prelude, r=alexcrichton
bors [Mon, 9 Jul 2018 14:29:59 +0000 (14:29 +0000)]
Auto merge of #52159 - SimonSapin:alloc-prelude, r=alexcrichton

Add the `alloc::prelude` module

It contains the re-exports that are in `std::prelude::v1` but not in `core::prelude::v1`.

Calling it prelude is somewhat of a misnomer since (unlike those modules in `std` or `core`) its contents are never implicitly imported in modules. Rather it is intended to be used with an explicit glob import like `use alloc::prelude::*;`. However there is precedent for the same misnomer with `std::io::prelude`, for example.

This new module is unstable with the same feature name as the `alloc` care. They are proposed for stabilization together in RFC https://github.com/rust-lang/rfcs/pull/2480.

6 years agoWarn windows-gnu users that the bundled gcc can't compile
ljedrz [Mon, 9 Jul 2018 13:28:12 +0000 (15:28 +0200)]
Warn windows-gnu users that the bundled gcc can't compile

6 years agorun asmjs and emscripten builds on CI (temporary)
gnzlbg [Mon, 9 Jul 2018 09:29:32 +0000 (11:29 +0200)]
run asmjs and emscripten builds on CI (temporary)

6 years agostill support LLVM4 for emscripten
gnzlbg [Mon, 9 Jul 2018 09:29:13 +0000 (11:29 +0200)]
still support LLVM4 for emscripten

6 years agobump llvm version of failing codegen test
gnzlbg [Mon, 2 Jul 2018 09:13:34 +0000 (11:13 +0200)]
bump llvm version of failing codegen test

6 years agobump minimum LLVM version to 5.0
gnzlbg [Fri, 29 Jun 2018 08:28:51 +0000 (10:28 +0200)]
bump minimum LLVM version to 5.0

6 years agoAuto merge of #52160 - euclio:include-macros, r=oli-obk
bors [Mon, 9 Jul 2018 08:41:43 +0000 (08:41 +0000)]
Auto merge of #52160 - euclio:include-macros, r=oli-obk

add regression test for #48835

Fixes #48835.

The underlying issue was fixed in #51978.

6 years agoAlso distribute cargo clippy
Oliver Schneider [Mon, 9 Jul 2018 08:15:30 +0000 (10:15 +0200)]
Also distribute cargo clippy