]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoAuto merge of #50803 - varkor:never-transmute-never, r=eddyb
bors [Sun, 20 May 2018 00:49:37 +0000 (00:49 +0000)]
Auto merge of #50803 - varkor:never-transmute-never, r=eddyb

Fix an ICE when attempting to transmute an uninhabited type

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

6 years agoAuto merge of #50893 - kennytm:rollup, r=kennytm
bors [Sat, 19 May 2018 22:33:57 +0000 (22:33 +0000)]
Auto merge of #50893 - kennytm:rollup, r=kennytm

Rollup of 8 pull requests

Successful merges:

 - #50531 (Cleanup uses of TypeIdHasher and replace them with StableHasher)
 - #50819 (Fix potential divide by zero)
 - #50827 (Update LLVM to 56c931901cfb85cd6f7ed44c7d7520a8de1edf97)
 - #50829 (CheckLoopVisitor: also visit break expressions)
 - #50854 (in which the unused shorthand field pattern debacle/saga continues)
 - #50858 (Reorder description for snippets in rustdoc documentation)
 - #50883 (Fix warning when building stage0 libcore)
 - #50889 (Update clippy)

Failed merges:

6 years agoRollup merge of #50889 - oli-obk:clippy, r=kennytm
kennytm [Sat, 19 May 2018 20:21:05 +0000 (04:21 +0800)]
Rollup merge of #50889 - oli-obk:clippy, r=kennytm

Update clippy

# Conflicts:
# src/Cargo.lock

6 years agoRollup merge of #50819 - cjkenn:cjkenn/div-by-zero, r=kennytm
kennytm [Sat, 19 May 2018 20:17:41 +0000 (04:17 +0800)]
Rollup merge of #50819 - cjkenn:cjkenn/div-by-zero, r=kennytm

Fix potential divide by zero

This should fix #50761

I had trouble reproducing with the provided code, but looking at the stack trace would indicate that this code is the likely cause. I made a number of assumptions here, because I don't have enough context on how the register size is set:

1. I assumed `rest.unit.size.bytes()` can be 0, and it's ok if it's set to 0 before this function is called
2. I assumed that if `rest.unit.size.bytes()` is 0, that we want `rest_count` to also be 0.

6 years agoRollup merge of #50883 - dlrobertson:fix_warning, r=TimNN
kennytm [Sat, 19 May 2018 15:41:05 +0000 (23:41 +0800)]
Rollup merge of #50883 - dlrobertson:fix_warning, r=TimNN

Fix warning when building stage0 libcore

When building stage0 a warning will be triggered when compiling libcore
due to `align_to_offsets` not being used.

6 years agoRollup merge of #50858 - robinkrahl:rustdoc-fix-order, r=steveklabnik
kennytm [Sat, 19 May 2018 15:41:04 +0000 (23:41 +0800)]
Rollup merge of #50858 - robinkrahl:rustdoc-fix-order, r=steveklabnik

Reorder description for snippets in rustdoc documentation

The example code snippets for the `no_run` and `compile_fail` attributes in the rustdoc documentation were followed by the description for the wrong attribute.  This patch reorders the descriptions to match the code snippets.

6 years agoRollup merge of #50854 - zackmdavis:and_the_case_of_the_unused_field_pattern_3_straig...
kennytm [Sat, 19 May 2018 15:41:03 +0000 (23:41 +0800)]
Rollup merge of #50854 - zackmdavis:and_the_case_of_the_unused_field_pattern_3_straight_to_video, r=estebank

in which the unused shorthand field pattern debacle/saga continues

In e4b1a79 (#47922), we corrected erroneous suggestions for unused
shorthand field pattern bindings, suggesting `field: _` where the
previous suggestion of `_field` wouldn't even have compiled
(#47390). Soon, it was revealed that this was insufficient (#50303), and
the fix was extended to references, slices, &c. (#50327) But even this
proved inadequate, as the erroneous suggestions were still being issued
for patterns in local (`let`) bindings (#50804). Here, we yank the
shorthand-detection and variable/node registration code into a new
common function that can be called while visiting both match arms and
`let` bindings.

Resolves #50804.

r? @estebank

6 years agoRollup merge of #50829 - est31:master, r=estebank
kennytm [Sat, 19 May 2018 15:41:01 +0000 (23:41 +0800)]
Rollup merge of #50829 - est31:master, r=estebank

CheckLoopVisitor: also visit break expressions

Fixes #50802

6 years agoRollup merge of #50827 - nox:llvmup, r=eddyb
kennytm [Sat, 19 May 2018 15:41:00 +0000 (23:41 +0800)]
Rollup merge of #50827 - nox:llvmup, r=eddyb

Update LLVM to 56c931901cfb85cd6f7ed44c7d7520a8de1edf97

This brings in https://github.com/rust-lang/llvm/pull/115, which fixes https://github.com/rust-lang/rust/issues/49873.

6 years agoAuto merge of #50782 - matthewjasper:wheres-main, r=matthewjasper
bors [Sat, 19 May 2018 20:10:34 +0000 (20:10 +0000)]
Auto merge of #50782 - matthewjasper:wheres-main, r=matthewjasper

Prevent main from having a where clause.

Closes #50714

Should this have a crater run?

cc #48557, #48214

r? @nikomatsakis

6 years agoremove feature line from test
cjkenn [Sat, 19 May 2018 20:01:28 +0000 (13:01 -0700)]
remove feature line from test

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 agouse if let to avoid potential div by zero
cjkenn [Thu, 17 May 2018 03:02:01 +0000 (20:02 -0700)]
use if let to avoid potential div by zero

remove semicolon -_-

Add rem_bytes to conditional to avoid error when performing mod by 0

Add test file to confirm compilation passes.

Ensure we don't divide or mod by zero in llvm_type. Include test file from issue.

6 years agoRollup merge of #50531 - iancormac84:merge-typeidhasher-cleanup, r=michaelwoerister
kennytm [Sat, 19 May 2018 15:40:58 +0000 (23:40 +0800)]
Rollup merge of #50531 - iancormac84:merge-typeidhasher-cleanup, r=michaelwoerister

Cleanup uses of TypeIdHasher and replace them with StableHasher

Fixes #50424

r? @michaelwoerister

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 agoUpdate clippy
Oliver Schneider [Sat, 19 May 2018 11:18:02 +0000 (13:18 +0200)]
Update clippy

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 agoFix warning when building stage0 libcore
Dan Robertson [Sat, 19 May 2018 01:13:31 +0000 (01:13 +0000)]
Fix warning when building stage0 libcore

When building stage0 a warning will be triggered when compiling libcore
due to align_to_offsets not being used.

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 agoPrevent main and start from having a where clause.
Matthew Jasper [Fri, 18 May 2018 21:03:24 +0000 (22:03 +0100)]
Prevent main and start from having a where clause.

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 agoReorder description for snippets in rustdoc documentation
Robin Krahl [Fri, 18 May 2018 12:09:15 +0000 (14:09 +0200)]
Reorder description for snippets in rustdoc documentation

The example code snippets for the `no_run` and `compile_fail` attributes
in the rustdoc documentation were followed by the description for the
wrong attribute.  This patch reorders the descriptions to match the code
snippets.

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 agoin which the unused shorthand field pattern debacle/saga continues
Zack M. Davis [Fri, 18 May 2018 07:07:31 +0000 (00:07 -0700)]
in which the unused shorthand field pattern debacle/saga continues

In e4b1a79 (#47922), we corrected erroneous suggestions for unused
shorthand field pattern bindings, suggesting `field: _` where the
previous suggestion of `_field` wouldn't even have compiled
(#47390). Soon, it was revealed that this was insufficient (#50303), and
the fix was extended to references, slices, &c. (#50327) But even this
proved inadequate, as the erroneous suggestions were still being issued
for patterns in local (`let`) bindings (#50804). Here, we yank the
shorthand-detection and variable/node registration code into a new
common function that can be called while visiting both match arms and
`let` bindings.

Resolves #50804.

6 years agoUpdate LLVM to 56c931901cfb85cd6f7ed44c7d7520a8de1edf97
Anthony Ramine [Thu, 17 May 2018 09:13:04 +0000 (11:13 +0200)]
Update LLVM to 56c931901cfb85cd6f7ed44c7d7520a8de1edf97

This brings in https://github.com/rust-lang/llvm/pull/115, which fixes
https://github.com/rust-lang/rust/issues/49873.

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 agoFixed accidental removal of StableHasher declaration.
iancormac84 [Thu, 17 May 2018 23:43:36 +0000 (19:43 -0400)]
Fixed accidental removal of StableHasher declaration.

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 agoRemoved yet another unused import.
iancormac84 [Wed, 16 May 2018 06:29:15 +0000 (02:29 -0400)]
Removed yet another unused import.

6 years agoRemoved unused import.
iancormac84 [Wed, 16 May 2018 00:27:37 +0000 (20:27 -0400)]
Removed unused import.

6 years agoAdded extra hashing step.
iancormac84 [Tue, 8 May 2018 23:57:45 +0000 (19:57 -0400)]
Added extra hashing step.

6 years agoFix more unused imports errors.
iancormac84 [Tue, 8 May 2018 14:58:32 +0000 (10:58 -0400)]
Fix more unused imports errors.

6 years agoRemoved unused imports.
iancormac84 [Tue, 8 May 2018 14:02:41 +0000 (10:02 -0400)]
Removed unused imports.

6 years agoCode structure edits.
iancormac84 [Tue, 8 May 2018 13:38:29 +0000 (09:38 -0400)]
Code structure edits.

6 years agoRemoved TypeIdHasher.
iancormac84 [Tue, 8 May 2018 13:23:36 +0000 (09:23 -0400)]
Removed TypeIdHasher.

6 years agoRemoved use of TypeIdHasher in symbol hash generation and replaced it with StableHasher.
iancormac84 [Tue, 8 May 2018 11:58:33 +0000 (07:58 -0400)]
Removed use of TypeIdHasher in symbol hash generation and replaced it with StableHasher.

6 years agoRemoved use of TypeIdHasher in debuginfo and replaced it with StableHasher. Also...
iancormac84 [Tue, 8 May 2018 11:52:01 +0000 (07:52 -0400)]
Removed use of TypeIdHasher in debuginfo and replaced it with StableHasher. Also corrected erroneous mention of TypeIdHasher in implementation of HashStable trait.

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.