Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiple labels when some don't have message #39214

Merged
merged 1 commit into from
Jan 24, 2017

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Jan 21, 2017

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

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
```
@estebank
Copy link
Contributor Author

For an example of what this bug actually looks like in practice (taken from #39202):

The presentation logic should still allow for labels without messages with a reasonable output. Given that, the proper thing to do is to not have labels without a message, specially when multiple labels might overlap. Cases that would now be shown in this way

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

might actually be masking

error: foo
 --> test.rs:3:6
  |
3 |   a { b { c } d }
  |   ----^^^^^^^----
  |   | | |       |
  |   | | |       something about d
  |   | | something about b and its block
  |   | something about the a block
  |   something about a

Thankfully, this is a very contrived example.

@GuillaumeGomez
Copy link
Member

This is really great! 👍

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jan 23, 2017

📌 Commit 469ecef has been approved by nikomatsakis

@bors
Copy link
Contributor

bors commented Jan 23, 2017

⌛ Testing commit 469ecef with merge 7814fb7...

bors added a commit that referenced this pull request Jan 23, 2017
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
@bors
Copy link
Contributor

bors commented Jan 23, 2017

💔 Test failed - status-travis

@alexcrichton
Copy link
Member

alexcrichton commented Jan 23, 2017 via email

@bors
Copy link
Contributor

bors commented Jan 24, 2017

⌛ Testing commit 469ecef with merge 067221f...

@bors
Copy link
Contributor

bors commented Jan 24, 2017

💔 Test failed - status-travis

@alexcrichton
Copy link
Member

alexcrichton commented Jan 24, 2017 via email

@bors
Copy link
Contributor

bors commented Jan 24, 2017

⌛ Testing commit 469ecef with merge d2d8ae6...

bors added a commit that referenced this pull request Jan 24, 2017
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
@bors
Copy link
Contributor

bors commented Jan 24, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing d2d8ae6 to master...

@bors bors merged commit 469ecef into rust-lang:master Jan 24, 2017
@estebank estebank deleted the fix-labels-without-msg branch November 9, 2023 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants