Commit Graph

58099 Commits

Author SHA1 Message Date
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
Ariel Ben-Yehuda
04a92a1f56 un-break the construct_witness logic
Fixes #35609.
2016-10-26 22:41:17 +03:00
Ariel Ben-Yehuda
abae5e7e25 split the exhaustiveness-checking logic to its own module
`check_match` is now left with its grab bag of random checks.
2016-10-26 22:41:17 +03:00
Ariel Ben-Yehuda
48387c8bd9 refactor the pat_is_catchall logic 2016-10-26 22:41:17 +03:00
Ariel Ben-Yehuda
732f22745d move hair::cx::pattern to const_eval 2016-10-26 22:41:17 +03:00
Ariel Ben-Yehuda
bb5afb4121 use a struct abstraction in check_match 2016-10-26 22:41:16 +03:00
Ariel Ben-Yehuda
b69cca6da4 remove SliceWithSubslice, only used from old trans 2016-10-26 22:41:16 +03:00
Ariel Ben-Yehuda
e5c01f4633 comment some ugly points in check_match 2016-10-26 22:41:16 +03:00
bors
a6b3b01b5f Auto merge of #37270 - Mark-Simulacrum:smallvec-optimized-arenas, r=eddyb
Add ArrayVec and AccumulateVec to reduce heap allocations during interning of slices

Updates `mk_tup`, `mk_type_list`, and `mk_substs` to allow interning directly from iterators. The previous PR, #37220, changed some of the calls to pass a borrowed slice from `Vec` instead of directly passing the iterator, and these changes further optimize that to avoid the allocation entirely.

This change yields 50% less malloc calls in [some cases](https://pastebin.mozilla.org/8921686). It also yields decent, though not amazing, performance improvements:
```
futures-rs-test  4.091s vs  4.021s --> 1.017x faster (variance: 1.004x, 1.004x)
helloworld       0.219s vs  0.220s --> 0.993x faster (variance: 1.010x, 1.018x)
html5ever-2016-  3.805s vs  3.736s --> 1.018x faster (variance: 1.003x, 1.009x)
hyper.0.5.0      4.609s vs  4.571s --> 1.008x faster (variance: 1.015x, 1.017x)
inflate-0.1.0    3.864s vs  3.883s --> 0.995x faster (variance: 1.232x, 1.005x)
issue-32062-equ  0.309s vs  0.299s --> 1.033x faster (variance: 1.014x, 1.003x)
issue-32278-big  1.614s vs  1.594s --> 1.013x faster (variance: 1.007x, 1.004x)
jld-day15-parse  1.390s vs  1.326s --> 1.049x faster (variance: 1.006x, 1.009x)
piston-image-0. 10.930s vs 10.675s --> 1.024x faster (variance: 1.006x, 1.010x)
reddit-stress    2.302s vs  2.261s --> 1.019x faster (variance: 1.010x, 1.026x)
regex.0.1.30     2.250s vs  2.240s --> 1.005x faster (variance: 1.087x, 1.011x)
rust-encoding-0  1.895s vs  1.887s --> 1.005x faster (variance: 1.005x, 1.018x)
syntex-0.42.2   29.045s vs 28.663s --> 1.013x faster (variance: 1.004x, 1.006x)
syntex-0.42.2-i 13.925s vs 13.868s --> 1.004x faster (variance: 1.022x, 1.007x)
```

We implement a small-size optimized vector, intended to be used primarily for collection of presumed to be short iterators. This vector cannot be "upsized/reallocated" into a heap-allocated vector, since that would require (slow) branching logic, but during the initial collection from an iterator heap-allocation is possible.

We make the new `AccumulateVec` and `ArrayVec` generic over implementors of the `Array` trait, of which there is currently one, `[T; 8]`. In the future, this is likely to expand to other values of N.

Huge thanks to @nnethercote for collecting the performance and other statistics mentioned above.
2016-10-26 03:47:55 -07:00
bors
586a988313 Auto merge of #36421 - TimNN:check-abis, r=alexcrichton
check target abi support

This PR checks for each extern function / block whether the ABI / calling convention used is supported by the current target.

This was achieved by adding an `abi_blacklist` field to the target specifications, listing the calling conventions unsupported for that target.
2016-10-25 21:49:59 -07:00
Mark-Simulacrum
989eba79a3 Add size hint to Result's FromIterator implementation. 2016-10-25 20:06:17 -06:00
Mark-Simulacrum
982a48575b Utilize AccumulateVec to avoid heap allocations in mk_{substs, type_list, tup} calls. 2016-10-25 20:06:17 -06:00
Mark-Simulacrum
a4f7ba376e Add AccumulateVec, a potentially stack-allocated vector.
AccumulateVec is generic over the Array trait, which is currently only
implemented for [T; 8].
2016-10-25 20:06:17 -06:00
bors
a7557e758d Auto merge of #37361 - jseyfried:fix_crate_var_regressions, r=nrc
Fix `$crate`-related regressions

Fixes #37345, fixes #37357, fixes #37352, and improves the `unused_extern_crates` lint.
r? @nrc
2016-10-25 17:54:13 -07:00
Jeffrey Seyfried
0d30325286 Avoid false positive unused_extern_crates. 2016-10-25 20:38:58 +00:00
Jeffrey Seyfried
04ca378b89 Support use $crate; with a future compatibility warning. 2016-10-25 20:26:00 +00:00
Jeffrey Seyfried
199ed20aa6 Fix $crate-related regressions. 2016-10-25 20:25:59 +00:00
bors
aef18be1bc Auto merge of #37111 - TimNN:sized-enums, r=nikomatsakis
Disallow Unsized Enums

Fixes #16812.

This PR is a potential fix for #16812, an issue which is reported [again](https://github.com/rust-lang/rust/issues/36801) and [again](https://github.com/rust-lang/rust/issues/36975), with over a dozen duplicates by now.

This PR is mainly meant to promoted discussion about the issue and the correct way to fix it.

This is a [breaking-change] since the error is now reported during wfchecking, so that even the definition of a (potentially) unsized enum will cause an error (whereas it would previously cause an ICE at trans time if the enum was used in an unsized manner).
2016-10-25 12:37:43 -07:00
Tim Neumann
1422ac9a8f adapt tests 2016-10-25 19:56:36 +02:00
bors
67f26f7e0c Auto merge of #37360 - jseyfried:fix_label_scope, r=nrc
resolve: fix label scopes

Fixes #37353 (turns an ICE back into an error).
r? @nrc
2016-10-25 06:20:02 -07:00
bors
affc3b7552 Auto merge of #37292 - jseyfried:import_macros_in_resolve, r=nrc
Process `#[macro_use]` imports in `resolve` and clean up macro loading

Groundwork macro modularization (cc #35896).
r? @nrc
2016-10-24 23:15:59 -07:00
bors
7a208648da Auto merge of #37382 - jonathandturner:rollup, r=jonathandturner
Rollup of 7 pull requests

- Successful merges: #37228, #37304, #37324, #37328, #37336, #37349, #37372
- Failed merges:
2016-10-24 16:47:38 -07:00
Jonathan Turner
e948cf17bc Rollup merge of #37372 - vtduncan:pathbuf-docs-link, r=steveklabnik
Link to PathBuf from the Path docs

I got stuck trying to use `Path` when `PathBuf` was what I needed. Hopefully this makes `PathBuf` and the module docs a bit easier to find for others.

r? @steveklabnik
2016-10-24 15:41:29 -07:00
Jonathan Turner
59b7ea4c59 Rollup merge of #37349 - srinivasreddy:meta_1, r=nikomatsakis
rustfmt on metadata folder
2016-10-24 15:41:29 -07:00
Jonathan Turner
691ab948ce Rollup merge of #37336 - michaelwoerister:debuginfo-type-ids, r=eddyb
debuginfo: Use TypeIdHasher for generating global debuginfo type IDs.

The only requirement for debuginfo type IDs is that they are globally unique. The `TypeIdHasher` (which is used for `std::intrinsic::type_id()` provides that, so we can get rid of some redundancy by re-using it for debuginfo. Values produced by the `TypeIdHasher` are also more stable than the current `UniqueTypeId` generation algorithm produces -- these incorporate the `NodeId`s, which is not good for incremental compilation.

@alexcrichton @eddyb : Could you take a look at the endianess adaptations that I made to the `TypeIdHasher`?

Also, are we sure that a 64 bit hash is wide enough for something that is supposed to be globally unique? For debuginfo I'm using 160 bits to make sure that we don't run into conflicts there.
2016-10-24 15:41:29 -07:00
Jonathan Turner
e7da61975f Rollup merge of #37328 - michaelwoerister:stable-local-symbol-names, r=nagisa
trans: Make names of internal symbols independent of CGU translation order

Every codegen unit gets its own local counter for generating new symbol names. This makes bitcode and object files reproducible at the binary level even when incremental compilation is used.

The PR also solves a rare ICE resulting from a naming conflict between a user defined name and a generated one. E.g. try compiling the following program with 1.12.1 stable:
```rust

pub fn str7233() -> &'static str { "foo" }
```
This results in:
> error: internal compiler error: ../src/librustc_trans/common.rs:979: symbol `str7233` is already defined

Running into this is not very likely but it's also easily avoidable.
2016-10-24 15:41:29 -07:00
Jonathan Turner
050499c407 Rollup merge of #37324 - GuillaumeGomez:trait_error_message, r=jonathandturner
Improve E0277 help message

Fixes #37319.

r? @jonathandturner
2016-10-24 15:41:29 -07:00
Jonathan Turner
855f3e740c Rollup merge of #37304 - GuillaumeGomez:collections_url, r=frewsxcv
Add missing urls in collections module

r? @steveklabnik
2016-10-24 15:41:28 -07:00
Jonathan Turner
91c7a8270b Rollup merge of #37228 - loggerhead:patch-1, r=steveklabnik
Fix a error of 'book/deref-coercions.html'

The original sentence is:

> This example has two conversions: `Rc<String>` to `String` and then `String` to `&str`.

But it should be

> This example has two conversions: `Rc<String>` to `String` and then `String` to `str`.

or

> This example has two conversions: `&Rc<String>` to `&String` and then `&String` to `&str`.

I think the latter is more clearly.

r? @steveklabnik
2016-10-24 15:41:28 -07:00
Tim Neumann
db032578a4 add new test case 2016-10-24 23:11:27 +02:00
bors
3caf63cc00 Auto merge of #37313 - raphlinus:fuchsia, r=alexcrichton
Add Fuchsia support

Adds support for the x86_64-unknown-fuchsia target, which covers the
Fuchsia operating system.
2016-10-24 13:31:29 -07:00
Tim Neumann
d22f706150 adapt existing tests 2016-10-24 20:55:56 +02:00
Tim Neumann
f1695238ca disallow unsized enums 2016-10-24 20:07:14 +02:00
bors
7bd2427307 Auto merge of #37365 - alexcrichton:fix-nightlies, r=brson
Try to fix the nightlies

Touching up a few pieces after  the fix for #37280 landed.
2016-10-24 08:46:28 -07:00
Michael Woerister
992203b976 Adapt rmake-test to new naming scheme for internal symbols. 2016-10-24 11:07:45 -04:00
Michael Woerister
025b27d6c8 debuginfo: Erase regions when creating debuginfo for statics. 2016-10-24 10:29:16 -04:00
Tim Neumann
9eb0fd98c6 check target abi support 2016-10-24 15:59:53 +02:00
Duncan
27dbfffc71 Link to PathBuf from the Path docs 2016-10-24 16:34:37 +13:00
bors
ac468b67bf Auto merge of #37322 - nnethercote:CombineFields-instantiate, r=eddyb
Use `SmallVector` in `CombineFields::instantiate`.

This avoids 4% of malloc calls when compiling
rustc-benchmarks/issue-32278-big-array-of-strings, and 1--2% for other
benchmarks. A small win, but an easy one.
2016-10-23 20:10:16 -07:00
Nicholas Nethercote
9270a9217a Use SmallVector in CombineFields::instantiate.
This avoids 4% of malloc calls when compiling
rustc-benchmarks/issue-32278-big-array-of-strings, and 1--2% for other
benchmarks. A small win, but an easy one.
2016-10-24 14:08:06 +11:00
Jeffrey Seyfried
5e8951d331 Clean up CrateLoader::process_item. 2016-10-24 00:51:11 +00:00
Jeffrey Seyfried
9c514a1cc1 Refactor away CrateLoader::load_macros. 2016-10-24 00:45:12 +00:00
Jeffrey Seyfried
4968600740 Refactor away metadata::creader::Macros. 2016-10-24 00:45:04 +00:00
Jeffrey Seyfried
53de24bbd1 Refactor away fields MacroDef::{use_locally, export}. 2016-10-24 00:43:19 +00:00
Jeffrey Seyfried
e4baeaa30d Import macros in resolve instead of in metadata::macro_import. 2016-10-24 00:43:12 +00:00