Commit Graph

82344 Commits

Author SHA1 Message Date
kennytm
7896ac3e08
Rollup merge of #53363 - llogiq:num-individual-nonzero-docs, r=steveklabnik
add individual docs to `core::num::NonZero*`
2018-08-21 17:51:54 +08:00
kennytm
445718084f
Rollup merge of #53521 - alexcrichton:optimize-lit-token, r=michaelwoerister
syntax: Optimize some literal parsing

Currently in the `wasm-bindgen` project we have a very very large crate that's
procedurally generated, `web-sys`. To generate this crate we parse all of a
browser's WebIDL and we then generate bindings for all of the APIs contained
within.

The resulting Rust file is 18MB large (wow!) and currently takes a very long
time to compile in debug mode. On the nightly compiler a *debug* build takes 90s
for the crate to finish. I was curious what was taking so long and upon
investigating a *massive* portion of the time was spent in the `lit_token`
method of the compiler, primarily formatting strings via `format!`.

Upon some more investigation it looks like the `byte_str_lit` was allocating an
error message once per byte, causing a very large number of allocations to
happen for large literals, of which wasm-bindgen generates quite a few (some are
MB large).

This commit fixes the issue by lazily allocating the error message, only doing
so if the error message is actually needed (which should be never). As a result,
the debug mode compilation time for our `web-sys` crate decreased from 90s to
20s, a very nice improvement! (although we've still got some work to do).
2018-08-21 17:51:52 +08:00
kennytm
b5519db323
Rollup merge of #53496 - matthiaskrgr:codespell_08_2018, r=varkor
Fix typos found by codespell.
2018-08-21 17:51:49 +08:00
kennytm
0834a1aea7
Rollup merge of #53492 - danc86:lld-riscv, r=alexcrichton
update lld submodule to include RISCV patch

This pulls in one new commit, to add support for linking static RISCV
binaries, suitable for the new riscv32imac-unknown-none-elf target.
See: https://github.com/rust-lang/lld/pull/1
2018-08-21 17:51:48 +08:00
kennytm
5d4a25da05
Rollup merge of #53465 - bjorn3:remove_link_meta_struct, r=varkor
Remove LinkMeta struct

Fixes #53291
2018-08-21 17:51:46 +08:00
kennytm
c980ba75fc
Rollup merge of #53452 - tromey:lldb-manifest-fix, r=alexcrichton
Change target triple used to check for lldb in build-manifest

The wrong target triple was used for lldb in build-manifest.  lldb is
only built for macOS, so update the triple to reflect that.

This is an attempt to fix bug#48168.
2018-08-21 17:51:44 +08:00
kennytm
2a0d72075e
Rollup merge of #53405 - oconnor663:search_esc, r=GuillaumeGomez
restore the page title after escaping out of a search

Currently if I start a search in the docs, but then hit ESC, the "Results for..." title is still there in my browser tab. This is a simple attempt to fix that. I see that there's a separate `var previousTitle = document.title` thing happening in `startSearch()`, but as far as I can tell that's only related to the back stack? I'd also appreciate feedback on the right place to declare the `titleBeforeSearch` variable.

Testing-wise, I've confirmed by hand that the tab title restores correctly after building with `./x.py doc --stage 1 src/libstd`, but nothing more involved than that. What else should I test?
2018-08-21 17:51:42 +08:00
kennytm
b21e956f27
Rollup merge of #53393 - BurntPizza:serialize-inlines, r=alexcrichton
Mark libserialize functions as inline

Got to thinking: "what if that big pile of tiny functions isn't inlining as it should?"
So a few `replace-regex` later the local perf run says this:
<details>

![](https://i.imgur.com/gvdJEgG.png)
</details>
Not huge, but still a win, which is interesting. Want to verify with the real perf run, but I understand there's a backlog.

I didn't notice any increase in compile time or binary sizes for rustc/libs.
2018-08-21 17:51:40 +08:00
kennytm
f9e3af7439
Rollup merge of #53370 - jkozlowski:stabilize-macro_vis_matcher, r=cramertj
Stabilize macro_vis_matcher

This PR should stabilize [macro_vis_matcher](https://github.com/rust-lang/rust/issues/41022) feature.

- [ ] "reference" book changes: https://github.com/rust-lang-nursery/reference/pull/400
- [ ] "Rust by example" book changes: https://github.com/rust-lang/rust-by-example/pull/1096
- [ ] "clippy" changes: https://github.com/rust-lang-nursery/rust-clippy/pull/3055

r? @cramertj
2018-08-21 17:51:38 +08:00
Alex Crichton
5bf2ad3018 syntax: Optimize some literal parsing
Currently in the `wasm-bindgen` project we have a very very large crate that's
procedurally generated, `web-sys`. To generate this crate we parse all of a
browser's WebIDL and we then generate bindings for all of the APIs contained
within.

The resulting Rust file is 18MB large (wow!) and currently takes a very long
time to compile in debug mode. On the nightly compiler a *debug* build takes 90s
for the crate to finish. I was curious what was taking so long and upon
investigating a *massive* portion of the time was spent in the `lit_token`
method of the compiler, primarily formatting strings via `format!`.

Upon some more investigation it looks like the `byte_str_lit` was allocating an
error message once per byte, causing a very large number of allocations to
happen for large literals, of which wasm-bindgen generates quite a few (some are
MB large).

This commit fixes the issue by lazily allocating the error message, only doing
so if the error message is actually needed (which should be never). As a result,
the debug mode compilation time for our `web-sys` crate decreased from 90s to
20s, a very nice improvement! (although we've still got some work to do).
2018-08-20 11:28:37 -07:00
kennytm
ffde96c201
Rollup merge of #53296 - estebank:suggest-closure, r=KodrAus
When closure with no arguments was expected, suggest wrapping

Fix #49694.
2018-08-21 01:20:12 +08:00
kennytm
fa3d56aca8
Rollup merge of #53213 - tmccombs:stable-ipconstructors, r=KodrAus
Stabilize IP associated constants

Fixes #44582
2018-08-21 01:20:10 +08:00
kennytm
b51723a872
Rollup merge of #53030 - Aaronepower:master, r=Mark-Simulacrum
Updated RELEASES.md for 1.29.0

[Rendered](https://github.com/Aaronepower/rust/blob/master/RELEASES.md)

r? @Mark-Simulacrum
cc @rust-lang/release
2018-08-21 01:20:08 +08:00
bors
bf1e461173 Auto merge of #47562 - Centril:feature/core_convert_id, r=oli-obk
Add the identity function as core::convert::identity

## New notes

This implements rust-lang/rfcs#2306 (see https://github.com/rust-lang/rust/issues/53500).

## Old notes (ignore this in new reviews)

Adds the identity function `fn id<T>(x: T) -> T { x }` to core::convert and the prelude.
Some motivations for why this is useful are explained in the doc tests.
Another is that using the identity function instead of `{ x }` or `|x| x` makes it clear that you intended to use an identity conversion on purpose.

The reasoning:
+ behind adding this to `convert` and not `mem` is that this is an identity *conversion*.
+ for adding this to the prelude is that it should be easy enough to use that the ease of writing your own identity function or using a closure `|x| x` doesn't overtake that.

I've separated this out into two feature gates so that the addition to the prelude can be considered and stabilized separately.

cc @bluss
2018-08-20 09:09:55 +00:00
Mazdak Farrokhzad
86641d97b2
core::convert::identity: fix issue number to #53500 2018-08-20 09:16:56 +02:00
bors
758239c9c9 Auto merge of #53519 - Manishearth:clippyup, r=eddyb
Update clippy

r? @oli-obk @eddyb
2018-08-20 06:34:09 +00:00
Manish Goregaokar
7e5a2b21de Update clippy 2018-08-19 19:17:24 -07:00
bors
d2048b6db3 Auto merge of #52101 - japaric:linker-flavor, r=alexcrichton
try to infer linker flavor from linker name and vice versa

This is a second take on PR #50359 that implements the logic proposed in https://github.com/rust-lang/rust/pull/50359#pullrequestreview-116663121

With this change it would become possible to link `thumb*` binaries using GNU's LD on stable as `-C linker=arm-none-eabi-ld` would be enough to change both the linker and the linker flavor from their default values of `arm-none-eabi-gcc` and `gcc`.

To link `thumb*` binaries using rustc's LLD on stable `-Z linker-flavor` would need to be stabilized as `-C linker=rust-lld -Z linker-flavor=ld.lld` are both required to change the linker and the linker flavor, but this PR doesn't propose that. We would probably need some sort of stability guarantee around `rust-lld`'s name and availability to make linking with rustc's LLD truly stable.

With this change it would also be possible to link `thumb*` binaries using a system installed LLD on stable using the `-C linker=ld.lld` flag (provided that `ld.lld` is a symlink to the system installed LLD).

r? @alexcrichton
2018-08-20 01:12:58 +00:00
bors
6bf6d50a6f Auto merge of #52953 - dsciarra:mv-codemap-sourcemap, r=petrochenkov
Rename CodeMap/FileMap to SourceMap/SourceFile

A first renaming for #51574
2018-08-19 23:08:26 +00:00
Jorge Aparicio
a6f4ae864e fix: preserve msvc linker fallback logic 2018-08-19 23:59:20 +02:00
bors
f28f648a96 Auto merge of #53316 - tristanburgess:52895_existential_type_ICE, r=oli-obk
52985: cause cycle err on inf trait normalization

Issue: #52985
 - If an existential type is defined, but no user code infers the
concrete type behind the existential type, normalization would
infinitely recurse on this existential type which is only defined in
terms of itself.
  - Instead of raising an inf recurse error, we cause a cycle error to
help highlight that the issue is that the type is only defined in terms
of itself.
  - Three known potential improvements:
    - If type folding itself was exposed as a query, used by
normalization and other mechanisms, cases that would cause infinite recursion would
automatically cause a cycle error.
    - The span for the cycle error should be improved to point to user
code that fails to allow inference of the concrete type of the existential type,
assuming that this error occurs because no user code can allow inference the
concrete type.
    - A mechanism to extend the cycle error with a helpful note would be nice. Currently,
the error is built and maintained by src/librustc/ty/query/plumbing,
with no known way to extend the information that the error gets built
with.

r? @oli-obk
2018-08-19 21:03:12 +00:00
Donato Sciarra
6138c82803 fix tidy errors 2018-08-19 23:01:01 +02:00
Donato Sciarra
a2ff845f3a mv CachingCodemapView CachingSourceMapView 2018-08-19 23:01:01 +02:00
Donato Sciarra
062bfbf39b mv codemap source_map 2018-08-19 23:01:01 +02:00
Donato Sciarra
d3fe97f3d3 mv codemap() source_map() 2018-08-19 23:01:01 +02:00
Donato Sciarra
82607d2cf3 mv (mod) codemap source_map 2018-08-19 23:01:00 +02:00
Donato Sciarra
cbd0595710 mv filemap source_file 2018-08-19 23:00:59 +02:00
Donato Sciarra
d6dcbcd4e1 mv FileMap SourceFile 2018-08-19 23:00:59 +02:00
Donato Sciarra
c655473378 mv CodeMap SourceMap 2018-08-19 23:00:59 +02:00
Mazdak Farrokhzad
b7772e6c9e convert-id: tests for const gating. 2018-08-19 21:06:43 +02:00
bors
3ac79c7184 Auto merge of #53258 - nikomatsakis:issue-53189-optimize-reassignment-immutable-state, r=pnkfelix
optimize reassignment immutable state

This is the "simple fix" when it comes to checking for reassignment. We just shoot for compatibility with the AST-based checker. Makes no attempt to solve #21232.

I opted for this simpler fix because I didn't want to think about complications [like the ones described here](https://github.com/rust-lang/rust/issues/21232#issuecomment-412219247).

Let's do some profiling measurements.

Fixes #53189

r? @pnkfelix
2018-08-19 17:44:43 +00:00
Mazdak Farrokhzad
f84ec02bf7 remove feature(convert_id) from lib{core,std}/lib.rs 2018-08-19 19:25:35 +02:00
Mazdak Farrokhzad
71187b7e18
Make core::convert::identity a const fn. 2018-08-19 18:49:31 +02:00
Mazdak Farrokhzad
c2217b7fb7
Get rid of unnecessary #![feature(core_float)]. 2018-08-19 18:37:00 +02:00
Mazdak Farrokhzad
8208c77782
Drop identity from prelude. 2018-08-19 18:36:18 +02:00
Mazdak Farrokhzad
08b1d83a46
Merge branch 'master' into feature/core_convert_id 2018-08-19 18:34:46 +02:00
Jakub Kozlowski
00920c0024 Stabilize macro_vis_matcher 2018-08-19 17:08:00 +01:00
Matthias Krüger
71120ef1e5 Fix typos found by codespell. 2018-08-19 17:41:28 +02:00
bors
bfc3b20663 Auto merge of #53248 - nikomatsakis:nll-trivial-sized-predicate, r=eddyb
skip trivial `Sized` predicates

This came to about a 2% win for me in cargo. Small, but hey.

r? @eddyb
2018-08-19 15:22:18 +00:00
Niko Matsakis
58e4b54bd4 move tests to borrowck directory, remove feature(nll)
now compare-mode can show us the differences
2018-08-19 08:15:13 -07:00
Niko Matsakis
4e50c5b6e4 add tests for assigning fields without initializing var
We did not seem to have any!
2018-08-19 07:35:07 -07:00
Niko Matsakis
78e987ab8f just check whether a variable is initialized
Don't iterate over all things that are initialized.
2018-08-19 07:34:44 -07:00
Niko Matsakis
a8a982bb61 treat local variables specially 2018-08-19 07:34:43 -07:00
bors
b355906919 Auto merge of #51131 - qnighy:unsized-locals, r=eddyb
Implement Unsized Rvalues

This PR is the first step to implement RFC1909: unsized rvalues (#48055).

## Implemented

- `Sized` is removed for arguments and local bindings. (under `#![feature(unsized_locals)]`)
- Unsized locations are allowed in MIR
- Unsized places and operands are correctly translated at codegen

## Not implemented in this PR

- Additional `Sized` checks:
  - tuple struct constructor (accidentally compiles now)
  - closure arguments at closure generation (accidentally compiles now)
  - upvars (ICEs now)
- Generating vtable for `fn method(self)` (ICEs now)
- VLAs: `[e; n]` where `n` isn't const
- Reduce unnecessary allocations

## Current status

- [x] Fix `__rust_probestack` (rust-lang-nursery/compiler-builtins#244)
  - [x] Get the fix merged
- [x] `#![feature(unsized_locals)]`
  - [x] Give it a tracking issue number
- [x] Lift sized checks in typeck and MIR-borrowck
  - [ ] <del>Forbid `A(unsized-expr)`</del> will be another PR
- [x] Minimum working codegen
- [x] Add more examples and fill in unimplemented codegen paths
- [ ] <del>Loosen object-safety rules (will be another PR)</del>
- [ ] <del>Implement `Box<FnOnce>` (will be another PR)</del>
- [ ] <del>Reduce temporaries (will be another PR)</del>
2018-08-19 12:21:56 +00:00
Dan Callaghan
99bba340f7 update lld submodule to include RISCV patch
This pulls in one new commit, to add support for linking static RISCV
binaries, suitable for the new riscv32imac-unknown-none-elf target.
See: https://github.com/rust-lang/lld/pull/1
2018-08-19 21:26:05 +10:00
Jorge Aparicio
98e4cd50f9 fix: use detected MSVC's link.exe 2018-08-19 12:35:58 +02:00
bors
8928de7439 Auto merge of #52972 - RalfJung:from_raw_parts_align, r=alexcrichton
debug_assert to ensure that from_raw_parts is only used properly aligned

This does not help nearly as much as I would hope because everybody uses the distributed libstd which is compiled without debug assertions. For this reason, I am not sure if this is even worth it. OTOH, this would have caught the misalignment fixed by https://github.com/rust-lang/rust/issues/42789 *if* there had been any tests actually using ZSTs with alignment >1 (we have a CI runner which has debug assertions in libstd enabled), and it seems to currently [fail in the rg testsuite](https://ci.appveyor.com/project/rust-lang/rust/build/1.0.8403/job/v7dfdcgn8ay5j6sb). So maybe it is worth it, after all.

I have seen the attribute `#[rustc_inherit_overflow_checks]` in some places, does that make it so that the *caller's* debug status is relevant? Is there a similar attribute for `debug_assert!`? That could even subsume `rustc_inherit_overflow_checks`: Something like `rustc_inherit_debug_flag` could affect *all* places that change the generated code depending on whether we are in debug or release mode. In fact, given that we have to keep around the MIR for generic functions anyway, is there ever a reason *not* to handle the debug flag that way? I guess currently we apply debug flags like `cfg` so this is dropped early during the MIR pipeline?

EDIT: I learned from @eddyb that because of how `debug_assert!` works, this is not realistic. Well, we could still have it for the rustc CI runs and then maybe, eventually, when libstd gets compiled client-side and there is both a debug and a release build... then this will also benefit users.^^
2018-08-19 09:40:36 +00:00
Jorge Aparicio
c8ef8b6602 LinkerFlavor::Gcc defaults to cc, not gcc 2018-08-19 09:39:19 +02:00
Masaki Hara
c488d59add Integrate OperandValue::UnsizedRef into OperandValue::Ref. 2018-08-19 08:07:33 +09:00
Masaki Hara
6e15e7c126 Integrate PassMode::UnsizedIndirect into PassMode::Indirect. 2018-08-19 08:07:33 +09:00