From 6f64432a3933475321d0083b1876d07b2f06cd7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Wed, 23 Nov 2022 14:51:24 -0800 Subject: [PATCH] Tweak output --- compiler/rustc_errors/src/emitter.rs | 2 +- ...alloc-error-handler-bad-signature-1.stderr | 16 +++++++-------- ...alloc-error-handler-bad-signature-2.stderr | 20 ++++++++----------- .../suggestions/suggest-remove-refs-3.stderr | 6 +++--- 4 files changed, 20 insertions(+), 24 deletions(-) diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index d22f3ca4214..1fabe15ff83 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -2282,7 +2282,7 @@ impl FileWithAnnotatedLines { } // Find overlapping multiline annotations, put them at different depths - multiline_annotations.sort_by_key(|&(_, ref ml)| (ml.line_start, ml.line_end)); + multiline_annotations.sort_by_key(|&(_, ref ml)| (ml.line_start, usize::MAX - ml.line_end)); for (_, ann) in multiline_annotations.clone() { for (_, a) in multiline_annotations.iter_mut() { // Move all other multiline annotations overlapping with this one diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr index 3e840a28a92..dd3665f22ac 100644 --- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr +++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr @@ -10,10 +10,10 @@ LL | fn oom( LL | || info: &Layout, LL | || ) -> () | ||_______- arguments to this function are incorrect -LL | | { -LL | | loop {} -LL | | } - | |_^ expected `&Layout`, found struct `Layout` +LL | | { +LL | | loop {} +LL | | } + | |__^ expected `&Layout`, found struct `Layout` | note: function defined here --> $DIR/alloc-error-handler-bad-signature-1.rs:10:4 @@ -36,10 +36,10 @@ LL | fn oom( LL | || info: &Layout, LL | || ) -> () | ||_______^ expected `!`, found `()` -LL | | { -LL | | loop {} -LL | | } - | |_- expected `!` because of return type +LL | | { +LL | | loop {} +LL | | } + | |__- expected `!` because of return type | = note: expected type `!` found unit type `()` diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr index 7cbfd557705..adb652fe616 100644 --- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr +++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr @@ -9,12 +9,10 @@ LL | fn oom( | || LL | || info: Layout, LL | || ) { - | || - - | ||_| - | | arguments to this function are incorrect -LL | | loop {} -LL | | } - | |_^ expected struct `Layout`, found struct `core::alloc::Layout` + | ||_- arguments to this function are incorrect +LL | | loop {} +LL | | } + | |__^ expected struct `Layout`, found struct `core::alloc::Layout` | = note: struct `core::alloc::Layout` and struct `Layout` have similar names, but are actually distinct types note: struct `core::alloc::Layout` is defined in crate `core` @@ -47,12 +45,10 @@ LL | fn oom( | || LL | || info: Layout, LL | || ) { - | || ^ - | ||_| - | | expected `!`, found `()` -LL | | loop {} -LL | | } - | |_- expected `!` because of return type + | ||_^ expected `!`, found `()` +LL | | loop {} +LL | | } + | |__- expected `!` because of return type | = note: expected type `!` found unit type `()` diff --git a/src/test/ui/suggestions/suggest-remove-refs-3.stderr b/src/test/ui/suggestions/suggest-remove-refs-3.stderr index b1afa2b0a6b..31cca323d0e 100644 --- a/src/test/ui/suggestions/suggest-remove-refs-3.stderr +++ b/src/test/ui/suggestions/suggest-remove-refs-3.stderr @@ -7,9 +7,9 @@ LL | for (i, _) in & & & | || LL | || & &v | ||___________- help: consider removing 5 leading `&`-references -LL | | .iter() -LL | | .enumerate() { - | |____________________^ `&&&&&Enumerate>` is not an iterator +LL | | .iter() +LL | | .enumerate() { + | |_____________________^ `&&&&&Enumerate>` is not an iterator | = help: the trait `Iterator` is not implemented for `&&&&&Enumerate>` = note: required for `&&&&&Enumerate>` to implement `IntoIterator`