Commit Graph

353 Commits

Author SHA1 Message Date
Lzu Tao 7d69d4ced2 Make use of ptr::null(_mut) instead of casting zero 2019-06-17 10:52:46 +00:00
Shotaro Yamada 6a0abd6048 Remove unnecessary .clone() 2019-06-15 20:46:00 +09:00
bors 961a9d6e97 Auto merge of #61741 - Centril:rollup-fgro5kz, r=Centril
Rollup of 11 pull requests

Successful merges:

 - #61518 (Add loops to doc list of things not stable in const fn)
 - #61526 (move some tests into subfolders)
 - #61550 (Windows 10 SDK is also required now.)
 - #61606 (Remove some legacy proc macro flavors)
 - #61652 (Mention slice patterns in array)
 - #61686 (librustc_errors: Add some more documentation)
 - #61698 (typeck: Fix const generic in repeat param ICE.)
 - #61707 (Azure: retry failed awscli installs)
 - #61715 (make sure make_ascii_lowercase actually leaves upper-case non-ASCII characters alone)
 - #61724 (core: use memcmp optimization for 128 bit integer slices)
 - #61726 (Use `for_each` in `Iterator::partition`)

Failed merges:

r? @ghost
2019-06-11 23:29:20 +00: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
Philipp Hansch 33137ffdd5 Address review comments
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-06-10 11:47:42 +02:00
Philipp Hansch e3516a128e librustc_errors: Add some more documentation 2019-06-10 11:46:32 +02:00
Vadim Petrochenkov 8049e6199b Remove unused #![feature(custom_attribute)]s 2019-06-08 23:55:24 +03: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 bfe5d9796b eprint -> eprintln to add trailing newline 2019-06-04 18:46:00 +02:00
Philipp Hansch 4a6b91cd66 Simplify source_string and block-format methods 2019-06-04 18:46:00 +02:00
Philipp Hansch 94c8aa6791 Print to stderr and bless 2019-06-04 18:46:00 +02:00
Philipp Hansch 3f727aeeb7 Add new diagnostic writer using annotate-snippet library
This adds a new diagnostic writer `AnnotateRsEmitterWriter` that uses
the [`annotate-snippet`][as] library to print out the human readable
diagnostics.

The goal is to eventually switch over to using the library instead of
maintaining our own diagnostics output.

This commit does *not* add all the required features to the new
diagnostics writer. It is only meant as a starting point so that other
people can contribute as well.

[as]: https://github.com/rust-lang/annotate-snippets-rs
2019-06-04 18:46:00 +02:00
Philipp Hansch 96e3fb255b librustc_errors: Move annotation collection to own impl
Extracted from work on #59346. This moves the annotation collection to
the `FileWithAnnotatedLines` impl to allow re-use in a separate
EmitterWriter.
2019-05-28 08:34:44 +02:00
Mazdak Farrokhzad a89c62ca2b Rollup merge of #61073 - phansch:remove_unused_annotation_style, r=matthewjasper
librustc_errors: Remove unused annotation style `OldSchoolNoteText`

I could not find any references to it and the `snippet` module does not
seem to be exported publicly, so I think it can be safely removed.

This was originally removed in 17bd76a51 and I'm not sure why it is still there.
2019-05-23 08:37:19 +02:00
Philipp Hansch 5ed42379e3 librustc_errors: Remove unused annotation style OldSchoolNoteText
I could not find any references to it and the `snippet` module does not
seem to be exported publicly, so I think it can be safely removed.
2019-05-23 08:01:38 +02:00
Jeremy Fitzhardinge 6c38625942 Make -Zemit-artifact-notifications also emit the artifact type
This is easier for tooling to handle than trying to reverse-engineer it from the filename extension.
2019-05-21 13:51:36 -07:00
Mazdak Farrokhzad 5cccda1770 Remove hir::ExprKind::If and replace it with lowering to hir::ExprKind::Match. 2019-05-10 19:41:10 +02:00
Eduard-Mihai Burtescu 1618c079ab rustc: rename -Z emit-directives to -Z emit-artifact-notifications and simplify the output. 2019-05-07 04:49:54 +03:00
Aleksey Kladov bfa5f27847 introduce unescape module
Currently, we deal with escape sequences twice: once when we lex a
string, and a second time when we unescape literals. This PR aims to
remove this duplication, by introducing a new `unescape` mode as a
single source of truth for character escaping rules
2019-05-02 15:31:57 +03:00
Nicholas Nethercote 7bcb0cffb6 In JSON output, emit a directive after metadata is generated.
To implement pipelining, Cargo needs to know when metadata generation is
finished. This commit adds code to do that. Unfortunately, metadata file
writing currently occurs very late during compilation, so pipelining
won't produce a speed-up. Moving metadata file writing earlier will be a
follow-up.

The change involves splitting the existing `Emitter::emit` method in
two: `Emitter::emit_diagnostic` and `Emitter::emit_directive`.

The JSON directives look like this:
```
{"directive":"metadata file written: liba.rmeta"}
```
The functionality is behind the `-Z emit-directives` option, and also
requires `--error-format=json`.
2019-04-30 08:51:57 +10:00
Xavier Denis 4a073dda93 Fix #58270, fix off-by-one error in error diagnostics. 2019-04-22 18:14:45 -05:00
Andy Russell b6f148c8bd hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
bors 6ed6f1461d Auto merge of #60034 - rasendubi:fix-comments, r=Centril
Small comments fix

- Fix comments around test harness generation
- Promote regular comments to rustdoc comments
2019-04-17 13:26:29 +00:00
Alexey Shmalko 56c0125568 Promote regular comments to rustdoc comments 2019-04-17 12:03:39 +03: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
Mateusz Mikuła 87e4b43d51 Deny internal in stage0 2019-04-17 05:15:00 +02:00
Oliver Scherer 325936ac20 Do not render ascii colors to buffers 2019-04-09 20:43:54 +02:00
flip1995 d3f0cb9b62 Deny internal lints on non conflicting crates
- libarena
- librustc_allocator
- librustc_borrowck
- librustc_codegen_ssa
- librustc_codegen_utils
- librustc_driver
- librustc_errors
- librustc_incremental
- librustc_metadata
- librustc_passes
- librustc_privacy
- librustc_resolve
- librustc_save_analysis
- librustc_target
- librustc_traits
- libsyntax
- libsyntax_ext
- libsyntax_pos
2019-04-03 18:24:21 +02:00
Oliver Scherer 39b21376db Rename colorful-json to json-rendered and make it a selection instead of a bool 2019-04-02 16:14:59 +02:00
Oliver Scherer 96404ee844 Emit ansi color codes in the rendered field of json diagnostics 2019-04-02 16:14:58 +02:00
Mazdak Farrokhzad dffdd8f728 Rollup merge of #58805 - fabric-and-ink:redundant_import, r=petrochenkov
Lint for redundant imports

Add lint for redundant imports. The changes are suggested by @petrochenkov.

Closes #10178.
2019-03-31 19:19:47 +02:00
Mazdak Farrokhzad fb8396da84 Rollup merge of #59574 - JohnTitor:distinguish-error-vs-warning, r=Centril
Distinguish message for external macros depending on error level

fixes #57716

(I picked you because assigned to this issue.)
r? @estebank
2019-03-31 16:10:38 +02:00
Yuki OKUSHI 45c82abf13 Distinguish depending on error level
Remove unnecessary comment
2019-03-31 07:51:31 +09:00
Fabian Drinck 541c4999a9 Remove redundant imports 2019-03-30 22:37:02 +01:00
Esteban Küber b5690c2cb8 Fix MultilineAnnotation field name 2019-03-28 20:19:50 -07:00
Esteban Küber 8fad69c200 Add comemnts clarifying logic 2019-03-28 20:18:50 -07:00
Esteban Küber e13e9a5d63 review comments 2019-03-28 20:03:13 -07:00
Esteban Küber 326ec800b9 Account for fully overlapping multiline annotations
When two multiline span labels point at the same span, we special
case the output to avoid weird behavior:

```
        foo(
   _____^
  |_____|
 ||         bar,
 ||     );
 ||      ^
 ||______|
  |______foo
         baz
```

instead showing

```
       foo(
  _____^
 |         bar,
 |     );
 |      ^
 |      |
 |______foo
        baz
```
2019-03-27 19:35:30 -07:00
Esteban Küber 9bfb0ef818 Tweak unsupported negative trait bounds message 2019-03-23 13:05:30 -07:00
Steven Malis 266ca31f74 Stabilize Range*::contains. 2019-03-12 21:00:37 -07:00
Esteban Küber a7563a30c0 fix bad logic 2019-03-07 08:46:18 -08:00
Esteban Küber c41ddf1773 Keep current behavior while accepting error count 2019-03-07 03:17:39 -08:00
Esteban Küber 7a55a004fa Make -Z treat-err-as-bug take a number of errors to be emitted
`-Z treat-err-as-bug=0` will cause `rustc` to panic after the first
error is reported. `-Z treat-err-as-bug=2` will cause `rustc` to
panic after 3 errors have been reported.
2019-03-06 19:51:32 -08:00
Taiki Endo 871910a2c6 Use ? in some macros 2019-02-24 21:59:44 +09:00
Mazdak Farrokhzad 56e19160af Rollup merge of #58296 - estebank:hidden-suggestion, r=oli-obk
Hidden suggestion support

Add way to hide suggestion snippet window from cli output to avoid cluttered spans that don't enhance understanding.

r? @pietroalbini CC @zackmdavis
2019-02-14 02:41:21 +01:00
bors b244f61b77 Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnik
Cosmetic improvements to doc comments

This has been factored out from https://github.com/rust-lang/rust/pull/58036 to only include changes to documentation comments (throughout the rustc codebase).

r? @steveklabnik

Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far!
2019-02-12 19:09:24 +00:00
Esteban Küber 87dd2e1df9 Use hidden suggestions for unused imports lint 2019-02-11 11:16:22 -08:00
Esteban Küber 235523c7d4 Add way to completely hide suggestion from cli output 2019-02-11 10:01:40 -08:00
Esteban Küber 7cfba1c5e8 Never inline HideCodeAlways suggestions 2019-02-11 10:01:40 -08:00
Esteban Küber 6ea159ea7e Expose hidden snippet suggestions 2019-02-11 10:01:40 -08:00