]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoPass edition flags to compiler from rustdoc as expected
Guillaume Gomez [Sat, 14 Jul 2018 18:45:44 +0000 (20:45 +0200)]
Pass edition flags to compiler from rustdoc as expected

6 years agoAuto merge of #52256 - tinco:issue_52255, r=sanxiyn
bors [Thu, 12 Jul 2018 15:12:37 +0000 (15:12 +0000)]
Auto merge of #52256 - tinco:issue_52255, r=sanxiyn

make pretty source comparison check be fatal (fixes #52255)

This is not ready for merging because it reveals (at least) two regressions in the pretty suite. Should I attempt to fix those in this PR also?

6 years agoAuto merge of #52303 - kennytm:rollup, r=kennytm
bors [Thu, 12 Jul 2018 12:50:13 +0000 (12:50 +0000)]
Auto merge of #52303 - kennytm:rollup, r=kennytm

Rollup of 9 pull requests

Successful merges:

 - #51816 (bootstrap: write texts to a .tmp file first for atomicity)
 - #51912 (impl Clone for Box<CStr>, Box<OsStr>, Box<Path>)
 - #52164 (use proper footnote syntax for references)
 - #52220 (Deny bare trait objects in `src/bootstrap`)
 - #52276 (rustc: Verify #[proc_macro] is only a word)
 - #52277 (Uncapitalize "If")
 - #52287 (Deny bare trait objects in src/librustc_resolve)
 - #52295 (Deny bare trait objects in src/libsyntax_ext)
 - #52298 (make reference to dirs crate clickable in terminals)

Failed merges:

r? @ghost

6 years agoRollup merge of #52298 - RalfJung:dirs, r=Mark-Simulacrum
kennytm [Thu, 12 Jul 2018 12:25:33 +0000 (20:25 +0800)]
Rollup merge of #52298 - RalfJung:dirs, r=Mark-Simulacrum

make reference to dirs crate clickable in terminals

Currently I have to copy-paste the link; with this change I can just click it right in my terminal window.

6 years agoRollup merge of #52295 - ljedrz:dyn_libsyntax_ext, r=petrochenkov
kennytm [Thu, 12 Jul 2018 12:25:32 +0000 (20:25 +0800)]
Rollup merge of #52295 - ljedrz:dyn_libsyntax_ext, r=petrochenkov

Deny bare trait objects in src/libsyntax_ext

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

6 years agoRollup merge of #52287 - ljedrz:dyn_librustc_resolve, r=petrochenkov
kennytm [Thu, 12 Jul 2018 12:25:30 +0000 (20:25 +0800)]
Rollup merge of #52287 - ljedrz:dyn_librustc_resolve, r=petrochenkov

Deny bare trait objects in src/librustc_resolve

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

6 years agoRollup merge of #52277 - kraai:patch-2, r=kennytm
kennytm [Thu, 12 Jul 2018 12:25:29 +0000 (20:25 +0800)]
Rollup merge of #52277 - kraai:patch-2, r=kennytm

Uncapitalize "If"

6 years agoRollup merge of #52276 - alexcrichton:validate-proc-macro-attr, r=petrochenkov
kennytm [Thu, 12 Jul 2018 12:25:28 +0000 (20:25 +0800)]
Rollup merge of #52276 - alexcrichton:validate-proc-macro-attr, r=petrochenkov

rustc: Verify #[proc_macro] is only a word

... and perform the same verification for #[proc_macro_attribute], currently
neither of these attributes take any arguments.

Closes #52273

6 years agoRollup merge of #52220 - ljedrz:dyn_bootstrap, r=kennytm
kennytm [Thu, 12 Jul 2018 12:25:27 +0000 (20:25 +0800)]
Rollup merge of #52220 - ljedrz:dyn_bootstrap, r=kennytm

Deny bare trait objects in `src/bootstrap`

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

6 years agoRollup merge of #52164 - euclio:references, r=TimNN
kennytm [Thu, 12 Jul 2018 12:25:26 +0000 (20:25 +0800)]
Rollup merge of #52164 - euclio:references, r=TimNN

use proper footnote syntax for references

The previous syntax was causing rustdoc to interpret them as links.

6 years agoRollup merge of #51912 - mbrubeck:more_box_slice_clone, r=alexcrichton
kennytm [Thu, 12 Jul 2018 12:25:25 +0000 (20:25 +0800)]
Rollup merge of #51912 - mbrubeck:more_box_slice_clone, r=alexcrichton

impl Clone for Box<CStr>, Box<OsStr>, Box<Path>

Implements #51908.

6 years agoRollup merge of #51816 - nodakai:conf-py-tmpfile, r=kennytm
kennytm [Thu, 12 Jul 2018 12:25:23 +0000 (20:25 +0800)]
Rollup merge of #51816 - nodakai:conf-py-tmpfile, r=kennytm

bootstrap: write texts to a .tmp file first for atomicity

If you are using a hard-linked file as your config.toml, this change will affect the way other instances of the file is modified.
The original version would modify all other instances whereas the new version will leave others unchanged, reducing the ref count by one.

6 years agomake reference to dirs crate clickable in terminals
Ralf Jung [Thu, 12 Jul 2018 10:48:10 +0000 (12:48 +0200)]
make reference to dirs crate clickable in terminals

6 years agoAuto merge of #52230 - alexcrichton:attr-and-derive, r=petrochenkov
bors [Thu, 12 Jul 2018 10:16:19 +0000 (10:16 +0000)]
Auto merge of #52230 - alexcrichton:attr-and-derive, r=petrochenkov

rustc: Search all derives for inert attributes

This commit fixes an apparent mistake in librustc_resolve where when the
`proc_macro` feature is enabled (or `rust_2018_preview`) the resolution of
custom attributes for custom derive was tweaked. Previously when an attribute
failed to resolve it was attempted to locate if there is a custom derive also in
scope which declares the attribute, but only the first custom derive directive
was search.

Instead this commit fixes the loop to search all custom derive invocations
looking for any which register the attribute in question.

Closes #52219

6 years agoDeny bare trait objects in src/libsyntax_ext
ljedrz [Thu, 12 Jul 2018 09:58:16 +0000 (11:58 +0200)]
Deny bare trait objects in src/libsyntax_ext

6 years agoDeny bare trait objects in src/librustc_resolve
ljedrz [Thu, 12 Jul 2018 08:15:35 +0000 (10:15 +0200)]
Deny bare trait objects in src/librustc_resolve

6 years agoAuto merge of #52282 - kennytm:fix-rls-break, r=oli-obk
bors [Thu, 12 Jul 2018 08:12:18 +0000 (08:12 +0000)]
Auto merge of #52282 - kennytm:fix-rls-break, r=oli-obk

Patch clippy_lints to use the in-tree clippy as well.

Should fix the most recent RLS build break.

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 agoUpdate [patch] section of clippy to include clippy_lints.
kennytm [Thu, 12 Jul 2018 02:52:57 +0000 (10:52 +0800)]
Update [patch] section of clippy to include clippy_lints.

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 agoUncapitalize "If"
Matt Kraai [Thu, 12 Jul 2018 00:19:41 +0000 (17:19 -0700)]
Uncapitalize "If"

6 years agofix expected output of pretty/cast-lt and issue-4264 tests
Tinco Andringa [Wed, 11 Jul 2018 23:16:27 +0000 (01:16 +0200)]
fix expected output of pretty/cast-lt and issue-4264 tests

6 years agorustc: Verify #[proc_macro] is only a word
Alex Crichton [Wed, 11 Jul 2018 22:49:23 +0000 (15:49 -0700)]
rustc: Verify #[proc_macro] is only a word

... and perform the same verification for #[proc_macro_attribute], currently
neither of these attributes take any arguments.

Closes #52273

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 agouse proper footnote syntax for references
Andy Russell [Sun, 8 Jul 2018 22:02:33 +0000 (18:02 -0400)]
use proper footnote syntax for references

The previous syntax was causing rustdoc to interpret them as links.

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 agomake pretty source comparison check be fatal (fixes #52255)
Tinco Andringa [Wed, 11 Jul 2018 13:21:14 +0000 (15:21 +0200)]
make pretty source comparison check be fatal (fixes #52255)

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 agorustc: Search all derives for inert attributes
Alex Crichton [Tue, 10 Jul 2018 21:04:41 +0000 (14:04 -0700)]
rustc: Search all derives for inert attributes

This commit fixes an apparent mistake in librustc_resolve where when the
`proc_macro` feature is enabled (or `rust_2018_preview`) the resolution of
custom attributes for custom derive was tweaked. Previously when an attribute
failed to resolve it was attempted to locate if there is a custom derive also in
scope which declares the attribute, but only the first custom derive directive
was search.

Instead this commit fixes the loop to search all custom derive invocations
looking for any which register the attribute in question.

Closes #52219

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 agoRestore #![deny(warnings)]
ljedrz [Tue, 10 Jul 2018 19:20:04 +0000 (21:20 +0200)]
Restore #![deny(warnings)]

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 agoDeny bare trait objects in `src/bootstrap`.
ljedrz [Tue, 10 Jul 2018 16:10:05 +0000 (18:10 +0200)]
Deny bare trait objects in `src/bootstrap`.

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 agobootstrap: our best to achieve atomic rename on Win32
NODA, Kai [Tue, 26 Jun 2018 19:23:14 +0000 (03:23 +0800)]
bootstrap: our best to achieve atomic rename on Win32

This is a tricky operation to implement on Win32; see
https://ci.appveyor.com/project/nodakai/python-win-behavior

Signed-off-by: NODA, Kai <nodakai@gmail.com>
6 years agobootstrap: write texts to a .tmp file first for atomicity
NODA, Kai [Sat, 23 Jun 2018 08:51:19 +0000 (16:51 +0800)]
bootstrap: write texts to a .tmp file first for atomicity

If you are using a hard-linked file as your config.toml, this change will affect the way other instances of the file is modified.
The original version would modify all other instances whereas the new version will leave others unchanged, reducing the ref count by one.

Signed-off-by: NODA, Kai <nodakai@gmail.com>
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