Commit Graph

324 Commits

Author SHA1 Message Date
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
Esteban Küber
05b4e7c8a9 Add way to hide suggestion snippet window from cli output 2019-02-11 10:01:40 -08:00
Alexander Regueiro
c3e182cf43 rustc: doc comments 2019-02-10 23:42:32 +00:00
Taiki Endo
2be0993c4e Revert removed #![feature(nll)] 2019-02-10 16:13:30 +09:00
bors
3315728c06 Auto merge of #57944 - estebank:unclosed-delim-the-quickening, r=oli-obk
Deduplicate mismatched delimiter errors

Delay unmatched delimiter errors until after the parser has run to deduplicate them when parsing and attempt recovering intelligently.

Second attempt at #54029, follow up to #53949. Fix #31528.
2019-02-09 20:15:57 +00:00
Guillaume Gomez
8b886e07f5 Remove images' url to make it work even without internet connection 2019-02-07 11:06:19 +01:00
Esteban Küber
7451cd8dc0 Deduplicate mismatched delimiter errors
Delay unmatched delimiter errors until after the parser has run to
deduplicate them when parsing and attempt recovering intelligently.
2019-02-07 01:41:30 -08:00
Taiki Endo
950fe6686d librustc_errors => 2018 2019-02-07 03:53:01 +09:00
Andy Russell
0897ffc28f
remove _with_applicability from suggestion fns 2019-01-26 23:07:55 -05:00
Andy Russell
8eaa84c79f
document Applicability 2019-01-26 23:06:08 -05:00
Esteban Küber
c4b8df5df2 Remove unnecessary dummy span checks
The emitter already verifies wether a given span note or span label
can be emitted to the output. If it can't, because it is a dummy
span, it will be either elided for labels or emitted as an unspanned
note/help when applicable.
2019-01-20 13:29:03 -08:00
Mazdak Farrokhzad
e78bde4015
Rollup merge of #57699 - euclio:applicability-ify, r=petrochenkov
add applicability to remaining suggestions

Fixes #50723.

I noticed that the suggestion methods on `DiagnosticBuilder` weren't actually deprecated due to #57679. This PR deprecates them properly and fixes the remaining usages.

There's also a PR for clippy at rust-lang/rust-clippy#3667.
2019-01-19 14:21:23 +01:00
Dan Robertson
e3ba6ed3f5
Fix suggestions given mulitple bad lifetimes
When given multiple lifetimes prior to type parameters in generic
parameters, do not ICE and print the correct suggestion.
2019-01-18 01:10:14 +00:00
Andy Russell
02843d9eb7
properly deprecate suggestion methods 2019-01-17 10:18:56 -05:00
John Kåre Alsaker
03b7cec2de Replace LockCell with atomic types 2018-12-29 12:46:37 +01:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Alex Crichton
cf47a19305 Bump to 1.33.0
* Update bootstrap compiler
* Update version to 1.33.0
* Remove some `#[cfg(stage0)]` annotations

Actually updating the version number is blocked on updating Cargo
2018-12-12 08:09:26 -08:00
kennytm
0e41ef13aa
Rollup merge of #56516 - frewsxcv:frewsxcv-eq, r=Mark-Simulacrum
Replace usages of `..i + 1` ranges with `..=i`.

Before this change we were using old computer code techniques. After this change we use the new and improved computer code techniques.
2018-12-07 12:42:32 +08:00
Matthew Russo
f0f8aa9e05 adds DocTest filename variant, refactors doctest_offset out of source_map, fixes remaining test failures 2018-12-04 19:52:42 -05:00
Corey Farwell
c025d61409 Replace usages of ..i + 1 ranges with ..=i. 2018-12-04 12:05:19 -08:00
Esteban Küber
c45871ba02 Keep label on moved spans and point at macro invocation on parse error 2018-11-23 15:37:31 -08:00
Alex Crichton
255cc1aed3 rustc: Request ansi colors if stderr isn't a tty
Currently Cargo will always capture the output of rustc meaning that
rustc is never hooked up to a tty. To retain colors Cargo uses the
`fwdansi` crate to ensure that ansi color codes are translated to
windows terminal methods (and ansi codes otherwise just go their natural
route on Unix).

Cargo passes `--color always` to rustc to ensure that using a pipe
doesn't trick it into not emitting colors at all. It turns out, however,
that `--color always` ends up still accidentally using the native shell
api on native windows shells.

The fix here is to instead pass `AlwaysAnsi` to `termcolor` instead of
`Always`, ensuring that when `--color always` is passed to rustc and its
output isn't a terminal, we're always generating ansi colors regardless
of the platform.

Closes #55769
2018-11-08 07:53:03 -08:00
ljedrz
9ff0f33748 Pass suggestions as impl Iterator instead of Vec 2018-10-31 13:56:20 +01:00
David Lavati
6c9f6a1afd Rename other occs of (Code/File)Map to Source(Map/File) #51574 2018-10-29 21:26:13 +01:00
bors
ca2639e82e Auto merge of #55014 - ljedrz:lazyboye_unwraps, r=matthewjasper
Prefer unwrap_or_else to unwrap_or in case of function calls/allocations

The contents of `unwrap_or` are evaluated eagerly, so it's not a good pick in case of function calls and allocations. This PR also changes a few `unwrap_or`s with `unwrap_or_default`.

An added bonus is that in some cases this change also reveals if the object it's called on is an `Option` or a `Result` (based on whether the closure takes an argument).
2018-10-20 11:22:48 +00:00
Oliver Scherer
ab3f37ec43 Free some memory instead of just dropping elements 2018-10-19 14:34:44 +02:00
Oliver Scherer
3c9258e604 Prefer Default::default over FxHash*::default in struct constructors 2018-10-19 14:34:44 +02:00
Oliver Scherer
ee81739dc1 Deprecate the FxHashMap() and FxHashSet() constructor function hack 2018-10-19 14:34:44 +02:00
ljedrz
d28aed6dc4 Prefer unwrap_or_else to unwrap_or in case of function calls/allocations 2018-10-19 09:45:45 +02:00
ljedrz
a01a994231 A handful of random string-related improvements 2018-10-10 10:39:18 +02:00