Commit Graph

510 Commits

Author SHA1 Message Date
Mazdak Farrokhzad de6046fa0f remove rustc_error_codes deps except in rustc_driver 2020-01-18 21:53:53 +01:00
Dylan DPC 6b83862d09
Rollup merge of #67780 - cjgillot:passes-ty, r=Zoxc
Move some queries from rustc::ty to librustc_ty.

cc #65031
2020-01-16 11:58:00 +05:30
Dylan DPC 6270e49ce7
Rollup merge of #68232 - Mark-Simulacrum:unicode-tables, r=joshtriplett
Optimize size/speed of Unicode datasets

The overall implementation has the same general idea as the prior approach,
which was based on a compressed trie structure, but modified to use less space
(and, coincidentally, be an overall performance improvement).

Sizes | Old | New | New/current
-- | -- | -- | --
Alphabetic | 4616 | 2982 | 64.60%
Case_Ignorable | 3144 | 2112 | 67.18%
Cased | 2376 | 934 | 39.31%
Cc | 19 | 43 | 226.32%
Grapheme_Extend | 3072 | 1734 | 56.45%
Lowercase | 2328 | 985 | 42.31%
N | 2648 | 1239 | 46.79%
Uppercase | 1978 | 934 | 47.22%
White_Space | 241 | 140 | 58.09%
  |   |   |
Total | 20422 | 11103 | 54.37%

This table shows the size of the old and new tables in bytes. The most important
of these tables is "Grapheme_Extend", as it is present in essentially all Rust
programs due to being called from `str`'s Debug impl (`char::escape_debug`). In
a representative case given by this [blog post] for the embedded world, the
shrinking in this PR shrinks the final binary by 1,604 bytes, from 14,440 to
12,836.

The performance of these new tables, based on the (rough) benchmark of linearly
scanning the entire valid set of chars, querying for each `is_*`, is roughly
~50% better, though in some cases is either on par or slightly (3-5%) worse. In
practice, I believe the size benefits of this PR are the main concern. The new
implementation has been tested to be equivalent to the current nightly in terms
of returned values on the set of valid chars.

A (relatively) high-level explanation of the specific compression scheme used
can be found [in the generator].

This is split into three commits -- the first adds the generator which produces
the Rust code for the tables, the second adds support code for the lookup, and
the third actually swaps the current implementation out for the new one.

[blog post]: https://jamesmunns.com/blog/fmt-unreasonably-expensive/
[in the generator]: https://github.com/Mark-Simulacrum/rust/blob/unicode-tables/src/tools/unicode-table-generator/src/raw_emitter.rs
2020-01-15 22:49:27 +05:30
bors 6d0bb91bcb Auto merge of #68248 - JohnTitor:rollup-x0kml5f, r=JohnTitor
Rollup of 12 pull requests

Successful merges:

 - #67784 (Reset Formatter flags on exit from pad_integral)
 - #67914 (Don't run const propagation on items with inconsistent bounds)
 - #68141 (use winapi for non-stdlib Windows bindings)
 - #68211 (Add failing example for E0170 explanation)
 - #68219 (Untangle ZST validation from integer validation and generalize it to all zsts)
 - #68222 (Update the wasi-libc bundled with libstd)
 - #68226 (Avoid calling tcx.hir().get() on CRATE_HIR_ID)
 - #68227 (Update to a version of cmake with windows arm64 support)
 - #68229 (Update iovec to a version with no winapi dependency)
 - #68230 (Update libssh2-sys to a version that can build for aarch64-pc-windows…)
 - #68231 (Better support for cross compilation on Windows.)
 - #68233 (Update compiler_builtins with changes to fix 128 bit integer remainder for aarch64 windows.)

Failed merges:

r? @ghost
2020-01-15 13:00:43 +00:00
Yuki Okushi d2840e6bf1
Rollup merge of #68233 - danielframpton:update-compiler-builtins, r=alexcrichton
Update compiler_builtins with changes to fix 128 bit integer remainder for aarch64 windows.

I have been investigating enabling panic=unwind for aarch64-pc-windows-msvc (see #65313) and building rustc and cargo hosted on aarch64-pc-windows-msvc.
2020-01-15 21:51:59 +09:00
Yuki Okushi 2c994f22d6
Rollup merge of #68230 - danielframpton:update-libssh2-sys, r=alexcrichton
Update libssh2-sys to a version that can build for aarch64-pc-windows…

I have been investigating enabling panic=unwind for aarch64-pc-windows-msvc (see #65313) and building rustc and cargo hosted on aarch64-pc-windows-msvc.
2020-01-15 21:51:57 +09:00
Yuki Okushi cc07710196
Rollup merge of #68229 - danielframpton:update-iovec, r=alexcrichton
Update iovec to a version with no winapi dependency

I have been investigating enabling panic=unwind for aarch64-pc-windows-msvc (see #65313) and building rustc and cargo hosted on aarch64-pc-windows-msvc.
2020-01-15 21:51:55 +09:00
Yuki Okushi 58d348d3ab
Rollup merge of #68227 - danielframpton:update-cmake, r=alexcrichton
Update to a version of cmake with windows arm64 support

I have been investigating enabling panic=unwind for aarch64-pc-windows-msvc (see #65313) and building rustc and cargo hosted on aarch64-pc-windows-msvc.
2020-01-15 21:51:54 +09:00
Yuki Okushi be1ecce01f
Rollup merge of #68141 - euclio:replace-bindings-with-winapi, r=alexcrichton
use winapi for non-stdlib Windows bindings
2020-01-15 21:51:45 +09:00
Mark Rousskov 064f8885d5 Add unicode table generator 2020-01-14 19:11:15 -05:00
Daniel Frampton 106fe0b13a Update to a version of compiler_builtins with changes for fixes remainder for aarch64 windows 2020-01-14 13:32:26 -08:00
Daniel Frampton 9febc2bc7a Update to a version of cmake with windows arm64 support 2020-01-14 11:56:51 -08:00
Daniel Frampton 535fc9ce4c Update iovec to a version with no winapi dependency 2020-01-14 11:52:46 -08:00
Daniel Frampton 9f1452f699 Update libssh2-sys to a version that can build for aarch64-pc-windows-msvc 2020-01-14 11:26:03 -08:00
Eric Huss 55cb505257 Update rustfix in compiletest. 2020-01-14 09:50:55 -08:00
Eric Huss 6da85d6f99 Update cargo, rls 2020-01-14 09:47:04 -08:00
Camille GILLOT 9908a87367 Move to new crate rustc_ty. 2020-01-13 13:41:25 +01:00
bors 59c1db0339 Auto merge of #67901 - matthewjasper:split-mir-build, r=nagisa
Split MIR building into its own crate

This moves `rustc_mir::{build, hair, lints}` to `rustc_mir_build`.
The new crate only has a `provide` function as it's public API.

Based on #67898

cc @Centril @rust-lang/compiler
r? @oli-obk
2020-01-12 09:44:55 +00:00
Matthew Jasper b358929251 Split `rustc_mir::{build, hair, lints}` into their own crate 2020-01-12 09:39:26 +00:00
Andy Russell 7b564c67de
use winapi for non-stdlib Windows bindings 2020-01-11 20:56:46 -05:00
Mazdak Farrokhzad f58db20362 move rustc::lint::{context, passes} to rustc_lint.
Also do some cleanup of the interface.
2020-01-11 07:42:26 +01:00
Mazdak Farrokhzad 8c12c424e2 {rustc::lint -> rustc_lint}::internal 2020-01-11 07:42:26 +01:00
Mazdak Farrokhzad 9634e1f7d9
Rollup merge of #67806 - Centril:splitsynmore, r=petrochenkov
Extract `rustc_ast_passes`, move gating, & refactor linting

Based on https://github.com/rust-lang/rust/pull/67770.

This PR extracts a crate `rustc_ast_passes`:

- `ast_validation.rs`, which is contributed by `rustc_passes` (now only has HIR based passes) -- the goal here is to improve recompilation of the parser,
- `feature_gate.rs`, which is contributed by `syntax` and performs post-expansion-gating & final erroring for pre-expansion gating,
- `show_span`, which is contributed by `syntax`.

To facilitate this, we first have to also:

- Move `{leveled_}feature_err{_err}` from `syntax::feature_gate::check` into `rustc_session::parse`.
- Move `get_features` into `rustc_parse::config`, the only place it is used.
- Move some some lint datatypes and traits, e.g. `LintBuffer`, `BufferedEarlyLint`, `BuiltinLintDiagnostics`, `LintPass`, and `LintArray` into `rustc_session::lint`.
- Move all the hard-wired lint `static`s into `rustc_session::lint::builtin`.
2020-01-11 04:02:22 +01:00
Mazdak Farrokhzad 7d6548a14a rustc_passes: remove unused rustc_parse dep 2020-01-11 03:30:20 +01:00
Mazdak Farrokhzad 6cbcb83022 {syntax -> rustc_ast_passes}::feature_gate 2020-01-11 03:30:20 +01:00
Mazdak Farrokhzad ed69fbbc44 ast_validation -> new crate rustc_ast_passes 2020-01-11 03:27:39 +01:00
Mazdak Farrokhzad f361b71a7d nix syntax::early_buffered_lints 2020-01-11 03:26:16 +01:00
Mazdak Farrokhzad 7dbccf5b55 buffered lint infra -> rustc_session 2020-01-11 03:21:34 +01:00
Mazdak Farrokhzad fff5ef68b0 canonicalize rustc::session import 2020-01-11 03:19:50 +01:00
Mazdak Farrokhzad 6007641d21 gating diagnostics -> rustc_session::parse 2020-01-11 03:15:32 +01:00
bors e621797264 Auto merge of #65241 - tmiasko:no-std-san, r=alexcrichton
build-std compatible sanitizer support

### Motivation

When using `-Z sanitizer=*` feature it is essential that both user code and
standard library is instrumented. Otherwise the utility of sanitizer will be
limited, or its use will be impractical like in the case of memory sanitizer.

The recently introduced cargo feature build-std makes it possible to rebuild
standard library with arbitrary rustc flags. Unfortunately, those changes alone
do not make it easy to rebuild standard library with sanitizers, since runtimes
are dependencies of std that have to be build in specific environment,
generally not available outside rustbuild process. Additionally rebuilding them
requires presence of llvm-config and compiler-rt sources.

The goal of changes proposed here is to make it possible to avoid rebuilding
sanitizer runtimes when rebuilding the std, thus making it possible to
instrument standard library for use with sanitizer with simple, although
verbose command:

```
env CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS=-Zsanitizer=thread cargo test -Zbuild-std --target x86_64-unknown-linux-gnu
```

### Implementation

* Sanitizer runtimes are no long packed into crates. Instead, libraries build
  from compiler-rt are used as is, after renaming them into `librusc_rt.*`.
* rustc obtains runtimes from target libdir for default sysroot, so that
  they are not required in custom build sysroots created with build-std.
* The runtimes are only linked-in into executables to address issue #64629.
  (in previous design it was hard to avoid linking runtimes into static
  libraries produced by rustc as demonstrated by sanitizer-staticlib-link
  test, which still passes despite changes made in #64780).

cc @kennytm, @japaric, @firstyear, @choller
2020-01-10 23:26:21 +00:00
Yuki Okushi 7ae0618e0a
Rollup merge of #68050 - Centril:canon-error, r=Mark-Simulacrum
Canonicalize rustc_error imports

r? @Mark-Simulacrum
2020-01-11 04:50:53 +09:00
Michael Woerister ad65e3e6bc Fix some rebasing fallout. 2020-01-10 10:57:36 +01:00
Michael Woerister 11e4844480 Update measureme to 0.7.1 in order to fix compilation error on big-endian platforms. 2020-01-10 10:19:40 +01:00
Michael Woerister b8ead417a6 Initial support for recording query keys in self-profiling data. 2020-01-10 10:19:39 +01:00
Michael Woerister a62c040929 self-profile: Switch to new approach for event_id generation that enables query-invocation-specific event_ids. 2020-01-10 10:18:21 +01:00
Mazdak Farrokhzad 8bd3d240e3 nix syntax::errors & prefer rustc_errors over errors 2020-01-10 07:41:30 +01:00
Yuki Okushi a366aa6249
Rollup merge of #68040 - sinkuu:unused, r=petrochenkov
Cleanup
2020-01-10 04:18:42 +09:00
Tomasz Miąsko 78e7eeeaa1 Remove sanitizer runtime crates 2020-01-09 07:54:02 +01:00
Shotaro Yamada f443ae68c2 Remove unused dependencies 2020-01-09 11:52:03 +09:00
Mazdak Farrokhzad 2c3e5d3de0 - remove syntax::{span_warn!, span_err!, span_fatal!. struct_err!}
- remove syntax::{help!, span_help!, span_note!}
- remove unused syntax::{struct_span_fatal, struct_span_err_or_warn!, span_err_or_warn!}
- lintify check_for_bindings_named_same_as_variants + conflicting_repr_hints
- inline syntax::{struct_span_warn!, diagnostic_used!}
- stringify_error_code! -> error_code! & use it more.
- find_plugin_registrar: de-fatalize an error
- de-fatalize metadata errors
- move type_error_struct! to rustc_typeck
- struct_span_err! -> rustc_errors
2020-01-08 04:25:33 +01:00
bors ef92009c1d Auto merge of #66899 - msizanoen1:riscv-std, r=alexcrichton
Standard library support for riscv64gc-unknown-linux-gnu

Add std support for RISC-V 64-bit GNU/Linux and update libc for RISC-V support.

r? @alexcrichton
2020-01-06 19:07:42 +00:00
msizanoen1 d61e193cd0 Update cc crate 2020-01-06 22:44:57 +07:00
Mazdak Farrokhzad ebfd8673a7 Remove rustc_hir reexports in rustc::hir. 2020-01-05 12:49:22 +01:00
Mazdak Farrokhzad 937c76bfb2 cleanup librustc_hir/Cargo.toml 2020-01-04 19:03:27 +01:00
Mazdak Farrokhzad 7a14073875 move def_id to new rustc_hir crate 2020-01-04 19:01:42 +01:00
Mazdak Farrokhzad 5ccc1e45bd move Node{Map,Set} -> rustc_session::node_id 2020-01-04 18:59:28 +01:00
Charles Lew 485e98aae2 Implement uncommon_codepoints lint. 2020-01-03 08:20:12 +08:00
bors 1ed41b0720 Auto merge of #67729 - mati865:deps, r=nikomatsakis
Bump smallvec
2020-01-01 15:10:48 +00:00
Mazdak Farrokhzad 7b6ef2b369 librustc_ast_lowering: cargo changes. 2019-12-31 17:33:10 +01:00