]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoAuto merge of #50690 - oli-obk:mir_stuff, r=eddyb
bors [Sat, 19 May 2018 17:30:18 +0000 (17:30 +0000)]
Auto merge of #50690 - oli-obk:mir_stuff, r=eddyb

Ensure that statics are always ByRef

Statics aren't values to be used, they are names for memory locations.

r? @eddyb

cc @Zoxc

fixes #50706

6 years agoAuto merge of #50763 - KyleStach1678:unused-loop-label, r=petrochenkov
bors [Sat, 19 May 2018 14:52:30 +0000 (14:52 +0000)]
Auto merge of #50763 - KyleStach1678:unused-loop-label, r=petrochenkov

Add lint checks for unused loop labels

Previously no warning was generated when a loop label was written out but never used (i.e. in a `break` or `continue` statement):
```rust
fn main() {
    'unused_label: loop {}
}
```
would compile without complaint.

This fix introduces `-W unused_loop_label`, which generates the following warning message for the above snippet:
```
warning: unused loop label
 --> main.rs:2:5
  |
2 |     'unused_label: loop {}
  |     ^^^^^^^^^^^^^
  |
  = note: #[warn(unused_loop_label)] on by default
```

Fixes: #50751.
6 years agoUse `Size` instead of `u64` in mir interpretation
Oliver Schneider [Sat, 19 May 2018 14:37:29 +0000 (16:37 +0200)]
Use `Size` instead of `u64` in mir interpretation

6 years agoKeep statics' constant as ByRef
Oliver Schneider [Thu, 17 May 2018 14:14:30 +0000 (16:14 +0200)]
Keep statics' constant as ByRef

6 years agoGo through an allocation when accessing fields of constants
Oliver Schneider [Mon, 14 May 2018 16:54:24 +0000 (18:54 +0200)]
Go through an allocation when accessing fields of constants

6 years agoReintroduce some sanity checks
Oliver Schneider [Sun, 13 May 2018 17:52:53 +0000 (19:52 +0200)]
Reintroduce some sanity checks

6 years agoEnsure that statics are always ByRef
Oliver Schneider [Sat, 12 May 2018 16:47:20 +0000 (18:47 +0200)]
Ensure that statics are always ByRef

6 years agoAuto merge of #50760 - petrochenkov:legimp, r=nikomatsakis
bors [Sat, 19 May 2018 12:16:50 +0000 (12:16 +0000)]
Auto merge of #50760 - petrochenkov:legimp, r=nikomatsakis

Turn deprecation lint `legacy_imports` into a hard error

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

The lint was introduced in Dec 2016, then made deny-by-default in Jun 2017 when crater run found 0 regressions caused by it.

This lint requires some not entirely trivial amount of import resolution logic that (surprisingly or not) interacts with `feature(use_extern_macros)` (https://github.com/rust-lang/rust/issues/35896), so it would be desirable to remove it before stabilizing `use_extern_macros`.
In particular, this PR fixes the failing example in https://github.com/rust-lang/rust/issues/50725 (but not the whole issue, `use std::panic::{self}` still can cause other undesirable errors when `use_extern_macros` is enabled).

6 years agoAuto merge of #50874 - nikomatsakis:nll-reset-unification, r=estebank
bors [Sat, 19 May 2018 10:04:42 +0000 (10:04 +0000)]
Auto merge of #50874 - nikomatsakis:nll-reset-unification, r=estebank

use `reset_unifications` instead of creating new unification table

This eliminates a hot spot in NLL performance.

6 years agoAuto merge of #50744 - nikic:mutable-noalias, r=alexcrichton
bors [Sat, 19 May 2018 07:42:03 +0000 (07:42 +0000)]
Auto merge of #50744 - nikic:mutable-noalias, r=alexcrichton

Emit noalias on &mut parameters by default

This used to be disabled due to LLVM bugs in the handling of
noalias information in conjunction with unwinding. However,
according to #31681 all known LLVM bugs have been fixed by
LLVM 6.0, so it's probably time to reenable this optimization.

-Z no-mutable-noalias is left as an escape-hatch to debug problems
suspected to stem from this change.

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 agoDefault `unused_labels` to allow, move to "unused"
Kyle Stachowicz [Fri, 18 May 2018 23:53:39 +0000 (16:53 -0700)]
Default `unused_labels` to allow, move to "unused"

6 years agoRevert "Remove unused label in mir"
Kyle Stachowicz [Fri, 18 May 2018 14:12:19 +0000 (07:12 -0700)]
Revert "Remove unused label in mir"

This reverts commit b2a2450cf2925498e1c3bdd781aa1978f9eb00e5.

6 years agoRevert "Allow `unused_labels` in some compile-fail tests"
Kyle Stachowicz [Fri, 18 May 2018 14:11:44 +0000 (07:11 -0700)]
Revert "Allow `unused_labels` in some compile-fail tests"

This reverts commit b9257e2ca161b1bf5aae9d6b667f4d0c6b8d7be6.

6 years agoAllow `unused_labels` in some compile-fail tests
Kyle Stachowicz [Fri, 18 May 2018 05:17:06 +0000 (22:17 -0700)]
Allow `unused_labels` in some compile-fail tests

6 years agoRemove unused label in mir
Kyle Stachowicz [Fri, 18 May 2018 00:58:16 +0000 (17:58 -0700)]
Remove unused label in mir

6 years agoAdd tests for new labeled blocks for `unused_labels`
Kyle Stachowicz [Fri, 18 May 2018 00:32:05 +0000 (17:32 -0700)]
Add tests for new labeled blocks for `unused_labels`

6 years agoReimplement unused_labels lint as a compiler builtin in the resolver
Kyle Stachowicz [Fri, 18 May 2018 00:20:30 +0000 (17:20 -0700)]
Reimplement unused_labels lint as a compiler builtin in the resolver

6 years agoRevert "Add lint checks for unused loop labels"
Kyle Stachowicz [Thu, 17 May 2018 23:57:46 +0000 (16:57 -0700)]
Revert "Add lint checks for unused loop labels"

This functionality is being reimplemented in the resolver phase

This reverts commit 503a69e844970476b27bf1ac7be951bb22194f50.

6 years agoFix formatting in unused label linting to make tidy checks pass
Kyle Stachowicz [Wed, 16 May 2018 03:58:09 +0000 (20:58 -0700)]
Fix formatting in unused label linting to make tidy checks pass

6 years agoFix ignored unused outer label when inner label shadows and is broken multiple times
Kyle Stachowicz [Wed, 16 May 2018 03:32:43 +0000 (20:32 -0700)]
Fix ignored unused outer label when inner label shadows and is broken multiple times

6 years agoAdd test case for shadowed labels, with the inner broken multiple times
Kyle Stachowicz [Wed, 16 May 2018 03:17:20 +0000 (20:17 -0700)]
Add test case for shadowed labels, with the inner broken multiple times

6 years agoRename `unused_loop_label` to `unused_label` and fix/clean up lint logic
Kyle Stachowicz [Wed, 16 May 2018 00:36:43 +0000 (17:36 -0700)]
Rename `unused_loop_label` to `unused_label` and fix/clean up lint logic

6 years agoAdd additional test case to unused_label lint
Kyle Stachowicz [Wed, 16 May 2018 00:08:24 +0000 (17:08 -0700)]
Add additional test case to unused_label lint

6 years agoRename test to `unused_label` and remove empty `stdout` file
Kyle Stachowicz [Tue, 15 May 2018 23:34:08 +0000 (16:34 -0700)]
Rename test to `unused_label` and remove empty `stdout` file

6 years agoAdd lint checks for unused loop labels
Kyle Stachowicz [Tue, 15 May 2018 06:32:21 +0000 (23:32 -0700)]
Add lint checks for unused loop labels

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 agouse `reset_unifications` instead of creating new unification table
Niko Matsakis [Fri, 18 May 2018 19:25:34 +0000 (15:25 -0400)]
use `reset_unifications` instead of creating new unification table

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 agoEmit noalias on &mut parameters by default
Nikita Popov [Mon, 14 May 2018 13:20:51 +0000 (15:20 +0200)]
Emit noalias on &mut parameters by default

This used to be disabled due to LLVM bugs in the handling of
noalias information in conjunction with unwinding. However,
according to #31681 all known LLVM bugs have been fixed by
LLVM 6.0, so it's probably time to reenable this optimization.

Noalias annotations will not be emitted by default if either
-C panic=abort (as previously) or LLVM >= 6.0 (new).

-Z mutable-noalias=no is left as an escape-hatch to allow
debugging problems suspected to stem from this change.

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.