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

Reorder span suggestions to appear below main labels #43251

Merged
merged 1 commit into from
Jul 20, 2017

Conversation

gaurikholkar-zz
Copy link

@gaurikholkar-zz gaurikholkar-zz commented Jul 15, 2017

A fix to #41698

r? @nikomatsakis

Copy link
Contributor

@oli-obk oli-obk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a nit. Lgtm otherwise

r? @nikomatsakis

@@ -347,8 +347,7 @@ impl EmitterWriter {

// Sort the annotations by (start, end col)
let mut annotations = line.annotations.clone();
annotations.sort();
annotations.reverse();
annotations.sort_by(|a,b| b.start_col.cmp(&a.start_col));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment here about what and why this is done, the reversing is pretty subtle.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that a comment would be good. I personally have no idea why this yields the correct result. =) But the change looks good!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have a list of annotations (A1, A2, C1, C2, B1, B2) where the letter signifies the span, since we are only sorting by the span, the order of the elements with the same span will never change. Since we are reversing the ordering (|a, b| but b.cmp(a)), you get (C1, C2, B1, B2, A1, A2). All the elements with the same span are still ordered first to last, but all the elements with different spans are ordered by their spans in last to first order. Last to first order is important, because the jiggly lines and | are on the left, so the rightmost span needs to be rendered first, otherwise the lines would end up needing to go over a message.

If the above is comprehensible, I think it can be copy pasted as the requested comment ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we are only sorting by the span, the order of the elements with the same span will never change

This is because our sort is stable?

Copy link
Author

@gaurikholkar-zz gaurikholkar-zz Jul 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikomatsakis the documentation says that sort_by is stable though. @oli-obk @evolarium

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a pretty decent description. =)

@oli-obk
Copy link
Contributor

oli-obk commented Jul 16, 2017

hmm, bors does't like review comments. I'm not a reviewer, so:

r? @nikomatsakis

@Mark-Simulacrum Mark-Simulacrum added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 17, 2017
Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment explaining why the sort produces the desired effect would be good! But otherwise looks nice.

@bors
Copy link
Contributor

bors commented Jul 17, 2017

☔ The latest upstream changes (presumably #42033) made this pull request unmergeable. Please resolve the merge conflicts.

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jul 17, 2017

📌 Commit 66f3c07 has been approved by nikomatsakis

@oli-obk
Copy link
Contributor

oli-obk commented Jul 17, 2017

You have some trailing whitespace in emitter.rs

[00:03:00] tidy error: /checkout/src/librustc_errors/emitter.rs:351: trailing whitespace
[00:03:00] tidy error: /checkout/src/librustc_errors/emitter.rs:352: trailing whitespace
[00:03:00] tidy error: /checkout/src/librustc_errors/emitter.rs:354: trailing whitespace
[00:03:00] tidy error: /checkout/src/librustc_errors/emitter.rs:355: trailing whitespace
[00:03:00] tidy error: /checkout/src/librustc_errors/emitter.rs:356: trailing whitespace
[00:03:00] tidy error: /checkout/src/librustc_errors/emitter.rs:357: trailing whitespace
[00:03:00] tidy error: /checkout/src/librustc_errors/emitter.rs:358: trailing whitespace

@gaurikholkar-zz
Copy link
Author

@oli-obk fixed the tidy errors.

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jul 17, 2017

📌 Commit 601a7a9 has been approved by nikomatsakis

@Mark-Simulacrum
Copy link
Member

Could you squash the commits down?

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jul 17, 2017

📌 Commit 26a8357 has been approved by nikomatsakis

@bors
Copy link
Contributor

bors commented Jul 18, 2017

⌛ Testing commit 26a8357 with merge 67cdb87d51c55b3a1b2e70f37992f70f8fcda9e9...

@bors
Copy link
Contributor

bors commented Jul 18, 2017

💔 Test failed - status-travis

@est31
Copy link
Member

est31 commented Jul 18, 2017

@bors retry

@arielb1 arielb1 added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 18, 2017
@bors
Copy link
Contributor

bors commented Jul 19, 2017

⌛ Testing commit 26a8357 with merge f868a5ba86c3e204cfde67a7ec9405bd6433bbee...

@bors
Copy link
Contributor

bors commented Jul 19, 2017

💔 Test failed - status-appveyor

@oli-obk
Copy link
Contributor

oli-obk commented Jul 19, 2017

spurious?

 Downloading toml v0.1.30
error: unable to get packages from source
Caused by:
  [35] SSL connect error (schannel: next InitializeSecurityContext failed: Unknown error (0x80092013) - The revocation function was unable to check revocation because the revocation server was offline.)
failed to run: C:\projects\rust\build\x86_64-pc-windows-msvc\stage0\bin/cargo.exe build --manifest-path C:\projects\rust\src/bootstrap/Cargo.toml --locked
Build completed unsuccessfully in 0:01:05
make: *** [Makefile:77: prepare] Error 1
Command failed. Attempt 2/5:
 Downloading libc v0.2.26
error: unable to get packages from source
Caused by:
  [35] SSL connect error (schannel: next InitializeSecurityContext failed: Unknown error (0x80092013) - The revocation function was unable to check revocation because the revocation server was offline.)
failed to run: C:\projects\rust\build\x86_64-pc-windows-msvc\stage0\bin/cargo.exe build --manifest-path C:\projects\rust\src/bootstrap/Cargo.toml --locked
Build completed unsuccessfully in 0:00:00
make: *** [Makefile:77: prepare] Error 1
Command failed. Attempt 3/5:
 Downloading cmake v0.1.24
error: unable to get packages from source
Caused by:
  [35] SSL connect error (schannel: next InitializeSecurityContext failed: Unknown error (0x80092013) - The revocation function was unable to check revocation because the revocation server was offline.)
failed to run: C:\projects\rust\build\x86_64-pc-windows-msvc\stage0\bin/cargo.exe build --manifest-path C:\projects\rust\src/bootstrap/Cargo.toml --locked
Build completed unsuccessfully in 0:00:00
make: *** [Makefile:77: prepare] Error 1
Command failed. Attempt 4/5:
 Downloading libc v0.2.26
error: unable to get packages from source
Caused by:
  [35] SSL connect error (schannel: next InitializeSecurityContext failed: Unknown error (0x80092013) - The revocation function was unable to check revocation because the revocation server was offline.)
failed to run: C:\projects\rust\build\x86_64-pc-windows-msvc\stage0\bin/cargo.exe build --manifest-path C:\projects\rust\src/bootstrap/Cargo.toml --locked
Build completed unsuccessfully in 0:00:00
make: *** [Makefile:77: prepare] Error 1
Command failed. Attempt 5/5:
 Downloading filetime v0.1.10
error: unable to get packages from source
Caused by:
  [35] SSL connect error (schannel: next InitializeSecurityContext failed: Unknown error (0x80092013) - The revocation function was unable to check revocation because the revocation server was offline.)
failed to run: C:\projects\rust\build\x86_64-pc-windows-msvc\stage0\bin/cargo.exe build --manifest-path C:\projects\rust\src/bootstrap/Cargo.toml --locked
Build completed unsuccessfully in 0:00:00
make: *** [Makefile:77: prepare] Error 1
The command has failed after 5 attempts.
Command exited with code 1

@gaurikholkar-zz
Copy link
Author

Network connectivity issues?

@est31
Copy link
Member

est31 commented Jul 19, 2017

@gaurikholkar #43178 (comment)

@nagbot-rs
Copy link

nagbot-rs commented Jul 19, 2017 via email

@bors
Copy link
Contributor

bors commented Jul 19, 2017

@nagbot-rs: 🔑 Insufficient privileges: and not in try users

@alexcrichton
Copy link
Member

@bors: retry

@bors
Copy link
Contributor

bors commented Jul 20, 2017

⌛ Testing commit 26a8357 with merge 1beaea2...

bors added a commit that referenced this pull request Jul 20, 2017
Reorder span suggestions to appear below main labels

A fix to #41698

r? @nikomatsakis
@bors
Copy link
Contributor

bors commented Jul 20, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants