Commit Graph

445 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
5c4a595ff0
Rollup merge of #66027 - Mark-Simulacrum:panic-handler-query, r=alexcrichton
Move has_panic_handler to query

Moves us off of a global Once instead re-querying the lang item each time. The conditions on when we set it to true change a little (previously we'd make sure a few more lang items were `Some`) but I think they in practice don't matter, we won't compile later on if we don't have them.
2019-11-06 03:28:08 +01:00
Mark Rousskov
c68df7c503 Delete lint buffer from Session 2019-11-03 21:52:42 -05:00
Mark Rousskov
ea1ff8c07c Utilize Resolver lint buffer during HIR lowering 2019-11-03 21:52:42 -05:00
Mark Rousskov
692ae3d9fb Move has_panic_handler to query 2019-11-01 22:24:43 -04:00
Tyler Mandry
7297cd8d92
Rollup merge of #65470 - traxys:fix_65401, r=michaelwoerister
Don't hide ICEs from previous incremental compiles

I think this fixes #65401, the compiler does not fail to ICE after the first compilation, tested on the last snippet of [this comment](https://github.com/rust-lang/rust/issues/63154#issuecomment-541592381).
I am not very sure of the fix as I don't understand much of the structure of the compiler.
2019-11-01 11:20:09 -07:00
Mazdak Farrokhzad
fb12c70852 rustc, rustc_passes: don't depend on syntax_expand.
This is done by moving some data definitions to syntax::expand.
2019-10-27 17:05:57 +01:00
Mark Rousskov
dab3bd6cda Create lint store during plugin registration
Remove lint store from Session
2019-10-17 19:41:21 -04:00
Quentin Boyer
5930551f6a Check if there are any delayed_span_bugs and abort incremental compilation in this case 2019-10-16 13:13:13 +02:00
Mazdak Farrokhzad
d420d719c4 move syntax::ext to new crate syntax_expand 2019-10-16 10:59:53 +02:00
Mazdak Farrokhzad
ae156a56d4 syntax::parse::sess -> syntax::sess 2019-10-15 09:41:58 +02:00
Tomasz Miąsko
d488500812 Don't discard value names when using address or memory sanitizer
The value names are used when reporting issues found by address
sanitizer or memory sanitizer. Avoid discarding names when those
sanitizers are enabled, unless explicitly requested to do otherwise.
2019-10-13 12:10:35 +02:00
Mark Rousskov
e85089b63a Remove -Zprofile-queries 2019-10-03 21:34:27 -04:00
Tyler Mandry
8f5f92a07a
Rollup merge of #64840 - michaelwoerister:self-profiling-raii-refactor, r=wesleywiser
SelfProfiler API refactoring and part one of event review

This PR refactors the `SelfProfiler` a little bit so that most profiling methods are RAII-based. The codegen backend code already had something similar, this refactoring pulls this functionality up into `SelfProfiler` itself, for general use.

The second commit of this PR is a review and update of the existing events we are already recording. Names have been made more consistent. CGU names have been removed from event names. They will be added back in when function parameter recording is implemented.

There is still some work to be done for adding new events, especially around trait resolution and the incremental system.

r? @wesleywiser
2019-10-01 23:06:16 -07:00
Tyler Mandry
65a050fddc
Rollup merge of #64722 - Mark-Simulacrum:alt-parallel, r=alexcrichton
Make all alt builders produce parallel-enabled compilers

We're not quite ready to ship parallel compilers by default, but the alt
builders are not used too much (in theory), so we believe that shipping
a possibly-broken compiler there is not too problematic.

r? @nikomatsakis
2019-10-01 23:06:11 -07:00
Mark Rousskov
1a1067d1a5 Make the default parallelism 1
This changes the default parallelism for parallel compilers to one,
instead of the previous default, which was "num cpus". This is likely
not an optimal default long-term, but it is a good default for testing
whether parallel compilers are not a significant regression over a
sequential compiler.

Notably, this in theory makes a parallel-enabled compiler behave
exactly like a sequential compiler with respect to the jobserver.
2019-09-30 16:49:19 -04:00
Michael Woerister
b0b073cdb0 Self-Profiling: Refactor SelfProfiler API to be RAII based where possible. 2019-09-30 13:30:47 +02:00
Mazdak Farrokhzad
40fae88fa8
Rollup merge of #64324 - alexcrichton:share-generics-again, r=michaelwoerister
rustc: Fix mixing crates with different `share_generics`

This commit addresses #64319 by removing the `dylib` crate type from the
list of crate type that exports generic symbols. The bug in #64319
arises because a `dylib` crate type was trying to export a symbol in an
uptream crate but it miscalculated the symbol name of the uptream
symbol. This isn't really necessary, though, since `dylib` crates aren't
that heavily used, so we can just conservatively say that the `dylib`
crate type never exports generic symbols, forcibly removing them from
the exported symbol lists if were to otherwise find them.

The fix here happens in two places:

* First is in the `local_crate_exports_generics` method, indicating that
  it's now `false` for the `Dylib` crate type. Only rlibs actually
  export generics at this point.

* Next is when we load exported symbols from upstream crate. If, for our
  compilation session, the crate may be included from a dynamic library,
  then its generic symbols are removed. When the crate was linked into a
  dynamic library its symbols weren't exported, so we can't consider
  them a candidate to link against.

Overally this should avoid situations where we incorrectly calculate the
upstream symbol names in the face of differnet `share_generics` options,
ultimately...

Closes #64319
2019-09-25 03:48:22 +02:00
Alex Crichton
5d531aeaf4 rustc: Convert dependency_formats to a query
This commit converts a field of `Session`, `dependency_formats`, into a
query of `TyCtxt`. This information then also needed to be threaded
through to other remaining portions of the linker, but it's relatively
straightforward. The only change here is that instead of
`HashMap<CrateType, T>` the data structure changed to `Vec<(CrateType,
T)>` to make it easier to deal with in queries.
2019-09-23 12:29:51 -07:00
Mazdak Farrokhzad
ae8b3e8fc6 Introduce a diagnostic stashing API. 2019-09-23 17:50:06 +02:00
Mark Rousskov
2a767eec0c Remove unused methods from Handler 2019-09-17 09:30:45 -04:00
Mark Rousskov
b304e60131 Remove Handler::{emit, emit_with_code} 2019-09-17 09:30:45 -04:00
Mark Rousskov
cdd805506e Replace DiagnosticBuilder with Diagnostic when emitting error 2019-09-17 09:29:46 -04:00
Alexander Regueiro
c1d29ee3c7 Aggregation of cosmetic changes made during work on REPL PRs: librustc 2019-09-07 16:27:19 +01:00
Esteban Küber
21f2e93345 Add terminal_width debugging flag 2019-08-21 11:58:24 -07:00
Mazdak Farrokhzad
e1de70b045
Rollup merge of #62735 - petrochenkov:galloc, r=alexcrichton
Turn `#[global_allocator]` into a regular attribute macro

It was a 99% macro with exception of some diagnostic details.

As a result of the change, `#[global_allocator]` now works in nested modules and even in nameless blocks.

Fixes https://github.com/rust-lang/rust/issues/44113
Fixes https://github.com/rust-lang/rust/issues/58072
2019-07-25 23:21:00 +02:00
Mark Rousskov
d749b5e223 Gate binary dependency information behind -Zbinary-dep-depinfo 2019-07-24 11:00:09 -04:00
Vadim Petrochenkov
a93fdfedf3 Merge rustc_allocator into libsyntax_ext 2019-07-24 12:27:58 +03:00
Wesley Wiser
3622311d53 Only error about MSVC + PGO + unwind if we're generating code
When `rustc` is invoked with the `--print` argument, we don't actually
generate any code (unless it's the `native-static-libs` option). So we
don't need to error our in this case since there's no risk of generating
either LLVM assertions or corrupted binaries.
2019-07-11 21:52:21 -04:00
Wesley Wiser
374daa7985 Revert "Emit warning when trying to use PGO in conjunction with unwinding on Windows."
This reverts commit 74a39a39a4.
2019-07-11 21:50:00 -04:00
Eric Rahm
74a39a39a4 Emit warning when trying to use PGO in conjunction with unwinding on Windows. 2019-07-09 17:17:30 -04:00
Jeremy Stucki
d28832dde9
Remove needless lifetimes 2019-07-03 10:01:02 +02:00
bors
0beb2ba16a Auto merge of #61268 - michaelwoerister:stabilize-pgo, r=alexcrichton
Stabilize support for Profile-guided Optimization

This PR makes profile-guided optimization available via the `-C profile-generate` / `-C profile-use` pair of commandline flags and adds end-user documentation for the feature to the [rustc book](https://doc.rust-lang.org/rustc/). The PR thus ticks the last two remaining checkboxes of the [stabilization tracking issue](https://github.com/rust-lang/rust/issues/59913).

From the tracking issue:
> Profile-guided optimization (PGO) is a common optimization technique for ahead-of-time compilers. It works by collecting data about a program's typical execution (e.g. probability of branches taken, typical runtime values of variables, etc) and then uses this information during program optimization for things like inlining decisions, machine code layout, or indirect call promotion.

If you are curious about how this can be used, there is a rendered version of the documentation this PR adds available [here](
https://github.com/michaelwoerister/rust/blob/stabilize-pgo/src/doc/rustc/src/profile-guided-optimization.md).

r? @alexcrichton
cc @rust-lang/compiler
2019-07-02 20:00:29 +00:00
Matthew Jasper
30b6c59f24 Prefer to use has_errors to err_count 2019-06-22 15:36:24 +01:00
Michael Woerister
b7fe2ca5e0 Stabilize profile-guided optimization. 2019-06-21 09:54:58 +02:00
Philipp Hansch
df076b2d5e
librustc_errors: Rename AnnotateRs -> AnnotateSnippet
The proper name of the library is `annotate-snippet`, not `annotate-rs`,
this commit should get rid of any confusing `AnnotateRs` names.

1. Renames `annotate_rs_emitter.rs` to
   `annotate_snippet_emitter_writer.rs` so that the difference between the
   `Emitter` trait and the implementers is more clear.
2. Renames `AnnotateRsEmitterWriter` to `AnnotateSnippetEmitterWriter`
3. Renames `HumanReadableErrorType::AnnotateRs` to `HumanReadableErrorType::AnnotateSnippet`
2019-06-05 21:43:55 +02:00
Philipp Hansch
c04a2ccb35
Add new error-format value to use annotate-snippet output 2019-06-04 18:46:00 +02:00
bors
c28084ac16 Auto merge of #61005 - michaelwoerister:error-pgo-windows-unwind, r=zackmdavis
Emit error when trying to use PGO in conjunction with unwinding on Windows.

This PR makes `rustc` emit an error when trying use PGO in conjunction with `-Cpanic=unwind` on Windows, isn't supported by LLVM yet. The error messages points to https://github.com/rust-lang/rust/issues/61002, which documents this known limitation.
2019-05-30 03:37:37 +00:00
Eduard-Mihai Burtescu
29b7c0687e rustc_codegen_llvm: remove LLVM instruction count stats. 2019-05-29 01:43:57 +03:00
Michael Woerister
64ee32e53a Rename PgoGenerate to something more general. 2019-05-28 16:14:34 +02:00
Michael Woerister
53f1c38734 Allow to specify profiling data output directory as -Zself-profile argument. 2019-05-28 16:14:34 +02:00
Michael Woerister
9f92668ce1 Emit error when trying to use PGO in conjunction with unwinding on Windows. 2019-05-28 15:25:52 +02:00
Michael Woerister
eeb7348dc3 PGO: Check that pgo-use file actually exists. LLVM seems to only emit an easy-to-overlook warning otherwise. 2019-05-27 14:32:03 +02:00
Nicholas Nethercote
fb084a48e2 Pass a Symbol to check_name, emit_feature_err, and related functions. 2019-05-13 09:29:22 +10:00
John Kåre Alsaker
df5a0111be Optimize HIR map 2019-05-08 12:18:09 +02:00
Nicholas Nethercote
68f5101cd5 Remove unused DiagnosticOutput::Emitter variant. 2019-04-26 09:48:52 +10:00
Mazdak Farrokhzad
bd0d097a33
Rollup merge of #60045 - estebank:suggest-std, r=petrochenkov
Suggest appropriate path when calling associated item on bare types

When looking at the documentation for `std::f32` or `std::str`, for
example, it is easy to get confused and assume `std::f32` and `f32`
are the same thing. Because of this, it is not uncommon to attempt
writing `f32::consts::PI` instead of the correct
`std::f32::consts::PI`. When encountering the former, which results
in an access error due to it being an inexistent path, try to access
the same path under `std`. If this succeeds, this information is
stored for later tweaking of the final E0599 to provide an
appropriate suggestion.

Fix #26760, fix #46660.
2019-04-19 06:03:16 +02:00
Esteban Küber
6aa4c992bc Suggest appropriate path when calling associated item on bare types
When looking at the documentation for `std::f32` or `std::str`, for
example, it is easy to get confused and assume `std::f32` and `f32`
are the same thing. Because of this, it is not uncommon to attempt
writing `f32::consts::PI` instead of the correct
`std::f32::consts::PI`. When encountering the former, which results
in an access error due to it being an inexistent path, try to access
the same path under `std`. If this succeeds, this information is
stored for later tweaking of the final E0599 to provide an
appropriate suggestion.

This suggestion applies to both E0233 and E0599 and is only checked
when the first ident of a path corresponds to a primitive type.
2019-04-18 19:18:26 -07:00
Michael Woerister
08efbac758 Implement event filtering for self-profiler. 2019-04-18 17:03:53 +02:00
Mazdak Farrokhzad
c89bc54d4f
Rollup merge of #59128 - oli-obk:colorful_json, r=mark-i-m,eddyb
Emit ansi color codes in the `rendered` field of json diagnostics

cc @ljedrz

Implemented for https://github.com/rust-lang/rust/pull/56595#issuecomment-447645115 (x.py clippy)
2019-04-17 10:31:30 +02:00
Wesley Wiser
56e434d84d Use measureme in self-profiler
Related to #58372
Related to #58967
2019-04-12 20:27:29 -04:00