Commit Graph

58416 Commits

Author SHA1 Message Date
Mark-Simulacrum
709a06bc92 Remove outdated fixme comment. 2016-10-28 19:35:30 -06:00
bors
e9b2fcb2fe Auto merge of #37373 - nnethercote:html5ever-more-more, r=nrc
Avoid more allocations when compiling html5ever

These three commits reduce the number of allocations performed when compiling html5ever from 13.2M to 10.8M, which speeds up compilation by about 2%.

r? @nrc
2016-10-28 17:02:01 -07:00
Nick Cameron
c751c08cf4 save-analysis: change imports to carry a ref id rather than their own node id 2016-10-29 08:43:14 +10:00
Nick Cameron
c2c37b401e Fix more spans in deriving::generic 2016-10-29 11:18:30 +13:00
bors
f0ab4a4f2a Auto merge of #37367 - jseyfried:import_crate_root, r=nrc
Support `use *;` and `use ::*;`.

Fixes #31484.
r? @nrc
2016-10-28 13:42:23 -07:00
bors
421b595f25 Auto merge of #37450 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 5 pull requests

- Successful merges: #36206, #37343, #37430, #37436, #37441
- Failed merges:
2016-10-28 10:20:55 -07:00
Cobrand
6768edde78 improve docs for Index and IndexMut 2016-10-28 17:18:48 +02:00
Felix S. Klock II
3f639a0f11 Do not intern filemap to entry w/ mismatched length. Fix #37274 (I think). 2016-10-28 17:16:34 +02:00
Felix S. Klock II
c40fad34e2 Debug instrumentation for construction of ImportedFileMap table entries. 2016-10-28 17:16:34 +02:00
Guillaume Gomez
61e765ad98 Rollup merge of #37441 - federicomenaquintero:master, r=steveklabnik
reference: Mention --crate-type=cdylib in the Linkage section

This option is missing in the docs! :)
2016-10-28 17:05:48 +02:00
Guillaume Gomez
1d7e1b3552 Rollup merge of #37436 - nrc:save-span-errs, r=petrochenkov
Give variant spans used in derives the correct expansion id

This fixes a problem in save-analysis where it mistakes a path to a variant as the variant itself.

r? @petrochenkov
2016-10-28 17:05:48 +02:00
Guillaume Gomez
f12e66e642 Rollup merge of #37430 - robinst:missing-crate-message-add-semicolon, r=eddyb
Add semicolon to "Maybe a missing `extern crate foo`" message

I had it a couple of times that I was missing the "extern crate" line
after I introduced a new dependency. So I copied the text from the
message and inserted it into the beginning of my code, only to find the
compiler complaining that I was missing the semicolon. (I forgot to add
it after the text that I had pasted.)

There's a similar message which does include the semicolon, namely
"help: you can import it into scope: `use foo::Bar;`". I think the two
messages should be consistent, so this change adds it for "extern
crate".
2016-10-28 17:05:47 +02:00
Guillaume Gomez
777502ef05 Rollup merge of #37343 - bluss:write-doc, r=GuillaumeGomez
Add documentation for Read, Write impls for slices and Vec

The Write imps for &[u8] and Vec<u8> are quite different, and we need this to
be reflected in the docs.

These documentation comments will be visible on the respective type's
page in the trait impls section.
2016-10-28 17:05:47 +02:00
Guillaume Gomez
f02577d491 Rollup merge of #36206 - mcarton:35755, r=pnkfelix
Fix bad error message with `::<` in types

Fix #36116.

Before:
```rust
error: expected identifier, found `<`
  --> src/test/compile-fail/issue-36116.rs:16:52
   |
16 |     let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>);
   |                                                    ^

error: chained comparison operators require parentheses
  --> src/test/compile-fail/issue-36116.rs:16:52
   |
16 |     let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>);
   |                                                    ^^^^^^
   |
   = help: use `::<...>` instead of `<...>` if you meant to specify type arguments

error: expected expression, found `)`
  --> src/test/compile-fail/issue-36116.rs:16:57
   |
16 |     let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>);
   |                                                         ^

error: expected identifier, found `<`
  --> src/test/compile-fail/issue-36116.rs:20:17
   |
20 |     let g: Foo::<i32> = Foo { _a: 42 };
   |                 ^

error: aborting due to 5 previous errors
```

After:
```rust
error: unexpected token: `::`
  --> src/test/compile-fail/issue-36116.rs:16:50
   |
16 |     let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>);
   |                                                  ^^
   |
   = help: use `<...>` instead of `::<...>` if you meant to specify type arguments

error: unexpected token: `::`
  --> src/test/compile-fail/issue-36116.rs:20:15
   |
20 |     let g: Foo::<i32> = Foo { _a: 42 };
   |               ^^
   |
   = help: use `<...>` instead of `::<...>` if you meant to specify type arguments

error: aborting due to 2 previous errors
```
2016-10-28 17:05:47 +02:00
bors
36d7467180 Auto merge of #37196 - tamird:fix-tidy-features, r=brson
tidy/features: fix checking of lang features

r? @brson

See the commit messages - the actual "fixes" here are strawmen; I'm happy to adjust them if you have suggestions.
2016-10-28 07:01:17 -07:00
Eduard Burtescu
e34792b181 rustc: move the MIR map into TyCtxt. 2016-10-28 13:55:49 +03:00
mcarton
f7cc6dc1ed
Fix bad error message with ::< in types 2016-10-28 12:52:41 +02:00
bors
9d3caecdd7 Auto merge of #37321 - nrc:lib-proc-macro, r=@alexcrichton
Split up libproc_macro_plugin

Separate the plugin code from non-plugin code to break a potential cycle in crates.

This will allow us to merge the new libproc_macro_tokens into libproc_macro.

r? @alexcrichton
2016-10-28 03:11:56 -07:00
Eduard Burtescu
36340ba994 rustc: move mir::repr::* to mir. 2016-10-28 10:37:24 +03:00
bors
0da37c585e Auto merge of #37212 - srinivasreddy:libcollectionstest, r=nrc
run rustfmt on libcollectionstest
2016-10-27 22:02:31 -07:00
Nicholas Nethercote
a920e355ea Shrink Expr_::ExprInlineAsm.
On 64-bit this reduces the size of `Expr_` from 144 to 64 bytes, and
reduces the size of `Expr` from 176 to 96 bytes.
2016-10-28 15:18:55 +11:00
Tamir Duberstein
bef1911b15
tidy/features: fix checking of lang features
Removes the `STATUSES` static which duplicates truth from the pattern
match in `collect_lang_features`.

Fixes existing duplicates by renaming:
- never_type{,_impls} on `impl`s on `!`
- concat_idents{,_macro} on `macro_rules! concat_idents`

Fixes #37013.
2016-10-27 21:35:57 -04:00
Tamir Duberstein
7367db6fcc
tidy/bins: fix false positive on non checked-in binary
`git ls-files` now exits zero when called with a missing file; check
that the file is included in the output before reporting a checked-in
binary. Observed with git 2.10.1 and tripped by a symlink created by
tests:

src/test/run-make/issue-26006/out/time/deps/liblibc.rlib -> out/libc/liblibc.rlib
2016-10-27 21:35:57 -04:00
Federico Mena Quintero
9f8d4ee74d reference: Mention --crate-type=cdylib in the Linkage section 2016-10-27 20:23:23 -05:00
bors
5530030420 Auto merge of #37035 - petrochenkov:selfstruct, r=eddyb
Support `Self` in struct expressions and patterns

Struct expressions and patterns generally support type aliases `Alias { field: 10 }` i.e. they already have to work with `ty::Ty` to do their job. `Self` is a type alias (when it's not a type parameter) => struct expressions and patterns should support `Self`.

Typical example:
```
impl MyStruct {
    fn new() -> Self {
        Self { a: 10, b: "Hello" }
    }
}
```

The first commit does some preparations and cleanups, see the commit message for  details.
This also fixes couple of bugs related to aliases in struct paths (fixes https://github.com/rust-lang/rust/issues/36286).

EDIT:
Since struct expressions and patterns always work with `ty::Ty` now, associated paths in them are also supported. If associated type `A::B` successfully resolves to a struct (or union) type, then `A::B { /* fields */ }` is a valid expression/pattern. This will become more important when enum variants are treated as [associated items](https://github.com/rust-lang/rust/issues/26264#issuecomment-250603946).

r? @eddyb
2016-10-27 18:18:56 -07:00
Nick Cameron
15821caee9 Split up libproc_macro_plugin
Separate the plugin code from non-plugin code to break a potential cycle in crates.

This will allow us to merge the new libproc_macro_tokens into libproc_macro.
2016-10-28 12:17:17 +13:00
Nick Cameron
16e1d36c08 Give variant spans used in derives the correct expansion id
This fixes a problem in save-analysis where it mistakes a path to a variant as the variant itself.
2016-10-28 10:49:45 +13:00
Marcin Fatyga
4e2822c5c2 Rename ordering chaining functions. 2016-10-27 23:31:10 +02:00
bors
3f4408347d Auto merge of #37350 - srinivasreddy:meta_2, r=nrc
run rustfmt on librustc_metadata folder
2016-10-27 12:51:49 -07:00
Vadim Petrochenkov
8a38928b44 Address comments + Fix rebase 2016-10-27 22:20:25 +03:00
Vadim Petrochenkov
eada951f9c Support Self in struct expressions and patterns 2016-10-27 22:14:42 +03:00
Vadim Petrochenkov
a9f91b1b0e Preparations and cleanup
Diagnostics for struct path resolution errors in resolve and typeck are unified.
Self type is treated as a type alias in few places (not reachable yet).
Unsafe cell is seen in constants even through type aliases.
All checks for struct paths in typeck work on type level.
2016-10-27 22:14:41 +03:00
Alex Crichton
de80670f74 Disable jemalloc on aarch64/powerpc
Sounds like jemalloc is broken on systems which differ in page size than the
host it was compiled on (unless an option was passed). This unfortunately
reduces the portability of binaries created and can often make Rust segfault by
default. For now let's patch over this by disabling jemalloc until we can figure
out a better solution.

Closes #36994
Closes #37320
cc jemalloc/jemalloc#467
2016-10-27 08:08:33 -07:00
bors
07436946b6 Auto merge of #37245 - goffrie:recovery, r=nrc
Recover out of an enum or struct's braced block.

If we encounter a syntax error inside of a braced block, then we should
fail by consuming the rest of the block if possible.
This implements such recovery for enums and structs.

Fixes #37113.
2016-10-27 07:19:16 -07:00
Ulrik Sverdrup
9568f44842 Add documentation for Read, Write impls for slices and Vec
The Write impls for &[u8] and Vec<u8> are quite different, and we need this to
be reflected in the docs.

These documentation comments will be visible on the respective type's
page in the trait impls section.
2016-10-27 15:25:14 +02:00
bors
a0e31a5bfc Auto merge of #36894 - petrochenkov:deny, r=nikomatsakis
Make sufficiently old or low-impact compatibility lints deny-by-default

Tracking issues are updated/created when necessary.
Needs crater run before proceeding.

r? @nikomatsakis
2016-10-27 04:06:31 -07:00
Vadim Petrochenkov
2a85211040 Make sufficiently old or low-impact compatibility lints deny-by-default 2016-10-27 12:06:03 +03:00
bors
46d39f3329 Auto merge of #37128 - nrc:depr-attr, r=@alexcrichton
Deprecate no_debug and custom_derive

r? @nikomatsakis
2016-10-27 00:51:58 -07:00
Zack M. Davis
ef6a07221d deduplicate one-time diagnostics on lint ID as well as span and message
Some lint-level attributes (like `bad-style`, or, more dramatically,
`warnings`) can affect more than one lint; it seems fairer to point out
the attribute once for each distinct lint affected. Also, a UI test is
added. This remains in the matter of #24690.
2016-10-26 23:24:59 -07:00
Zack M. Davis
8d1da8452c one-time diagnostics are only one-time for humans, not JSON-eating tools
Jonathan D. Turner pointed out that we don't want to dedup in JSON
mode. Since the compile-test runner uses JSON output, we regrettably
need to revert the edits to existing tests; one imagines that testing
for one-time diagnosticity for humans will have to be added as a UI
test.

This remains in the matter of #24690.
2016-10-26 22:42:20 -07:00
bors
bc283c9487 Auto merge of #11994 - eddyb:struct-literal-field-shorthand, r=nrc
Implement field shorthands in struct literal expressions.

Implements #37340 in a straight-forward way: `Foo { x, y: f() }` parses as `Foo { x: x, y: f() }`.
Because of the added `is_shorthand` to `ast::Field`, this is `[syntax-breaking]` (cc @Manishearth).

* [x] Mark the fields as being a shorthand (the exact same way we do it in patterns), for pretty-printing.
* [x] Gate the shorthand syntax with `#![feature(field_init_shorthand)]`.
* [x] Don't parse numeric field as identifiers.
* [x] Arbitrary field order tests.
2016-10-26 21:47:25 -07:00
Robin Stocker
de5172ce5f Add semicolon to "Maybe a missing extern crate foo" message
I had it a couple of times that I was missing the "extern crate" line
after I introduced a new dependency. So I copied the text from the
message and inserted it into the beginning of my code, only to find the
compiler complaining that I was missing the semicolon. (I forgot to add
it after the text that I had pasted.)

There's a similar message which does include the semicolon, namely
"help: you can import it into scope: `use foo::Bar;`". I think the two
messages should be consistent, so this change adds it for "extern
crate".
2016-10-27 15:24:08 +11:00
Zack M. Davis
95805ee627 save a borrow by using return value of HashSet::insert
Thanks to Niko Matsakis's review for the suggestion.
2016-10-26 20:52:54 -07:00
Geoffry Song
c9036ccffe Recover out of an enum or struct's braced block.
If we encounter a syntax error inside of a braced block, then we should
fail by consuming the rest of the block if possible.
This implements such recovery for enums and structs.

Fixes #37113.
2016-10-26 22:27:14 -04:00
Nick Cameron
8c4a39cd95 review changes 2016-10-27 14:44:05 +13:00
bors
4a584637b0 Auto merge of #36695 - arielb1:literal-match, r=eddyb
Refactor match checking to use HAIR

Refactor match checking to use HAIR instead of HIR, fixing quite a few bugs in the process.

r? @eddyb
2016-10-26 18:18:57 -07:00
Eduard Burtescu
9908711e5e Implement field shorthands in struct literal expressions. 2016-10-27 03:15:13 +03:00
Ulrik Sverdrup
5dc9db541e vec: Remove the Vec specialization for .extend()
This now produces as good code (with optimizations) using the TrustedLen
codepath.
2016-10-27 01:45:31 +02:00
Nick Cameron
9322332140 deprecation message for custom derive 2016-10-27 11:44:42 +13:00
Nick Cameron
b7675cf04a Deprecate custom_derive
Has a custom deprecation since deprecating features is not supported and is a pain to implement
2016-10-27 11:44:42 +13:00