]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoadd test for issue 52129
QuietMisdreavus [Sat, 14 Jul 2018 02:46:47 +0000 (21:46 -0500)]
add test for issue 52129

6 years agodon't panic when you see proc-macros
QuietMisdreavus [Fri, 13 Jul 2018 22:34:58 +0000 (17:34 -0500)]
don't panic when you see proc-macros

6 years agoAuto merge of #51987 - nikomatsakis:nll-region-infer-scc, r=pnkfelix
bors [Fri, 13 Jul 2018 13:28:55 +0000 (13:28 +0000)]
Auto merge of #51987 - nikomatsakis:nll-region-infer-scc, r=pnkfelix

nll experiment: compute SCCs instead of iterative region solving

This is an attempt to speed up region solving by replacing the current iterative dataflow with a SCC computation. The idea is to detect cycles (SCCs) amongst region constraints and then compute just one value per cycle. The graph with all cycles removed is of course a DAG, so we can then solve constraints "bottom up" once the liveness values are known.

I kinda ran out of time this morning so the last commit is a bit sloppy but I wanted to get this posted, let travis run on it, and maybe do a perf run, before I clean it up.

6 years agoAuto merge of #51622 - kennytm:three-field-range-inclusive, r=SimonSapin
bors [Fri, 13 Jul 2018 10:18:38 +0000 (10:18 +0000)]
Auto merge of #51622 - kennytm:three-field-range-inclusive, r=SimonSapin

Change RangeInclusive to a three-field struct.

Fix #45222.

This PR also reverts #48012 (i.e. removed the `try_fold`/`try_rfold` specialization for `RangeInclusive`) because LLVM no longer has trouble recognizing a RangeInclusive loop.

6 years agoAuto merge of #52281 - cramertj:fast-tls, r=alexcrichton
bors [Fri, 13 Jul 2018 08:00:16 +0000 (08:00 +0000)]
Auto merge of #52281 - cramertj:fast-tls, r=alexcrichton

Use fast TLS on Fuchsia

I'm not sure why Fuchsia was separated here, but we provide these symbols, and tests are passing in QEMU with this change. cc @raphlinus.

r? @alexcrichton

6 years agonit: fix typo
Niko Matsakis [Fri, 13 Jul 2018 05:28:36 +0000 (01:28 -0400)]
nit: fix typo

6 years agonit: fix `all_sccs` comment
Niko Matsakis [Fri, 13 Jul 2018 05:28:06 +0000 (01:28 -0400)]
nit: fix `all_sccs` comment

6 years agonit: tweak comment order
Niko Matsakis [Fri, 13 Jul 2018 05:27:13 +0000 (01:27 -0400)]
nit: tweak comment order

6 years agonit: improve SCC comments
Niko Matsakis [Fri, 13 Jul 2018 05:25:21 +0000 (01:25 -0400)]
nit: improve SCC comments

6 years agonit: clarify "keep it around" comment
Niko Matsakis [Fri, 13 Jul 2018 05:18:35 +0000 (01:18 -0400)]
nit: clarify "keep it around" comment

6 years agonit: s/successor/successors/
Niko Matsakis [Fri, 13 Jul 2018 05:18:00 +0000 (01:18 -0400)]
nit: s/successor/successors/

6 years agonit: `use graph::{self, ..}`
Niko Matsakis [Fri, 13 Jul 2018 05:17:20 +0000 (01:17 -0400)]
nit: `use graph::{self, ..}`

6 years agodump scc graphviz too
Niko Matsakis [Wed, 4 Jul 2018 23:39:38 +0000 (19:39 -0400)]
dump scc graphviz too

6 years agoimpl graphviz trait for a newtype of regioncx
Niko Matsakis [Wed, 4 Jul 2018 10:07:17 +0000 (06:07 -0400)]
impl graphviz trait for a newtype of regioncx

6 years agocompute region values using SCCs not iterative flow
Niko Matsakis [Mon, 2 Jul 2018 15:29:39 +0000 (11:29 -0400)]
compute region values using SCCs not iterative flow

The strategy is this:

- we compute SCCs once all outlives constraints are known
- we allocate a set of values **per region** for storing liveness
- we allocate a set of values **per SCC** for storing the final values
- when we add a liveness constraint to the region R, we also add it
  to the final value of the SCC to which R belongs
- then we can apply the constraints by just walking the DAG for the
  SCCs and union'ing the children (which have their liveness
  constraints within)

There are a few intermediate refactorings that I really ought to have
broken out into their own commits:

- reverse the constraint graph so that `R1: R2` means `R1 -> R2` and
  not `R2 -> R1`. This fits better with the SCC computation and new
  style of inference (`->` now means "take value from" and not "push
  value into")
  - this does affect some of the UI tests, since they traverse the
    graph, but mostly the artificial ones and they don't necessarily
    seem worse
- put some things (constraint set, etc) into `Rc`. This lets us root
  them to permit mutation and iteration. It also guarantees they don't
  change, which is critical to the correctness of the algorithm.
- Generalize various helpers that previously operated only on points
  to work on any sort of region element.

6 years agoChanged implementation of the third field to make LLVM optimize it better.
kennytm [Fri, 13 Jul 2018 05:08:28 +0000 (13:08 +0800)]
Changed implementation of the third field to make LLVM optimize it better.

6 years agoAuto merge of #52275 - alexcrichton:no-macro-use, r=nrc
bors [Fri, 13 Jul 2018 03:40:33 +0000 (03:40 +0000)]
Auto merge of #52275 - alexcrichton:no-macro-use, r=nrc

rustc: Lint against `#[macro_use]` in 2018 idioms

This commit adds a lint to the compiler to warn against the `#[macro_use]`
directive as part of the `rust_2018_idioms` lint. This lint is turned off by
default and is only enabled when the `use_extern_macros` feature is also
enabled.

The lint here isn't fully fleshed out as it's just a simple warning rather than
suggestions of how to actually import the macro, but hopefully it's a good base
to start from!

cc #52043

6 years agoInclude is_empty() in PartialEq and Hash.
kennytm [Sat, 30 Jun 2018 09:13:21 +0000 (17:13 +0800)]
Include is_empty() in PartialEq and Hash.

When the index is not PartialOrd, always treat the range as empty.

6 years agoUpgrade implementation of StepBy<RangeInclusive<_>>.
kennytm [Fri, 22 Jun 2018 17:42:29 +0000 (01:42 +0800)]
Upgrade implementation of StepBy<RangeInclusive<_>>.

6 years agoFix some RangeInclusive test cases.
kennytm [Tue, 19 Jun 2018 08:56:18 +0000 (16:56 +0800)]
Fix some RangeInclusive test cases.

6 years agoChange RangeInclusive to a three-field struct.
kennytm [Mon, 18 Jun 2018 20:08:20 +0000 (04:08 +0800)]
Change RangeInclusive to a three-field struct.

Fix #45222.

6 years agoAuto merge of #52046 - cramertj:fix-generator-mir, r=eddyb
bors [Fri, 13 Jul 2018 00:38:17 +0000 (00:38 +0000)]
Auto merge of #52046 - cramertj:fix-generator-mir, r=eddyb

Ensure StorageDead is created even if variable initialization fails

Rebase and slight cleanup of https://github.com/rust-lang/rust/pull/51109
Fixes https://github.com/rust-lang/rust/issues/49232

r? @eddyb

6 years agorustc: Lint against `#[macro_use]` in 2018 idioms
Alex Crichton [Wed, 11 Jul 2018 21:25:29 +0000 (14:25 -0700)]
rustc: Lint against `#[macro_use]` in 2018 idioms

This commit adds a lint to the compiler to warn against the `#[macro_use]`
directive as part of the `rust_2018_idioms` lint. This lint is turned off by
default and is only enabled when the `use_extern_macros` feature is also
enabled.

The lint here isn't fully fleshed out as it's just a simple warning rather than
suggestions of how to actually import the macro, but hopefully it's a good base
to start from!

cc #52043

6 years agoAuto merge of #51339 - sdroege:exact-chunks-remainder, r=alexcrichton
bors [Thu, 12 Jul 2018 19:39:04 +0000 (19:39 +0000)]
Auto merge of #51339 - sdroege:exact-chunks-remainder, r=alexcrichton

Add ExactChunks::remainder and ExactChunks::into_remainder

These allow to get the leftover items of the slice that are not being
iterated as part of the iterator due to not filling a complete chunk.

The mutable version consumes the slice because otherwise we would either
a) have to borrow the iterator instead of taking the lifetime of
the underlying slice, which is not what *any* of the other iterator
functions is doing, or
b) would allow returning multiple mutable references to the same data

The current behaviour of consuming the iterator is consistent with
IterMut::into_slice for the normal iterator.

----

This is related to https://github.com/rust-lang/rust/issues/47115#issuecomment-392685177 and the following comments.

While there the discussion was first about a way to get the "tail" of the iterator (everything from the slice that is still not iterated yet), this gives kind of unintuitive behaviour and is inconsistent with how the other slice iterators work.

Unintuitive because the `next_back` would have no effect on the tail (or otherwise the tail could not include the remainder items), inconsistent because a) generally the idea of the slice iterators seems to be to only ever return items that were not iterated yet (and don't provide a way to access the same item twice) and b) we would return a "flat" `&[T]` slice but the iterator's shape is `&[[T]]` instead, c) the mutable variant would have to borrow from the iterator instead of the underlying slice (all other iterator functions borrow from the underlying slice!)

As such, I've only implemented functions to get the remainder. This also allows the implementation to be completely safe still (and around slices instead of raw pointers), while getting the tail would either be inefficient or would have to be implemented around raw pointers.

CC @kerollmops

6 years agoEnsure StorageDead is created even if variable initialization fails
Taylor Cramer [Wed, 4 Jul 2018 01:09:00 +0000 (18:09 -0700)]
Ensure StorageDead is created even if variable initialization fails

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 agomake `RegionValues` generic over its domain
Niko Matsakis [Mon, 2 Jul 2018 14:57:52 +0000 (10:57 -0400)]
make `RegionValues` generic over its domain

We used to store one value per RegionVid; we will soon be storing one
value per SCC.

6 years agointroduce a generic SCC computation
Niko Matsakis [Mon, 2 Jul 2018 14:40:03 +0000 (10:40 -0400)]
introduce a generic SCC computation

6 years agostrengthen `Idx` to require `Ord + Hash`
Niko Matsakis [Mon, 2 Jul 2018 14:55:44 +0000 (10:55 -0400)]
strengthen `Idx` to require `Ord + Hash`

You should always be able to know that any `T` where `T: Idx`
can be used in a `BTreeMap` and a `FxHashMap`.

6 years agorename `control_flow_graph` to `graph`
Niko Matsakis [Mon, 2 Jul 2018 10:14:49 +0000 (06:14 -0400)]
rename `control_flow_graph` to `graph`

6 years agorename `graph` to `control_flow_graph::implementation`
Niko Matsakis [Sun, 1 Jul 2018 21:06:00 +0000 (17:06 -0400)]
rename `graph` to `control_flow_graph::implementation`

6 years agodeconstruct the `ControlFlowGraph` trait into more granular traits
Niko Matsakis [Sun, 1 Jul 2018 20:54:01 +0000 (16:54 -0400)]
deconstruct the `ControlFlowGraph` trait into more granular traits

6 years agorename `constraint_set` to `constraints`
Niko Matsakis [Sun, 1 Jul 2018 14:29:18 +0000 (10:29 -0400)]
rename `constraint_set` to `constraints`

also promote to its own directory, make local to nll

6 years agointroduce `ConstraintGraph`, stop mutating constraints in place
Niko Matsakis [Sun, 1 Jul 2018 10:11:08 +0000 (06:11 -0400)]
introduce `ConstraintGraph`, stop mutating constraints in place

Encapsulate the dependencies more cleanly.

6 years agogenerate reborrow constraints at type check time
Niko Matsakis [Sun, 1 Jul 2018 14:22:36 +0000 (10:22 -0400)]
generate reborrow constraints at type check time

6 years agofix `debug!`
Niko Matsakis [Sun, 1 Jul 2018 10:12:04 +0000 (06:12 -0400)]
fix `debug!`

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 agoUse fast TLS on Fuchsia
Taylor Cramer [Thu, 12 Jul 2018 01:11:53 +0000 (18:11 -0700)]
Use fast TLS on Fuchsia

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