Commit Graph

611 Commits

Author SHA1 Message Date
Mark Rousskov
402a8af1d5 Remove lint callback from driver
This is leftover from a restructuring of lint registration for drivers;
it should now happen via the register_lints field on Config rather than
this function.
2019-10-25 19:27:57 -04:00
Vadim Petrochenkov
2c16f84490 rustc_driver: Remove unnecessary use of crate store 2019-10-24 20:50:11 +03:00
Mazdak Farrokhzad
7c043e284a
Rollup merge of #65193 - Mark-Simulacrum:lockless-lintstore, r=nikomatsakis
Lockless LintStore

This removes mutability from the lint store after registration. Each commit stands alone, for the most part, though they don't make sense out of sequence.

The intent here is to move LintStore to a more parallel-friendly architecture, although also just a cleaner one from an implementation perspective. Specifically, this has the following changes:
 * We no longer implicitly register lints when registering lint passes
    * For the most part this means that registration calls now likely want to call something like:
       `lint_store.register_lints(&Pass::get_lints())` as well as `register_*_pass`.
    * In theory this is a simplification as it's much easier for folks to just register lints and then have passes that implement whichever lint however they want, rather than necessarily tying passes to lints.
 * Lint passes still have a list of associated lints, but a followup PR could plausibly change that
   * This list must be known for a given pass type, not instance, i.e., `fn get_lints()` is the signature instead of `fn get_lints(&self)` as before.
 * We do not store pass objects, instead storing constructor functions. This means we always get new passes when running lints (this happens approximately once though for a given compiler session, so no behavior change is expected).
 * Registration API is _much_ simpler: generally all functions are just taking `Fn() -> PassObject` rather than several different `bool`s.
2019-10-23 22:19:10 +02:00
Mark Rousskov
4e8d1b2292 Add some documentation 2019-10-22 16:53:28 -04:00
Mazdak Farrokhzad
d945f9860f move parse_cfgspecs to rustc_interface 2019-10-19 13:25:46 +02:00
Mark Rousskov
6be0a7081a Update API to be more compatible with plugin needs
Move to using Box<dyn Fn() -> ...> so that we can let plugins register
state.

This also adds a callback that'll get called from plugin registration so
that Clippy and other tools can register lints without using the plugin
API. The plugin API still works, but this new API is more compatible
with drivers other than rustc.
2019-10-17 19:41:21 -04:00
Mark Rousskov
dab3bd6cda Create lint store during plugin registration
Remove lint store from Session
2019-10-17 19:41:21 -04:00
Mark Rousskov
748eccd488 Lints being from a plugin is dependent on the lint, not the registration 2019-10-17 19:16:41 -04:00
Vadim Petrochenkov
e8c28e24b9 rustc_metadata: Privatize private code and remove dead code 2019-10-14 18:05:45 +03:00
Mazdak Farrokhzad
9d766ed593 refactor session::config::build_session_options_and_crate_config 2019-10-13 18:49:15 +02:00
Mazdak Farrokhzad
b30d9beafb
Rollup merge of #64799 - Aaron1011:fix/double-panic, r=Mark-Simulacrum
Fix double panic when printing query stack during an ICE

On the latest nightly, any call to `bug` or `span_bug` will result in two panics - the first one as a normal result of calling `bug` / `span_bug`, and the second as a result of trying to print the query stack from the panic handler. This is caused by the query-printing code attempting to acquire a lock on `HandlerInnder`, which is still being held by `bug`.

This PR moves the actual panic out of `HandlerInner`, into `Handler`. This allows us to release the lock on `HandlerInner` before triggering the panic, ensuring that the panic handler will be able to acquire the lock if necessary.
2019-09-29 04:36:01 +02:00
Aaron Hill
e9aa0e7540
Use existing Handler to print query stack
When the panic handler is run, the existing Handler may be in a weird
state if it was responsible for triggering the panic. By using a freshly
created Handler, we avoid trying to re-entrantly lock a HandlerInner,
which was causing a double panic on ICEs.
2019-09-26 16:17:00 -04:00
varkor
38121173e2 Rename MetaItem.node to MetaItem.kind 2019-09-26 18:21:48 +01:00
Mazdak Farrokhzad
ae8b3e8fc6 Introduce a diagnostic stashing API. 2019-09-23 17:50:06 +02: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
Mazdak Farrokhzad
acbbcda399
Rollup merge of #64497 - nnethercote:fix-64339, r=petrochenkov
Don't print the "total" `-Ztime-passes` output if `--prints=...` is also given

Fixes #64339.
2019-09-16 17:09:43 +02:00
Nicholas Nethercote
bb229865fa Don't print the "total" -Ztime-passes output if --prints=... is also given.
Fixes #64339.
2019-09-16 13:27:38 +10:00
bors
572d3d9634 Auto merge of #60584 - jonas-schievink:ice-panic-hook, r=oli-obk
Use `panic::set_hook` to print the ICE message

This allows custom frontends and backends to override the hook with their own, for example to point people to a different issue tracker.

ICE messages are printed in a slightly different order now. Nightly prints:

```
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:347:21
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: aborting due to 2 previous errors

Some errors have detailed explanations: E0277, E0658.
For more information about an error, try `rustc --explain E0277`.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.36.0-nightly (08bfe1612 2019-05-02) running on x86_64-unknown-linux-gnu
```

After this PR, rustc prints:

```
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:347:21
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.36.0-dev running on x86_64-unknown-linux-gnu

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0277, E0658.
For more information about an error, try `rustc --explain E0277`.
```
2019-09-15 00:10:08 +00:00
Mark Rousskov
41b39fce98 Remove rustc_diagnostic_macros feature 2019-09-05 12:35:18 -04:00
Jonas Schievink
cf1db72281 Update comment 2019-08-30 12:34:38 +02:00
Jonas Schievink
3e2d4d28b1 Document the ICE hook and make it more flexible 2019-08-30 12:34:20 +02:00
Jonas Schievink
035333993d Clarify that rustc unwinds on errors, not panics 2019-08-30 12:34:20 +02:00
Jonas Schievink
e296ed321e Move librustc panic handler into the new one 2019-08-30 12:34:20 +02:00
Jonas Schievink
a8926a5e9c Use panic::set_hook to print the ICE message 2019-08-30 12:34:20 +02:00
bors
0f41401691 Auto merge of #63827 - andjo403:out-of-process-rustc-in-rustdoc, r=Mark-Simulacrum
Run doctests via out-of-process rustc

closes #63638
2019-08-30 10:25:26 +00:00
bors
19a38de68a Auto merge of #63402 - estebank:strip-margin, r=oli-obk
Strip code to the left and right in diagnostics for long lines

Fix #62999.
2019-08-30 06:49:15 +00:00
Andreas Jonson
56ab485fbe support rustdoc test from stdin to rustc 2019-08-29 22:23:05 +02:00
bors
201e52e5fe Auto merge of #63175 - jsgf:argsfile, r=jsgf
rustc: implement argsfiles for command line

Many tools, such as gcc and gnu-ld, support "args files" - that is, being able to specify @file on the command line.  This causes `file` to be opened and parsed for command line options. They're separated with whitespace; whitespace can be quoted with double or single quotes, and everything can be \\-escaped. Args files may recursively include other args files via `@file2`.

See https://sourceware.org/binutils/docs/ld/Options.html#Options for the documentation of gnu-ld's @file parameters.

This is useful for very large command lines, or when command lines are being generated into files by other tooling.
2019-08-22 06:14:49 +00:00
Esteban Küber
21f2e93345 Add terminal_width debugging flag 2019-08-21 11:58:24 -07:00
Jeremy Fitzhardinge
d9497749a8 Move argfile expansion into run_compiler
This will make @path work with miri and other non-standard entrypoints.

Also since this simplifies librustc_driver::args, move it into a simple source file. Also
remove the tests since they're doing nothing more than checking `str::lines` has the right
behaviour.
2019-08-20 12:34:14 -07:00
Jeremy Fitzhardinge
d2219c2e2e rustc: implement argsfiles for command line
This makes `rustc` support `@path` arguments on the command line. The `path` is opened and the file is interpreted
as new command line options which are logically inserted at that point in the command-line. The options in the file
are one per line. The file is UTF-8 encoded, and may have either Unix or Windows line endings.
It does not support recursive use of `@path`.

This is useful for very large command lines, or when command-lines are being generated into files by other tooling.
2019-08-19 19:06:46 -07:00
Jeremy Fitzhardinge
859657f2c5 Use named arguments for formatting usage message.
It was getting a bit awkward.
2019-08-19 19:06:46 -07:00
Simon Sapin
d0bbc6062d Deprecate using rustc_plugin without the rustc_driver dylib.
CC https://github.com/rust-lang/rust/pull/59800
7198687bb2

Fix https://github.com/rust-lang/rust/issues/62717
2019-08-20 00:21:32 +02:00
Vadim Petrochenkov
6cb28b6617 Ident::with_empty_ctxt -> Ident::with_dummy_span
`Ident` has had a full span rather than just a `SyntaxContext` for a long time now.
2019-08-15 20:39:26 +03:00
Mark Rousskov
1ee37cd872 Cleanup historical stability comments
These weren't removed by ccbcc720a6 most likely by accident,
let's clean them up now.
2019-08-09 19:25:34 -04:00
Vadim Petrochenkov
676d282dd3 Deny unused_lifetimes through rustbuild 2019-07-28 18:47:02 +03:00
Vadim Petrochenkov
434152157f Remove lint annotations in specific crates that are already enforced by rustbuild
Remove some random unnecessary lint `allow`s
2019-07-28 18:46:24 +03:00
Vadim Petrochenkov
614037171b cleanup: Remove extern crate serialize as rustc_serializes 2019-07-23 19:20:16 +03:00
Igor Matuszewski
ff63336b65 Use more descriptive Compilation enum in rustc interface callbacks 2019-07-15 17:01:03 +02:00
Igor Matuszewski
ae75311823 Add Callbacks::after_expansion 2019-07-15 16:53:18 +02:00
Mazdak Farrokhzad
40841e049a
Rollup merge of #62110 - nnethercote:improve-Ztime-passes, r=Zoxc
Improve -Ztime-passes

Two improvements that make `-Ztime-passes` more useful.

r? @Zoxc
2019-07-05 20:26:52 +02:00
Nicholas Nethercote
87b103d4a9 Add a "total" measurement to -Ztime-passes.
This is useful for getting the total compilation time at the end.
To do this, the patch changes `print_time_passes_entry` to not increment
the depth, which means that `print_time_passes_entry_internal` is no
longer needed.
2019-07-05 08:19:48 +10:00
flip1995
084c829fb8
Enable internal lints in bootstrap 2019-06-24 10:45:20 +02:00
Eduard-Mihai Burtescu
630ec8880c Add deny(unused_lifetimes) to all the crates that have deny(internal). 2019-06-11 14:11:59 +03:00
Nicholas Nethercote
999c1fc281 Remove the equality operation between Symbol and strings.
And also the equality between `Path` and strings, because `Path` is made
up of `Symbol`s.
2019-05-13 09:31:30 +10:00
Yuki OKUSHI
bf4d0adf23 Rename to RUSTC_LOG 2019-04-30 17:27:53 +09:00
Mateusz Mikuła
87e4b43d51 Deny internal in stage0 2019-04-17 05:15:00 +02:00
Mazdak Farrokhzad
59e95ddfa8
Rollup merge of #59680 - DevQps:document-rustc-z-flag, r=cramertj
Document the -Z flag to the rustc book

# Description

Changes:
- Added new documentation on the `-Z` flag of rustc in the command-line arguments section of the rustc book.

If I need to rephrase anything or if you have any improvements, please let me know! I deliberately did not create an exhaustive list of all options since they are likely to change over time and per toolchain version.

closes #41142
2019-04-12 12:17:48 +02:00
Christian
7acfa453df Updated the documentation, now claiming the -Z is associated to unstable compiler flags, instead of flags for debugging. 2019-04-10 12:10:25 +02:00