]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoUse deterministic `FnvHash{Map,Set}` in rustdoc
Jonas Schievink [Wed, 24 Aug 2016 08:55:03 +0000 (10:55 +0200)]
Use deterministic `FnvHash{Map,Set}` in rustdoc

7 years agoUse `FnvHashMap` in more places
Jonas Schievink [Mon, 22 Aug 2016 22:57:54 +0000 (00:57 +0200)]
Use `FnvHashMap` in more places

* A step towards #34902
* More stable error messages in some places related to crate loading
* Possible slight performance improvements since all `HashMap`s
  replaced had small keys where `FnvHashMap` should be faster
  (although I didn't measure)

7 years agoAuto merge of #36030 - Manishearth:rollup, r=Manishearth
bors [Sat, 27 Aug 2016 10:07:48 +0000 (03:07 -0700)]
Auto merge of #36030 - Manishearth:rollup, r=Manishearth

Rollup of 7 pull requests

- Successful merges: #35124, #35877, #35953, #36002, #36004, #36005, #36014
- Failed merges:

7 years agoFixup rustbuild on #35124
Manish Goregaokar [Sat, 27 Aug 2016 06:03:02 +0000 (11:33 +0530)]
Fixup rustbuild on #35124

7 years agoAuto merge of #35877 - KiChjang:issue-35869, r=arielb1
bors [Sat, 27 Aug 2016 06:57:17 +0000 (23:57 -0700)]
Auto merge of #35877 - KiChjang:issue-35869, r=arielb1

Fix ICE when arg types can't be found in impl/trait methods while comparing

Fixes #35869.

7 years agoRollup merge of #36014 - slash3g:stabilize-type-macros, r=nikomatsakis
Manish Goregaokar [Sat, 27 Aug 2016 04:01:15 +0000 (09:31 +0530)]
Rollup merge of #36014 - slash3g:stabilize-type-macros, r=nikomatsakis

Stabilize type-macros

Closes #27245

r? @nikomatsakis

7 years agoRollup merge of #36005 - apasel422:traitobj, r=alexcrichton
Manish Goregaokar [Sat, 27 Aug 2016 04:01:15 +0000 (09:31 +0530)]
Rollup merge of #36005 - apasel422:traitobj, r=alexcrichton

Replace unnecessary uses of `TraitObject` with casts

r? @alexcrichton

7 years agoRollup merge of #36004 - petrochenkov:hashloan, r=arielb1
Manish Goregaokar [Sat, 27 Aug 2016 04:01:15 +0000 (09:31 +0530)]
Rollup merge of #36004 - petrochenkov:hashloan, r=arielb1

rustc_borrowck: Don't hash types in loan paths

1) Types for equal loan paths are not always equal, they can sometimes differ in lifetimes, making equal loan paths hash differently.

Example:
https://github.com/rust-lang/rust/blob/71bdeea561355ba5adbc9a1f44f4f866a75a15c4/src/libcollections/linked_list.rs#L835-L856

One of `self.list`s has type
```
&ReFree(CodeExtent(15013/CallSiteScope { fn_id: 18907, body_id: 18912 }), BrNamed(0:DefIndex(3066), 'a(397), WontChange)) mut linked_list::LinkedList<T>
```
and other has type
```
&ReScope(CodeExtent(15018/Remainder(BlockRemainder { block: 18912, first_statement_index: 0 }))) mut linked_list::LinkedList<T>
```
(... but I'm not sure it's not a bug actually.)

2) Not hashing types is faster than hashing types.

r? @arielb1

7 years agoRollup merge of #36002 - eddyb:abstract-kindness, r=nikomatsakis
Manish Goregaokar [Sat, 27 Aug 2016 04:01:14 +0000 (09:31 +0530)]
Rollup merge of #36002 - eddyb:abstract-kindness, r=nikomatsakis

Combine types and regions in Substs into one interleaved list.

Previously, `Substs` would contain types and regions, in two separate vectors, for example:
```rust
<X as Trait<'a, 'b, A, B>>::method::<'p, 'q, T, U>
/* corresponds to */
Substs { regions: ['a, 'b, 'p, 'q], types: [X, A, B, T, U] }
```

This PR continues the work started in #35605 by further removing the distinction.
A new abstraction over types and regions is introduced in the compiler, `Kind`.
Each `Kind` is a pointer (`&TyS` or `&Region`), with the lowest two bits used as a tag.
Two bits were used instead of just one (type = `0`, region = `1`) to allow adding more kinds.

`Substs` contain only a `Vec<Kind>`, with `Self` first, followed by regions and types (in the definition order):
```rust
Substs { params: [X, 'a, 'b, A, B, 'p, 'q, T, U] }
```
The resulting interleaved list has the property of being the concatenation of parameters for the (potentially) nested generic items it describes, and can be sliced back into those components:
```rust
params[0..5] = [X, 'a, 'b, A, B] // <X as Trait<'a, 'b, A, B>>
params[5..9] = ['p, 'q, T, U] // <_>::method::<'p, 'q, T, U>
```

r? @nikomatsakis

7 years agoRollup merge of #35953 - Aatch:better-missing-block-error, r=nrc
Manish Goregaokar [Sat, 27 Aug 2016 04:01:14 +0000 (09:31 +0530)]
Rollup merge of #35953 - Aatch:better-missing-block-error, r=nrc

Improve error message when failing to parse a block

We want to catch this error:

```
if (foo)
    bar;
```

as it's valid syntax in other languages, and say how to fix it.
Unfortunately it didn't care if the suggestion made sense and just
highlighted the unexpected token.

Now it attempts to parse a statement, and if it succeeds, it shows the
help message.

Fixes #35907

7 years agoRollup merge of #35877 - KiChjang:issue-35869, r=arielb1
Manish Goregaokar [Sat, 27 Aug 2016 04:01:14 +0000 (09:31 +0530)]
Rollup merge of #35877 - KiChjang:issue-35869, r=arielb1

Fix ICE when arg types can't be found in impl/trait methods while comparing

Fixes #35869.

7 years agoRollup merge of #35124 - steveklabnik:remove_style, r=aturon
Manish Goregaokar [Sat, 27 Aug 2016 04:01:14 +0000 (09:31 +0530)]
Rollup merge of #35124 - steveklabnik:remove_style, r=aturon

Remove style guide.

We originally imported this into the repository with the intent of
fixing it up. Instead, nothing happened.

Its appearance on rust-lang.org makes it seem semi-official, but it's
not. The rustfmt strike team will end up producing something like this
anyway, and leaving it around does nothing but mislead people.

r? @aturon

7 years agoAuto merge of #35542 - scottcarr:visitor_refactor, r=nikomatsakis
bors [Sat, 27 Aug 2016 02:05:11 +0000 (19:05 -0700)]
Auto merge of #35542 - scottcarr:visitor_refactor, r=nikomatsakis

[MIR] track Location in MirVisitor, combine Location

All the users of MirVisitor::visit_statement implement their own statement index tracking.  This PR move the tracking into MirVisitor itself.

Also, there were 2 separate implementations of Location that were identical.  This PR eliminates one of them.

7 years agoAuto merge of #36008 - eddyb:compound-fail, r=michaelwoerister
bors [Fri, 26 Aug 2016 22:18:03 +0000 (15:18 -0700)]
Auto merge of #36008 - eddyb:compound-fail, r=michaelwoerister

Do not emit "class method" debuginfo for types that are not DICompositeType.

Fixes #35991 by restricting the "class method" debuginfo sugar from #33358 to structs and enums only.

r? @michaelwoerister

7 years agorustc: use Vec<Kind> in Substs, where Kind is a &TyS | &Region tagged pointer.
Eduard Burtescu [Fri, 26 Aug 2016 22:13:48 +0000 (01:13 +0300)]
rustc: use Vec<Kind> in Substs, where Kind is a &TyS | &Region tagged pointer.

7 years agorustc: pass ty::Region behind an interned 'tcx reference.
Eduard Burtescu [Thu, 25 Aug 2016 20:58:52 +0000 (23:58 +0300)]
rustc: pass ty::Region behind an interned 'tcx reference.

7 years agorustc: use accessors for Substs::{types,regions}.
Eduard Burtescu [Thu, 18 Aug 2016 05:32:50 +0000 (08:32 +0300)]
rustc: use accessors for Substs::{types,regions}.

7 years agofix port for visit_statement
Scott A Carr [Fri, 26 Aug 2016 19:39:16 +0000 (15:39 -0400)]
fix port for visit_statement

7 years agoStabilize type-macros
Daniele Baracchi [Wed, 24 Aug 2016 11:07:43 +0000 (13:07 +0200)]
Stabilize type-macros

Closes #27245

7 years agoReplace unnecessary uses of `TraitObject` with casts
Andrew Paseltiner [Fri, 26 Aug 2016 00:56:47 +0000 (20:56 -0400)]
Replace unnecessary uses of `TraitObject` with casts

7 years agoAuto merge of #35975 - jonathandturner:error_buffering, r=alexcrichton
bors [Fri, 26 Aug 2016 10:29:45 +0000 (03:29 -0700)]
Auto merge of #35975 - jonathandturner:error_buffering, r=alexcrichton

Buffer unix and lock windows to prevent message interleaving

When cargo does a build on multiple processes, multiple crates may error at the same time.  If this happens, currently you'll see interleaving of the error messages, which makes for an unreadable message.

Example:

```
    --> --> src/bin/multithread-unix.rs:16:35src/bin/singlethread.rs:16:24

      ||

1616  | |     Server::new(&addr).workers(8).    Server::new(&addr).serveserve(|r: Request| {(|r: Request| {

      | |                                                          ^^^^^^^^^^ expected struct `std::io::Error`, found () expected struct `std::io::Error`, found ()

      ||

      = = notenote: expected type `std::io::Error`: expected type `std::io::Error`

      = = notenote:    found type `()`:    found type `()`

      = = notenote: required because of the requirements on the impl of `futures_minihttp::Service<futures_minihttp::Request, futures_minihttp::Response>` for `[closure@src/bin/multithread-unix.rs:16:41: 22:6]`: required because of the requirements on the impl of `futures_minihttp::Service<futures_minihttp::Request, futures_minihttp::Response>` for `[closure@src/bin/singlethread.rs:16:30: 22:6]`

error: aborting due to previous error

error: aborting due to previous error
```

This patch uses two techniques to prevent this interleaving.  On Unix systems, since they use the text-based ANSI protocol for coloring, we can safely buffer up whole messages before we emit.  This PR does this buffering, and emits the whole message at once.

On Windows, term must use the Windows terminal API to color the output.  This disallows us from using the same buffering technique.  Instead, here we grab a Windows mutex (thanks to @alexcrichton for the lock code).  This lock only works in Windows and will hold a mutex for the duration of a message output.

r? @nikomatsakis

7 years agoDo not emit "class method" debuginfo for types that are not DICompositeType.
Eduard Burtescu [Fri, 26 Aug 2016 04:39:17 +0000 (07:39 +0300)]
Do not emit "class method" debuginfo for types that are not DICompositeType.

7 years agoAuto merge of #35906 - jseyfried:local_prelude, r=eddyb
bors [Fri, 26 Aug 2016 03:45:32 +0000 (20:45 -0700)]
Auto merge of #35906 - jseyfried:local_prelude, r=eddyb

Use `#[prelude_import]` in `libcore` and `libstd`

r? @eddyb

7 years agoAuto merge of #35885 - durka:gh35753, r=arielb1
bors [Thu, 25 Aug 2016 22:44:22 +0000 (15:44 -0700)]
Auto merge of #35885 - durka:gh35753, r=arielb1

modify fds-are-cloexec test to open a file that exists

Fixes #35753.

Is it a valid assumption that the current directory is always the root of the repo when the tests are run?

r? @nagisa

7 years agorustc_borrowck: Don't hash types in loan paths
Vadim Petrochenkov [Wed, 24 Aug 2016 18:10:19 +0000 (21:10 +0300)]
rustc_borrowck: Don't hash types in loan paths

7 years agoprevent error message interleaving on win/unix
Jonathan Turner [Thu, 25 Aug 2016 20:28:35 +0000 (13:28 -0700)]
prevent error message interleaving on win/unix

7 years agoAlso remove build steps for style
Steve Klabnik [Thu, 25 Aug 2016 19:20:31 +0000 (15:20 -0400)]
Also remove build steps for style

7 years agoRemove style guide.
Steve Klabnik [Fri, 29 Jul 2016 22:56:09 +0000 (18:56 -0400)]
Remove style guide.

We originally imported this into the repository with the intent of
fixing it up. Instead, nothing happened.

Its appearance on rust-lang.org makes it seem semi-official, but it's
not. The rustfmt strike team will end up producing something like this
anyway, and leaving it around does nothing but mislead people.

7 years agoAuto merge of #34923 - eddyb:deny-fn-item-transmute, r=nikomatsakis
bors [Thu, 25 Aug 2016 18:28:30 +0000 (11:28 -0700)]
Auto merge of #34923 - eddyb:deny-fn-item-transmute, r=nikomatsakis

Deny (by default) transmuting from fn item types to pointer-sized types.

This sets the #19925 lint (transmute from zero-sized fn item type) to `deny` by default.
Technically a `[breaking-change]`, but will not affect dependent crates because of `--cap-lints`.

7 years agouse file!() even though it shouldn't be necessary
Alex Burka [Thu, 25 Aug 2016 16:39:25 +0000 (12:39 -0400)]
use file!() even though it shouldn't be necessary

7 years agoAuto merge of #35884 - habnabit:freebsd-arc4rand, r=alexcrichton
bors [Thu, 25 Aug 2016 15:32:19 +0000 (08:32 -0700)]
Auto merge of #35884 - habnabit:freebsd-arc4rand, r=alexcrichton

Use arc4rand(9) on FreeBSD

From rust-lang-nursery/rand#112:

>After reading through #30691 it seems that there's general agreement that using OS-provided facilities for seeding rust userland processes is fine as long as it doesn't use too much from libc. FreeBSD's `arc4random_buf(3)` is not only a whole lot of libc code, but also not even currently exposed in the libc crate. Fortunately, the mechanism `arc4random_buf(3)` et al. use for getting entropy from the kernel ([`arc4rand(9)`](https://www.freebsd.org/cgi/man.cgi?query=arc4random&apropos=0&sektion=9&manpath=FreeBSD+10.3-RELEASE&arch=default&format=html)) is exposed via `sysctl(3)` with constants that are already in the libc crate.

>I haven't found too much documentation on `KERN_ARND`—it's missing or only briefly described in most of the places that cover sysctl mibs. But, from digging through the kernel source, it appears that the sysctl used in this PR is very close to just calling `arc4rand(9)` directly (with `reseed` set to 0 and no way to change it).

I expected [rand](/rust-lang-nursery/rand) to reply quicker, so I tried submitting it there first. It's been a few weeks with no comment, so I don't know the state of it, but maybe someone will see it here and have an opinion. This is basically the same patch. It pains me to duplicate the code but I guess it hasn't been factored out into just one place yet.

7 years agoAuto merge of #35979 - Manishearth:rollup, r=Manishearth
bors [Thu, 25 Aug 2016 11:35:52 +0000 (04:35 -0700)]
Auto merge of #35979 - Manishearth:rollup, r=Manishearth

Rollup of 6 pull requests

- Successful merges: #35238, #35867, #35885, #35916, #35947, #35955
- Failed merges:

7 years agoRollup merge of #35955 - frewsxcv:idiomatic-methods, r=eddyb
Manish Goregaokar [Thu, 25 Aug 2016 08:22:53 +0000 (13:52 +0530)]
Rollup merge of #35955 - frewsxcv:idiomatic-methods, r=eddyb

Use idiomatic names for string-related methods names.

None

7 years agoRollup merge of #35947 - SimonSapin:decodeutf8-error-handling, r=alexcrichton
Manish Goregaokar [Thu, 25 Aug 2016 08:22:53 +0000 (13:52 +0530)]
Rollup merge of #35947 - SimonSapin:decodeutf8-error-handling, r=alexcrichton

Yield Err in char::decode_utf8 per Unicode, like String::from_utf8_lossy

r? @alexcrichton

7 years agoRollup merge of #35916 - eddyb:mir-no-dead-allocas, r=Aatch
Manish Goregaokar [Thu, 25 Aug 2016 08:22:52 +0000 (13:52 +0530)]
Rollup merge of #35916 - eddyb:mir-no-dead-allocas, r=Aatch

rustc_trans: do not generate allocas for unused locals.

This fixes a regression observed in a [`mio` test](https://travis-ci.org/carllerche/mio/jobs/152142886) which was referencing a 4MB `const` array.
Even though MIR rvalue promotion would promote the borrow of the array, a dead temp was left behind.
As the array doesn't have an immediate type, an `alloca` was generated for it, even though it had no uses.

The fix is pretty dumb: assume that locals need to be borrowed or assigned before being used.
And if it can't be used, it doesn't get an `alloca`, even if the type would otherwise demand it.
This could change in the future, but all the MIR we generate now doesn't break that rule.

7 years agoRollup merge of #35867 - frewsxcv:rustdoc-cleanup, r=alexcrichton
Manish Goregaokar [Thu, 25 Aug 2016 08:22:52 +0000 (13:52 +0530)]
Rollup merge of #35867 - frewsxcv:rustdoc-cleanup, r=alexcrichton

Various refactorings in the rustdoc module.

None

7 years agoRollup merge of #35238 - vadimcn:macro-debug-locs, r=michaelwoerister
Manish Goregaokar [Thu, 25 Aug 2016 08:22:52 +0000 (13:52 +0530)]
Rollup merge of #35238 - vadimcn:macro-debug-locs, r=michaelwoerister

Fix debug line number info for macro expansions.

Macro expansions result in code tagged with completely different debug locations than the surrounding expressions.  This wrecks havoc on debugger's ability the step over source lines.
This change fixes the problem by tagging expanded code as "inlined" at the macro expansion site, which allows the debugger to sort it out.
Note that only the outermost expansion is currently handled, stepping into a macro will still result in stepping craziness.

r? @eddyb

7 years agoFix debug line info for macro expansions.
Vadim Chugunov [Thu, 25 Aug 2016 02:34:31 +0000 (19:34 -0700)]
Fix debug line info for macro expansions.

Macro expansions produce code tagged with debug locations that are completely different from the surrounding expressions.  This wrecks havoc on debugger's ability the step over source lines.

In order to have a good line stepping behavior in debugger, we overwrite debug locations of macro expansions with that of the outermost expansion site.

7 years agoImplement `From<ast::FloatTy>` for `PrimitiveType`.
Corey Farwell [Tue, 23 Aug 2016 23:41:14 +0000 (19:41 -0400)]
Implement `From<ast::FloatTy>` for `PrimitiveType`.

7 years agoImplement `From<ast::UintTy>` for `PrimitiveType`.
Corey Farwell [Tue, 23 Aug 2016 23:22:18 +0000 (19:22 -0400)]
Implement `From<ast::UintTy>` for `PrimitiveType`.

7 years agoImplement `From<ast::IntTy>` for `PrimitiveType`.
Corey Farwell [Tue, 23 Aug 2016 23:12:24 +0000 (19:12 -0400)]
Implement `From<ast::IntTy>` for `PrimitiveType`.

7 years agoRemove unnecessary 'Primitive' prefix on `PrimitiveType` enum variants.
Corey Farwell [Tue, 23 Aug 2016 22:51:56 +0000 (18:51 -0400)]
Remove unnecessary 'Primitive' prefix on `PrimitiveType` enum variants.

7 years agoStop reexporting `PrimitiveType` enum in librustdoc.
Corey Farwell [Tue, 23 Aug 2016 22:48:10 +0000 (18:48 -0400)]
Stop reexporting `PrimitiveType` enum in librustdoc.

7 years agoMigrate ItemType::from_type_kind to convert::From.
Corey Farwell [Sat, 20 Aug 2016 19:55:43 +0000 (15:55 -0400)]
Migrate ItemType::from_type_kind to convert::From.

7 years agoMigrate ItemType::from_item to convert::From.
Corey Farwell [Sat, 20 Aug 2016 18:22:16 +0000 (14:22 -0400)]
Migrate ItemType::from_item to convert::From.

7 years agoMigrate Context::maybe_ignore_item method to standalone function.
Corey Farwell [Sat, 20 Aug 2016 18:22:08 +0000 (14:22 -0400)]
Migrate Context::maybe_ignore_item method to standalone function.

The method wasn't using any `self` data from Context, so it seemed
miseading to implement it as a method.

7 years agoMove ItemEnum → Generics logic into method on ItemEnum.
Corey Farwell [Sat, 20 Aug 2016 17:36:52 +0000 (13:36 -0400)]
Move ItemEnum → Generics logic into method on ItemEnum.

7 years agoAuto merge of #35814 - alexcrichton:armv7-no-neon, r=brson
bors [Thu, 25 Aug 2016 06:05:47 +0000 (23:05 -0700)]
Auto merge of #35814 - alexcrichton:armv7-no-neon, r=brson

rustc: Don't enable NEON by default on armv7 Linux

One of the primary platforms for the `armv7-unknown-linux-gnueabihf` target,
Linux distributions, do not enable NEON extensions by default. This PR disables
that feature by defualt but enables the `d16` feature which enables VFP3D16 that
distributions do enable.

Closes #35590

7 years agoAuto merge of #35971 - jonathandturner:rollup, r=jonathandturner
bors [Thu, 25 Aug 2016 01:42:24 +0000 (18:42 -0700)]
Auto merge of #35971 - jonathandturner:rollup, r=jonathandturner

Rollup of 4 pull requests

- Successful merges: #35876, #35920, #35948, #35961
- Failed merges: #35395

7 years agoRemove needless imports in `libcollections`.
Jeffrey Seyfried [Mon, 22 Aug 2016 20:16:36 +0000 (20:16 +0000)]
Remove needless imports in `libcollections`.

7 years agoUse `#[prelude_import]` in `libstd`.
Jeffrey Seyfried [Mon, 22 Aug 2016 19:47:38 +0000 (19:47 +0000)]
Use `#[prelude_import]` in `libstd`.

7 years agoUse `#[prelude_import]` in `libcore`.
Jeffrey Seyfried [Mon, 22 Aug 2016 10:02:28 +0000 (10:02 +0000)]
Use `#[prelude_import]` in `libcore`.

7 years agoAuto merge of #35764 - eddyb:byegone, r=nikomatsakis
bors [Wed, 24 Aug 2016 21:57:34 +0000 (14:57 -0700)]
Auto merge of #35764 - eddyb:byegone, r=nikomatsakis

Remove the old AST-based backend from rustc_trans.

Starting with Rust 1.13, `--disable-orbit` , `-Z orbit=off` and `#[rustc_no_mir]` have been removed.
Only the new MIR backend is left in the compiler, and only early const_eval uses ASTs from other crates.

Filling drop (previously "zeroing drop"), `#[unsafe_no_drop_flag]` and associated unstable APIs are gone.
Implementing `Drop` doesn't add a flag anymore to the type, all of the dynamic drop is function local.
This is a [breaking-change], please use `Option::None` and/or `mem::forget` if you are unsure about your ability to prevent/control the drop of a value. In the future, `union` will be usable in some such cases.

**NOTE**: DO NOT MERGE before we get the new beta as the stage0, there's some cruft to remove.

All of this will massively simplify any efforts to implement (and as such it blocks) features such as `union`s, safe use of `#[packed]` or new type layout optimizations, not to mention many other experiments.

7 years agoMore robust testing
Keith Yeung [Mon, 22 Aug 2016 08:59:31 +0000 (01:59 -0700)]
More robust testing

7 years agoExtract error reporting into its own fn
Keith Yeung [Mon, 22 Aug 2016 08:59:18 +0000 (01:59 -0700)]
Extract error reporting into its own fn

7 years agoRollup merge of #35961 - 0xmohit:pr/error-codes-E0445-E0454, r=GuillaumeGomez
Jonathan Turner [Wed, 24 Aug 2016 17:35:29 +0000 (10:35 -0700)]
Rollup merge of #35961 - 0xmohit:pr/error-codes-E0445-E0454, r=GuillaumeGomez

Update E0445 and E0454 to new error format

Fixes #35922.
Fixes #35930.
Part of #35233.

r? @GuillaumeGomez

7 years agoRollup merge of #35948 - tshepang:missing-comma, r=steveklabnik
Jonathan Turner [Wed, 24 Aug 2016 17:35:29 +0000 (10:35 -0700)]
Rollup merge of #35948 - tshepang:missing-comma, r=steveklabnik

reference: add trailing commas

7 years agoRollup merge of #35920 - GuillaumeGomez:err_codes, r=jonathandturner
Jonathan Turner [Wed, 24 Aug 2016 17:35:29 +0000 (10:35 -0700)]
Rollup merge of #35920 - GuillaumeGomez:err_codes, r=jonathandturner

Err codes

r? @jonathandturner

7 years agoRollup merge of #35876 - matthew-piziak:sub-examples, r=GuillaumeGomez
Jonathan Turner [Wed, 24 Aug 2016 17:35:29 +0000 (10:35 -0700)]
Rollup merge of #35876 - matthew-piziak:sub-examples, r=GuillaumeGomez

more evocative examples for `Sub` and `SubAssign`

These examples are exactly analogous to those in PRs #35709 and #35806. I'll probably remove the `fn main` wrappers for `Add` and `Sub` once this is merged in.

Part of #29365.

r? @steveklabnik

7 years agoAuto merge of #35883 - durka:gh35849, r=eddyb
bors [Wed, 24 Aug 2016 17:29:12 +0000 (10:29 -0700)]
Auto merge of #35883 - durka:gh35849, r=eddyb

typeck: use NoExpectation to check return type of diverging fn

Fixes #35849.

Thanks @eddyb.

7 years agoUpdate E0445 and E0454 to new error format
Mohit Agarwal [Wed, 24 Aug 2016 12:13:51 +0000 (17:43 +0530)]
Update E0445 and E0454 to new error format

Fixes #35922.
Fixes #35930.
Part of #35233.

r? @GuillaumeGomez

7 years agoRemove AST from metadata except for consts and const fns.
Eduard Burtescu [Wed, 17 Aug 2016 19:50:55 +0000 (22:50 +0300)]
Remove AST from metadata except for consts and const fns.

7 years agoRemove drop flags from structs and enums implementing Drop.
Eduard Burtescu [Tue, 23 Aug 2016 07:39:30 +0000 (10:39 +0300)]
Remove drop flags from structs and enums implementing Drop.

7 years agorustc_trans: remove the bulk of old trans and most of its support code.
Eduard Burtescu [Tue, 16 Aug 2016 14:41:38 +0000 (17:41 +0300)]
rustc_trans: remove the bulk of old trans and most of its support code.

7 years agoDisable old trans access via -Z orbit, #[rustc_no_mir] or --disable-orbit.
Eduard Burtescu [Wed, 24 Aug 2016 03:36:37 +0000 (06:36 +0300)]
Disable old trans access via -Z orbit, #[rustc_no_mir] or --disable-orbit.

7 years agoAdd new error code tests
Guillaume Gomez [Tue, 23 Aug 2016 13:35:59 +0000 (15:35 +0200)]
Add new error code tests

7 years agoAdd error code test checkup
Guillaume Gomez [Tue, 23 Aug 2016 13:35:26 +0000 (15:35 +0200)]
Add error code test checkup

7 years agoAdd E0478 error explanation
Guillaume Gomez [Tue, 23 Aug 2016 13:35:10 +0000 (15:35 +0200)]
Add E0478 error explanation

7 years agoAuto merge of #35748 - michaelwoerister:fix-rust-gdb-py-version-check, r=brson
bors [Wed, 24 Aug 2016 05:52:29 +0000 (22:52 -0700)]
Auto merge of #35748 - michaelwoerister:fix-rust-gdb-py-version-check, r=brson

Make version check in gdb_rust_pretty_printing.py more compatible.

Some versions of Python don't support the `major` field on the object returned by `sys.version_info`.

Fixes #35724

r? @brson

7 years agoReuse iterator to avoid unnecessary creation.
Corey Farwell [Wed, 24 Aug 2016 01:34:53 +0000 (21:34 -0400)]
Reuse iterator to avoid unnecessary creation.

7 years agoUse idiomatic names for string-related methods names.
Corey Farwell [Wed, 24 Aug 2016 01:27:20 +0000 (21:27 -0400)]
Use idiomatic names for string-related methods names.

7 years agoAuto merge of #35951 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Tue, 23 Aug 2016 23:28:20 +0000 (16:28 -0700)]
Auto merge of #35951 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 6 pull requests

- Successful merges: #35910, #35912, #35913, #35936, #35939, #35949
- Failed merges: #35395

7 years agoRollup merge of #35949 - tshepang:excess, r=GuillaumeGomez
Guillaume Gomez [Tue, 23 Aug 2016 20:48:03 +0000 (22:48 +0200)]
Rollup merge of #35949 - tshepang:excess, r=GuillaumeGomez

doc: one line too many

7 years agoRollup merge of #35939 - creativcoder:e0195, r=jonathandturner
Guillaume Gomez [Tue, 23 Aug 2016 20:48:03 +0000 (22:48 +0200)]
Rollup merge of #35939 - creativcoder:e0195, r=jonathandturner

Update E0195 to new error format

Fixes #35511
Part of #35233

r? @jonathandturner

7 years agoRollup merge of #35936 - matthew-piziak:div-rational-example, r=GuillaumeGomez
Guillaume Gomez [Tue, 23 Aug 2016 20:48:03 +0000 (22:48 +0200)]
Rollup merge of #35936 - matthew-piziak:div-rational-example, r=GuillaumeGomez

replace `Div` example with something more evocative of division

Analogous to PR #35860.

r? @GuillaumeGomez

7 years agoRollup merge of #35913 - frewsxcv:panic, r=steveklabnik
Guillaume Gomez [Tue, 23 Aug 2016 20:48:02 +0000 (22:48 +0200)]
Rollup merge of #35913 - frewsxcv:panic, r=steveklabnik

Mark panicking tests as `should_panic` instead of `no_run`.

None

7 years agoRollup merge of #35912 - brson:rust-installer, r=alexcrichton
Guillaume Gomez [Tue, 23 Aug 2016 20:48:02 +0000 (22:48 +0200)]
Rollup merge of #35912 - brson:rust-installer, r=alexcrichton

Update rust-installer. Fixes #35840

cc @Diggsey

7 years agoRollup merge of #35910 - tbu-:pr_weird_linebreak, r=alexcrichton
Guillaume Gomez [Tue, 23 Aug 2016 20:48:02 +0000 (22:48 +0200)]
Rollup merge of #35910 - tbu-:pr_weird_linebreak, r=alexcrichton

Change a weird line break in `core::str`

7 years agodoc: one line too many
Tshepang Lekhonkhobe [Tue, 23 Aug 2016 20:31:44 +0000 (22:31 +0200)]
doc: one line too many

7 years agoreference: add trailing commas
Tshepang Lekhonkhobe [Tue, 23 Aug 2016 20:25:40 +0000 (22:25 +0200)]
reference: add trailing commas

7 years agoYield Err in char::decode_utf8 per Unicode, like String::from_utf8_lossy
Simon Sapin [Tue, 23 Aug 2016 20:09:59 +0000 (22:09 +0200)]
Yield Err in char::decode_utf8 per Unicode, like String::from_utf8_lossy

7 years agoUse a macro in test_decode_utf8 to preserve line numbers in panic messages.
Simon Sapin [Tue, 23 Aug 2016 15:26:34 +0000 (17:26 +0200)]
Use a macro in test_decode_utf8 to preserve line numbers in panic messages.

7 years agoAuto merge of #35854 - nikomatsakis:incr-comp-cache-hash-35549, r=mw
bors [Tue, 23 Aug 2016 18:53:17 +0000 (11:53 -0700)]
Auto merge of #35854 - nikomatsakis:incr-comp-cache-hash-35549, r=mw

compute and cache HIR hashes at beginning

This avoids the compile-time overhead of computing them twice.  It also fixes
an issue where the hash computed after typeck is differen than the hash before,
because typeck mutates the def-map in place.

Fixes #35549.
Fixes #35593.

Some performance measurements suggest this `HashesMap` is very small in memory (unobservable via `-Z time-passes`) and very cheap to construct. I do see some (very minor) performance wins in the incremental case after the first run -- the first run costs more because loading the dep-graph didn't have any hashing to do in that case. Example timings from two runs  of `libsyntex-syntax` -- the (1) indicates first run, (2) indicates second run, and (*) indicates both together:

| Phase | Master | Branch |
| ---- | ---- | ---- |
| compute_hashes_map (1) | N/A | 0.343 |
| load_dep_graph (1) | 0 | 0 |
| serialize dep graph (1) | 4.190 | 3.920 |
| total (1) | 4.190 | 4.260 |
| compute_hashes_map (2) | N/A | 0.344 |
| load_dep_graph (2) | 0.592 | 0.252 |
| serialize dep graph (2) | 4.119 | 3.779 |
| total (2) | 4.71 | 4.375 |
| total (*) | 8.9 | 8.635 |

r? @michaelwoerister

7 years agofix stray comment
Niko Matsakis [Tue, 23 Aug 2016 17:29:28 +0000 (13:29 -0400)]
fix stray comment

7 years agopacify the mercilous tidy
Niko Matsakis [Tue, 23 Aug 2016 17:28:50 +0000 (13:28 -0400)]
pacify the mercilous tidy

7 years agotypeck: use NoExpectation to check return type of diverging fn
Alex Burka [Sun, 21 Aug 2016 22:45:25 +0000 (22:45 +0000)]
typeck: use NoExpectation to check return type of diverging fn

This fixes #35849, a regression introduced by the typeck refactoring
around TyNever/!.

7 years agoUpdate E0195 to new error format
Rahul Sharma [Wed, 10 Aug 2016 10:34:11 +0000 (16:04 +0530)]
Update E0195 to new error format

7 years agoreplace `Div` example with something more evocative of division
Matthew Piziak [Tue, 23 Aug 2016 16:09:06 +0000 (12:09 -0400)]
replace `Div` example with something more evocative of division

Analogous to PR #35860.

r? @GuillaumeGomez

7 years agoconsider DepNode::Krate to be an input
Niko Matsakis [Tue, 23 Aug 2016 15:57:27 +0000 (11:57 -0400)]
consider DepNode::Krate to be an input

This seems not only more correct but allows us to write tests that check
whether the krate hash as a whole is clean/dirty

7 years agoAuto merge of #35656 - Stebalien:fused, r=alexcrichton
bors [Tue, 23 Aug 2016 14:46:52 +0000 (07:46 -0700)]
Auto merge of #35656 - Stebalien:fused, r=alexcrichton

Implement 1581 (FusedIterator)

* [ ] Implement on patterns. See https://github.com/rust-lang/rust/issues/27721#issuecomment-239638642.
* [ ] Handle OS Iterators. A bunch of iterators (`Args`, `Env`, etc.) in libstd wrap platform specific iterators. The current ones all appear to be well-behaved but can we assume that future ones will be?
* [ ] Does someone want to audit this? On first glance, all of the iterators on which I implemented `FusedIterator` appear to be well-behaved but there are a *lot* of them so a second pair of eyes would be nice.
* I haven't touched rustc internal iterators (or the internal rand) because rustc doesn't actually call `fuse()`.
* `FusedIterator` can't be implemented on `std::io::{Bytes, Chars}`.

Closes: #35602 (Tracking Issue)
Implements: rust-lang/rfcs#1581

7 years agomake svh independent of item ordering
Niko Matsakis [Tue, 23 Aug 2016 14:42:46 +0000 (10:42 -0400)]
make svh independent of item ordering

7 years agocache def-path hashes across all items
Niko Matsakis [Tue, 23 Aug 2016 11:56:34 +0000 (07:56 -0400)]
cache def-path hashes across all items

This seems like approx a 2x win on syntex_syntax.

7 years agorename HashesMap to IncrementalHashesMap
Niko Matsakis [Tue, 23 Aug 2016 11:47:14 +0000 (07:47 -0400)]
rename HashesMap to IncrementalHashesMap

7 years agoadd regression test for #35593
Niko Matsakis [Tue, 23 Aug 2016 11:40:53 +0000 (07:40 -0400)]
add regression test for #35593

Fixes #35593

7 years agoAuto merge of #35627 - apasel422:coerce-cell, r=alexcrichton
bors [Tue, 23 Aug 2016 11:16:28 +0000 (04:16 -0700)]
Auto merge of #35627 - apasel422:coerce-cell, r=alexcrichton

Implement `CoerceUnsized` for `{Cell, RefCell, UnsafeCell}`

These impls are analogous to the one for `NonZero`. It's occasionally useful to be able to coerce the cell types when they're being used inside another abstraction. See Manishearth/rust-gc#17 for an example.

r? @eddyb

7 years agoImprove error message when failing to parse a block
James Miller [Tue, 23 Aug 2016 06:23:31 +0000 (18:23 +1200)]
Improve error message when failing to parse a block

We want to catch this error:

```
if (foo)
    bar;
```

as it's valid syntax in other languages, and say how to fix it.
Unfortunately it didn't care if the suggestion made sense and just
highlighted the unexpected token.

Now it attempts to parse a statement, and if it succeeds, it shows the
help message.

Fixes #35907

7 years agorustc_trans: do not generate allocas for unused locals.
Eduard Burtescu [Tue, 23 Aug 2016 06:07:23 +0000 (09:07 +0300)]
rustc_trans: do not generate allocas for unused locals.

7 years agoAuto merge of #35766 - brson:bump, r=alexcrichton
bors [Tue, 23 Aug 2016 03:51:54 +0000 (20:51 -0700)]
Auto merge of #35766 - brson:bump, r=alexcrichton

Upgrade bootstrap compiler to 1.12

r? @alexcrichton

7 years agoMark panicking tests as `should_panic` instead of `no_run`.
Corey Farwell [Tue, 23 Aug 2016 00:39:20 +0000 (20:39 -0400)]
Mark panicking tests as `should_panic` instead of `no_run`.

7 years agoUpdate rust-installer. Fixes #35840
Brian Anderson [Tue, 23 Aug 2016 00:38:26 +0000 (00:38 +0000)]
Update rust-installer. Fixes #35840