Commit Graph

362 Commits

Author SHA1 Message Date
Alex Crichton
345ba505ec rustc: Remove dylib crate type from most rustc crates
Now that procedural macros no longer link transitively to libsyntax,
this shouldn't be needed any more! This commit is an experiment in
removing all dynamic libraries from rustc except for librustc_driver
itself. Let's see how far we can get with that!
2019-07-07 03:23:00 +02:00
Mazdak Farrokhzad
485a084b45
Rollup merge of #61545 - flip1995:internal_lints, r=oli-obk
Implement another internal lints

cc #49509

This adds ~~two~~ one internal lint~~s~~:
1. LINT_PASS_IMPL_WITHOUT_MACRO: Make sure, that the `{declare,impl}_lint_pass` macro is used to implement lint passes. cc #59669
2. ~~USAGE_OF_TYCTXT_AND_SPAN_ARGS: item 2 on the list in #49509~~

~~With 2. I wasn't sure, if this lint should be applied everywhere. That means a careful review of 0955835 would be great. Also 73fb9b4 allows this lint on some functions. Should I also apply this lint there?~~

TODO (not directly relevant for review):
- [ ] https://github.com/rust-lang/rust/pull/59316#discussion_r280186517 (not sure yet, if this works or how to query for `rustc_private`, since it's not in [`Features`](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/feature_gate/struct.Features.html) 🤔 cc @eddyb)
- [x] https://github.com/rust-lang/rust/pull/61735#discussion_r292389870
- [x] Check explicitly for the `{declare,impl}_lint_pass!` macros

r? @oli-obk
2019-07-05 20:26:51 +02:00
Jeremy Stucki
ec711767a7
Remove needless lifetimes 2019-07-03 10:01:02 +02:00
Mazdak Farrokhzad
4aa3e27231
Rollup merge of #62131 - Xanewok:clip-some-nits, r=petrochenkov
libsyntax: Fix some Clippy warnings

When I was working on it before a lot of these popped up in the RLS so I figured I'll send a small patch fixing only the (hopefully) uncontroversial ones.

Others that could be also fixed included also [`clippy::print_with_newline`](https://rust-lang.github.io/rust-clippy/master/index.html#print_with_newline) and [`clippy::cast_lossless`](https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless). Should I add them as well?

since most of it touches libsyntax...
r? @petrochenkov
2019-06-27 23:01:09 +02:00
Igor Matuszewski
1af1f6277e Fix clippy::print_with_newline 2019-06-26 14:11:58 +02:00
Igor Matuszewski
12806b7050 Fix clippy::redundant_field_names 2019-06-26 13:59:58 +02:00
flip1995
084c829fb8
Enable internal lints in bootstrap 2019-06-24 10:45:20 +02:00
Matthew Jasper
95a32157af Count all errors for track_errors 2019-06-22 15:36:24 +01:00
Matthew Jasper
30b6c59f24 Prefer to use has_errors to err_count 2019-06-22 15:36:24 +01:00
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