// and "annotations lines", where the highlight lines have the `^`.
// Sort the annotations by (start, end col)
+ // The labels are reversed, sort and then reversed again.
+ // Consider a list of annotations (A1, A2, C1, C2, B1, B2) where
+ // the letter signifies the span. Here we are only sorting by the
+ // span and hence, the order of the elements with the same span will
+ // not change. On 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.
+
let mut annotations = line.annotations.clone();
- annotations.sort();
- annotations.reverse();
+ annotations.sort_by(|a,b| b.start_col.cmp(&a.start_col));
// First, figure out where each label will be positioned.
//
17 | (&mut self).bar();
| ^^^^
| |
- | try removing `&mut` here
| cannot reborrow mutably
+ | try removing `&mut` here
error[E0596]: cannot borrow immutable argument `self` as mutable
--> $DIR/issue-31424.rs:23:15
16 | self.run(&mut self);
| ^^^^
| |
- | try removing `&mut` here
| cannot reborrow mutably
+ | try removing `&mut` here
error: aborting due to previous error
16 | get(&mut key);
| ^^^
| |
- | try removing `&mut` here
| cannot reborrow mutably
+ | try removing `&mut` here
error: aborting due to previous error
22 | test(&mut x);
| ^
| |
- | try removing `&mut` here
| cannot reborrow mutably
+ | try removing `&mut` here
error: aborting due to previous error
19 | let e = f.v[0];
| ^^^^^^
| |
- | help: consider using a reference instead: `&f.v[0]`
| cannot move out of indexed content
+ | help: consider using a reference instead: `&f.v[0]`
error: aborting due to previous error
14 | foo(|y: String| { });
| ^^^ --------------- implements `std::ops::Fn<(std::string::String,)>`
| |
- | requires `std::ops::Fn<(usize,)>`
| expected usize, found struct `std::string::String`
+ | requires `std::ops::Fn<(usize,)>`
|
= note: required by `foo`
18 | baz(|_| ());
| ^^^ ------ implements `std::ops::Fn<(_,)>`
| |
- | requires `for<'r> std::ops::Fn<(&'r (),)>`
| expected concrete lifetime, found bound lifetime parameter
+ | requires `for<'r> std::ops::Fn<(&'r (),)>`
|
= note: required because of the requirements on the impl of `Foo` for `[closure@$DIR/closure-mismatch.rs:18:9: 18:15]`
= note: required by `baz`
17 | once::<&str>("str").fuse().filter(|a: &str| true).count();
| ^^^^^^ -------------- implements `for<'r> std::ops::FnMut<(&'r str,)>`
| |
- | requires `for<'r> std::ops::FnMut<(&'r &str,)>`
| expected &str, found str
+ | requires `for<'r> std::ops::FnMut<(&'r &str,)>`
error: aborting due to 2 previous errors
25 | let z = call_it(3, f);
| ^^^^^^^
| |
- | requires `std::ops::FnMut<(isize, isize)>`
| expected isize, found usize
+ | requires `std::ops::FnMut<(isize, isize)>`
|
= note: required by `call_it`
52 | whiskers -= other;
| ^^^^^^^^
| |
- | help: try: `self.whiskers`
| `self` value is only available in methods with `self` parameter
+ | help: try: `self.whiskers`
error[E0425]: cannot find function `shave` in this scope
--> $DIR/issue-2356.rs:57:5
110 | whiskers = 4;
| ^^^^^^^^
| |
- | help: try: `self.whiskers`
| `self` value is only available in methods with `self` parameter
+ | help: try: `self.whiskers`
error[E0425]: cannot find function `purr_louder` in this scope
--> $DIR/issue-2356.rs:115:5
13 | impl K for isize {} //~ ERROR expected trait, found type alias `K`
| ^
| |
- | type aliases cannot be used for traits
| did you mean `I`?
+ | type aliases cannot be used for traits
error: cannot continue compilation due to previous error
26 | Z;
| ^
| |
- | did you mean `Z { /* fields */ }`?
| did you mean `S`?
| constructor is not visible here due to private fields
+ | did you mean `Z { /* fields */ }`?
|
help: possible better candidate is found in another module, you can import it into scope
|
36 | S;
| ^
| |
- | did you mean `S { /* fields */ }`?
| constructor is not visible here due to private fields
+ | did you mean `S { /* fields */ }`?
|
help: possible better candidate is found in another module, you can import it into scope
|
42 | xcrate::S;
| ^^^^^^^^^
| |
- | did you mean `xcrate::S { /* fields */ }`?
| constructor is not visible here due to private fields
+ | did you mean `xcrate::S { /* fields */ }`?
|
help: possible better candidate is found in another module, you can import it into scope
|
19 | f(cx);
| ^^
| |
- | help: try: `self.cx`
| `self` value is only available in methods with `self` parameter
+ | help: try: `self.cx`
error: aborting due to previous error
25 | if x = x {
| ^^^^^
| |
- | help: did you mean to compare equality?: `x == x`
| expected bool, found ()
+ | help: did you mean to compare equality?: `x == x`
|
= note: expected type `bool`
found type `()`
31 | if (x = x) {
| ^^^^^^^
| |
- | help: did you mean to compare equality?: `x == x`
| expected bool, found ()
+ | help: did you mean to compare equality?: `x == x`
|
= note: expected type `bool`
found type `()`
37 | if y = (Foo { foo: x }) {
| ^^^^^^^^^^^^^^^^^^^^
| |
- | help: did you mean to compare equality?: `y == (Foo { foo: x })`
| expected bool, found ()
+ | help: did you mean to compare equality?: `y == (Foo { foo: x })`
|
= note: expected type `bool`
found type `()`
43 | if 3 = x {
| ^^^^^
| |
- | help: did you mean to compare equality?: `3 == x`
| expected bool, found ()
+ | help: did you mean to compare equality?: `3 == x`
|
= note: expected type `bool`
found type `()`