]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agorustbuild: Install rustfmt as part of extended build
Marc-Antoine Perennou [Tue, 14 Nov 2017 08:57:56 +0000 (09:57 +0100)]
rustbuild: Install rustfmt as part of extended build

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
6 years agoAuto merge of #45920 - sunfishcode:trap-on-unreachable, r=Zoxc
bors [Thu, 16 Nov 2017 06:10:36 +0000 (06:10 +0000)]
Auto merge of #45920 - sunfishcode:trap-on-unreachable, r=Zoxc

Enable TrapUnreachable in LLVM.

This patch enables LLVM's TrapUnreachable flag, which tells it to translate `unreachable` instructions into hardware trap instructions, rather than allowing control flow to "fall through" into whatever code happens to follow it in memory.

This follows up on https://github.com/rust-lang/rust/issues/28728#issuecomment-332581533. For example, for @zackw's testcase [here](https://github.com/rust-lang/rust/issues/42009#issue-228745924), the output function contains a `ud2` instead of no code, so it won't "fall through" into whatever happens to be next in memory.

(I'm also working on the problem of LLVM optimizing away infinite loops, but the patch here is useful independently.)

I tested this patch on a few different codebases, and the code size increase ranged from 0.0% to 0.1%.

6 years agoAuto merge of #46025 - nrc:rustfmt-fix, r=Mark-Simulacrum
bors [Thu, 16 Nov 2017 03:49:13 +0000 (03:49 +0000)]
Auto merge of #46025 - nrc:rustfmt-fix, r=Mark-Simulacrum

Fix a bug where the rustfmt tarball was not being produced

r? @alexcrichton

This makes rustfmt a dep of 'extended', which seems to be necessary for the rustfmt dist step to actually get run.

6 years agoFix a bug where the rustfmt tarball was not being produced
Nick Cameron [Thu, 16 Nov 2017 03:02:18 +0000 (16:02 +1300)]
Fix a bug where the rustfmt tarball was not being produced

6 years agoAuto merge of #45692 - steveklabnik:ship-cargo-book, r=alexcrichton
bors [Thu, 16 Nov 2017 01:16:58 +0000 (01:16 +0000)]
Auto merge of #45692 - steveklabnik:ship-cargo-book, r=alexcrichton

 Start shipping the Cargo book

Fixes #44910
Fixes #39588

See both of those bugs for more details.

6 years agoUpdate the compiler-builtins to latest master.
Dan Gohman [Thu, 16 Nov 2017 00:07:48 +0000 (16:07 -0800)]
Update the compiler-builtins to latest master.

6 years agoAuto merge of #45918 - chrisvittal:impl-trait-pr, r=nikomatsakis
bors [Wed, 15 Nov 2017 22:47:54 +0000 (22:47 +0000)]
Auto merge of #45918 - chrisvittal:impl-trait-pr, r=nikomatsakis

Implement `impl Trait` in argument position (RFC1951, Universal quantification)

Implements the remainder of #44721, part of #34511.

**Note**: This PR currently allows argument position `impl Trait` in trait functions. The machinery is there to prevent this if we want to, but it currently does not.

Rename `hir::TyImplTrait` to `hir::TyImplTraitExistential` and add `hir::TyImplTraitUniversal(DefId, TyParamBounds)`. The `DefId` is needed to extract the index of the parameter in `ast_ty_to_ty`.

Introduce an `ImplTraitContext` enum to lowering to keep track of the kind and allowedness of `impl Trait` in that position. This new argument is passed through many places, all ending up in `lower_ty`.

Modify `generics_of` and `explicit_predicates_of` to collect the `impl Trait` args into anonymous synthetic generic parameters and to extend the predicates with the appropriate bounds.

Add a comparison of the 'syntheticness' of type parameters, that is, prevent the following.
```rust
trait Foo {
    fn foo(&self, &impl Debug);
}
impl Foo for Bar {
    fn foo<U: Debug>(&self, x: &U) { ... }
}
```
And vice versa.

Incedentally, supress `unused type parameter` errors if the type being compared is already a `TyError`.

**TODO**: I have tried to annotate open questions with **FIXME**s. The most notable ones that haven't been resolved are the names of the `impl Trait` types and the questions surrounding the new `compare_synthetic_generics` method.
1. For now, the names used for `impl Trait` parameters are `keywords::Invalid.name()`. I would like them to be `impl ...` if possible, but I haven't figured out a way to do that yet.
2. For `compare_synthetic_generics` I have tried to outline the open questions in the [function itself](https://github.com/chrisvittal/rust/blob/3fc9e3705f7bd01f3cb0ea470cf2892f17a92350/src/librustc_typeck/check/compare_method.rs#L714-L725)

r? @nikomatsakis

6 years agoChange clippy to broken after hir::Ty enum change
Christopher Vittal [Wed, 15 Nov 2017 20:38:54 +0000 (15:38 -0500)]
Change clippy to broken after hir::Ty enum change

6 years agoadd a new test featuring two impl traits to show what it looks like
Niko Matsakis [Wed, 15 Nov 2017 18:28:35 +0000 (13:28 -0500)]
add a new test featuring two impl traits to show what it looks like

6 years agoRemove Fn trait + impl Trait rustdoc tests
Christopher Vittal [Wed, 15 Nov 2017 02:24:43 +0000 (21:24 -0500)]
Remove Fn trait + impl Trait rustdoc tests

6 years agoRenumber error to fix tidy
Christopher Vittal [Wed, 15 Nov 2017 01:56:42 +0000 (20:56 -0500)]
Renumber error to fix tidy

6 years agoAdd cases to where-allowed.rs
Christopher Vittal [Wed, 15 Nov 2017 01:38:07 +0000 (20:38 -0500)]
Add cases to where-allowed.rs

6 years agoAdd/Fix stderr references for impl Trait ui tests
Christopher Vittal [Wed, 15 Nov 2017 01:07:53 +0000 (20:07 -0500)]
Add/Fix stderr references for impl Trait ui tests

6 years agoDisallow all impl Trait within Fn trait sugar
Christopher Vittal [Wed, 15 Nov 2017 00:57:09 +0000 (19:57 -0500)]
Disallow all impl Trait within Fn trait sugar

We already disallowed them to be in the arg list, such as
Fn(impl Debug), but now we disallow Fn() -> impl Debug.

Also remove the ImplTraitContext argument from the function
lower_parenthesized_parameter_data as it is now unused.

Comment out part of test run-pass/impl-trait/xcrate.rs that now fails.

6 years agoIncorporate review feedback
Christopher Vittal [Tue, 14 Nov 2017 21:24:35 +0000 (16:24 -0500)]
Incorporate review feedback

Add requested comments, restructure some small bits of code. Fix extern
declarations allowing impl Trait.

6 years agoAdd proper names to impl Trait parameters.
Chris Vittal [Tue, 14 Nov 2017 17:27:55 +0000 (12:27 -0500)]
Add proper names to impl Trait parameters.

Uses Symbol::intern and hir.node_to_pretty_string to create a name for
the impl Trait parameter that is just impl and then a ' + ' separated
list of bounds that the user typed.

6 years agosome tests featuring multiple bounds, other errors
Niko Matsakis [Mon, 13 Nov 2017 19:27:58 +0000 (14:27 -0500)]
some tests featuring multiple bounds, other errors

6 years agoadd a UI test showing the current output from an impl trait type
Niko Matsakis [Mon, 13 Nov 2017 19:20:56 +0000 (14:20 -0500)]
add a UI test showing the current output from an impl trait type

6 years agoadd some more positive tests
Niko Matsakis [Mon, 13 Nov 2017 19:16:34 +0000 (14:16 -0500)]
add some more positive tests

It'd be good to have a positive test for each case where it is
allowed, I should think.

6 years agorename `equality-universal` to a more extensible naming scheme
Niko Matsakis [Mon, 13 Nov 2017 19:11:10 +0000 (14:11 -0500)]
rename `equality-universal` to a more extensible naming scheme

6 years agoextend `where-allowed.rs` with many more cases
Niko Matsakis [Mon, 13 Nov 2017 19:07:00 +0000 (14:07 -0500)]
extend `where-allowed.rs` with many more cases

also merge disallowed and disallowed-2 into that set

6 years agorename many-cases to where-allowed
Niko Matsakis [Mon, 13 Nov 2017 19:05:31 +0000 (14:05 -0500)]
rename many-cases to where-allowed

6 years agotest we reject equivalent signatures with more than one argument
Niko Matsakis [Mon, 13 Nov 2017 18:26:27 +0000 (13:26 -0500)]
test we reject equivalent signatures with more than one argument

6 years agoAdd universal_impl_trait unstable-book entry
Christopher Vittal [Fri, 10 Nov 2017 20:51:28 +0000 (15:51 -0500)]
Add universal_impl_trait unstable-book entry

6 years agoFix unclosed delimiter in sample error
Christopher Vittal [Fri, 10 Nov 2017 20:35:19 +0000 (15:35 -0500)]
Fix unclosed delimiter in sample error

6 years agoRemove unamed parameters
Christopher Vittal [Fri, 10 Nov 2017 19:56:16 +0000 (14:56 -0500)]
Remove unamed parameters

6 years agoFix style and grammar
Christopher Vittal [Fri, 10 Nov 2017 19:18:10 +0000 (14:18 -0500)]
Fix style and grammar

6 years agoAdd/Modify tests for argument position impl Trait
Christopher Vittal [Fri, 10 Nov 2017 18:02:06 +0000 (13:02 -0500)]
Add/Modify tests for argument position impl Trait

6 years agoAdd universal_impl_trait feature gate
Christopher Vittal [Fri, 10 Nov 2017 17:58:52 +0000 (12:58 -0500)]
Add universal_impl_trait feature gate

Move feature gate check to inside HIR lowering. Change error messages
and update tests.

6 years agoAdd new error comparision to hide desugaring
Christopher Vittal [Fri, 10 Nov 2017 17:47:33 +0000 (12:47 -0500)]
Add new error comparision to hide desugaring

First some background:
To the compiler, the following two signatures in the trait vs the impl
are the same.

```rust
trait Foo {
    fn foo(&self, &impl Debug);
}
impl Foo for () {
    fn foo<U: Debug>(&self, x: &U) { ... }
}
```

We do not want to allow this, and so we add a new error and check.

The check just tests that all paramters 'syntheticness' match up. As
during collection, the impl Trait parameters are transformed into
anonymous synthetic generics.

Furthermore, causes a check for unused type parameters to be skipped in
check_bounds_are_used if there is already a TyError. Thus, an unused
input will not trigger `type parameter unused` errors.

Update the one test that checked for this error in the case of
a TyError.

6 years agoAdd collection of impl Trait argument lifetimes
Christopher Vittal [Fri, 10 Nov 2017 17:45:34 +0000 (12:45 -0500)]
Add collection of impl Trait argument lifetimes

6 years agoAlter type collection to collect impl Trait bounds
Christopher Vittal [Fri, 10 Nov 2017 17:38:05 +0000 (12:38 -0500)]
Alter type collection to collect impl Trait bounds

In ast_generics extraction in generics_of and explicit_predicates_of,
also collect inputs if there are any.

Then use a Visitor to extract the necessary information from the
TyImplTraitUniversal types before extending generics and predicates with
the new information.

6 years agoAdd bool item is_in_impl_trait to LoweringContext
Christopher Vittal [Fri, 10 Nov 2017 17:33:05 +0000 (12:33 -0500)]
Add bool item is_in_impl_trait to LoweringContext

This is for tracking if an ImplItem is part of a trait impl. Add
a with_trait_impl_ref method to ItemLowerer to appropriately save the
state to allow appropriate nesting of trait and non-trait impls.

6 years agoSplit hir::TyImplTrait, move checks to HIR lowering
Christopher Vittal [Fri, 10 Nov 2017 17:23:59 +0000 (12:23 -0500)]
Split hir::TyImplTrait, move checks to HIR lowering

Replace hir::TyImplTrait with TyImplTraitUniversal and
TyImplTraitExistential.

Add an ImplTraitContext enum to rustc::hir::lowering to track the kind
and allowedness of an impl Trait.

Significantly alter lowering to thread ImplTraitContext and one other
boolean parameter described below throughought much of lowering.

The other parameter is for tracking if lowering a function is in a trait
impl, as there is not enough information to otherwise know this
information during lowering otherwise.

This change also removes the checks from ast_ty_to_ty for impl trait
allowedness as they are now all taking place in HIR lowering.

6 years agoMove E0562 to librustc from librustc_typeck
Christopher Vittal [Fri, 10 Nov 2017 17:09:40 +0000 (12:09 -0500)]
Move E0562 to librustc from librustc_typeck

With the check for impl trait moving from type checking to HIR lowering
the error needs to move too.

6 years agoAuto merge of #45938 - vramana:fix-ice-45698, r=arielb1
bors [Wed, 15 Nov 2017 20:18:13 +0000 (20:18 +0000)]
Auto merge of #45938 - vramana:fix-ice-45698, r=arielb1

Fix End-user description not implemented for field access on `TyClosure

- [x] Add Tests

6 years agoAuto merge of #45936 - mikhail-m1:mir-borrowck-storage-dead, r=arielb1
bors [Wed, 15 Nov 2017 16:07:48 +0000 (16:07 +0000)]
Auto merge of #45936 - mikhail-m1:mir-borrowck-storage-dead, r=arielb1

add `StorageDead` handling

fix #45642
r? @arielb1

6 years agoAuto merge of #45715 - oli-obk:clippy, r=kennytm
bors [Wed, 15 Nov 2017 13:06:08 +0000 (13:06 +0000)]
Auto merge of #45715 - oli-obk:clippy, r=kennytm

Reenable clippy testing

fixes #45680

6 years agoReenable clippy testing
Oliver Schneider [Thu, 2 Nov 2017 10:27:06 +0000 (11:27 +0100)]
Reenable clippy testing

6 years agofix test
Mikhail Modin [Wed, 15 Nov 2017 09:30:30 +0000 (12:30 +0300)]
fix test

6 years agofix comment, remove redundant code
Mikhail Modin [Mon, 13 Nov 2017 12:46:22 +0000 (15:46 +0300)]
fix comment, remove redundant code

6 years agoadd `StorageDead` handling
Mikhail Modin [Fri, 10 Nov 2017 11:11:25 +0000 (14:11 +0300)]
add `StorageDead` handling

6 years agoAuto merge of #45944 - eddyb:provide, r=nikomatsakis
bors [Wed, 15 Nov 2017 08:02:19 +0000 (08:02 +0000)]
Auto merge of #45944 - eddyb:provide, r=nikomatsakis

rustc_driver: expose a way to override query providers in CompileController.

This API has been a long-time coming and will probably become the main method for custom drivers (that is, binaries other than `rustc` itself that use `librustc_driver`) to adapt the compiler's behavior.

6 years agoAuto merge of #45922 - vramana:fix-45702, r=nikomatsakis
bors [Wed, 15 Nov 2017 04:48:16 +0000 (04:48 +0000)]
Auto merge of #45922 - vramana:fix-45702, r=nikomatsakis

Fix MIR borrowck EndRegion not found

Fixes #45702

- [x] Add Tests

6 years agoAuto merge of #45913 - sinkuu:mir-inlining-closure, r=arielb1
bors [Wed, 15 Nov 2017 01:32:30 +0000 (01:32 +0000)]
Auto merge of #45913 - sinkuu:mir-inlining-closure, r=arielb1

Handle closures correctly in MIR inlining

Fixes #45894.

6 years agoFix printing of upvar in closures
Ramana Venkata [Sun, 12 Nov 2017 16:19:02 +0000 (21:49 +0530)]
Fix printing of upvar in closures

6 years agoFix End-user description not implemented for field access on `TyClosure
Ramana Venkata [Sat, 11 Nov 2017 23:08:40 +0000 (04:38 +0530)]
Fix End-user description not implemented for field access on `TyClosure

Fixes #45698

6 years agoAuto merge of #45821 - djzin:unreachable-match-arms, r=nikomatsakis
bors [Tue, 14 Nov 2017 18:47:34 +0000 (18:47 +0000)]
Auto merge of #45821 - djzin:unreachable-match-arms, r=nikomatsakis

always add an unreachable branch on matches to give more info to llvm

As part of https://github.com/djzin/rustc-optimization I discovered that some simple enum optimizations (src/unary/three_valued_enum.rs and src/unary/four_valued_enum.rs in the repo) are not applied - and the reason for this is that we erase the info that the discriminant of an enum is one of the options by putting the last one in an "otherwise" branch. This patch adds an extra branch so that LLVM can know what the possibilities are for the discriminant, which fixes the three- and four- valued cases.

Note that for whatever reason, this doesn't fix the case of 2 variants (most notably `Option` and `Result` have 2 variants) - a pass re-ordering might fix this or we may wish to add "assume" annotations on discriminants to force it to optimize.

6 years agoAuto merge of #45981 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Tue, 14 Nov 2017 16:18:19 +0000 (16:18 +0000)]
Auto merge of #45981 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 7 pull requests

- Successful merges: #45815, #45941, #45950, #45961, #45967, #45970, #45977
- Failed merges:

6 years agoRollup merge of #45977 - kennytm:fix-pulldown-warnings, r=steveklabnik
Guillaume Gomez [Tue, 14 Nov 2017 15:52:14 +0000 (16:52 +0100)]
Rollup merge of #45977 - kennytm:fix-pulldown-warnings, r=steveklabnik

Fixed several pulldown warnings when documenting libstd.

6 years agoRollup merge of #45970 - GuillaumeGomez:from-str-docs, r=QuietMisdreavus
Guillaume Gomez [Tue, 14 Nov 2017 15:52:13 +0000 (16:52 +0100)]
Rollup merge of #45970 - GuillaumeGomez:from-str-docs, r=QuietMisdreavus

Add missing links in FromStr docs

r? @QuietMisdreavus

6 years agoRollup merge of #45967 - matthewjasper:array-move-types, r=arielb1
Guillaume Gomez [Tue, 14 Nov 2017 15:52:12 +0000 (16:52 +0100)]
Rollup merge of #45967 - matthewjasper:array-move-types, r=arielb1

MIR-borrowck: don't ICE for cannot move from array error

Closes #45694
compile-fail test E0508 now gives
```text
error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array (Ast)
  --> .\src\test\compile-fail\E0508.rs:18:18
   |
18 |     let _value = array[0];  //[ast]~ ERROR E0508
   |                  ^^^^^^^^
   |                  |
   |                  cannot move out of here
   |                  help: consider using a reference instead: `&array[0]`

error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array (Mir)
  --> .\src\test\compile-fail\E0508.rs:18:18
   |
18 |     let _value = array[0];  //[ast]~ ERROR E0508
   |                  ^^^^^^^^ cannot move out of here

error: aborting due to 2 previous errors
```

6 years agoRollup merge of #45961 - dereckson:unix-agnosticity-ci, r=Mark-Simulacrum
Guillaume Gomez [Tue, 14 Nov 2017 15:52:11 +0000 (16:52 +0100)]
Rollup merge of #45961 - dereckson:unix-agnosticity-ci, r=Mark-Simulacrum

Use #!/usr/bin/env as shebang for Bash scripts

On some systems, the bash command could be available in another
directory than /bin. As such, to offer an env shebang is more
convenient.

This make sense even for docker scripts, as you can use Docker
on FreeBSD or SmartOS for example.

6 years agoRollup merge of #45950 - fitzgen:update-unary-and-binary-exprs-test-to-use-incr-excep...
Guillaume Gomez [Tue, 14 Nov 2017 15:52:10 +0000 (16:52 +0100)]
Rollup merge of #45950 - fitzgen:update-unary-and-binary-exprs-test-to-use-incr-except, r=michaelwoerister

incr: Make `unary_and_binary_exprs.rs` use `except`-style incremental checking

Part of #44924

r? @michaelwoerister

6 years agoRollup merge of #45941 - gaurikholkar:master, r=nikomatsakis
Guillaume Gomez [Tue, 14 Nov 2017 15:52:09 +0000 (16:52 +0100)]
Rollup merge of #45941 - gaurikholkar:master, r=nikomatsakis

update match-expressions.rs with DepNode labels

As a part of #44924, I have updated the match-expressions.rs. The PR has tests verified for the following dependency nodes for let-expressions

- MirValidated
- MirOptimized
- TypeCheckTables
- TypeOfItem
- GenericsOfItem
- PredicatesOfItem
- FnSignature

cc @michaelwoerister
r? @nikomatsakis

6 years agoRollup merge of #45815 - QuietMisdreavus:happy-little-notices, r=GuillaumeGomez
Guillaume Gomez [Tue, 14 Nov 2017 15:52:07 +0000 (16:52 +0100)]
Rollup merge of #45815 - QuietMisdreavus:happy-little-notices, r=GuillaumeGomez

rustdoc: tweak notes on ignore/compile_fail examples

Part of https://github.com/rust-lang/rust/issues/44927

This is a softening of these notices to mention *why* a given example has a given callout, rather then telling viewers to be careful with an example. It also changes the character used for these samples from a warning logo to a circle-i/information logo.

![image](https://user-images.githubusercontent.com/5217170/32464361-5fbb5d9e-c305-11e7-8482-ce71b97a54df.png)

6 years agoAuto merge of #45896 - malbarbo:use-libc-const, r=alexcrichton
bors [Tue, 14 Nov 2017 13:46:19 +0000 (13:46 +0000)]
Auto merge of #45896 - malbarbo:use-libc-const, r=alexcrichton

Use getrandom syscall for all Linux and Android targets.

I suppose we can use it in all Linux and Android targets. In function `is_getrandom_available` is checked if the syscall is available (getrandom syscall was add in version 3.17 of Linux kernel), if the syscall is not available `fill_bytes` fallback to reading from `/dev/urandom`.

Update libc to include getrandom related constants.

6 years agoFix test
Shotaro Yamada [Tue, 14 Nov 2017 13:29:09 +0000 (22:29 +0900)]
Fix test

6 years agoUpdate libc (new const definitions for Linux sparc64)
Marco A L Barbosa [Tue, 14 Nov 2017 12:47:04 +0000 (10:47 -0200)]
Update libc (new const definitions for Linux sparc64)

6 years agolink the cargo book into the bookshelf
steveklabnik [Wed, 1 Nov 2017 19:24:35 +0000 (15:24 -0400)]
link the cargo book into the bookshelf

6 years agoStart shipping the Cargo book
steveklabnik [Wed, 1 Nov 2017 19:21:55 +0000 (15:21 -0400)]
Start shipping the Cargo book

Fixes #44910
Fixes #39588

See both of those bugs for more details.

6 years agoFixed several pulldown warnings when documenting libstd.
kennytm [Tue, 14 Nov 2017 09:22:57 +0000 (17:22 +0800)]
Fixed several pulldown warnings when documenting libstd.

6 years agoAdd TyCtxt::is_closure
Shotaro Yamada [Fri, 10 Nov 2017 17:20:53 +0000 (02:20 +0900)]
Add TyCtxt::is_closure

6 years agoMake create_temp_necessary a method
Shotaro Yamada [Fri, 10 Nov 2017 17:05:29 +0000 (02:05 +0900)]
Make create_temp_necessary a method

6 years agoHandle closures correctly in MIR inlining
Shotaro Yamada [Fri, 10 Nov 2017 14:06:06 +0000 (23:06 +0900)]
Handle closures correctly in MIR inlining

6 years agoAuto merge of #45916 - eddyb:even-mirer-0, r=nikomatsakis
bors [Tue, 14 Nov 2017 07:54:51 +0000 (07:54 +0000)]
Auto merge of #45916 - eddyb:even-mirer-0, r=nikomatsakis

rustc_mir: hardcode pass list internally and remove premature pluggability.

Fixes #41712 by moving the MIR pass lists from `rustc_driver` to `rustc_mir`.
The application of the passes is done with the `rustc_mir::transform::run_passes` macro, which is public, as are all the passes AFAIK, and can be used to apply MIR passes outside of `rustc_mir`.

With the ability to override query providers through the `rustc_driver` (orthogonal to, and not included in this PR), custom drivers will be able to substitute the entire pass list if they want to.
**EDIT**: the aforementioned ability is added by #45944.

r? @nikomatsakis

6 years agodon't send block back to be marked unreachable twice
Djzin [Tue, 14 Nov 2017 06:59:56 +0000 (06:59 +0000)]
don't send block back to be marked unreachable twice

6 years agorustc: split off BodyOwnerKind from MirSource.
Eduard-Mihai Burtescu [Fri, 10 Nov 2017 17:20:35 +0000 (19:20 +0200)]
rustc: split off BodyOwnerKind from MirSource.

6 years agorustc: remove unused MirSource::GeneratorDrop.
Eduard-Mihai Burtescu [Fri, 10 Nov 2017 12:23:51 +0000 (14:23 +0200)]
rustc: remove unused MirSource::GeneratorDrop.

6 years agorustc_mir: drive passes directly with a macro.
Eduard-Mihai Burtescu [Fri, 10 Nov 2017 11:58:06 +0000 (13:58 +0200)]
rustc_mir: drive passes directly with a macro.

6 years agorustc: move the MIR pass infrastructure and list to rustc_mir.
Eduard-Mihai Burtescu [Thu, 9 Nov 2017 22:49:51 +0000 (00:49 +0200)]
rustc: move the MIR pass infrastructure and list to rustc_mir.

6 years agoadd optimization codegen tests
Djzin [Mon, 13 Nov 2017 23:24:30 +0000 (23:24 +0000)]
add optimization codegen tests

6 years agouse lazy cached unreachable block - assign it to the function's closing brace
Djzin [Mon, 13 Nov 2017 23:08:12 +0000 (23:08 +0000)]
use lazy cached unreachable block - assign it to the function's closing brace

6 years agoalways add an unreachable branch on matches to give more info to llvm about which...
Djzin [Tue, 7 Nov 2017 00:07:32 +0000 (00:07 +0000)]
always add an unreachable branch on matches to give more info to llvm about which values are possible

6 years agoAuto merge of #45915 - michaelwoerister:removed-nodes-in-try-mark-green, r=alexcrichton
bors [Tue, 14 Nov 2017 05:30:34 +0000 (05:30 +0000)]
Auto merge of #45915 - michaelwoerister:removed-nodes-in-try-mark-green, r=alexcrichton

incr.comp.: Don't crash in DepGraph::try_mark_green() when encountering a removed input node.

Fixes a small regression that was introduced in #45867.

r? @nikomatsakis

6 years agoAuto merge of #45909 - sinkuu:issue-45885, r=arielb1
bors [Tue, 14 Nov 2017 02:05:37 +0000 (02:05 +0000)]
Auto merge of #45909 - sinkuu:issue-45885, r=arielb1

Normalize inlined function in MIR inliner

Fixes #45885

r? @arielb1

6 years agoAuto merge of #45436 - zilbuz:issue-44837, r=nikomatsakis
bors [Mon, 13 Nov 2017 23:36:07 +0000 (23:36 +0000)]
Auto merge of #45436 - zilbuz:issue-44837, r=nikomatsakis

MIR-borrowck: add permisson checks to `fn access_lvalue`

WIP : Some FIXME left and some broken tests.

Fix #44837

6 years agoUse the correct type for cannot move error
matthewjasper [Mon, 13 Nov 2017 22:40:22 +0000 (22:40 +0000)]
Use the correct type for cannot move error

6 years agoAdd missing links in FromStr docs
Guillaume Gomez [Mon, 13 Nov 2017 22:25:52 +0000 (23:25 +0100)]
Add missing links in FromStr docs

6 years agoAuto merge of #45903 - nrc:rustfmt-dist, r=alexcrichton
bors [Mon, 13 Nov 2017 21:06:11 +0000 (21:06 +0000)]
Auto merge of #45903 - nrc:rustfmt-dist, r=alexcrichton

Distribute Rustfmt

r? @alexcrichton

6 years agomir-borrowck: Test for `check_access_permissions()`
Basile Desloges [Sat, 21 Oct 2017 19:15:28 +0000 (21:15 +0200)]
mir-borrowck: Test for `check_access_permissions()`

6 years agomir-borrowck: Check access permissions in `access_lvalue()`
Basile Desloges [Sat, 21 Oct 2017 19:15:04 +0000 (21:15 +0200)]
mir-borrowck: Check access permissions in `access_lvalue()`

6 years agomir-borrowck: Move `is_static_mut()` to `ty/utils.rs`
Basile Desloges [Sun, 12 Nov 2017 11:40:56 +0000 (12:40 +0100)]
mir-borrowck: Move `is_static_mut()` to `ty/utils.rs`

6 years agoupdate codeblock-title test with new notice text
QuietMisdreavus [Mon, 13 Nov 2017 17:44:19 +0000 (11:44 -0600)]
update codeblock-title test with new notice text

6 years agoAuto merge of #45890 - arielb1:self-first, r=eddyb
bors [Mon, 13 Nov 2017 17:42:13 +0000 (17:42 +0000)]
Auto merge of #45890 - arielb1:self-first, r=eddyb

check::method - unify receivers before normalizing method signatures

Normalizing method signatures can unify inference variables, which can
cause receiver unification to fail. Unify the receivers first to avoid
that.

Fixes #36701.
Fixes #45801.
Fixes #45855.

r? @eddyb

beta-nominating because #43880 made this ICE happen in more cases (the code in that issue ICEs post-#43880 only, but the unit test here ICEs on all versions).

6 years agofixing indentation
gaurikholkar [Mon, 13 Nov 2017 14:49:54 +0000 (20:19 +0530)]
fixing indentation

6 years agoUse #!/usr/bin/env as shebang for Bash scripts
Sébastien Santoro [Mon, 13 Nov 2017 14:33:12 +0000 (14:33 +0000)]
Use #!/usr/bin/env as shebang for Bash scripts

On some systems, the bash command could be available in another
directory than /bin. As such, to offer an env shebang is more
convenient.

This make sense even for docker scripts, as you can use Docker
on FreeBSD or SmartOS for example.

6 years agoAuto merge of #45824 - dotdash:stack_pop, r=alexcrichton
bors [Mon, 13 Nov 2017 14:20:15 +0000 (14:20 +0000)]
Auto merge of #45824 - dotdash:stack_pop, r=alexcrichton

Update LLVM to fix miscompiles with -Copt-level=z on Windows

Fixes #45034

6 years agoAuto merge of #45810 - SimonSapin:ac-dc, r=aturon
bors [Mon, 13 Nov 2017 11:46:55 +0000 (11:46 +0000)]
Auto merge of #45810 - SimonSapin:ac-dc, r=aturon

Disable LLVM assertions on Nightly, enable them in "alt" builds.

Per IRC discussion https://mozilla.logbot.info/rust-infra/20171106#c13812170-c13812204

Background: https://internals.rust-lang.org/t/disabling-llvm-assertions-in-nightly-builds/5388/14

6 years agoAuto merge of #45956 - kennytm:rollup, r=kennytm
bors [Mon, 13 Nov 2017 09:13:00 +0000 (09:13 +0000)]
Auto merge of #45956 - kennytm:rollup, r=kennytm

Rollup of 9 pull requests

- Successful merges: #45828, #45892, #45893, #45914, #45917, #45927, #45933, #45952, #45954
- Failed merges:

6 years agoRollup merge of #45954 - udoprog:fix-style, r=kennytm
kennytm [Mon, 13 Nov 2017 09:09:48 +0000 (17:09 +0800)]
Rollup merge of #45954 - udoprog:fix-style, r=kennytm

Fix style in interner test

6 years agoRollup merge of #45952 - zackmdavis:singular_projection, r=estebank
kennytm [Mon, 13 Nov 2017 09:09:47 +0000 (17:09 +0800)]
Rollup merge of #45952 - zackmdavis:singular_projection, r=estebank

deduplicate projection error (E0271) messages

The `ErrorId` variant takes a u16 so that `DiagnosticMessageId` can retain
its `Copy` status (the present author's first choice having been the "EXXX"
code as a string).

The duplicated "type mismatch resolving `{}`" literal is unfortunate, but
the `struct_span_err!` macro (which we want to mark that error code as
used) is fussy about taking a literal, and the one-time-diagnostics set
needs an owned string.

This is concerning #33941 and probably #45805!

r? @estebank

6 years agoRollup merge of #45933 - shanavas786:refactor-filter, r=alexcrichton
kennytm [Mon, 13 Nov 2017 09:09:46 +0000 (17:09 +0800)]
Rollup merge of #45933 - shanavas786:refactor-filter, r=alexcrichton

Refactor Option::filter method

6 years agoRollup merge of #45927 - sinkuu:mir-borrowck-closure, r=estebank
kennytm [Mon, 13 Nov 2017 09:09:45 +0000 (17:09 +0800)]
Rollup merge of #45927 - sinkuu:mir-borrowck-closure, r=estebank

MIR-borrowck: fix diagnostics for closures

Emit notes for captured variables in the same manner as AST borrowck.

```
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
  --> $DIR/borrowck-closures-two-mut.rs:24:24
   |
23 |     let c1 = to_fn_mut(|| x = 4);
   |                        -- - previous borrow occurs due to use of `x` in closure
   |                        |
   |                        first mutable borrow occurs here
24 |     let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once
   |                        ^^ - borrow occurs due to use of `x` in closure
   |                        |
   |                        second mutable borrow occurs here
25 | }
   | - first borrow ends here

error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
  --> $DIR/borrowck-closures-two-mut.rs:24:24
   |
23 |     let c1 = to_fn_mut(|| x = 4);
   |                        -- - previous borrow occurs due to use of `x` in closure
   |                        |
   |                        first mutable borrow occurs here
24 |     let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once
   |                        ^^ - borrow occurs due to use of `x` in closure
   |                        |
   |                        second mutable borrow occurs here
25 | }
   | - first borrow ends here
```

Fixes #45362.

6 years agoRollup merge of #45917 - ollie27:compiletest_stamp, r=alexcrichton
kennytm [Mon, 13 Nov 2017 09:09:44 +0000 (17:09 +0800)]
Rollup merge of #45917 - ollie27:compiletest_stamp, r=alexcrichton

compiletest: Fix a couple of test re-run issues

* Re-run rustdoc tests if rustdoc or htmldocck.py was updated.
* Put stamp files in the correct subdirectories to avoid clashes when
the file names match but the subdirectory doesn't.

6 years agoRollup merge of #45914 - michaelwoerister:fix-test-header-parsing, r=alexcrichton
kennytm [Mon, 13 Nov 2017 09:09:43 +0000 (17:09 +0800)]
Rollup merge of #45914 - michaelwoerister:fix-test-header-parsing, r=alexcrichton

Fix test case header parsing code in presence of multiple revisions.

The previous code would parse the TestProps, and then parse them again with a revision set, adding some elements (like aux_builds) a second time to the existing TestProps.

6 years agoRollup merge of #45893 - redox-os:futex_timeout, r=alexcrichton
kennytm [Mon, 13 Nov 2017 09:09:42 +0000 (17:09 +0800)]
Rollup merge of #45893 - redox-os:futex_timeout, r=alexcrichton

Redox: Use futex timeout to implement CondVar::wait_timeout

`CondVar::wait_timeout` is implemented by supplying a `TimeSpec` pointer to `futex`. In addition, all calls to `unimplemented!()` have been removed from the Redox `sys` module.

Related to https://github.com/rust-lang/rust/pull/45892

6 years agoRollup merge of #45892 - redox-os:is_absolute_fix, r=alexcrichton
kennytm [Mon, 13 Nov 2017 09:09:41 +0000 (17:09 +0800)]
Rollup merge of #45892 - redox-os:is_absolute_fix, r=alexcrichton

Redox: Return true from Path::is_absolute if a Path contains root or a scheme

In Redox, different subsystems have different filesystem paths. However, the majority of applications using the `Path::is_absolute` function really only want to know if a path is absolute from the perspective of the scheme it is currently running in, usually `file:`. This makes both `file:/` and `/` return `true` from `Path::is_absolute`, meaning that most code does not have to check if it is running on Redox.

Code that wants to know if a path contains a scheme can implement such a check on its own.

Related to https://github.com/rust-lang/rust/pull/45893

6 years agoRollup merge of #45828 - pornel:printoption, r=nrc
kennytm [Mon, 13 Nov 2017 09:09:40 +0000 (17:09 +0800)]
Rollup merge of #45828 - pornel:printoption, r=nrc

Remove deprecated message

Follow up of #43067

6 years agoFix style in interner test
John-John Tedro [Mon, 13 Nov 2017 06:55:20 +0000 (07:55 +0100)]
Fix style in interner test