Commit Graph

58053 Commits

Author SHA1 Message Date
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
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
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
Alex Crichton f96a4cca81 configure: Disable debuginfo lines on MinGW
Looks like these are causing assertions on the bots, let's disable them for now
(#37364).
2016-10-23 10:25:01 -07:00
Alex Crichton 174838f7f9 mk: Filter debuginfo=1 from test flags
Fixes tests with `--enable-debuginfo-lines`.
2016-10-23 10:20:48 -07:00
bors 1e5dab1da0 Auto merge of #37358 - typelist:select-fix, r=eddyb
Fix typo that resulted in comparison-to-self

This line was introduced in commit 843db01bd9, rebased from eddyb's c5f6f84d59b853b6a3485380721b71b479ece337.

I don't know whether this fixes anything in practice, but it seems like the changed version was what was intended originally.

r? @eddyb
2016-10-23 08:23:22 -07:00
bors 1bc7f8f49f Auto merge of #37347 - srinivasreddy:llvm, r=eddyb
run rustfmt on librustc_llvm folder
2016-10-23 05:17:01 -07:00
bors 87af2324bb Auto merge of #37325 - newpavlov:master, r=frewsxcv
libcore documentation for builtin macros

Fixes: #36272

Additionally I've edited docstring for `include!` a bit. (related PR #36404)

Unfortunately it seems there is no sane way to reexport empty macros definitions for their docstrings. To avoid copying the whole documentation for builtin macros I've only copied description and added links to `std` macro pages.
2016-10-23 02:10:28 -07:00
bors 40f79ba8c9 Auto merge of #37327 - aidanhs:aphs-bytes-iter-doc, r=alexcrichton
`as_bytes` is not the iterator on String, `bytes` is

r? @steveklabnik
2016-10-22 23:02:24 -07:00
bors febfe7683b Auto merge of #37326 - SimonSapin:from-cow, r=alexcrichton
Implement `From<Cow<str>> for String` and `From<Cow<[T]>> for Vec<T>`.

Motivation: the `selectors` crate is generic over a string type, in order to support all of `String`,  `string_cache::Atom`, and `gecko_string_cache::Atom`. Multiple trait bounds are used for the various operations done with these strings. One of these operations is creating a string (as efficiently as possible, re-using an existing memory allocation if possible) from `Cow<str>`.

The `std::convert::From` trait seems natural for this, but the relevant implementation was missing before this PR. To work around this I’ve added a `FromCowStr` trait in `selectors`, but with trait coherence that means one of `selectors` or `string_cache` needs to depend on the other to implement this trait. Using a trait from `std` would solve this.

The `Vec<T>` implementation is just added for consistency. I also tried a more general `impl<'a, O, B: ?Sized + ToOwned<Owned=O>> From<Cow<'a, B>> for O`, but (the compiler thinks?) it conflicts with `From<T> for T` the impl (after moving all of `collections::borrow` into `core::borrow` to work around trait coherence).
2016-10-22 19:47:05 -07:00
bors 4845adde36 Auto merge of #37301 - jseyfried:improve_metadata_modules, r=eddyb
metadata: improve some confusing type and module names

r? @eddyb
2016-10-22 16:26:54 -07:00
Johannes Muenzel f9cb7dfc0c Fix typo that resulted in comparison-to-self 2016-10-22 13:51:31 -07:00
bors a117bba125 Auto merge of #37318 - nnethercote:html5ever-more, r=nrc,eddyb
Avoid some allocations in the macro parser

These three commits reduce the number of heap allocations done when compiling rustc-benchmarks/html5ever-2016-08-25 by 20%, from 16.5M to 13.3M. This speeds up (debug) compilation of it with a stage1 compiler by about 7%.
2016-10-22 13:09:24 -07:00
Jeffrey Seyfried f3993d1a7f Rename `loader.rs` -> `locator.rs`. 2016-10-22 20:01:50 +00:00
Jeffrey Seyfried 92413c9cf4 Move `Library` into `creader.rs`. 2016-10-22 20:01:49 +00:00
Jeffrey Seyfried 0e99b83f52 Rename `csearch.rs` -> `cstore_impl.rs`. 2016-10-22 20:01:42 +00:00
Jeffrey Seyfried 2b43fac2b9 Remove `CrateReader`, use `CrateLoader` instead. 2016-10-22 20:01:38 +00:00
bors 0eb4d46d03 Auto merge of #37310 - vadimcn:drop-spans, r=michaelwoerister
Fix line stepping in debugger.

Attribute drop code to block's closing brace, instead of the line where the allocation was done.
Attribute function epilogues to function body's closing brace, rather than the function header.

Fixes #37032

r? @michaelwoerister
2016-10-22 10:02:19 -07:00
bors b5f6d7ec2d Auto merge of #37298 - nnethercote:faster-deflate, r=alexcrichton
Use a faster `deflate` setting

In #37086 we have considered various ideas for reducing the cost of LLVM bytecode compression. This PR implements the simplest of these: use a faster `deflate` setting. It's very simple and reduces the compression time by almost half while increasing the size of the resulting rlibs by only about 2%.

I looked at using zstd, which might be able to halve the compression time again. But integrating zstd is beyond my Rust FFI integration abilities at the moment -- it consists of a few dozen C files, has a non-trivial build system, etc. I decided it was worth getting a big chunk of the possible improvement with minimum effort.

The following table shows the before and after percentages of instructions executed during compression while doing debug builds of some of the rustc-benchmarks with a stage1 compiler.
```
html5ever-2016-08-25      1.4% -> 0.7%
hyper.0.5.0               3.8% -> 2.4%
inflate-0.1.0             1.0% -> 0.5%
piston-image-0.10.3       2.9% -> 1.8%
regex.0.1.30              3.4% -> 2.1%
rust-encoding-0.3.0       4.8% -> 2.9%
syntex-0.42.2             2.9% -> 1.8%
syntex-0.42.2-incr-clean 14.2% -> 8.9%
```
The omitted ones spend 0% of their time in decompression.

And here are actual timings:
```
futures-rs-test  4.110s vs  4.102s --> 1.002x faster (variance: 1.017x, 1.004x)
helloworld       0.223s vs  0.226s --> 0.986x faster (variance: 1.012x, 1.022x)
html5ever-2016-  4.218s vs  4.186s --> 1.008x faster (variance: 1.008x, 1.010x)
hyper.0.5.0      4.746s vs  4.661s --> 1.018x faster (variance: 1.002x, 1.016x)
inflate-0.1.0    4.194s vs  4.143s --> 1.012x faster (variance: 1.007x, 1.006x)
issue-32062-equ  0.317s vs  0.316s --> 1.001x faster (variance: 1.013x, 1.005x)
issue-32278-big  1.811s vs  1.825s --> 0.992x faster (variance: 1.014x, 1.006x)
jld-day15-parse  1.412s vs  1.412s --> 1.001x faster (variance: 1.019x, 1.008x)
piston-image-0. 11.058s vs 10.977s --> 1.007x faster (variance: 1.008x, 1.039x)
reddit-stress    2.331s vs  2.342s --> 0.995x faster (variance: 1.019x, 1.006x)
regex.0.1.30     2.294s vs  2.276s --> 1.008x faster (variance: 1.007x, 1.007x)
rust-encoding-0  1.963s vs  1.924s --> 1.020x faster (variance: 1.009x, 1.006x)
syntex-0.42.2   29.667s vs 29.391s --> 1.009x faster (variance: 1.002x, 1.023x)
syntex-0.42.2-i 15.257s vs 14.148s --> 1.078x faster (variance: 1.018x, 1.008x)
```

r? @alexcrichton
2016-10-22 06:37:30 -07:00
Srinivas Reddy Thatiparthy 9972d17ecf
run rustfmt on librustc_llvm folder 2016-10-22 18:37:35 +05:30
bors 4879166194 Auto merge of #37294 - nikomatsakis:issue-37154, r=nikomatsakis
remove keys w/ skolemized regions from proj cache when popping skolemized regions

This addresses #37154 (a regression). The projection cache was incorrectly caching the results for skolemized regions -- when we pop skolemized regions, we are supposed to drop cache keys for them (just as we remove those skolemized regions from the region inference graph). This is because those skolemized region numbers will be reused later with different meaning (and we have determined that the old ones don't leak out in any meaningful way).

I did a *somewhat* aggressive fix here of only removing keys that mention the skolemized regions. One could imagine just removing all keys added since we started the skolemization (as indeed I did in my initial commit). This more aggressive fix required fixing a latent bug in `TypeFlags`, as an aside.

I believe the more aggressive fix is correct; clearly there can be entries that are unrelated to the skoelemized region, and it's a shame to remove them. My one concern was that it *is* possible I believe to have some region variables that are created and related to skolemized regions, and maybe some of them could end up in the cache. However, that seems harmless enough to me-- those relations will be removed, and couldn't have impacted how trait resolution proceeded anyway (iow, the cache entry is not wrong, though it is kind of useless).

r? @pnkfelix
cc @arielb1
2016-10-22 03:30:23 -07:00
bors 4642e08b4d Auto merge of #37281 - TimNN:pad-align, r=eddyb
trans: pad const structs to aligned size

Fixes #37222.

I'm not sure if that is the *correct* way to fix this, but it *does* work.
2016-10-22 00:04:31 -07:00
bors f136e9e299 Auto merge of #37337 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 10 pull requests

- Successful merges: #37043, #37209, #37211, #37219, #37244, #37253, #37286, #37297, #37309, #37314
- Failed merges:
2016-10-21 20:29:25 -07:00
Michael Woerister 7ef418b37e Make ArchIndependentHasher publicly visible. 2016-10-21 19:28:01 -04:00
Guillaume Gomez 1c2d2235c9 Rollup merge of #37314 - tshepang:simple, r=GuillaumeGomez
doc: a more simple description of Iterator::nth
2016-10-22 01:22:00 +02:00
Guillaume Gomez c3802f6789 Rollup merge of #37309 - vkatsikaros:vkatsikaros/37307, r=GuillaumeGomez
TRPL: guessing game: minor clarification

The original text is correct and exact, but might confuse a non-English speaker (at least I was confused), so I made it a bit more plain (see https://github.com/rust-lang/rust/issues/37307).

I know minor wording changes like these are affected by personal style, so I'd understand if you don't find this useful.

r? @steveklabnik
2016-10-22 01:22:00 +02:00
Guillaume Gomez 8aa14c3f49 Rollup merge of #37297 - thepowersgang:fix-bad-crate-attrs, r=eddyb
test - Add missing ! to crate_type/crate_id attributes

Fix some useless attributes in a test dependency.
2016-10-22 01:21:59 +02:00
Guillaume Gomez 59faa20156 Rollup merge of #37286 - srinivasreddy:graph, r=nrc
run rustfmt on graph folder
2016-10-22 01:21:59 +02:00
Guillaume Gomez 38337c2159 Rollup merge of #37253 - srinivasreddy:liballoc, r=nrc
Apply rustfmt on liballoc folder
2016-10-22 01:21:59 +02:00
Guillaume Gomez 0dee00f545 Rollup merge of #37244 - senior:add-error-desc-182-230-399, r=GuillaumeGomez
Add error explaination for E0182, E0230 and E0399

This PR adds some error descriptions requested in issue https://github.com/rust-lang/rust/issues/32777.

r? @GuillaumeGomez

Specifically this adds descriptions for

E0182 - unexpected binding of associated item in expression path
E0230 - missing type parameter from on_unimplemented description
E0399 - overriding a trait type without re-implementing default methods
2016-10-22 01:21:59 +02:00
Guillaume Gomez 8133a55e05 Rollup merge of #37219 - srinivasreddy:prelude, r=nrc
Run rustfmt on libcore/prelude folder
2016-10-22 01:21:59 +02:00
Guillaume Gomez 686ff0c169 Rollup merge of #37211 - srinivasreddy:alt, r=nrc
run rustfmt on various folders
2016-10-22 01:21:58 +02:00
Guillaume Gomez 88d1cbdbab Rollup merge of #37209 - srinivasreddy:bootstrap_bin, r=nrc
run rustfmt on bootstrap/bin folder
2016-10-22 01:21:58 +02:00
Guillaume Gomez 18f9758c4f Rollup merge of #37043 - GuillaumeGomez:vec_urls, r=frewsxcv
Add missing urls on Vec docs

r? @steveklabnik
2016-10-22 01:21:58 +02:00
bors a6fa57291b Auto merge of #37174 - mikhail-m1:dnlle, r=jonathandturner
improve "Doesn't live long enough" error

I've fixed only with same case

issue #36537 part of  #35233
r? @jonathandturner
2016-10-21 15:57:35 -07:00
Michael Woerister e46c1ad9c9 Adapt codegen test to new naming scheme for generated symbols. 2016-10-21 18:29:25 -04:00
Michael Woerister c52836c888 debuginfo: Use TypeIdHasher to create global type identifiers for debuginfo. 2016-10-21 17:56:36 -04:00
Michael Woerister 6f3edb034c type_id: Make result of std::intrinsics::type_id() endian-independent. 2016-10-21 17:53:49 -04:00
Michael Woerister e6aa92c432 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.
2016-10-21 14:58:53 -04:00
Aidan Hobson Sayers dceb2c9cd2 `as_bytes` is not the iterator, `bytes` is 2016-10-21 18:28:02 +01:00
Simon Sapin 7e603d4e3b Implement `From<Cow<str>> for String` and `From<Cow<[T]>> for Vec<T>`.
Motivation: the `selectors` crate is generic over a string type,
in order to support all of `String`, `string_cache::Atom`, and
`gecko_string_cache::Atom`. Multiple trait bounds are used
for the various operations done with these strings.
One of these operations is creating a string (as efficiently as possible,
re-using an existing memory allocation if possible) from `Cow<str>`.

The `std::convert::From` trait seems natural for this, but
the relevant implementation was missing before this PR.
To work around this I’ve added a `FromCowStr` trait in `selectors`,
but with trait coherence that means one of `selectors` or `string_cache`
needs to depend on the other to implement this trait.
Using a trait from `std` would solve this.

The `Vec<T>` implementation is just added for consistency.
I also tried a more general
`impl<'a, O, B: ?Sized + ToOwned<Owned=O>> From<Cow<'a, B>> for O`,
but (the compiler thinks?) it conflicts with `From<T> for T` the impl
(after moving all of `collections::borrow` into `core::borrow`
to work around trait coherence).
2016-10-21 17:42:29 +02:00
Niko Matsakis 483bc864ca add regression test for #37154
Fixes #37154
2016-10-21 11:13:36 -04:00
Niko Matsakis 567b11fc3a only remove keys that mention skolemized regions 2016-10-21 11:13:36 -04:00