Commit Graph

31 Commits

Author SHA1 Message Date
Matthew Jasper cbcef3effc Rework `rustc_serialize`
- Move the type parameter from `encode` and `decode` methods to
  the trait.
- Remove `UseSpecialized(En|De)codable` traits.
- Remove blanket impls for references.
- Add `RefDecodable` trait to allow deserializing to arena-allocated
  references safely.
- Remove ability to (de)serialize HIR.
- Create proc-macros `(Ty)?(En|De)codable` to help implement these new
  traits.
2020-08-14 17:34:30 +01:00
Matthias Krüger 9523c89f18 use is_empty() instead of len() == x to determine if structs are empty. 2020-02-28 15:16:27 +01:00
Mark Rousskov a06baa56b9 Format the world 2019-12-22 17:42:47 -05: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
Esteban Küber b5690c2cb8 Fix MultilineAnnotation field name 2019-03-28 20:19:50 -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
Taiki Endo 950fe6686d librustc_errors => 2018 2019-02-07 03:53:01 +09:00
Mark Rousskov 2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Esteban Küber ed5dcc3118 Remove highlighting from secondary messages
Deemphasize the secondary messages so that all other highlights stand
out more.
2018-06-11 15:52:10 -07:00
Manish Goregaokar c785013951 Remove dead code 2018-02-02 09:18:49 +05:30
varkor 0ac465924e Add line numbers and columns to error messages spanning multiple files
If an error message is emitted that spans several files, only the
primary file currently has line and column data attached. This is
useful information, even in files other than the one in which the error
occurs. We can often work out which line and column the error
corresponds to in other files — in this case it is helpful to add them
(in the case of ambiguity, the first relevant line/column is picked,
which is still helpful than none).
2018-01-26 15:33:05 +00:00
kennytm 0af67a4df0 Rollup merge of #46052 - oli-obk:rendered_diagnostics_in_json, r=petrochenkov
Include rendered diagnostic in json

r? @petrochenkov
2017-11-22 01:12:59 +08:00
Oliver Schneider ddaf523aa4
The end of a span can be *before* the first char in a line 2017-11-20 09:37:54 +01:00
Alex Burka c73bcf043e show macro backtrace with env var 2017-11-19 22:22:22 +00:00
Michael Woerister 6fccd71f75 librustc_errors: Don't emit the same error message twice. 2017-10-25 15:01:06 +02:00
Fourchaux c7104be1a3 Fix typos & us spellings 2017-08-15 21:56:30 +02:00
Kevin Mehall 17bd76a516 Remove unused code from librustc_errors 2017-07-06 18:49:32 -07:00
Esteban Küber cc07c357e4 Reduce visual clutter of multiline start when possible
When a span starts on a line with nothing but whitespace to the left,
and there are no other annotations in that line, simplify the visual
representation of the span.

Go from:

```rust
error[E0072]: recursive type `A` has infinite size
 --> file2.rs:1:1
  |
1 |   struct A {
  |  _^ starting here...
2 | |     a: A,
3 | | }
  | |_^ ...ending here: recursive type has infinite size
  |
```

To:

```rust
error[E0072]: recursive type `A` has infinite size
 --> file2.rs:1:1
  |
1 | / struct A {
2 | |     a: A,
3 | | }
  | |_^ recursive type has infinite size
```

Remove `starting here...`/`...ending here` labels from all multiline
diagnostics.
2017-04-20 17:31:20 -07:00
Esteban Küber 4bc7f5b52c Always show end line of multiline annotations
```rust
error[E0046]: not all trait items implemented, missing: `Item`
  --> $DIR/issue-23729.rs:20:9
   |
20 |           impl Iterator for Recurrence {
   |  _________^ starting here...
21 | |             //~^ ERROR E0046
22 | |             //~| NOTE missing `Item` in implementation
23 | |             //~| NOTE `Item` from trait: `type Item;`
...  |
36 | |             }
37 | |         }
   | |_________^ ...ending here: missing `Item` in implementation
   |
   = note: `Item` from trait: `type Item;`
```

instead of

```rust
error[E0046]: not all trait items implemented, missing: `Item`
  --> $DIR/issue-23729.rs:20:9
   |
20 |         impl Iterator for Recurrence {
   |         ^ missing `Item` in implementation
   |
   = note: `Item` from trait: `type Item;`
```
2017-04-09 13:48:25 -07:00
Niko Matsakis d9aaca71cc store typeck lints in the `TypeckTables`
Otherwise they are a "hidden output"
2017-02-02 20:38:16 -05:00
bors d2d8ae6575 Auto merge of #39214 - estebank:fix-labels-without-msg, r=nikomatsakis
Fix multiple labels when some don't have message

The diagnostic emitter now accounts for labels with no text message, presenting the underline on its own, without drawing the line for the non existing message below it. Go from

```
error: foo
 --> test.rs:3:6
  |
3 |   a { b { c } d }
  |   ----^^^^^^^----
  |   |   |
  |   |   `b` is a good letter
  |
```

to

```
error: foo
 --> test.rs:3:6
  |
3 |   a { b { c } d }
  |   ----^^^^^^^----
  |       |
  |       `b` is a good letter
```

from

```
error: foo
 --> test.rs:3:6
  |
3 |   a { b { c } d }
  |   ^^^^-------^^^^
  |   |   |
  |   |
  |   `a` is a good letter
```

to

```
error: foo
 --> test.rs:3:6
  |
3 |   a { b { c } d }
  |   ^^^^-------^^^^ `a` is a good letter
```

and from

```
error: foo
 --> test.rs:3:6
  |
3 |   a { b { c } d }
  |   ^^^^-------^^^^
  |   |   |
  |   |
  |
```

to

```
error: foo
 --> test.rs:3:6
  |
3 |   a { b { c } d }
  |   ^^^^-------^^^^
```
r? @nikomatsakis
cc @jonathandturner, @GuillaumeGomez, @nrc
2017-01-24 11:51:34 +00:00
Esteban Küber 469ecef422 Fix multiple labels when some don't have message
The diagnostic emitter now accounts for labels with no text message,
presenting the underline on its own, without drawing the line for the
non existing message below it. Go from

```
error: foo
 --> test.rs:3:6
  |
3 |   a { b { c } d }
  |   ----^^^^^^^----
  |   |   |
  |   |   `b` is a good letter
  |
```

to

```
error: foo
 --> test.rs:3:6
  |
3 |   a { b { c } d }
  |   ----^^^^^^^----
  |       |
  |       `b` is a good letter
```

and from

```
error: foo
 --> test.rs:3:6
  |
3 |   a { b { c } d }
  |   ^^^^-------^^^^
  |   |   |
  |   |
  |   `a` is a good letter
```

to

```
error: foo
 --> test.rs:3:6
  |
3 |   a { b { c } d }
  |   ^^^^-------^^^^ `a` is a good letter
```
2017-01-20 21:15:24 -08:00
Esteban Küber fc774e629f Teach Diagnostics to highlight text 2017-01-17 14:28:53 -08:00
Esteban Küber b7982bbbe0 review comments 2016-11-23 23:44:17 -08:00
Esteban Küber eb53ca3aad Show multiline spans in full if short enough
When dealing with multiline spans that span few lines, show the complete
span instead of restricting to the first character of the first line.

For example, instead of:

```
% ./rustc foo.rs
error[E0277]: the trait bound `{integer}: std::ops::Add<()>` is not satisfied
  --> foo.rs:13:9
   |
13 |    foo(1 + bar(x,
   |        ^ trait `{integer}: std::ops::Add<()>` not satisfied
   |
```

show

```
% ./rustc foo.rs
error[E0277]: the trait bound `{integer}: std::ops::Add<()>` is not satisfied
  --> foo.rs:13:9
   |
13 |      foo(1 + bar(x,
   |  ________^ starting here...
14 | |            y),
   | |_____________^ ...ending here: trait `{integer}: std::ops::Add<()>` not satisfied
   |
```
2016-11-22 13:42:36 -08:00
Srinivas Reddy Thatiparthy b260617345
run rustfmt on librustc_errors folder 2016-10-18 23:13:02 +05:30
Jonathan Turner fad4f32c31 Turn on new errors, json mode. Remove duplicate unicode test 2016-08-07 07:46:49 -07:00
Jonathan Turner 2f2c3e1783 DCE and fixing some internal tests 2016-07-14 07:57:46 -04:00
Jonathan Turner 71ec2867e3 Implement latest rfc style using simpler rendering 2016-07-14 07:57:46 -04:00
Jonathan Turner 80f1c78752 make old school mode a bit more configurable 2016-06-23 15:19:40 -04:00
Jonathan Turner 2b8bab095d Move test helper functions to consolidated codemap testing 2016-06-23 10:50:05 -04:00