Commit Graph

21 Commits

Author SHA1 Message Date
Oli Scherer 29de70da1b Replace the many arguments of `EmitterWriter::stderr` with builder methods 2023-07-31 07:19:23 +00:00
Trevor Gross 6a1c10bd85 Add a simple markdown parser for formatting `rustc --explain`
Currently, the output of `rustc --explain foo` displays the raw markdown in a
pager. This is acceptable, but using actual formatting makes it easier to
understand.

This patch consists of three major components:

1.  A markdown parser. This is an extremely simple non-backtracking recursive
    implementation that requires normalization of the final token stream
2.  A utility to write the token stream to an output buffer
3.  Configuration within rustc_driver_impl to invoke this combination for
    `--explain`. Like the current implementation, it first attempts to print to
    a pager with a fallback colorized terminal, and standard print as a last
    resort.

    If color is disabled, or if the output does not support it, or if printing
    with color fails, it will write the raw markdown (which matches current
    behavior).

    Pagers known to support color are: `less` (with `-r`), `bat` (aka `catbat`),
    and `delta`.

The markdown parser does not support the entire markdown specification, but
should support the following with reasonable accuracy:

-   Headings, including formatting
-   Comments
-   Code, inline and fenced block (no indented block)
-   Strong, emphasis, and strikethrough formatted text
-   Links, anchor, inline, and reference-style
-   Horizontal rules
-   Unordered and ordered list items, including formatting

This parser and writer should be reusable by other systems if ever needed.
2023-07-03 16:04:18 -04:00
klensy 3c03cce341 bump windows crate 0.46 -> 0.48 in workspace 2023-05-09 18:20:13 +03:00
Nilstrieb b5d3d970fa Add `rustc_fluent_macro` to decouple fluent from `rustc_macros`
Fluent, with all the icu4x it brings in, takes quite some time to
compile. `fluent_messages!` is only needed in further downstream rustc
crates, but is blocking more upstream crates like `rustc_index`. By
splitting it out, we allow `rustc_macros` to be compiled earlier, which
speeds up `x check compiler` by about 5 seconds (and even more after the
needless dependency on `serde_json` is removed from
`rustc_data_structures`).
2023-04-18 18:56:22 +00:00
Andy Russell bb7c373fdf
migrate compiler, bootstrap, and compiletest to windows-rs 2023-03-20 13:19:35 -04:00
Jhonny Bill Mena d1030fab22 UPDATE - migrate fn simd_simple_float_intrinsic error messages 2022-12-27 20:59:21 -05:00
Matthias Krüger 52cc0d5360
Rollup merge of #103117 - joshtriplett:use-is-terminal, r=eholk
Use `IsTerminal` in place of `atty`

In any crate that can use nightly features, use `IsTerminal` rather than
`atty`:

- Use `IsTerminal` in `rustc_errors`
- Use `IsTerminal` in `rustc_driver`
- Use `IsTerminal` in `rustc_log`
- Use `IsTerminal` in `librustdoc`
2022-11-19 15:35:18 +01:00
Charles Lew d15b020278 Enable icu sync feature for parallel compiler 2022-11-18 14:46:35 -08:00
Josh Triplett c5ad97da25 Use IsTerminal in rustc_errors 2022-10-16 15:10:40 +01:00
reez12g 9a4c5abe45 Remove from compiler/ crates 2022-09-29 16:49:04 +09:00
Xiretza 8489a67f0b Implement IntoDiagnosticArg for rustc_ast::Path 2022-09-27 20:29:18 +02:00
Luis Cardoso 329d5014b6 translations(rustc_session): migrate output.rs 2022-09-10 08:19:17 +02:00
Nathan Stocks 0d65819d52 respond to review feedback: mainly eliminate as many conversions as possible...
- ... when creating diagnostics in rustc_metadata
-  use the error_code! macro
- pass macro output to diag.code()
- use fluent from within manual implementation of SessionDiagnostic
- emit the untested errors in case they occur in the wild
- stop panicking in the probably-not-dead code, add fixme to write test
2022-08-31 10:56:42 -06:00
klensy 754b52669f dedupe 'annotate-snippets' crate versions 2022-08-02 21:07:01 +03:00
Michael Goulet ff9fd36aa4 Implement IntoDiagnosticArg for hir::ConstContext 2022-07-08 03:47:31 +00:00
bjorn3 62a4f91a5a Use serde_json for json error messages 2022-06-03 16:46:19 +00:00
David Wood c45f29595d span: move `MultiSpan`
`MultiSpan` contains labels, which are more complicated with the
introduction of diagnostic translation and will use types from
`rustc_errors` - however, `rustc_errors` depends on `rustc_span` so
`rustc_span` cannot use types like `DiagnosticMessage` without
dependency cycles. Introduce a new `rustc_error_messages` crate that can
contain `DiagnosticMessage` and `MultiSpan`.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-05 07:01:00 +01:00
Mark Rousskov c746be2219 Migrate to 2021 2021-09-20 22:21:42 -04:00
Jade 3cf820e17d rfc3052: Remove authors field from Cargo manifests
Since RFC 3052 soft deprecated the authors field anyway, hiding it from
crates.io, docs.rs, and making Cargo not add it by default, and it is
not generally up to date/useful information, we should remove it from
crates in this repo.
2021-07-29 14:56:05 -07:00
Aaron Hill 23018a55d9
Implement rustc side of report-future-incompat 2020-10-30 20:02:14 -04:00
mark 9e5f7d5631 mv compiler to compiler/ 2020-08-30 18:45:07 +03:00