]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoAuto merge of #50709 - alexcrichton:revert-musl, r=sfackler
bors [Sat, 19 May 2018 03:10:53 +0000 (03:10 +0000)]
Auto merge of #50709 - alexcrichton:revert-musl, r=sfackler

Revert #50105 until regression is fixed

Discovered at https://github.com/rust-lang/rust/pull/50105#issuecomment-388630750 it looks like this caused a regression with i686 musl, so let's revert in the meantime while a fix is worked out

6 years agoAuto merge of #50603 - eddyb:issue-49955, r=nikomatsakis
bors [Sat, 19 May 2018 00:27:45 +0000 (00:27 +0000)]
Auto merge of #50603 - eddyb:issue-49955, r=nikomatsakis

 rustc_mir: allow promotion of promotable temps indexed at runtime.

Fixes #49955.

r? @nikomatsakis

6 years agoAuto merge of #50319 - nagisa:align_to, r=alexcrichton
bors [Fri, 18 May 2018 21:49:38 +0000 (21:49 +0000)]
Auto merge of #50319 - nagisa:align_to, r=alexcrichton

Implement [T]::align_to

Note that this PR deviates from what is accepted by RFC slightly by making `align_offset` to return an offset in elements, rather than bytes. This is necessary to sanely support `[T]::align_to` and also simply makes more sense™. The caveat is that trying to align a pointer of ZST is now an equivalent to `is_aligned` check, rather than anything else (as no number of ZST elements will align a misaligned ZST pointer).

It also implements the `align_to` slightly differently than proposed in the RFC to properly handle cases where size of T and U aren’t co-prime.

Furthermore, a promise is made that the slice containing `U`s will be as large as possible (contrary to the RFC) – otherwise the function is quite useless.

The implementation uses quite a few underhanded tricks and takes advantage of the fact that alignment is a power-of-two quite heavily to optimise the machine code down to something that results in as few known-expensive instructions as possible. Currently calling `ptr.align_offset` with an unknown-at-compile-time `align` results in code that has just a single "expensive" modulo operation; the rest is "cheap" arithmetic and bitwise ops.

cc https://github.com/rust-lang/rust/issues/44488 @oli-obk

As mentioned in the commit message for align_offset, many thanks go to Chris McDonald.

6 years agoAuto merge of #50697 - KiChjang:issue-50461, r=pnkfelix
bors [Fri, 18 May 2018 19:36:26 +0000 (19:36 +0000)]
Auto merge of #50697 - KiChjang:issue-50461, r=pnkfelix

Use EverInit instead of MaybeInit to determine initialization

Fixes #50461.
Fixes #50463.

6 years agoAuto merge of #50653 - oli-obk:bad_const, r=cramertj
bors [Fri, 18 May 2018 17:17:35 +0000 (17:17 +0000)]
Auto merge of #50653 - oli-obk:bad_const, r=cramertj

Make the `const_err` lint `deny`-by-default

At best these things are runtime panics (debug mode) or overflows (release mode). More likely they are public constants that are unused in the crate declaring them.

This is not a breaking change, as dependencies won't break and root crates can `#![warn(const_err)]`, though I don't know why anyone would do that.

6 years agoAuto merge of #50533 - GuillaumeGomez:rustdoc-prim-auto, r=QuietMisdreavus
bors [Fri, 18 May 2018 14:52:12 +0000 (14:52 +0000)]
Auto merge of #50533 - GuillaumeGomez:rustdoc-prim-auto, r=QuietMisdreavus

add auto-impl for primitive type

Part of #50431.

I have no clue how to test this though with the rustdoc test suite...

r? @QuietMisdreavus

6 years agoAuto merge of #50307 - petrochenkov:keyhyg2, r=nikomatsakis
bors [Fri, 18 May 2018 10:57:05 +0000 (10:57 +0000)]
Auto merge of #50307 - petrochenkov:keyhyg2, r=nikomatsakis

Implement edition hygiene for keywords

Determine "keywordness" of an identifier in its hygienic context.
cc https://github.com/rust-lang/rust/pull/49611

I've resurrected `proc` as an Edition-2015-only keyword for testing purposes, but it should probably be buried again. EDIT: `proc` is removed again.

6 years agoAuto merge of #50758 - varkor:stabilise-inclusive_range_methods, r=SimonSapin
bors [Fri, 18 May 2018 08:10:23 +0000 (08:10 +0000)]
Auto merge of #50758 - varkor:stabilise-inclusive_range_methods, r=SimonSapin

Stabilise inclusive_range_methods

r? @SimonSapin

Closes #49022.

6 years agoAuto merge of #50848 - nrc:update, r=alexcrichton
bors [Fri, 18 May 2018 05:23:23 +0000 (05:23 +0000)]
Auto merge of #50848 - nrc:update, r=alexcrichton

Update RLS and Rustfmt

Fixes RLS build (The Rustfmt update is insignificant)

r? @alexcrichton

6 years agoAuto merge of #50847 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
bors [Fri, 18 May 2018 02:58:13 +0000 (02:58 +0000)]
Auto merge of #50847 - Mark-Simulacrum:rollup, r=Mark-Simulacrum

Rollup of 10 pull requests

Successful merges:

 - #50387 (Remove leftover tab in libtest outputs)
 - #50553 (Add Option::xor method)
 - #50610 (Improve format string errors)
 - #50649 (Tweak `nearest_common_ancestor()`.)
 - #50790 (Fix grammar documentation wrt Unicode identifiers)
 - #50791 (Fix null exclusions in grammar docs)
 - #50806 (Add `bless` x.py subcommand for easy ui test replacement)
 - #50818 (Speed up `opt_normalize_projection_type`)
 - #50837 (Revert #49767)
 - #50839 (Make sure people know the book is free oline)

Failed merges:

6 years agoAuto merge of #50566 - nnethercote:bump, r=petrochenkov
bors [Fri, 18 May 2018 00:09:37 +0000 (00:09 +0000)]
Auto merge of #50566 - nnethercote:bump, r=petrochenkov

Streamline `StringReader::bump`

These patches make `bump` smaller and nicer. They speed up most runs for coercions and tuple-stress by 1--3%.

6 years agoAuto merge of #50593 - nikomatsakis:nll-no-location, r=nikomatsakis
bors [Thu, 17 May 2018 21:36:43 +0000 (21:36 +0000)]
Auto merge of #50593 - nikomatsakis:nll-no-location, r=nikomatsakis

stop considering location when computing outlives relationships

This doesn't (yet?) use SEME regions, but it does ignore the location for outlives constraints. This makes (I believe) NLL significantly faster -- but we should do some benchmarks. It regresses the "get-default" family of use cases for NLL, which is a shame, but keeps the other benefits, and thus represents a decent step forward.

r? @pnkfelix

6 years agoFix rebase
Vadim Petrochenkov [Thu, 17 May 2018 20:32:47 +0000 (23:32 +0300)]
Fix rebase

6 years agoUpdate RLS and Rustfmt
Nick Cameron [Thu, 17 May 2018 19:59:16 +0000 (07:59 +1200)]
Update RLS and Rustfmt

6 years agoFix align_offset_stride1 & align_to_simple tests
Simonas Kazlauskas [Thu, 17 May 2018 15:02:47 +0000 (18:02 +0300)]
Fix align_offset_stride1 & align_to_simple tests

6 years agoRemove the intrinsic for align_offset
Simonas Kazlauskas [Thu, 3 May 2018 21:49:22 +0000 (00:49 +0300)]
Remove the intrinsic for align_offset

Keep only the language item. This removes some indirection and makes
codegen worse for debug builds, but simplifies code significantly, which
is a good tradeoff to make, in my opinion.

Besides, the codegen can be improved even further with some constant
evaluation improvements that we expect to happen in the future.

6 years agoRemove the `proc` keyword again
Vadim Petrochenkov [Sun, 13 May 2018 13:35:52 +0000 (16:35 +0300)]
Remove the `proc` keyword again

6 years agoTurn some functions from `token.rs` into methods on `Ident`
Vadim Petrochenkov [Sun, 13 May 2018 13:14:43 +0000 (16:14 +0300)]
Turn some functions from `token.rs` into methods on `Ident`

6 years agoPass crate editions to macro expansions, update tests
Vadim Petrochenkov [Sun, 13 May 2018 00:51:46 +0000 (03:51 +0300)]
Pass crate editions to macro expansions, update tests

6 years agoKeep crate edition in metadata
Vadim Petrochenkov [Sun, 13 May 2018 00:50:39 +0000 (03:50 +0300)]
Keep crate edition in metadata

6 years agoAdd tests
Vadim Petrochenkov [Mon, 23 Apr 2018 22:50:28 +0000 (01:50 +0300)]
Add tests

6 years agoAdd two keywords specific to editions 2015 and 2018 respectively
Vadim Petrochenkov [Sat, 28 Apr 2018 23:20:46 +0000 (02:20 +0300)]
Add two keywords specific to editions 2015 and 2018 respectively

6 years agoImplement [T]::align_to
Simonas Kazlauskas [Sun, 29 Apr 2018 14:09:56 +0000 (17:09 +0300)]
Implement [T]::align_to

6 years agoAdd edition to expansion info
Vadim Petrochenkov [Fri, 27 Apr 2018 23:08:16 +0000 (02:08 +0300)]
Add edition to expansion info

6 years agoMove definition of `Edition` from libsyntax to libsyntax_pos
Vadim Petrochenkov [Sun, 22 Apr 2018 22:44:19 +0000 (01:44 +0300)]
Move definition of `Edition` from libsyntax to libsyntax_pos

6 years agoAdd doc comments mentioning unspecified behaviour upon exhaustion
varkor [Wed, 16 May 2018 20:19:17 +0000 (21:19 +0100)]
Add doc comments mentioning unspecified behaviour upon exhaustion

6 years agoStabilise into_inner
varkor [Mon, 14 May 2018 22:31:20 +0000 (23:31 +0100)]
Stabilise into_inner

6 years agoStabilise inclusive_range_methods
varkor [Mon, 14 May 2018 22:25:22 +0000 (23:25 +0100)]
Stabilise inclusive_range_methods

6 years agoRollup merge of #50839 - glassresistor:master, r=steveklabnik
Mark Simulacrum [Thu, 17 May 2018 19:51:30 +0000 (13:51 -0600)]
Rollup merge of #50839 - glassresistor:master, r=steveklabnik

Make sure people know the book is free oline

I've used the tutorial a number of times to relearn rust basics.  When i saw this for a moment I was sad thinking it had been taken offline.

6 years agoRollup merge of #50837 - steveklabnik:revert-49767, r=QuietMisdreavus
Mark Simulacrum [Thu, 17 May 2018 19:51:28 +0000 (13:51 -0600)]
Rollup merge of #50837 - steveklabnik:revert-49767, r=QuietMisdreavus

Revert #49767

There was [some confusion](https://github.com/rust-lang/rust/pull/49767#issuecomment-389250815) and I accidentally merged a PR that wasn't ready.

6 years agoRollup merge of #50818 - nnethercote:faster-normalize, r=nikomatsakis
Mark Simulacrum [Thu, 17 May 2018 19:51:27 +0000 (13:51 -0600)]
Rollup merge of #50818 - nnethercote:faster-normalize, r=nikomatsakis

Speed up `opt_normalize_projection_type`

`opt_normalize_projection_type` is hot in the serde and futures benchmarks in rustc-perf. These two patches speed up the execution of most runs for them by 2--4%.

6 years agoRollup merge of #50806 - oli-obk:gesundheit, r=ehuss
Mark Simulacrum [Thu, 17 May 2018 19:51:26 +0000 (13:51 -0600)]
Rollup merge of #50806 - oli-obk:gesundheit, r=ehuss

Add `bless` x.py subcommand for easy ui test replacement

fixes #49815

r? @nikomatsakis

6 years agoRollup merge of #50791 - bstrie:null, r=QuietMisdreavus
Mark Simulacrum [Thu, 17 May 2018 19:51:25 +0000 (13:51 -0600)]
Rollup merge of #50791 - bstrie:null, r=QuietMisdreavus

Fix null exclusions in grammar docs

The grammar documentation incorrectly says that comments, character literals,
and string literals may not include null.

6 years agoRollup merge of #50790 - bstrie:grammar, r=steveklabnik
Mark Simulacrum [Thu, 17 May 2018 19:51:24 +0000 (13:51 -0600)]
Rollup merge of #50790 - bstrie:grammar, r=steveklabnik

Fix grammar documentation wrt Unicode identifiers

The grammar defines identifiers in terms of XID_start and XID_continue,
but this is referring to the unstable non_ascii_idents feature.
The documentation implies that non_ascii_idents is forthcoming, but this
is left over from pre-1.0 documentation; in reality, non_ascii_idents
has been without even an RFC for several years now, and will not be
stabilized anytime soon. Furthermore, according to the tracking issue at
https://github.com/rust-lang/rust/issues/28979 , it's highly
questionable whether or not this feature will use XID_start or
XID_continue even when or if non_ascii_idents is stabilized.
This commit fixes this by respecifying identifiers as the usual
[a-zA-Z_][a-zA-Z0-9_]*

6 years agoRollup merge of #50649 - nnethercote:tweak-nearest_common_ancestor, r=nikomatsakis
Mark Simulacrum [Thu, 17 May 2018 19:51:22 +0000 (13:51 -0600)]
Rollup merge of #50649 - nnethercote:tweak-nearest_common_ancestor, r=nikomatsakis

Tweak `nearest_common_ancestor()`.

- Remove the "no nearest common ancestor found" case, because it's never
  hit in practise. (This means `closure_is_enclosed_by` can also be
  removed.)

- Add a comment about why `SmallVec` is used for the "seen" structures.

- Use `&Scope` instead of `Scope` to avoid some `map()` calls.

- Use `any(p)` instead of `position(p).is_some()`.

r? @nikomatsakis

6 years agoRollup merge of #50610 - estebank:fmt-str, r=Kimundi
Mark Simulacrum [Thu, 17 May 2018 19:51:21 +0000 (13:51 -0600)]
Rollup merge of #50610 - estebank:fmt-str, r=Kimundi

Improve format string errors

Point at format string position inside the formatting string:
```
error: invalid format string: unmatched `}` found
  --> $DIR/format-string-error.rs:21:22
   |
LL |     let _ = format!("}");
   |                      ^ unmatched `}` in format string
```

Explain that argument names can't start with an underscore:
```
error: invalid format string: invalid argument name `_foo`
  --> $DIR/format-string-error.rs:15:23
   |
LL |     let _ = format!("{_foo}", _foo = 6usize);
   |                       ^^^^ invalid argument name in format string
   |
   = note: argument names cannot start with an underscore
```

Fix #23476.

The more accurate spans will only be seen when using `format!` directly, when using `println!` the diagnostics machinery makes the span be the entire statement.

6 years agoRollup merge of #50553 - clarcharr:option_xor, r=sfackler
Mark Simulacrum [Thu, 17 May 2018 19:51:20 +0000 (13:51 -0600)]
Rollup merge of #50553 - clarcharr:option_xor, r=sfackler

Add Option::xor method

Implements the method requested in #50512.

6 years agoRollup merge of #50387 - phansch:remove_leftover_tab, r=alexcrichton
Mark Simulacrum [Thu, 17 May 2018 19:51:19 +0000 (13:51 -0600)]
Rollup merge of #50387 - phansch:remove_leftover_tab, r=alexcrichton

Remove leftover tab in libtest outputs

This removes some tabs that were present in the output of libtest.

Related #19299
Closes #50362

6 years agoChange align_offset to support different strides
Simonas Kazlauskas [Wed, 18 Apr 2018 15:38:12 +0000 (18:38 +0300)]
Change align_offset to support different strides

This is necessary if we want to implement `[T]::align_to` and is more
useful in general.

This implementation effort has begun during the All Hands and represents
a month of my futile efforts to do any sort of maths. Luckily, I
found the very very nice Chris McDonald (cjm) on IRC who figured out the
core formulas for me! All the thanks for existence of this PR go to
them!

Anyway… Those formulas were mangled by yours truly into the arcane forms
you see here to squeeze out the best assembly possible on most of the
modern architectures (x86 and ARM were evaluated in practice). I mean,
just look at it: *one actual* modulo operation and everything else is
just the cheap single cycle ops! Admitedly, the naive solution might be
faster in some common scenarios, but this code absolutely butchers the
naive solution on the worst case scenario.

Alas, the result of this arcane magic also means that the code pretty
heavily relies on the preconditions holding true and breaking those
preconditions will unleash the UB-est of all UBs! So don’t.

6 years agoUpdate tutorial.md
Mikela [Thu, 17 May 2018 19:25:24 +0000 (12:25 -0700)]
Update tutorial.md

6 years agoUse EverInit instead of MaybeInit to determine initialization
Keith Yeung [Sat, 12 May 2018 21:32:11 +0000 (14:32 -0700)]
Use EverInit instead of MaybeInit to determine initialization

6 years agoRevert "bootstrap.py: respect crt-static"
Alex Crichton [Sun, 13 May 2018 14:45:20 +0000 (07:45 -0700)]
Revert "bootstrap.py: respect crt-static"

This reverts commit 5ecf29df052c7eca10fccc96f4179d338fe0014e.

6 years agoRevert "musl: don't use the included startfiles with -crt-static"
Alex Crichton [Sun, 13 May 2018 14:45:16 +0000 (07:45 -0700)]
Revert "musl: don't use the included startfiles with -crt-static"

This reverts commit a5a875d17b34b61326d803eb2edea526d3bd6914.

6 years agoRevert "bootstrap: pass crt-static for the compiler host as well"
Alex Crichton [Sun, 13 May 2018 14:44:46 +0000 (07:44 -0700)]
Revert "bootstrap: pass crt-static for the compiler host as well"

This reverts commit ec2b861c2f8013e10ab1f6e01c9aed9ad1daaefe.

6 years agoRevert "musl: link crt{begin,end}.o from the system compiler"
Alex Crichton [Sun, 13 May 2018 14:44:46 +0000 (07:44 -0700)]
Revert "musl: link crt{begin,end}.o from the system compiler"

This reverts commit 6d9154a830dd9773fe8a4e34e1fc3dfb1ca6f935.

6 years agoRevert "Add a test for issue 36710."
Alex Crichton [Sun, 13 May 2018 14:44:46 +0000 (07:44 -0700)]
Revert "Add a test for issue 36710."

This reverts commit bd94bf5738c7a0fd148157831eabd1efede3b309.

6 years agoRevert "compiletest: escape CXX the same way as CC for MSVC"
Alex Crichton [Sun, 13 May 2018 14:44:45 +0000 (07:44 -0700)]
Revert "compiletest: escape CXX the same way as CC for MSVC"

This reverts commit 490d05055abd36521abc41c2e551ac789820e80f.

6 years agoRevert #49767
steveklabnik [Thu, 17 May 2018 17:19:41 +0000 (13:19 -0400)]
Revert #49767

There was [some confusion](https://github.com/rust-lang/rust/pull/49767#issuecomment-389250815) and I accidentally merged a PR that wasn't ready.

6 years agoMake sure people know the book is free oline
Mikela [Thu, 17 May 2018 16:49:28 +0000 (09:49 -0700)]
Make sure people know the book is free oline

6 years agoAuto merge of #50629 - Mark-Simulacrum:stage-step, r=alexcrichton
bors [Thu, 17 May 2018 16:44:38 +0000 (16:44 +0000)]
Auto merge of #50629 - Mark-Simulacrum:stage-step, r=alexcrichton

Switch to bootstrapping from 1.27

It's possible the Float trait could be removed from core, but I couldn't tell whether it was intended to be removed or not. @SimonSapin may be able to comment more here; we can presumably also do that in a follow up PR as this one is already quite large.

6 years agoRemove MAKEFLAGS to prevent accidental inheritance
Mark Simulacrum [Wed, 16 May 2018 23:04:12 +0000 (17:04 -0600)]
Remove MAKEFLAGS to prevent accidental inheritance

6 years agoFix rustc binary metadata overwriting librustc metadata
Mark Simulacrum [Sat, 12 May 2018 03:30:02 +0000 (21:30 -0600)]
Fix rustc binary metadata overwriting librustc metadata

In #49289, rustc was changed to emit metadata for binaries, which made
it so that the librustc.rmeta file created when compiling librustc was
overwritten by the rustc-main compilation. This commit renames the
rustc-main binary to avoid this problem.

https://github.com/rust-lang/cargo/issues/5524 has also been filed to
see if Cargo can learn to warn on this situation instead of leaving it
for the user to debug.

6 years agoRename rustdoc to use underscores
Mark Simulacrum [Sat, 12 May 2018 02:51:05 +0000 (20:51 -0600)]
Rename rustdoc to use underscores

6 years agoSwitch to 1.26 bootstrap compiler
Mark Simulacrum [Thu, 10 May 2018 18:02:19 +0000 (12:02 -0600)]
Switch to 1.26 bootstrap compiler

6 years agoUpdate docs and diagnostics
Oliver Schneider [Thu, 17 May 2018 14:28:36 +0000 (16:28 +0200)]
Update docs and diagnostics

6 years agoAuto merge of #50615 - irinagpopa:rename-trans, r=nikomatsakis
bors [Thu, 17 May 2018 14:10:11 +0000 (14:10 +0000)]
Auto merge of #50615 - irinagpopa:rename-trans, r=nikomatsakis

Rename trans to codegen everywhere.

Part of #45274.

6 years ago`bless` also produces `.nll` files now
Oliver Schneider [Thu, 17 May 2018 08:17:06 +0000 (10:17 +0200)]
`bless` also produces `.nll` files now

6 years agoFix selftests
Oliver Schneider [Thu, 17 May 2018 07:47:25 +0000 (09:47 +0200)]
Fix selftests

6 years agoMake `bless` a flag instead of a subcommand
Oliver Schneider [Wed, 16 May 2018 16:17:29 +0000 (18:17 +0200)]
Make `bless` a flag instead of a subcommand

6 years agoAdd `bless` x.py subcommand for easy ui test replacement
Oliver Schneider [Wed, 16 May 2018 15:18:19 +0000 (17:18 +0200)]
Add `bless` x.py subcommand for easy ui test replacement

6 years agoRename trans to codegen everywhere.
Irina Popa [Tue, 8 May 2018 13:10:16 +0000 (16:10 +0300)]
Rename trans to codegen everywhere.

6 years agoAuto merge of #50400 - ehuss:compiletest-revisions, r=alexcrichton
bors [Thu, 17 May 2018 08:29:11 +0000 (08:29 +0000)]
Auto merge of #50400 - ehuss:compiletest-revisions, r=alexcrichton

 compiletest: Run revisions as independent tests.

Fixes #47604.

- The output of each test is now in its own directory.
- "auxiliary" output is now under the respective test directory.
- `stage_id` removed from filenames, and instead placed in the stamp file as a hash.  This helps keep path lengths down for Windows.

In brief, the new layout looks like this:
```
<build_base>/<relative_dir>/<testname>.<revision>.<mode>/
    stamp
    <testname>.err
    <testname>.out
    a (binary)
    auxiliary/lib<auxname>.dylib
    auxiliary/<auxname>/<auxname>.err
    auxiliary/<auxname>/<auxname>.out
```
(revision and mode are optional)

6 years agoFix running multiple targets.
Eric Huss [Sun, 13 May 2018 05:18:55 +0000 (22:18 -0700)]
Fix running multiple targets.

The aux dir, which previously had the `stage_id` embedded in it, was picking up remnants from previous runs.

6 years agoFix update-references for tests within subdirectories.
Eric Huss [Fri, 4 May 2018 21:31:43 +0000 (14:31 -0700)]
Fix update-references for tests within subdirectories.

6 years agocompiletest: Run revisions as independent tests.
Eric Huss [Thu, 26 Apr 2018 22:27:31 +0000 (15:27 -0700)]
compiletest: Run revisions as independent tests.

- The output of each test is now in its own directory.
- "auxiliary" output is now under the respective test directory.
- `stage_id` removed from filenames, and instead placed in the stamp file as a hash.  This helps keep path lengths down for Windows.

In brief, the new layout looks like this:
```
<build_base>/<relative_dir>/<testname>.<revision>.<mode>/
    stamp
    <testname>.err
    <testname>.out
    a (binary)
    auxiliary/lib<auxname>.dylib
    auxiliary/<auxname>/<auxname>.err
    auxiliary/<auxname>/<auxname>.out
```
(revision and mode are optional)

6 years agocompiletest: rustfmt
Eric Huss [Thu, 26 Apr 2018 22:16:27 +0000 (15:16 -0700)]
compiletest: rustfmt

6 years agoAuto merge of #50665 - alexcrichton:fix-single-item-path-warnings, r=oli-obk
bors [Thu, 17 May 2018 05:00:14 +0000 (05:00 +0000)]
Auto merge of #50665 - alexcrichton:fix-single-item-path-warnings, r=oli-obk

rustc: Fix `crate` lint for single-item paths

This commit fixes recommending the `crate` prefix when migrating to 2018 for
paths that look like `use foo;` or `use {bar, baz}`

Closes #50660

6 years agoAuto merge of #50807 - kennytm:rollup, r=kennytm
bors [Thu, 17 May 2018 02:05:39 +0000 (02:05 +0000)]
Auto merge of #50807 - kennytm:rollup, r=kennytm

Rollup of 17 pull requests

Successful merges:

 - #50170 (Implement From for more types on Cow)
 - #50638 (Don't unconditionally set CLOEXEC twice on every fd we open on Linux)
 - #50656 (Fix `fn main() -> impl Trait` for non-`Termination` trait)
 - #50669 (rustdoc: deprecate `#![doc(passes, plugins, no_default_passes)]`)
 - #50726 (read2: Use inner function instead of closure)
 - #50728 (Fix rustdoc panic with `impl Trait` in type parameters)
 - #50736 (env: remove unwrap in examples in favor of try op)
 - #50740 (Remove LazyBTreeMap.)
 - #50752 (Add missing error codes in libsyntax-ext asm)
 - #50779 (Make mutable_noalias and arg_align_attributes be tracked)
 - #50787 (Fix run-make wasm tests)
 - #50788 (Fix an ICE when casting a nonexistent const)
 - #50789 (Ensure libraries built in stage0 have unique metadata)
 - #50793 (tidy: Add a check for empty UI test files)
 - #50797 (fix a typo in signed-integer::from_str_radix())
 - #50808 (Stabilize num::NonZeroU*)
 - #50809 (GitHub: Stop treating Cargo.lock as a generated file.)

Failed merges:

6 years agoAvoid allocations in `opt_normalize_projection_type`.
Nicholas Nethercote [Wed, 16 May 2018 21:58:08 +0000 (07:58 +1000)]
Avoid allocations in `opt_normalize_projection_type`.

This patch changes `opt_normalize_project_type` so it appends
obligations to a given obligations vector, instead of returning a new
obligations vector.

This change avoids lots of allocations. In the most extreme case, for a
clean "Check" build of serde it reduces the total number of allocations
by 20%.

6 years agoAuto merge of #50696 - ehuss:cargo-update, r=alexcrichton
bors [Wed, 16 May 2018 23:46:19 +0000 (23:46 +0000)]
Auto merge of #50696 - ehuss:cargo-update, r=alexcrichton

Update Cargo

Unblocking PRs:
- rust-lang/cargo#5535 - Ignore tab in libtest output. (unblocks #50387)
- rust-lang/cargo#5537 - Remove -Zno-trans test. (unblocks #50615)
- rust-lang/cargo#5540 - Fix tests when CARGO_TARGET_DIR is set. (unblocks self)

Regression fixes:
- rust-lang/cargo#5503 - cargo rustc broken for tests in project with bins
- rust-lang/cargo#5520 - shared proc-macro dependency built incorrectly

Changes:
- rust-lang/cargo#5527 - Point Source Replacement to the Overriding Dependencies section
- rust-lang/cargo#5533 - Detail how to run locally-built nightly cargo
- rust-lang/cargo#5522 - Add option to set user-agent
- rust-lang/cargo#5519 - NFC: fix a couple of typos, found by codespell.
- rust-lang/cargo#5513 - Fix `panic` for binaries built during tests.
- rust-lang/cargo#5512 - simplify build_requirements
- rust-lang/cargo#5301 - Add --build-plan for 'cargo build'
- rust-lang/cargo#5460 - Be more conservative about which files are linked to the output dir.
- rust-lang/cargo#5509 - Use the new stable
- rust-lang/cargo#5507 - Does not print seconds fraction with minutes
- rust-lang/cargo#5498 - Bump to 0.29.0
- rust-lang/cargo#5497 - Mention +nightly in ARCHITECTURE.md

The PR fixes #50640.

6 years agoAvoid repeated HashMap lookups in `opt_normalize_projection_type`.
Nicholas Nethercote [Wed, 16 May 2018 10:59:27 +0000 (20:59 +1000)]
Avoid repeated HashMap lookups in `opt_normalize_projection_type`.

There is a hot path through `opt_normalize_projection_type`:
- `try_start` does a cache lookup (#1).
- The result is a `NormalizedTy`.
- There are no unresolved type vars, so we call `complete`.
- `complete` does *another* cache lookup (#2), then calls
  `SnapshotMap::insert`.
- `insert` does *another* cache lookup (#3), inserting the same value
  that's already in the cache.

This patch optimizes this hot path by introducing `complete_normalized`,
for use when the value is known in advance to be a `NormalizedTy`. It
always avoids lookup #2. Furthermore, if the `NormalizedTy`'s
obligations are empty (the common case), we know that lookup #3 would be
a no-op, so we avoid it, while inserting a Noop into the `SnapshotMap`'s
undo log.

6 years agoRollup merge of #50809 - kennytm:show-cargo-lock-diff, r=alexcrichton
kennytm [Wed, 16 May 2018 21:24:42 +0000 (05:24 +0800)]
Rollup merge of #50809 - kennytm:show-cargo-lock-diff, r=alexcrichton

GitHub: Stop treating Cargo.lock as a generated file.

We do want to inspect the changes to Cargo.lock, hiding the diff by default would make it easier to miss important details like https://github.com/rust-lang/rust/pull/50629#discussion_r187556602 and https://github.com/rust-lang/rust/pull/50696#pullrequestreview-119648156

6 years agoRollup merge of #50170 - burtonageo:more_cow_from, r=alexcrichton
kennytm [Wed, 16 May 2018 21:22:07 +0000 (05:22 +0800)]
Rollup merge of #50170 - burtonageo:more_cow_from, r=alexcrichton

Implement From for more types on Cow

This is basically https://github.com/rust-lang/rust/pull/48191, except that it should be implemented in a way that doesn't break third party crates.

6 years agoRollup merge of #50808 - SimonSapin:nonzero, r=alexcrichton
kennytm [Wed, 16 May 2018 19:07:52 +0000 (03:07 +0800)]
Rollup merge of #50808 - SimonSapin:nonzero, r=alexcrichton

Stabilize num::NonZeroU*

Tracking issue: https://github.com/rust-lang/rust/issues/49137

6 years agoRollup merge of #50793 - jrlusby:master, r=petrochenkov
kennytm [Wed, 16 May 2018 19:07:35 +0000 (03:07 +0800)]
Rollup merge of #50793 - jrlusby:master, r=petrochenkov

tidy: Add a check for empty UI test files

Check for empty `.stderr` and `.stdout` files in UI test directories.
Empty files could  still pass testing for `compile-pass` tests with no output
so they can get into the repo accidentally, but they are not necessary and can
be removed.

This is very much an in progress pull request. I'm having an issue with rustfmt. It wanted to reformat the entire file for almost every file by default. And when I run tidy it just errors out because it catches the empty files that are already in the repo.

My next step is goin got be to remove those empty file and see if running tidy again will actually reformat things outside of the context of `cargo fmt`

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

6 years agoRollup merge of #50797 - shamiao:patch-1, r=kennytm
kennytm [Wed, 16 May 2018 15:23:04 +0000 (23:23 +0800)]
Rollup merge of #50797 - shamiao:patch-1, r=kennytm

fix a typo in signed-integer::from_str_radix()

a minor typo in docs.

6 years agoRollup merge of #50789 - cuviper:bootstrap-metadata, r=alexcrichton
kennytm [Wed, 16 May 2018 15:23:02 +0000 (23:23 +0800)]
Rollup merge of #50789 - cuviper:bootstrap-metadata, r=alexcrichton

Ensure libraries built in stage0 have unique metadata

Issue #50786 shows a case with local rebuild where the libraries built
by stage0 had the same suffix as stage0's own, and were accidentally
loaded by that stage0 rustc when compiling `librustc_trans`.

Now we set `__CARGO_DEFAULT_LIB_METADATA` to "bootstrap" during stage0,
rather than the release channel like usual, so the library suffix will
always be completely distinct from the stage0 compiler.

6 years agoRollup merge of #50788 - varkor:missing-const-cast, r=cramertj
kennytm [Wed, 16 May 2018 15:23:00 +0000 (23:23 +0800)]
Rollup merge of #50788 - varkor:missing-const-cast, r=cramertj

Fix an ICE when casting a nonexistent const

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

6 years agoRollup merge of #50787 - ehuss:fix-run-make-wasm, r=alexcrichton
kennytm [Wed, 16 May 2018 15:22:59 +0000 (23:22 +0800)]
Rollup merge of #50787 - ehuss:fix-run-make-wasm, r=alexcrichton

Fix run-make wasm tests

Fixes #50711

6 years agoRollup merge of #50779 - nox:untracked-options, r=rkruppe
kennytm [Wed, 16 May 2018 15:22:58 +0000 (23:22 +0800)]
Rollup merge of #50779 - nox:untracked-options, r=rkruppe

Make mutable_noalias and arg_align_attributes be tracked

6 years agoRollup merge of #50752 - GuillaumeGomez:more-error-code-in-libsyntax-ext, r=frewsxcv
kennytm [Wed, 16 May 2018 15:22:57 +0000 (23:22 +0800)]
Rollup merge of #50752 - GuillaumeGomez:more-error-code-in-libsyntax-ext, r=frewsxcv

Add missing error codes in libsyntax-ext asm

6 years agoRollup merge of #50740 - nnethercote:rm-LazyBTreeMap, r=cramertj
kennytm [Wed, 16 May 2018 15:22:56 +0000 (23:22 +0800)]
Rollup merge of #50740 - nnethercote:rm-LazyBTreeMap, r=cramertj

Remove LazyBTreeMap.

It was introduced in #50240 to avoid an allocation when creating a new
BTreeMap, which gave some speed-ups. But then #50352 made that the
default behaviour for BTreeMap, so LazyBTreeMap is no longer necessary.

6 years agoRollup merge of #50736 - udoprog:env-try-op, r=shepmaster
kennytm [Wed, 16 May 2018 15:22:54 +0000 (23:22 +0800)]
Rollup merge of #50736 - udoprog:env-try-op, r=shepmaster

env: remove unwrap in examples in favor of try op

6 years agoRollup merge of #50728 - sinkuu:fix_50702, r=GuillaumeGomez
kennytm [Wed, 16 May 2018 15:22:53 +0000 (23:22 +0800)]
Rollup merge of #50728 - sinkuu:fix_50702, r=GuillaumeGomez

Fix rustdoc panic with `impl Trait` in type parameters

Fixes #50702.

I'm not sure `impl Trait`s neither in arguments nor in return types are supposed to work, though.

6 years agoRollup merge of #50726 - udoprog:read2-inner-fn, r=alexcrichton
kennytm [Wed, 16 May 2018 15:22:52 +0000 (23:22 +0800)]
Rollup merge of #50726 - udoprog:read2-inner-fn, r=alexcrichton

read2: Use inner function instead of closure

Very minor thing, but there doesn't appear to be a reason to use a closure here.

Generated code is identical in my tests, but I believe it's clearer that nothing from the environment is being used.

6 years agoAuto merge of #50710 - Zoxc:value_to_constvalue, r=oli-obk
bors [Wed, 16 May 2018 21:01:31 +0000 (21:01 +0000)]
Auto merge of #50710 - Zoxc:value_to_constvalue, r=oli-obk

Fix conversion from Miri Value to ConstValue

This fixes an error compiling the `immeta` 0.3.6 crate. https://github.com/rust-lang/rust/issues/50707 may be fixed too.

r? @oli-obk

6 years agoRemove empty file introduced by rebase
Jane Lusby [Wed, 16 May 2018 17:21:15 +0000 (10:21 -0700)]
Remove empty file introduced by rebase

6 years agoRemove empty files
Jane Lusby [Wed, 16 May 2018 02:53:43 +0000 (19:53 -0700)]
Remove empty files

6 years agotidy: Add a check for empty UI test files
Jane Lusby [Wed, 16 May 2018 02:15:43 +0000 (19:15 -0700)]
tidy: Add a check for empty UI test files

Check for empty `.stderr` and `.stdout` files in UI test directories.
Empty files could  still pass testing for `compile-pass` tests with no output
so they can get into the repo accidentally, but they are not necessary and can
be removed.

6 years agoAuto merge of #49479 - nox:merge-funcs, r=nagisa
bors [Wed, 16 May 2018 17:15:37 +0000 (17:15 +0000)]
Auto merge of #49479 - nox:merge-funcs, r=nagisa

Reenable the MergeFunctions pass

The crash that happened in #23566 doesn't happen anymore with the LLVM mergefunc
pass enabled and it hugely reduces code size (for example it shaves off 10% of the
final Servo executable). This patch reenables it.

For those wondering, [here are the docs from LLVM about this pass](http://llvm.org/docs/MergeFunctions.html).

6 years agoStabilize num::NonZeroU*
Simon Sapin [Wed, 16 May 2018 16:07:35 +0000 (18:07 +0200)]
Stabilize num::NonZeroU*

Tracking issue: https://github.com/rust-lang/rust/issues/49137

6 years agoRemove unstable deprecated num::NonZeroI* types
Simon Sapin [Sat, 24 Mar 2018 10:36:29 +0000 (11:36 +0100)]
Remove unstable deprecated num::NonZeroI* types

6 years agoMake core::nonzero private
Simon Sapin [Fri, 16 Feb 2018 10:33:22 +0000 (11:33 +0100)]
Make core::nonzero private

It is now an implementation detail of ptr::NonNull and num::NonZero*

6 years agoGitHub: Stop treating Cargo.lock as a generated file.
kennytm [Wed, 16 May 2018 15:49:58 +0000 (23:49 +0800)]
GitHub: Stop treating Cargo.lock as a generated file.

We do want to inspect the changes to Cargo.lock, hiding the diff by default
would miss important details like
https://github.com/rust-lang/rust/pull/50629#discussion_r187556602

6 years agoRollup merge of #50669 - QuietMisdreavus:deprecated-attrs, r=GuillaumeGomez
kennytm [Wed, 16 May 2018 15:22:48 +0000 (23:22 +0800)]
Rollup merge of #50669 - QuietMisdreavus:deprecated-attrs, r=GuillaumeGomez

rustdoc: deprecate `#![doc(passes, plugins, no_default_passes)]`

Closes https://github.com/rust-lang/rust/issues/48164

Blocked on https://github.com/rust-lang/rust/pull/50541 - this includes those changes, which were necessary to create the UI test

cc https://github.com/rust-lang/rust/issues/44136

Turns out, there were special attributes to mess with rustdoc passes and plugins! Who knew! Since we deprecated the CLI flags for this functionality, it makes sense that we do the same for the attributes.

This PR also introduces a `#![doc(document_private_items)]` attribute, to match the `--document-private-items` flag introduced in https://github.com/rust-lang/rust/pull/44138 when the passes/plugins flags were deprecated.

I haven't done a search to see whether these attributes are being used at all, but if the flags were any indication, i don't expect to see any users of these.

6 years agoRollup merge of #50656 - leodasvacas:fix-impl-trait-in-main-ret, r=nikomatsakis
kennytm [Wed, 16 May 2018 15:22:47 +0000 (23:22 +0800)]
Rollup merge of #50656 - leodasvacas:fix-impl-trait-in-main-ret, r=nikomatsakis

Fix `fn main() -> impl Trait` for non-`Termination` trait

Fixes #50595.

This bug currently affects stable. Why I think we can go for hard error:
- It will in stable for at most one cycle and there is no legitimate reason to abuse it, nor any known uses in the wild.
- It only affects `bin` crates (which have a `main`), so there is little practical difference between a hard error or a deny lint, both are a one line fix.

The fix was to just unshadow a variable. Thanks @nikomatsakis for the mentoring!

r? @nikomatsakis

6 years agoRollup merge of #50638 - tbu-:pr_open_cloexec_once, r=nagisa
kennytm [Wed, 16 May 2018 15:22:45 +0000 (23:22 +0800)]
Rollup merge of #50638 - tbu-:pr_open_cloexec_once, r=nagisa

Don't unconditionally set CLOEXEC twice on every fd we open on Linux

Previously, every `open64` was accompanied by a `ioctl(…, FIOCLEX)`,
because some old Linux version would ignore the `O_CLOEXEC` flag we pass
to the `open64` function.

Now, we check whether the `CLOEXEC` flag is set on the first file we
open – if it is, we won't do extra syscalls for every opened file. If it
is not set, we fall back to the old behavior of unconditionally calling
`ioctl(…, FIOCLEX)` on newly opened files.

On old Linuxes, this amounts to one extra syscall per process, namely
the `fcntl(…, F_GETFD)` call to check the `CLOEXEC` flag.

On new Linuxes, this reduces the number of syscalls per opened file by
one, except for the first file, where it does the same number of
syscalls as before (`fcntl(…, F_GETFD)` to check the flag instead of
`ioctl(…, FIOCLEX)` to set it).

6 years agoAuto merge of #50045 - est31:label_break_value, r=eddyb
bors [Wed, 16 May 2018 14:22:17 +0000 (14:22 +0000)]
Auto merge of #50045 - est31:label_break_value, r=eddyb

Implement label break value (RFC 2046)

Implement label-break-value (#48594).

6 years agoUpdate Cargo
Eric Huss [Sat, 12 May 2018 20:08:55 +0000 (13:08 -0700)]
Update Cargo

Unblocking PRs:
- rust-lang/cargo#5535 - Ignore <tab> in libtest output. (unblocks #50387)
- rust-lang/cargo#5537 - Remove -Zno-trans test. (unblocks #50615)
- rust-lang/cargo#5540 - Fix tests when CARGO_TARGET_DIR is set. (unblocks self)

Regression fixes:
- rust-lang/cargo#5503 - cargo rustc broken for tests in project with bins
- rust-lang/cargo#5520 - (#50640) shared proc-macro dependency built incorrectly

Changes:
- rust-lang/cargo#5527 - Point Source Replacement to the Overriding Dependencies section
- rust-lang/cargo#5533 - Detail how to run locally-built nightly cargo
- rust-lang/cargo#5522 - Add option to set user-agent
- rust-lang/cargo#5519 - NFC: fix a couple of typos, found by codespell.
- rust-lang/cargo#5513 - Fix `panic` for binaries built during tests.
- rust-lang/cargo#5512 - simplify build_requirements
- rust-lang/cargo#5301 - Add --build-plan for 'cargo build'
- rust-lang/cargo#5460 - Be more conservative about which files are linked to the output dir.
- rust-lang/cargo#5509 - Use the new stable
- rust-lang/cargo#5507 - Does not print seconds fraction with minutes
- rust-lang/cargo#5498 - Bump to 0.29.0
- rust-lang/cargo#5497 - Mention +nightly in ARCHITECTURE.md

6 years agorustc_mir: allow promotion of promotable temps indexed at runtime.
Eduard-Mihai Burtescu [Thu, 10 May 2018 10:11:36 +0000 (13:11 +0300)]
rustc_mir: allow promotion of promotable temps indexed at runtime.