Commit Graph

56273 Commits

Author SHA1 Message Date
bors
78a0838756 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
2016-08-28 00:36:16 -07:00
bors
aa05a15363 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.
2016-08-27 21:20:28 -07:00
bors
e17d6db80a Auto merge of #36049 - jonathandturner:rollup, r=jonathandturner
Rollup of 6 pull requests

- Successful merges: #35657, #35980, #35985, #35989, #36003, #36044
- Failed merges:
2016-08-27 15:23:17 -07:00
Jonathan Turner
d00a89a9ff 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
2016-08-27 12:43:31 -07:00
Jonathan Turner
3bab26e6f3 Rollup merge of #36003 - GuillaumeGomez:err_codes, r=jonathandturner
Err codes

r? @jonathandturner
2016-08-27 12:43:31 -07:00
Jonathan Turner
1dbd49fc2a Rollup merge of #35989 - 0xmohit:pr/error-code-E0453, r=jonathandturner
Update E0453 to new error format

Fixes #35929.
Part of #35233.

r? @jonathandturner
2016-08-27 12:43:31 -07:00
Jonathan Turner
c8791f1a59 Rollup merge of #35985 - 0xmohit:pr/error-code-E0277, r=jonathandturner
Update E0277 to new error format

Fixes #35311.
Part of #35233.

r? @jonathandturner
2016-08-27 12:43:30 -07:00
Jonathan Turner
965f50dad5 Rollup merge of #35980 - kyrias:E0094-underline, r=jonathandturner
Make E0094 underline better

r? @jonathandturner
2016-08-27 12:43:30 -07:00
Jonathan Turner
dc6ae4b669 Rollup merge of #35657 - ahmedcharles:e0389, r=jonathandturner
Update E0389 to the new format. #35630
2016-08-27 12:43:30 -07:00
bors
a23064af5e Auto merge of #35674 - ahmedcharles:rpass, r=alexcrichton
Fix compiletest so it respects warnings for run-pass.
2016-08-27 12:31:25 -07:00
Mikhail Modin
9c07ed2128 update error E0450 to new format 2016-08-27 19:39:22 +03:00
bors
11946956a6 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
2016-08-27 07:52:20 -07:00
bors
099b9fdb1a Auto merge of #36030 - Manishearth:rollup, r=Manishearth
Rollup of 7 pull requests

- Successful merges: #35124, #35877, #35953, #36002, #36004, #36005, #36014
- Failed merges:
2016-08-27 03:07:48 -07:00
Manish Goregaokar
668d63132e
Fixup rustbuild on #35124 2016-08-27 15:40:25 +05:30
bors
6b74503aa4 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.
2016-08-26 23:57:17 -07:00
Eduard Burtescu
3e313d9528 rustc_trans: don't round up the DST prefix size to its alignment. 2016-08-27 08:51:55 +03:00
Manish Goregaokar
2b3921e0c3 Rollup merge of #36014 - slash3g:stabilize-type-macros, r=nikomatsakis
Stabilize type-macros

Closes #27245

r? @nikomatsakis
2016-08-27 09:31:15 +05:30
Manish Goregaokar
30835ec4e4 Rollup merge of #36005 - apasel422:traitobj, r=alexcrichton
Replace unnecessary uses of `TraitObject` with casts

r? @alexcrichton
2016-08-27 09:31:15 +05:30
Manish Goregaokar
933d481bdd 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:
71bdeea561/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
2016-08-27 09:31:15 +05:30
Manish Goregaokar
7a2a381e0e 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
2016-08-27 09:31:14 +05:30
Manish Goregaokar
1385feb5ee 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
2016-08-27 09:31:14 +05:30
Manish Goregaokar
b5969ca318 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.
2016-08-27 09:31:14 +05:30
Manish Goregaokar
e8da947263 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
2016-08-27 09:31:14 +05:30
Jorge Aparicio
027eab2f87 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.
2016-08-26 21:05:50 -05:00
bors
b7e2157dba 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.
2016-08-26 19:05:11 -07:00
bors
1987131063 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
2016-08-26 15:18:03 -07:00
Eduard Burtescu
7a8d4822d8 rustc: use Vec<Kind> in Substs, where Kind is a &TyS | &Region tagged pointer. 2016-08-27 01:15:07 +03:00
Eduard Burtescu
dffd238f8b rustc: pass ty::Region behind an interned 'tcx reference. 2016-08-27 01:15:06 +03:00
Eduard Burtescu
5222fa58a1 rustc: use accessors for Substs::{types,regions}. 2016-08-27 00:25:04 +03:00
Scott A Carr
c043a27e42 fix port for visit_statement 2016-08-26 15:39:16 -04:00
Guillaume Gomez
3e1b33dbdd Add new error code tests 2016-08-26 17:28:50 +02:00
Guillaume Gomez
a9907a1dd1 Small error code explanations improvements 2016-08-26 17:28:47 +02:00
Daniele Baracchi
ee055a1ff3
Stabilize type-macros
Closes #27245
2016-08-26 17:27:20 +02:00
Andrew Paseltiner
2b10df7f24
Replace unnecessary uses of TraitObject with casts 2016-08-26 06:37:36 -04:00
bors
d00c245415 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
2016-08-26 03:29:45 -07:00
Eduard Burtescu
8407952346 Do not emit "class method" debuginfo for types that are not DICompositeType. 2016-08-26 07:39:17 +03:00
bors
eaf71f8d10 Auto merge of #35906 - jseyfried:local_prelude, r=eddyb
Use `#[prelude_import]` in `libcore` and `libstd`

r? @eddyb
2016-08-25 20:45:32 -07:00
Mohit Agarwal
88e4def9c7
Update E0453 to new error format
Fixes #35929.
Part of #35233.

r? @jonathandturner
2016-08-26 07:59:20 +05:30
bors
e07dd59eae 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
2016-08-25 15:44:22 -07:00
Vadim Petrochenkov
14b4d72e01 rustc_borrowck: Don't hash types in loan paths 2016-08-26 01:15:45 +03:00
Guillaume Gomez
aeedf22880 Add E0525 error explanation 2016-08-26 00:13:48 +02:00
Jonathan Turner
a65b201d94 prevent error message interleaving on win/unix 2016-08-25 13:28:35 -07:00
Steve Klabnik
57719e2d73 Also remove build steps for style 2016-08-25 15:22:57 -04:00
Steve Klabnik
00d4a43d84 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.
2016-08-25 15:22:12 -04:00
bors
71bdeea561 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`.
2016-08-25 11:28:30 -07:00
Alex Burka
b2cd3e59b8 use file!() even though it shouldn't be necessary 2016-08-25 12:39:25 -04:00
bors
528c6f3ed6 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.
2016-08-25 08:32:19 -07:00
Mohit Agarwal
874a20d01d
Update E0277 to new error format
Fixes #35311.
Part of #35233.

r? @jonathandturner
2016-08-25 18:26:04 +05:30
bors
17a2be8c35 Auto merge of #35979 - Manishearth:rollup, r=Manishearth
Rollup of 6 pull requests

- Successful merges: #35238, #35867, #35885, #35916, #35947, #35955
- Failed merges:
2016-08-25 04:35:52 -07:00
Manish Goregaokar
cf597ab2ba Rollup merge of #35955 - frewsxcv:idiomatic-methods, r=eddyb
Use idiomatic names for string-related methods names.

None
2016-08-25 17:08:01 +05:30