Commit Graph

58161 Commits

Author SHA1 Message Date
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
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
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
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
bors
0da37c585e Auto merge of #37212 - srinivasreddy:libcollectionstest, r=nrc
run rustfmt on libcollectionstest
2016-10-27 22:02:31 -07: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
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
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
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
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
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
Nick Cameron
d1b08b136c deprecate no_debug 2016-10-27 11:44:42 +13:00
Nick Cameron
121e903f17 Add possibility of deprecating attributes 2016-10-27 11:44:42 +13:00
bors
c59cb71d97 Auto merge of #37419 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 7 pull requests

- Successful merges: #36206, #37144, #37391, #37394, #37396, #37398, #37414
- Failed merges:
2016-10-26 14:58:16 -07:00
Guillaume Gomez
48b022838b Rollup merge of #37414 - thepowersgang:fix-typo, r=nrc
Fix typo in libsyntax, it was bothering me

May I present - the world's shortest diff.
2016-10-26 23:49:27 +02:00
Guillaume Gomez
dc3b3afda6 Rollup merge of #37398 - zoffixznet:patch-1, r=GuillaumeGomez
Fix typo
2016-10-26 23:49:27 +02:00
Guillaume Gomez
46c5c6ccfd Rollup merge of #37396 - mikhail-m1:e0221, r=jonathandturner
Make error E0221 more helpful

fix #35970 as part of #35233
r? @jonathandturner
2016-10-26 23:49:27 +02:00
Guillaume Gomez
cf6f885e75 Rollup merge of #37394 - cramertj:cramertj/unused-import-with-id, r=GuillaumeGomez
Add identifier to unused import warnings

Fix #37376.

For some reason, though, I'm getting warnings with messages like "76:9: 76:16: unused import: `self::g`" instead of "unused import: `self::g`". @pnkfelix Any ideas what might be causing this?
2016-10-26 23:49:27 +02:00
Guillaume Gomez
12eefac766 Rollup merge of #37391 - vtduncan:vec-docs, r=GuillaumeGomez
Broken links in Vec docs

Fixed some issues with quote/bracket nesting and made quoting more consistent.

r? @steveklabnik
2016-10-26 23:49:27 +02:00
Guillaume Gomez
6a1d4e911a Rollup merge of #37144 - eulerdisk:fix_37126, r=nrc
save_analysis: Dump data only if get_path_data doesn't fail to resolve a path.

Solves #37126

Dump data only if `get_path_data` doesn't fail to resolve a path.
`get_path_data` returns `None` when it have to deals with `Def::Err`, which is used as placeholder for a failed resolution.

Tell me if this is good enough, maybe I have to add some tests ?

r? @nrc
2016-10-26 23:49:26 +02:00
Ariel Ben-Yehuda
3f9ebb48cf add back test for issue #6804 2016-10-27 00:38:18 +03:00
Ariel Ben-Yehuda
41578507a6 flatten nested slice patterns in HAIR construction
nested slice patterns have the same functionality as non-nested
ones, so flatten them in HAIR construction.

Fixes #26158.
2016-10-26 23:52:03 +03:00
Ariel Ben-Yehuda
8d3e89b484 handle mixed byte literal and byte array patterns
Convert byte literal pattern to byte array patterns when they are both
used together. so matching them is properly handled. I could've done the
conversion eagerly, but that could have caused a bad worst-case for
massive byte-array matches.

Fixes #18027.
Fixes #25051.
Fixes #26510.
2016-10-26 23:10:30 +03:00
Ariel Ben-Yehuda
76fb7d90ec remove StaticInliner and NaN checking
NaN checking was a lint for a deprecated feature. It can go away.
2016-10-26 22:41:17 +03:00
Ariel Ben-Yehuda
37418b850f stop using MatchCheckCtxt to hold the param-env for check_match 2016-10-26 22:41:17 +03:00
Ariel Ben-Yehuda
e313d8b290 change match checking to use HAIR
no intended functional changes
2016-10-26 22:41:17 +03:00