Commit Graph

56291 Commits

Author SHA1 Message Date
Jeffrey Seyfried
c14ff2884d Rollup merge of #35917 - jseyfried:remove_attr_ext_traits, r=nrc
syntax: Remove traits `AttrMetaMethods`, `AttributeMethods`, and `AttrNestedMetaItemMethods`
2016-08-28 10:40:04 +00:00
Jeffrey Seyfried
6303640e85 Rollup merge of #35850 - SergioBenitez:master, r=nrc
Implement RFC#1559: allow all literals in attributes

Implemented rust-lang/rfcs#1559, tracked by #34981.
2016-08-28 10:38:19 +00:00
Jeffrey Seyfried
413ecdee30 Rollup merge of #35728 - petrochenkov:empderive, r=manishearth
Fix #[derive] for empty tuple structs/variants

This was missing from https://github.com/rust-lang/rust/pull/35138
2016-08-28 10:34:50 +00:00
Jeffrey Seyfried
bd38e890ee Rollup merge of #35480 - KiChjang:e0379-bonus, r=nikomatsakis
Move E0379 check from typeck to ast validation

Part of #35233.
Extension of #35338, #35364.
Fixes #35404.
2016-08-28 10:32:52 +00:00
Jeffrey Seyfried
37f30173a0 Rollup merge of #35618 - jseyfried:ast_view_path_refactor, r=eddyb
Refactor `PathListItem`s

This refactors away variant `Mod` of `ast::PathListItemKind` and refactors the remaining variant `Ident` to a struct `ast::PathListItem_`.
2016-08-28 10:31:24 +00:00
Jeffrey Seyfried
b833e8d0a0 Rollup merge of #35591 - GuillaumeGomez:generics_span, r=jntrmr
Add Span field for Generics structs
2016-08-28 10:30:08 +00:00
Keith Yeung
e46b09a1f9 Add UI test for E0379 2016-08-27 22:43:51 -07:00
Keith Yeung
aa5c4bb05d Change Constness to Spanned<Constness> 2016-08-27 22:43:51 -07:00
Keith Yeung
1e9e798cce Move E0379 check from typeck to ast validation 2016-08-27 22:43:51 -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
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
Jeffrey Seyfried
469753f0ab Fix fallout in tests. 2016-08-25 20:41:41 +00:00
Jeffrey Seyfried
bfb01bbb26 Refactor away AttrMetaMethods. 2016-08-25 20:41:40 +00:00