]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoRollup merge of #35862 - Stebalien:fmt-docs, r=steveklabnik
Guillaume Gomez [Tue, 30 Aug 2016 08:39:05 +0000 (10:39 +0200)]
Rollup merge of #35862 - Stebalien:fmt-docs, r=steveklabnik

Clarify/fix formatting docs concerning fmt::Result/fmt::Error

1. `fmt::Result` != `io::Result<()>`
2. Formatters should only propagate errors, not return their own.

Confusion on reddit: https://www.reddit.com/r/rust/comments/4yorxr/is_implt_tostring_for_t_where_t_display_sized_a/

7 years agoRollup merge of #35810 - matthew-piziak:fn-trait-example, r=steveklabnik
Guillaume Gomez [Tue, 30 Aug 2016 08:39:05 +0000 (10:39 +0200)]
Rollup merge of #35810 - matthew-piziak:fn-trait-example, r=steveklabnik

improve documentation for `Fn*` traits

This PR is not yet a serious attempt at contribution. Rather, I'm opening this for discussion. I can think of a few things we may want to accomplish with the documentation of the `Fn`, `FnMut`, and `FnOnce` traits:
- the relationship between these traits and the closures that implement them
- examples of non-closure implementations
- the relationship between these traits and Rust's ownership semantics

7 years agoRollup merge of #35771 - matthew-piziak:range-inclusive-example-error, r=steveklabnik
Guillaume Gomez [Tue, 30 Aug 2016 08:39:05 +0000 (10:39 +0200)]
Rollup merge of #35771 - matthew-piziak:range-inclusive-example-error, r=steveklabnik

show how iterating over `RangeTo` and `RangeToInclusive` fails

Feedback on PR #35701 seems to be positive, so this does the same thing for `RangeTo` and `RangeToInclusive`.

7 years agoRollup merge of #35418 - birkenfeld:patch-1, r=aturon
Guillaume Gomez [Tue, 30 Aug 2016 08:39:05 +0000 (10:39 +0200)]
Rollup merge of #35418 - birkenfeld:patch-1, r=aturon

Doc: explain why Box/Rc/Arc methods do not take self

This can be confusing for newcomers, especially due to the argument name `this` that is used for Rc and Arc.

7 years agoAuto merge of #36117 - eddyb:llvm-hoist-meta, r=alexcrichton
bors [Tue, 30 Aug 2016 00:01:09 +0000 (17:01 -0700)]
Auto merge of #36117 - eddyb:llvm-hoist-meta, r=alexcrichton

llvm: backport "[SimplifyCFG] Hoisting invalidates metadata".

Fixes #36023 by backporting @majnemer's LLVM patch fixing [the LLVM bug](https://llvm.org/bugs/show_bug.cgi?id=29163.) where SimplifyCFG hoisted instructions andkept their metadata (conditional `!nonnull` loads could kill a null check later if hoisted).

r? @alexcrichton

7 years agollvm: backport "[SimplifyCFG] Hoisting invalidates metadata".
Eduard Burtescu [Mon, 29 Aug 2016 19:53:18 +0000 (22:53 +0300)]
llvm: backport "[SimplifyCFG] Hoisting invalidates metadata".

7 years agoAuto merge of #36080 - japaric:systemz, r=alexcrichton
bors [Mon, 29 Aug 2016 19:48:21 +0000 (12:48 -0700)]
Auto merge of #36080 - japaric:systemz, r=alexcrichton

build llvm with systemz backend enabled, and link to related libraries

when building rust against system llvm

closes #36077

r? @alexcrichton

7 years agoAuto merge of #36062 - japaric:smarter-submodules, r=alexcrichton
bors [Mon, 29 Aug 2016 04:57:51 +0000 (21:57 -0700)]
Auto merge of #36062 - japaric:smarter-submodules, r=alexcrichton

rustbuild: smarter `git submodule`-ing

With this commit, if one bootstraps rust against system llvm then the
src/llvm submodule is not updated/checked-out. This saves considerable
network bandwith when starting from a fresh clone of rust-lang/rust as
the llvm submodule is never cloned.

cc #30107

r? @alexcrichton
cc @petevine

~~We could also avoid updating the jemalloc submodule if --disable-jemalloc is used. It just hasn't been implemented.~~ Done

This probably doesn't handle "recursive" submodules correctly but I think we don't have any of those right now.

I'm still testing a bootstrap but already confirmed that the llvm submodule doesn't get updated when `--llvm-root` is passed to `configure`.

7 years agofix tidy error
Jorge Aparicio [Mon, 29 Aug 2016 03:13:35 +0000 (22:13 -0500)]
fix tidy error

7 years agoAuto merge of #36059 - CryZe:improved-demangling, r=alexcrichton
bors [Sun, 28 Aug 2016 23:13:16 +0000 (16:13 -0700)]
Auto merge of #36059 - CryZe:improved-demangling, r=alexcrichton

Improve Demangling of Rust Symbols

This turns `..` into `::`, handles some more escapes and gets rid of unwanted underscores at the beginning of path elements.

![Image of Diff](http://puu.sh/qQIN3.png)

7 years agoAuto merge of #36029 - KiChjang:issue-12033, r=arielb1
bors [Sun, 28 Aug 2016 20:16:47 +0000 (13:16 -0700)]
Auto merge of #36029 - KiChjang:issue-12033, r=arielb1

Fix lifetime rules for 'if' conditions

Fixes #12033.

Changes the temporary scope rules to make the condition of an if-then-else a terminating scope. This is a [breaking-change].

7 years agobuild llvm with systemz backend enabled, and link to related libraries
Jorge Aparicio [Sun, 28 Aug 2016 18:18:28 +0000 (13:18 -0500)]
build llvm with systemz backend enabled, and link to related libraries

when building rust against system llvm

closes #36077

7 years agoAuto merge of #35984 - jonas-schievink:reproducible-builds, r=eddyb
bors [Sun, 28 Aug 2016 17:19:52 +0000 (10:19 -0700)]
Auto merge of #35984 - jonas-schievink:reproducible-builds, r=eddyb

Steps towards reproducible builds

cc #34902

Running `make dist` twice will result in a rustc tarball where only `librustc_back.so`, `librustc_llvm.so` and `librustc_trans.so` differ. Building `libstd` and `libcore` twice with the same compiler and flags produces identical artifacts.

The third commit should close #24473

7 years agoAuto merge of #36058 - apasel422:tests, r=alexcrichton
bors [Sun, 28 Aug 2016 14:28:20 +0000 (07:28 -0700)]
Auto merge of #36058 - apasel422:tests, r=alexcrichton

Add tests for #20433, #26251, #28625, #33687

Closes #20433
Closes #26251
Closes #28625
Closes #33687

7 years agoRevert changes to the reproducible-builds test
Jonas Schievink [Sun, 28 Aug 2016 13:37:37 +0000 (15:37 +0200)]
Revert changes to the reproducible-builds test

7 years agoAuto merge of #36055 - japaric:rustbuild-no-filecheck, r=alexcrichton
bors [Sun, 28 Aug 2016 10:28:38 +0000 (03:28 -0700)]
Auto merge of #36055 - japaric:rustbuild-no-filecheck, r=alexcrichton

rustbuild: skip filecheck check if codegen tests are disabled

to match the behavior of the old Makefile-based build system

closes #35752

r? @alexcrichton

7 years agoAuto merge of #36028 - japaric:s390x, r=alexcrichton
bors [Sun, 28 Aug 2016 07:36:16 +0000 (00:36 -0700)]
Auto merge of #36028 - japaric:s390x, r=alexcrichton

initial support for s390x

A new target, `s390x-unknown-linux-gnu`, has been added to the compiler
and can be used to build no_core/no_std Rust programs.

Known limitations:

- librustc_trans/cabi_s390x.rs is missing. This means no support for
  `extern "C" fn`.
- No support for this arch in libc. This means std can't be cross
  compiled for this target.

r? @alexcrichton

This time I couldn't test running a binary cross compiled to this target under QEMU because the qemu-s390x that ships with Ubuntu 16.04 SIGABRTs with every s390x binary I run it with.

Change in binary size of `librustc_llvm.so`:

Without this commit (stage1): 41895736 bytes
With this commit (stage1): 42899016 bytes

~2.4% increase

7 years agoAuto merge of #36027 - eddyb:unsized-prefix, r=nagisa
bors [Sun, 28 Aug 2016 04:20:28 +0000 (21:20 -0700)]
Auto merge of #36027 - eddyb:unsized-prefix, r=nagisa

rustc_trans: don't round up the DST prefix size to its alignment.

Fixes #35815 by using `ty::layout` and `min_size` to compute the size of the DST prefix.
`ty::layout::Struct::min_size` is not rounded up to alignment, which could be smaller for the DST field.

7 years agodon't update the src/jemalloc submodule is jemalloc has been disabled
Jorge Aparicio [Sun, 28 Aug 2016 03:53:19 +0000 (22:53 -0500)]
don't update the src/jemalloc submodule is jemalloc has been disabled

i.e. via the --disable-jemalloc configure flag

7 years agodon't run codegen tests when they have been disabled
Jorge Aparicio [Sun, 28 Aug 2016 03:14:29 +0000 (22:14 -0500)]
don't run codegen tests when they have been disabled

7 years agorustbuild: smarter `git submodule`-ing
Jorge Aparicio [Sun, 28 Aug 2016 02:33:38 +0000 (21:33 -0500)]
rustbuild: smarter `git submodule`-ing

With this commit, if one bootstraps rust against system llvm then the
src/llvm submodule is not updated/checked-out. This saves considerable
network bandwith when starting from a fresh clone of rust-lang/rust as
the llvm submodule is never cloned.

cc #30107

7 years agoImprove Demangling of Rust Symbols
Christopher Serr [Sat, 27 Aug 2016 23:30:30 +0000 (01:30 +0200)]
Improve Demangling of Rust Symbols

This turns `..` into `::`, handles some more escapes and gets rid of
unwanted underscores at the beginning of path elements.

![Image of Diff](http://puu.sh/qQIN3.png)

7 years agoAdd tests for #20433, #26251, #28625, #33687
Andrew Paseltiner [Sat, 27 Aug 2016 22:37:27 +0000 (18:37 -0400)]
Add tests for #20433, #26251, #28625, #33687

Closes #20433
Closes #26251
Closes #28625
Closes #33687

7 years agoAuto merge of #36049 - jonathandturner:rollup, r=jonathandturner
bors [Sat, 27 Aug 2016 22:23:17 +0000 (15:23 -0700)]
Auto merge of #36049 - jonathandturner:rollup, r=jonathandturner

Rollup of 6 pull requests

- Successful merges: #35657, #35980, #35985, #35989, #36003, #36044
- Failed merges:

7 years agorustbuild: skip filecheck check if codegen tests are disabled
Jorge Aparicio [Sat, 27 Aug 2016 22:12:37 +0000 (17:12 -0500)]
rustbuild: skip filecheck check if codegen tests are disabled

to match the behavior of the old Makefile-based build system

closes #35752

7 years agoRollup merge of #36044 - mikhail-m1:master, r=jonathandturner
Jonathan Turner [Sat, 27 Aug 2016 19:43:31 +0000 (12:43 -0700)]
Rollup merge of #36044 - mikhail-m1:master, r=jonathandturner

update error E0450 to new format

Fixes #35925 as part of #35233.

I've solve the bonus, and I wonder if any simpler way to do this. But may be possible simplify if let expressions?

r? @jonathandturner

7 years agoRollup merge of #36003 - GuillaumeGomez:err_codes, r=jonathandturner
Jonathan Turner [Sat, 27 Aug 2016 19:43:31 +0000 (12:43 -0700)]
Rollup merge of #36003 - GuillaumeGomez:err_codes, r=jonathandturner

Err codes

r? @jonathandturner

7 years agoRollup merge of #35989 - 0xmohit:pr/error-code-E0453, r=jonathandturner
Jonathan Turner [Sat, 27 Aug 2016 19:43:31 +0000 (12:43 -0700)]
Rollup merge of #35989 - 0xmohit:pr/error-code-E0453, r=jonathandturner

Update E0453 to new error format

Fixes #35929.
Part of #35233.

r? @jonathandturner

7 years agoRollup merge of #35985 - 0xmohit:pr/error-code-E0277, r=jonathandturner
Jonathan Turner [Sat, 27 Aug 2016 19:43:30 +0000 (12:43 -0700)]
Rollup merge of #35985 - 0xmohit:pr/error-code-E0277, r=jonathandturner

Update E0277 to new error format

Fixes #35311.
Part of #35233.

r? @jonathandturner

7 years agoRollup merge of #35980 - kyrias:E0094-underline, r=jonathandturner
Jonathan Turner [Sat, 27 Aug 2016 19:43:30 +0000 (12:43 -0700)]
Rollup merge of #35980 - kyrias:E0094-underline, r=jonathandturner

Make E0094 underline better

r? @jonathandturner

7 years agoRollup merge of #35657 - ahmedcharles:e0389, r=jonathandturner
Jonathan Turner [Sat, 27 Aug 2016 19:43:30 +0000 (12:43 -0700)]
Rollup merge of #35657 - ahmedcharles:e0389, r=jonathandturner

Update E0389 to the new format. #35630

7 years agoAuto merge of #35674 - ahmedcharles:rpass, r=alexcrichton
bors [Sat, 27 Aug 2016 19:31:25 +0000 (12:31 -0700)]
Auto merge of #35674 - ahmedcharles:rpass, r=alexcrichton

Fix compiletest so it respects warnings for run-pass.

7 years agoFix lifetime rules for 'if' conditions
Keith Yeung [Sat, 27 Aug 2016 02:58:31 +0000 (19:58 -0700)]
Fix lifetime rules for 'if' conditions

7 years agoDoc: explain why Box/Rc/Arc methods do not take self
Georg Brandl [Sat, 6 Aug 2016 10:49:17 +0000 (12:49 +0200)]
Doc: explain why Box/Rc/Arc methods do not take self

This can be confusing for newcomers, especially due to the argument
name "this".

7 years agoupdate error E0450 to new format
Mikhail Modin [Sat, 27 Aug 2016 16:39:22 +0000 (19:39 +0300)]
update error E0450 to new format

7 years agoAuto merge of #35969 - bluss:memrchr-alignment, r=nagisa
bors [Sat, 27 Aug 2016 14:52:20 +0000 (07:52 -0700)]
Auto merge of #35969 - bluss:memrchr-alignment, r=nagisa

memrchr: Correct aligned offset computation

The memrchr fallback did not compute the offset correctly. It was
intentioned to land on usize-aligned addresses but did not.
This was suspected to have resulted in a crash on ARMv7!

This bug affected non-linux platforms.

I think like this, if we have a slice with pointer `ptr` and length
`len`, we want to find the last usize-aligned offset in the slice.
The correct computation should be:

For example if ptr = 1 and len = 6, and `size_of::<usize>()` is 4:

```
[ x x x x x x ]
  1 2 3 4 5 6
        ^-- last aligned address at offset 3 from the start.
```

The last aligned address is ptr + len - (ptr + len) % usize_size.

Compute offset from the start as:

offset = len - (ptr + len) % usize_size = 6 - (1 + 6) % 4 = 6 - 3 = 3.

I believe the function's return value was always correct previously, if
the platform supported unaligned addresses.

Fixes #35967

7 years agoFix the reproducible-build test
Jonas Schievink [Thu, 25 Aug 2016 19:37:36 +0000 (21:37 +0200)]
Fix the reproducible-build test

7 years agofix tidy
Jonas Schievink [Thu, 25 Aug 2016 15:53:41 +0000 (17:53 +0200)]
fix tidy

7 years agoMake metadata encoding deterministic
Jonas Schievink [Tue, 23 Aug 2016 20:02:47 +0000 (22:02 +0200)]
Make metadata encoding deterministic

`ty::Predicate` was being used as a key for a hash map, but its hash
implementation indirectly hashed addresses, which vary between each
compiler run. This is fixed by sorting predicates by their ID before
encoding them.

In my tests, rustc is now able to produce deterministic results when
compiling libcore and libstd.

I've beefed up `run-make/reproducible-build` to compare the produced
artifacts bit-by-bit. This doesn't catch everything, but should be a
good start.

cc #34902

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 agorustc_trans: don't round up the DST prefix size to its alignment.
Eduard Burtescu [Sat, 27 Aug 2016 05:51:55 +0000 (08:51 +0300)]
rustc_trans: don't round up the DST prefix size to its alignment.

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 agoinitial support for s390x
Jorge Aparicio [Sat, 27 Aug 2016 02:05:16 +0000 (21:05 -0500)]
initial support for s390x

A new target, `s390x-unknown-linux-gnu`, has been added to the compiler
and can be used to build no_core/no_std Rust programs.

Known limitations:

- librustc_trans/cabi_s390x.rs is missing. This means no support for
  `extern "C" fn`.
- No support for this arch in libc. This means std can be cross compiled
  for this target.

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 agoAdd new error code tests
Guillaume Gomez [Thu, 25 Aug 2016 22:14:20 +0000 (00:14 +0200)]
Add new error code tests

7 years agoSmall error code explanations improvements
Guillaume Gomez [Thu, 25 Aug 2016 22:14:01 +0000 (00:14 +0200)]
Small error code explanations improvements

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 agoUpdate E0453 to new error format
Mohit Agarwal [Thu, 25 Aug 2016 13:39:48 +0000 (19:09 +0530)]
Update E0453 to new error format

Fixes #35929.
Part of #35233.

r? @jonathandturner

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 agoAdd E0525 error explanation
Guillaume Gomez [Thu, 25 Aug 2016 22:13:48 +0000 (00:13 +0200)]
Add E0525 error explanation

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 agoUpdate E0277 to new error format
Mohit Agarwal [Thu, 25 Aug 2016 12:56:04 +0000 (18:26 +0530)]
Update E0277 to new error format

Fixes #35311.
Part of #35233.

r? @jonathandturner

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 agoMake E0094 underline better
Johannes Löthberg [Wed, 24 Aug 2016 23:24:49 +0000 (01:24 +0200)]
Make E0094 underline better

Fixes #35966.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
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.