Commit Graph

58448 Commits

Author SHA1 Message Date
bors
f5a702dc78 Auto merge of #37445 - nnethercote:shrink-Expr_, r=eddyb
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.

For the workload in #36799 this reduces the RSS for the "lowering ast -> hir" phase and all subsequent phases by 50 MiB, which reduces the peak RSS for that workload by about 1%. Not huge, but it's a very easy improvement.

r? @eddyb
2016-10-30 10:12:20 -07:00
msiglreith
9802c4c5f4 Fix typo in the BitAndAssign operator documentation 2016-10-30 17:50:28 +01:00
Matthew Piziak
dd6e8c5f18 move overflow tests from rust-fail to run-pass 2016-10-30 12:04:57 -04:00
Konrad Borowski
9cc98612d7 Don't mention "*" dependency version in guessing game example
It's a bad practice as far [RFC 1241] is concerned, and introducing it
in early tutorial may as well make it feel legitimate.

[RFC 1241]: https://github.com/rust-lang/rfcs/blob/master/text/1241-no-wildcard-deps.md
2016-10-30 15:24:13 +01:00
Mark-Simulacrum
bdb399db01 Fix ICE when attempting to get closure generics. 2016-10-30 08:12:20 -06:00
bors
6062e7ed3d Auto merge of #37431 - jseyfried:refactor_crate_config, r=eddyb
Move `CrateConfig` from `Crate` to `ParseSess`

This is a syntax-[breaking-change]. Most breakage can be fixed by removing a `CrateConfig` argument.
r? @eddyb
2016-10-30 06:51:30 -07:00
Pieter Frenssen
956d44fb17 Update "Testing" chapter for 1.12
I followed the "Testing" chapter using Rust 1.12.1 but there are some differences. By default the `tests` module is now also generated by `cargo new`, and the console output is updated.
2016-10-30 15:42:31 +02:00
Srinivas Reddy Thatiparthy
f32ce9c142
run rustfmt on librustc_driver folder 2016-10-30 18:26:51 +05:30
bors
aef5ca5590 Auto merge of #37392 - alexcrichton:more-disable-jemalloc, r=brson
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-30 03:31:00 -07:00
Matwey V. Kornilov
9b81f3c81b Add armv6l autodetection
Use arm-unknown-linux-gnueabihf for hardware floating point armv6 variant
2016-10-30 11:27:58 +03:00
Matwey V. Kornilov
10ce90fca2 Fix armv7 autodetection
armv7l is armv7 architecture and CFG_CPUTYPE should be armv7 in order to end up
with armv7-unknown-linux-gnueabihf.mk rather than
arm-unknown-linux-gnueabihf.mk
2016-10-30 11:26:25 +03:00
bors
12382665a9 Auto merge of #37401 - eddyb:lazy-2, r=nikomatsakis
[2/n] rustc_metadata: move is_extern_item to trans.

*This is part of a series ([prev](https://github.com/rust-lang/rust/pull/37400) | [next](https://github.com/rust-lang/rust/pull/37402)) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well.
If any motivation is unclear, please ask for additional PR description clarifications or code comments.*
<hr>

Minor cleanup missed by #36551: `is_extern_item` is one of, if not the only `CrateStore` method who takes a `TyCtxt` but doesn't produce something cached in it, and such methods are going away.
2016-10-30 00:01:21 -07:00
bors
ef6f743407 Auto merge of #37400 - eddyb:lazy-1, r=nikomatsakis
[1/n] Move the MIR map into the type context.

*This is part of a series ([prev]() | [next](https://github.com/rust-lang/rust/pull/37401)) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well.
If any motivation is unclear, please ask for additional PR description clarifications or code comments.*
<hr>

The first commit reorganizes the `rustc::mir` module to contain the MIR types directly without an extraneous `repr` module which serves no practical purpose but is rather an eyesore.

The second commit performs the actual move of the MIR map into the type context, for the purposes of future integration with requesting analysis/lowering by-products through `TyCtxt`.

Local `Mir` bodies need to be mutated by passes (hence `RefCell`), and at least one pass (`qualify_consts`) needs simultaneous access to multiple `Mir` bodies (hence arena-allocation).
`Mir` bodies loaded from other crates appear as if immutably borrowed (by `.borrow()`-ing one `Ref` and subsequently "leaking" it) to avoid, at least dynamically, *any* possibility of their local mutation.

One caveat is that lint passes can now snoop at the MIR (helpful) or even mutate it (dangerous).
However, lints are unstable anyway and we can find a way to deal with this in due time.
Future work will result in a tighter API, potentially hiding mutation *completely* outside of MIR passes.
2016-10-29 20:46:20 -07:00
bors
248e7b302a Auto merge of #37399 - retep998:heap-of-trouble, r=alexcrichton
Print out the error when HeapFree failures do occur

cc https://github.com/rust-lang/rust/issues/37395

I'd prefer to use `assert!` instead of `debug_assert!` if the cost is acceptable.

r? @alexcrichton
2016-10-29 17:28:07 -07:00
Josh Triplett
07bff08e4f Copyediting on documentation for write! and writeln!
Fix various sentence fragments, missing articles, and other grammatical
issues in the documentation for write! and writeln!.

Also fix the links (and link names) for common return types.
2016-10-29 15:44:43 -07:00
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
Vadzim Dambrouski
c0e82ad177 LLVM: Update submodule to rust-llvm-2016-10-29 branch. 2016-10-29 18:56:20 +03: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
Jeffrey Seyfried
cbd24757eb Move CrateConfig from Crate to ParseSess. 2016-10-29 07:52:58 +00: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
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