]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoClarify how the quote macro is loaded
Manish Goregaokar [Sat, 14 Jul 2018 19:06:50 +0000 (12:06 -0700)]
Clarify how the quote macro is loaded

6 years agoAuto merge of #51829 - petrochenkov:noideq, r=eddyb
bors [Sat, 14 Jul 2018 16:22:19 +0000 (16:22 +0000)]
Auto merge of #51829 - petrochenkov:noideq, r=eddyb

Remove most of `PartialEq` and `Hash` impls from AST and HIR structures

Continuation of https://github.com/rust-lang/rust/pull/49326, prerequisite for removing `PartialEq` for `Ident`.

6 years agoAddress comments
Vadim Petrochenkov [Fri, 6 Jul 2018 20:18:38 +0000 (23:18 +0300)]
Address comments

6 years agoRemove some tests using AST comparisons, fix other tests
Vadim Petrochenkov [Tue, 26 Jun 2018 22:59:07 +0000 (01:59 +0300)]
Remove some tests using AST comparisons, fix other tests

6 years agoRemove most of `Hash` impls from AST and HIR structures
Vadim Petrochenkov [Tue, 26 Jun 2018 21:57:27 +0000 (00:57 +0300)]
Remove most of `Hash` impls from AST and HIR structures

6 years agoRemove most of `PartialEq` impls from AST and HIR structures
Vadim Petrochenkov [Tue, 20 Mar 2018 22:58:25 +0000 (01:58 +0300)]
Remove most of `PartialEq` impls from AST and HIR structures

6 years agoAuto merge of #52212 - kennytm:o3-again, r=alexcrichton
bors [Sat, 14 Jul 2018 10:24:59 +0000 (10:24 +0000)]
Auto merge of #52212 - kennytm:o3-again, r=alexcrichton

Set opt-level = 3 the third time.

This PR reverts #51165 (set -O2 for fixing #50867),
which reverted #50329 (set -O3),
which was second attempt of #48204 (set -O3, closed due to Windows segfault that is fixed now),
which reverted #42123 (set -O2 to fix spurious Windows segfaults),
which reverted #41967 (set -O3).

Since we have found the root cause of #50867, this optimization could be tried again.

Last time we've found that setting -O3 regressed the wall time of NLL (https://github.com/rust-lang/rust/pull/50329#issuecomment-388084894), so we may need another perf run to confirm. I'd like to check this *after* the LLVM 7 upgrade #51966 has been merged, so marking this as <kbd>S-blocked</kbd> for now.

6 years agoAuto merge of #52244 - glandium:issue52097, r=estebank
bors [Sat, 14 Jul 2018 06:24:42 +0000 (06:24 +0000)]
Auto merge of #52244 - glandium:issue52097, r=estebank

Don't display default generic parameters in diagnostics that compare types

In errors like:
```
   expected type: `RawVec<foo, Global>`
      found type: `foo`
```

`RawVec` being defined as `RawVec<T, A: Alloc = Global>`, the error is better written as
```
   expected type: `RawVec<foo>`
      found type: `foo`
```

In fact, that is already what happens when `foo` is not an ADT, because in that case, the diagnostic handler doesn't try to highlight something, and just uses the `Display` trait instead of its own logic.

e.g.
```
   expected type: `RawVec<usize>`
      found type: `usize`
```

6 years agoAuto merge of #52328 - petrochenkov:pmroot, r=alexcrichton
bors [Sat, 14 Jul 2018 04:19:44 +0000 (04:19 +0000)]
Auto merge of #52328 - petrochenkov:pmroot, r=alexcrichton

proc_macro: Fix crate root detection

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

6 years agoAuto merge of #52314 - varkor:issue-52023, r=oli-obk
bors [Sat, 14 Jul 2018 02:11:10 +0000 (02:11 +0000)]
Auto merge of #52314 - varkor:issue-52023, r=oli-obk

Fix ICE when using a pointer cast as array size

Fixes #52023. I'm not sure if the comment https://github.com/rust-lang/rust/issues/52023#issuecomment-402402392 suggested we also emit `E0080`, but just emitting `E0018` seems reasonable for now.

r? @oli-obk

6 years agoAuto merge of #52032 - DiamondLovesYou:amdgpu-kernel-abi, r=alexcrichton
bors [Sat, 14 Jul 2018 00:12:21 +0000 (00:12 +0000)]
Auto merge of #52032 - DiamondLovesYou:amdgpu-kernel-abi, r=alexcrichton

Add the `amdgpu-kernel` ABI.

Technically, there are requirements imposed by the LLVM
`AMDGPUTargetMachine` on functions with this ABI (eg, the return type
must be void), but I'm unsure exactly where this should be enforced.

6 years agoAdd the `amdgpu-kernel` ABI.
Richard Diamond [Mon, 2 Jul 2018 03:42:00 +0000 (22:42 -0500)]
Add the `amdgpu-kernel` ABI.

Technically, there are requirements imposed by the LLVM
`AMDGPUTargetMachine` on functions with this ABI (eg, the return type
must be void), but I'm unsure exactly where this should be enforced.

6 years agoAuto merge of #52266 - michaelwoerister:incr-thinlto-preliminaries, r=alexcrichton
bors [Fri, 13 Jul 2018 22:06:38 +0000 (22:06 +0000)]
Auto merge of #52266 - michaelwoerister:incr-thinlto-preliminaries, r=alexcrichton

Preliminary work for incremental ThinLTO.

Since implementing incremental ThinLTO is a bit more involved than I initially thought, I'm splitting out some of the things that already work. This PR (1) adds a way accessing some ThinLTO information in `rustc` and (2) does some cleanup around CGU/object file naming (which makes things quite a bit nicer).

This is probably best reviewed one commit at a time.

6 years agoAuto merge of #52352 - kennytm:rollup, r=kennytm
bors [Fri, 13 Jul 2018 19:49:11 +0000 (19:49 +0000)]
Auto merge of #52352 - kennytm:rollup, r=kennytm

Rollup of 17 pull requests

Successful merges:

 - #51962 (Provide llvm-strip in llvm-tools component)
 - #52003 (Implement `Option::replace` in the core library)
 - #52156 (Update std::ascii::ASCIIExt deprecation notes)
 - #52280 (llvm-tools-preview: fix build-manifest)
 - #52290 (Deny bare trait objects in src/librustc_save_analysis)
 - #52293 (Deny bare trait objects in librustc_typeck)
 - #52299 (Deny bare trait objects in src/libserialize)
 - #52300 (Deny bare trait objects in librustc_target and libtest)
 - #52302 (Deny bare trait objects in the rest of rust)
 - #52310 (Backport 1.27.1 release notes to master)
 - #52315 (Resolve FIXME(#27942))
 - #52316 (task: remove wrong comments about non-existent LocalWake trait)
 - #52322 (Update llvm-rebuild-trigger in light of LLVM 7 upgrade)
 - #52330 (Don't silently ignore invalid data in target spec)
 - #52333 (CI: Enable core dump on Linux, and print their stack trace on segfault. )
 - #52346 (Fix typo in improper_ctypes suggestion)
 - #52350 (Bump bootstrap compiler to 1.28.0-beta.10)

Failed merges:

r? @ghost

6 years agoRollup merge of #52350 - pietroalbini:bump-bootstrap, r=Mark-Simulacrum
kennytm [Fri, 13 Jul 2018 18:56:58 +0000 (02:56 +0800)]
Rollup merge of #52350 - pietroalbini:bump-bootstrap, r=Mark-Simulacrum

Bump bootstrap compiler to 1.28.0-beta.10

r? @Mark-Simulacrum

6 years agoRollup merge of #52346 - rkruppe:patch-1, r=cramertj
kennytm [Fri, 13 Jul 2018 18:56:57 +0000 (02:56 +0800)]
Rollup merge of #52346 - rkruppe:patch-1, r=cramertj

Fix typo in improper_ctypes suggestion

closes #52345

6 years agoRollup merge of #52333 - kennytm:linux-core-dump, r=alexcrichton
kennytm [Fri, 13 Jul 2018 18:56:56 +0000 (02:56 +0800)]
Rollup merge of #52333 - kennytm:linux-core-dump, r=alexcrichton

CI: Enable core dump on Linux, and print their stack trace on segfault.

6 years agoRollup merge of #52330 - jethrogb:jb/target-link-args, r=varkor
kennytm [Fri, 13 Jul 2018 18:56:55 +0000 (02:56 +0800)]
Rollup merge of #52330 - jethrogb:jb/target-link-args, r=varkor

Don't silently ignore invalid data in target spec

This is technically a breaking change, but only because invalid data was previously silently being ignored.

6 years agoRollup merge of #52322 - varkor:llvm-7-rebuild-trigger, r=alexcrichton
kennytm [Fri, 13 Jul 2018 18:56:53 +0000 (02:56 +0800)]
Rollup merge of #52322 - varkor:llvm-7-rebuild-trigger, r=alexcrichton

Update llvm-rebuild-trigger in light of LLVM 7 upgrade

Not triggering a LLVM rebuild [since the LLVM 7 upgrade](https://github.com/rust-lang/rust/pull/51966#issuecomment-404624633) causes builds of rustc to fail.

r? @alexcrichton

6 years agoRollup merge of #52316 - seanmonstar:waker-unsafety, r=cramertj
kennytm [Fri, 13 Jul 2018 18:56:52 +0000 (02:56 +0800)]
Rollup merge of #52316 - seanmonstar:waker-unsafety, r=cramertj

task: remove wrong comments about non-existent LocalWake trait

~~A `LocalWaker` is specifically `!Send `, and the unsafety comment around
`LocalWaker::new` only specifies that it be safe to call `wake_local`.
One could then accidentally promote a `LocalWaker` into a `Waker`, which
is universally `Send`, simply via `Waker::from(local_waker)`. A
`LocalWaker` the was built expecting to not be `Send`, such as using
`Rc`, could be sent to other threads safely.~~

~~Separately, though somewhat related, `Context` holds a `&LocalWaker`
internally, and exposes a `waker() -> &Waker` method. This simply
transmutes the `&LocalWaker` to `&Waker`, which would be unsound, except
that you can't "send" a `&Waker`, you'd need to clone it first. Since
`UnsafeWake::clone_raw` requires that it return a `Waker`, the transmute
is not unsound. The transmuted `LocalWaker` will be promoted to a
`Waker` correctly.~~

~~That would mean that if `UnsafeWake::clone_raw` were to be changed, such
as returning `Self` instead of `Waker`, this would no longer be sound.
Thus, this also adds a comment to `clone_raw` to remember this.~~

r? @cramertj

6 years agoRollup merge of #52315 - ljedrz:FIXME_#27942, r=petrochenkov
kennytm [Fri, 13 Jul 2018 18:56:51 +0000 (02:56 +0800)]
Rollup merge of #52315 - ljedrz:FIXME_#27942, r=petrochenkov

Resolve FIXME(#27942)

[related issue](https://github.com/rust-lang/rust/issues/27942)

cc [#44366](https://github.com/rust-lang/rust/issues/44366)

6 years agoRollup merge of #52310 - Mark-Simulacrum:release-notes-backport-from-stable, r=pietro...
kennytm [Fri, 13 Jul 2018 18:56:50 +0000 (02:56 +0800)]
Rollup merge of #52310 - Mark-Simulacrum:release-notes-backport-from-stable, r=pietroalbini

Backport 1.27.1 release notes to master

r? @pietroalbini

6 years agoRollup merge of #52302 - ljedrz:dyn_futureproofing, r=cramertj
kennytm [Fri, 13 Jul 2018 18:56:49 +0000 (02:56 +0800)]
Rollup merge of #52302 - ljedrz:dyn_futureproofing, r=cramertj

Deny bare trait objects in the rest of rust

Add `#![deny(bare_trait_objects)]` to all the modules not covered before (those did not require code changes) that I consider applicable (I left out shims) in order to futureproof them.

6 years agoRollup merge of #52300 - ljedrz:dyn_target_test, r=Mark-Simulacrum
kennytm [Fri, 13 Jul 2018 18:56:47 +0000 (02:56 +0800)]
Rollup merge of #52300 - ljedrz:dyn_target_test, r=Mark-Simulacrum

Deny bare trait objects in librustc_target and libtest

Enforce `#![deny(bare_trait_objects)]` in `src/librustc_target` and `src/libtest`.

6 years agoRollup merge of #52299 - ljedrz:dyn_libserialize, r=cramertj
kennytm [Fri, 13 Jul 2018 18:56:46 +0000 (02:56 +0800)]
Rollup merge of #52299 - ljedrz:dyn_libserialize, r=cramertj

Deny bare trait objects in src/libserialize

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

6 years agoRollup merge of #52293 - ljedrz:dyn_librustc_typeck, r=estebank
kennytm [Fri, 13 Jul 2018 18:56:45 +0000 (02:56 +0800)]
Rollup merge of #52293 - ljedrz:dyn_librustc_typeck, r=estebank

Deny bare trait objects in librustc_typeck

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

6 years agoRollup merge of #52290 - ljedrz:dyn_librustc_save_analysis, r=cramertj
kennytm [Fri, 13 Jul 2018 18:56:44 +0000 (02:56 +0800)]
Rollup merge of #52290 - ljedrz:dyn_librustc_save_analysis, r=cramertj

Deny bare trait objects in src/librustc_save_analysis

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

6 years agoRollup merge of #52280 - japaric:llvm-tools-preview, r=kennytm
kennytm [Fri, 13 Jul 2018 18:56:42 +0000 (02:56 +0800)]
Rollup merge of #52280 - japaric:llvm-tools-preview, r=kennytm

llvm-tools-preview: fix build-manifest

r? @alexcrichton

6 years agoRollup merge of #52156 - zajlerke:update-deprecation-notice, r=Kimundi
kennytm [Fri, 13 Jul 2018 18:56:41 +0000 (02:56 +0800)]
Rollup merge of #52156 - zajlerke:update-deprecation-notice, r=Kimundi

Update std::ascii::ASCIIExt deprecation notes

Fixes #52085

6 years agoRollup merge of #52003 - Kerollmops:option-replace, r=Kimundi
kennytm [Fri, 13 Jul 2018 18:56:40 +0000 (02:56 +0800)]
Rollup merge of #52003 - Kerollmops:option-replace, r=Kimundi

Implement `Option::replace` in the core library

Here is the implementation of the `Option::replace` method. The first step of [the tracking issue #51998](https://github.com/rust-lang/rust/issues/51998).

6 years agoRollup merge of #51962 - crlf0710:patch-2, r=alexcrichton
kennytm [Fri, 13 Jul 2018 18:56:37 +0000 (02:56 +0800)]
Rollup merge of #51962 - crlf0710:patch-2, r=alexcrichton

Provide llvm-strip in llvm-tools component

Shipping this tool gives people reliable way to reduce the generated executable size.

I'm not sure if this strip tool is available from the llvm version current rust is built on. But let's take a look. @japaric

6 years agoBump bootstrap compiler to 1.28.0-beta.10
Pietro Albini [Fri, 13 Jul 2018 17:33:48 +0000 (19:33 +0200)]
Bump bootstrap compiler to 1.28.0-beta.10

6 years agoDon't silently ignore invalid data in target spec
Jethro Beekman [Fri, 13 Jul 2018 17:14:16 +0000 (10:14 -0700)]
Don't silently ignore invalid data in target spec

6 years agoAuto merge of #52242 - ashtneoi:suggest-ref-mut, r=pnkfelix
bors [Fri, 13 Jul 2018 17:08:39 +0000 (17:08 +0000)]
Auto merge of #52242 - ashtneoi:suggest-ref-mut, r=pnkfelix

NLL: Suggest `ref mut` and `&mut self`

Fixes #51244. Supersedes #51249, I think.

Under the old lexical lifetimes, the compiler provided helpful suggestions about adding `mut` when you tried to mutate a variable bound as `&self` or (explicit) `ref`. NLL doesn't have those suggestions yet. This pull request adds them.

I didn't bother making the help text exactly the same as without NLL, but I can if that's important.

(Originally this was supposed to be part of #51612, but I got bogged down trying to fit everything in one PR.)

6 years agoFix typo in improper_ctypes suggestion
Robin Kruppe [Fri, 13 Jul 2018 13:51:25 +0000 (15:51 +0200)]
Fix typo in improper_ctypes suggestion

closes #52345

6 years agoEnabled core dump on Linux, and print stack trace on failure.
kennytm [Thu, 12 Jul 2018 17:56:17 +0000 (01:56 +0800)]
Enabled core dump on Linux, and print stack trace on failure.

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 agoUse callback-based interface to load ThinLTO import data into rustc.
Michael Woerister [Fri, 13 Jul 2018 10:41:22 +0000 (12:41 +0200)]
Use callback-based interface to load ThinLTO import data into rustc.

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 agoBless one more test
ashtneoi [Fri, 13 Jul 2018 06:11:57 +0000 (23:11 -0700)]
Bless one more test

6 years agoFactor out suggest_ref_mut; use it in rustc_borrowck
ashtneoi [Thu, 12 Jul 2018 22:39:36 +0000 (15:39 -0700)]
Factor out suggest_ref_mut; use it in rustc_borrowck

Also teach rustc_borrowck not to show useless help messages like
"use a mutable reference instead: `x`".

6 years agoBless tests and update ERROR
ashtneoi [Thu, 12 Jul 2018 20:11:47 +0000 (13:11 -0700)]
Bless tests and update ERROR

6 years agospan_suggestion
csmoe [Thu, 14 Jun 2018 01:12:50 +0000 (09:12 +0800)]
span_suggestion

6 years agoadd nll stderr
csmoe [Sun, 3 Jun 2018 04:06:21 +0000 (12:06 +0800)]
add nll stderr

6 years agoupdate test
csmoe [Fri, 1 Jun 2018 13:03:24 +0000 (21:03 +0800)]
update test

6 years agoreplace ref
csmoe [Fri, 1 Jun 2018 11:00:15 +0000 (19:00 +0800)]
replace ref

6 years agolint with ref_span
csmoe [Fri, 1 Jun 2018 04:08:31 +0000 (12:08 +0800)]
lint with ref_span

6 years agoupdate test
csmoe [Thu, 31 May 2018 15:00:58 +0000 (23:00 +0800)]
update test

6 years agofix wrong replacing
csmoe [Thu, 31 May 2018 14:31:13 +0000 (22:31 +0800)]
fix wrong replacing

6 years agoAlso test `&mut self` suggestion
ashtneoi [Wed, 11 Jul 2018 10:45:25 +0000 (03:45 -0700)]
Also test `&mut self` suggestion

6 years agoSimplify match expression
ashtneoi [Wed, 11 Jul 2018 07:44:55 +0000 (00:44 -0700)]
Simplify match expression

6 years agoPut the two halves of suggest_ampmut back together
ashtneoi [Wed, 11 Jul 2018 06:23:13 +0000 (23:23 -0700)]
Put the two halves of suggest_ampmut back together

6 years agoDon't try to suggest `ref mut` for implicit `ref`
ashtneoi [Wed, 11 Jul 2018 06:14:12 +0000 (23:14 -0700)]
Don't try to suggest `ref mut` for implicit `ref`

6 years agoReimplement some "add `mut`" suggestions under NLL
ashtneoi [Wed, 11 Jul 2018 05:58:43 +0000 (22:58 -0700)]
Reimplement some "add `mut`" suggestions under NLL

Specifically, `&self` -> `&mut self` and explicit `ref` -> `ref mut`.
Implicit `ref` isn't handled yet and causes an ICE.

6 years agoAdd `ref mut` suggestion test
ashtneoi [Wed, 11 Jul 2018 04:31:07 +0000 (21:31 -0700)]
Add `ref mut` suggestion test

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 agoproc_macro: Fix crate root detection
Vadim Petrochenkov [Thu, 12 Jul 2018 22:59:41 +0000 (01:59 +0300)]
proc_macro: Fix crate root detection

6 years agotask: remove wrong comments about non-existent LocalWake trait
Sean McArthur [Thu, 12 Jul 2018 22:43:57 +0000 (15:43 -0700)]
task: remove wrong comments about non-existent LocalWake trait

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 agoUpdate llvm-rebuild-trigger in light of LLVM 7 upgrade
varkor [Thu, 12 Jul 2018 19:32:35 +0000 (12:32 -0700)]
Update llvm-rebuild-trigger in light of LLVM 7 upgrade

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 agoResolve FIXME(#27942)
ljedrz [Thu, 12 Jul 2018 16:59:56 +0000 (18:59 +0200)]
Resolve FIXME(#27942)

6 years agoBackport 1.27.1 release notes to master
Mark Rousskov [Thu, 12 Jul 2018 15:23:00 +0000 (09:23 -0600)]
Backport 1.27.1 release notes to master

6 years agoFix ICE when using a pointer cast as array size
varkor [Thu, 12 Jul 2018 16:10:39 +0000 (09:10 -0700)]
Fix ICE when using a pointer cast as array size

6 years agoRevert "Auto merge of #51165 - SimonSapin:opt2, r=alexcrichton"
kennytm [Tue, 10 Jul 2018 14:28:32 +0000 (22:28 +0800)]
Revert "Auto merge of #51165 - SimonSapin:opt2, r=alexcrichton"

This reverts commit 524ad9b9e03656f3fdeb03ed82fe78db3916e566, reversing
changes made to 59c0f5913ddc2f66c1ff8ab612f7027e38c85a6d.

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 agoFix some run-make tests after object file naming has changed.
Michael Woerister [Thu, 12 Jul 2018 12:59:50 +0000 (14:59 +0200)]
Fix some run-make tests after object file naming has changed.

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 agoDeny bare trait objects in the rest of rust
ljedrz [Thu, 12 Jul 2018 11:50:22 +0000 (13:50 +0200)]
Deny bare trait objects in the rest of rust

6 years agoDeny bare trait objects in librustc_target and libtest
ljedrz [Thu, 12 Jul 2018 11:26:29 +0000 (13:26 +0200)]
Deny bare trait objects in librustc_target and libtest

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

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