Commit Graph

58174 Commits

Author SHA1 Message Date
bors
2b262cf111 Auto merge of #37389 - cramertj:cramertj/fn-item-to-unsafe-ptr, r=eddyb
rustc_typeck: Allow reification from fn item to unsafe ptr

See https://github.com/rust-lang/rfcs/issues/1762.

I've never contributed to the compiler internals before-- apologies if I'm not going about this the right way.
2016-10-29 12:08:38 -07:00
bors
69d364bc4f Auto merge of #37449 - pnkfelix:fix-issue-37274, r=eddyb
Do not intern filemap to entry w/ mismatched length.

Do not intern filemap to entry w/ mismatched length.

Fix #37274 (I think).

Beta-nominated; note that only the second commit needs to be cherry picked to beta branch. (The first just adds some debug instrumentation that I wish had been present.)
2016-10-29 08:54:30 -07:00
bors
75a87c54d0 Auto merge of #37378 - petrochenkov:nopat, r=eddyb
Prohibit patterns in trait methods without bodies

They are not properly type checked
```rust
trait Tr {
    fn f(&a: u8); // <- This compiles
}
```
, mostly rejected by the parser already and generally don't make much sense.
This PR is kind of a missing part of https://github.com/rust-lang/rust/pull/35015.

Given the [statistics from crater](https://github.com/rust-lang/rust/pull/37378#issuecomment-256154994), the effect of this PR is mostly equivalent to improving `unused_mut` lint.

cc https://github.com/rust-lang/rust/issues/35078#issuecomment-255707355 https://github.com/rust-lang/rust/pull/35015 https://github.com/rust-lang/rfcs/pull/1685 https://github.com/rust-lang/rust/issues/35203
r? @eddyb
2016-10-29 05:41:05 -07:00
Vadim Petrochenkov
4ca11ce196 Update cargo sha for cargotest 2016-10-29 13:19:44 +03:00
bors
5db21c3af6 Auto merge of #37387 - raphlinus:fuchsia_aarch64, r=alexcrichton
Support for aarch64 architecture on Fuchsia

This patch adds support for the aarch64-unknown-fuchsia target. Also
updates src/liblibc submodule to include required libc change.
2016-10-29 00:28:39 -07:00
bors
17e9d9ae82 Auto merge of #37385 - raphlinus:fuchsia_random, r=alexcrichton
Add support for kernel randomness for Fuchsia

Wire up cprng syscall as provider for rand::os::OsRng on Fuchsia.
2016-10-28 21:31:26 -07: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
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
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
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