Fix spacing of expected/found notes without a label
This commit is contained in:
parent
ff991d6034
commit
3fea832fd7
@ -193,9 +193,18 @@ impl Diagnostic {
|
||||
expected_extra: &dyn fmt::Display,
|
||||
found_extra: &dyn fmt::Display,
|
||||
) -> &mut Self {
|
||||
let expected_label = format!("expected {}", expected_label);
|
||||
|
||||
let found_label = format!("found {}", found_label);
|
||||
let expected_label = expected_label.to_string();
|
||||
let expected_label = if expected_label.is_empty() {
|
||||
"expected".to_string()
|
||||
} else {
|
||||
format!("expected {}", expected_label)
|
||||
};
|
||||
let found_label = found_label.to_string();
|
||||
let found_label = if found_label.is_empty() {
|
||||
"found".to_string()
|
||||
} else {
|
||||
format!("found {}", found_label)
|
||||
};
|
||||
let (found_padding, expected_padding) = if expected_label.len() > found_label.len() {
|
||||
(expected_label.len() - found_label.len(), 0)
|
||||
} else {
|
||||
|
@ -14,16 +14,16 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | bar(foo, x)
|
||||
| ^
|
||||
= note: expected `Type<'_>`
|
||||
found `Type<'a>`
|
||||
= note: expected `Type<'_>`
|
||||
found `Type<'a>`
|
||||
= note: but, the lifetime must be valid for the static lifetime...
|
||||
note: ...so that the expression is assignable
|
||||
--> $DIR/project-fn-ret-invariant.rs:48:4
|
||||
|
|
||||
LL | bar(foo, x)
|
||||
| ^^^^^^^^^^^
|
||||
= note: expected `Type<'static>`
|
||||
found `Type<'_>`
|
||||
= note: expected `Type<'static>`
|
||||
found `Type<'_>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -14,16 +14,16 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | static_val(x);
|
||||
| ^
|
||||
= note: expected `std::boxed::Box<dyn std::fmt::Debug>`
|
||||
found `std::boxed::Box<(dyn std::fmt::Debug + 'a)>`
|
||||
= note: expected `std::boxed::Box<dyn std::fmt::Debug>`
|
||||
found `std::boxed::Box<(dyn std::fmt::Debug + 'a)>`
|
||||
= note: but, the lifetime must be valid for the static lifetime...
|
||||
note: ...so that the types are compatible
|
||||
--> $DIR/dyn-trait.rs:20:5
|
||||
|
|
||||
LL | static_val(x);
|
||||
| ^^^^^^^^^^
|
||||
= note: expected `StaticTrait`
|
||||
found `StaticTrait`
|
||||
= note: expected `StaticTrait`
|
||||
found `StaticTrait`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -26,8 +26,8 @@ note: ...so that the types are compatible
|
||||
|
|
||||
LL | self.a();
|
||||
| ^
|
||||
= note: expected `&'a Self`
|
||||
found `&Self`
|
||||
= note: expected `&'a Self`
|
||||
found `&Self`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -27,8 +27,8 @@ note: ...so that the types are compatible
|
||||
|
|
||||
LL | self.foo();
|
||||
| ^^^
|
||||
= note: expected `&'a Self`
|
||||
found `&Self`
|
||||
= note: expected `&'a Self`
|
||||
found `&Self`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -117,8 +117,8 @@ note: ...so that the types are compatible
|
||||
|
|
||||
LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: expected `Publisher<'_>`
|
||||
found `Publisher<'_>`
|
||||
= note: expected `Publisher<'_>`
|
||||
found `Publisher<'_>`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
@ -14,8 +14,8 @@ note: ...so that the types are compatible
|
||||
|
|
||||
LL | match (&t,) {
|
||||
| ^^^^^
|
||||
= note: expected `(&&(T,),)`
|
||||
found `(&&'a (T,),)`
|
||||
= note: expected `(&&(T,),)`
|
||||
found `(&&'a (T,),)`
|
||||
note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 1:27...
|
||||
--> $DIR/issue-52213.rs:1:27
|
||||
|
|
||||
|
@ -20,8 +20,8 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | Box::new(self.out_edges(u).map(|e| e.target()))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: expected `std::boxed::Box<(dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node> + 'static)>`
|
||||
found `std::boxed::Box<dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node>>`
|
||||
= note: expected `std::boxed::Box<(dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node> + 'static)>`
|
||||
found `std::boxed::Box<dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node>>`
|
||||
|
||||
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
|
||||
--> $DIR/issue-55796.rs:21:9
|
||||
@ -45,8 +45,8 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | Box::new(self.in_edges(u).map(|e| e.target()))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: expected `std::boxed::Box<(dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node> + 'static)>`
|
||||
found `std::boxed::Box<dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node>>`
|
||||
= note: expected `std::boxed::Box<(dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node> + 'static)>`
|
||||
found `std::boxed::Box<dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node>>`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -26,8 +26,8 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | Foo { bar }
|
||||
| ^^^^^^^^^^^
|
||||
= note: expected `Foo<'_>`
|
||||
found `Foo<'_>`
|
||||
= note: expected `Foo<'_>`
|
||||
found `Foo<'_>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -19,8 +19,8 @@ note: ...so that the types are compatible
|
||||
|
|
||||
LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: expected `Visitor<'d>`
|
||||
found `Visitor<'_>`
|
||||
= note: expected `Visitor<'d>`
|
||||
found `Visitor<'_>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -16,8 +16,8 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | C { f: b }
|
||||
| ^
|
||||
= note: expected `std::boxed::Box<std::boxed::Box<&isize>>`
|
||||
found `std::boxed::Box<std::boxed::Box<&isize>>`
|
||||
= note: expected `std::boxed::Box<std::boxed::Box<&isize>>`
|
||||
found `std::boxed::Box<std::boxed::Box<&isize>>`
|
||||
note: but, the lifetime must be valid for the lifetime `'a` as defined on the impl at 15:6...
|
||||
--> $DIR/type-alias-free-regions.rs:15:6
|
||||
|
|
||||
@ -28,8 +28,8 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | C { f: b }
|
||||
| ^^^^^^^^^^
|
||||
= note: expected `C<'a>`
|
||||
found `C<'_>`
|
||||
= note: expected `C<'a>`
|
||||
found `C<'_>`
|
||||
|
||||
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
|
||||
--> $DIR/type-alias-free-regions.rs:27:16
|
||||
@ -49,8 +49,8 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | C { f: Box::new(b.0) }
|
||||
| ^^^
|
||||
= note: expected `std::boxed::Box<&isize>`
|
||||
found `std::boxed::Box<&isize>`
|
||||
= note: expected `std::boxed::Box<&isize>`
|
||||
found `std::boxed::Box<&isize>`
|
||||
note: but, the lifetime must be valid for the lifetime `'a` as defined on the impl at 25:6...
|
||||
--> $DIR/type-alias-free-regions.rs:25:6
|
||||
|
|
||||
@ -61,8 +61,8 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | C { f: Box::new(b.0) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: expected `C<'a>`
|
||||
found `C<'_>`
|
||||
= note: expected `C<'a>`
|
||||
found `C<'_>`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -14,8 +14,8 @@ note: ...so that the types are compatible
|
||||
|
|
||||
LL | <Foo<'a>>::C
|
||||
| ^^^^^^^^^^^^
|
||||
= note: expected `Foo<'_>`
|
||||
found `Foo<'a>`
|
||||
= note: expected `Foo<'_>`
|
||||
found `Foo<'a>`
|
||||
= note: but, the lifetime must be valid for the static lifetime...
|
||||
note: ...so that reference does not outlive borrowed content
|
||||
--> $DIR/constant-in-expr-inherent-1.rs:8:5
|
||||
|
@ -14,8 +14,8 @@ note: ...so that the types are compatible
|
||||
|
|
||||
LL | T::C
|
||||
| ^^^^
|
||||
= note: expected `Foo<'_>`
|
||||
found `Foo<'a>`
|
||||
= note: expected `Foo<'_>`
|
||||
found `Foo<'a>`
|
||||
= note: but, the lifetime must be valid for the static lifetime...
|
||||
note: ...so that reference does not outlive borrowed content
|
||||
--> $DIR/constant-in-expr-trait-item-3.rs:10:5
|
||||
|
@ -24,8 +24,8 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | ss
|
||||
| ^^
|
||||
= note: expected `&'b (dyn SomeTrait + 'b)`
|
||||
found `&dyn SomeTrait`
|
||||
= note: expected `&'b (dyn SomeTrait + 'b)`
|
||||
found `&dyn SomeTrait`
|
||||
|
||||
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
|
||||
--> $DIR/object-lifetime-default-elision.rs:71:5
|
||||
@ -53,8 +53,8 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | ss
|
||||
| ^^
|
||||
= note: expected `&'b (dyn SomeTrait + 'b)`
|
||||
found `&dyn SomeTrait`
|
||||
= note: expected `&'b (dyn SomeTrait + 'b)`
|
||||
found `&dyn SomeTrait`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -39,8 +39,8 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | Box::new(v)
|
||||
| ^
|
||||
= note: expected `&[u8]`
|
||||
found `&'a [u8]`
|
||||
= note: expected `&[u8]`
|
||||
found `&'a [u8]`
|
||||
note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 25:9...
|
||||
--> $DIR/region-object-lifetime-in-coercion.rs:25:9
|
||||
|
|
||||
@ -51,8 +51,8 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | Box::new(v)
|
||||
| ^^^^^^^^^^^
|
||||
= note: expected `std::boxed::Box<(dyn Foo + 'b)>`
|
||||
found `std::boxed::Box<dyn Foo>`
|
||||
= note: expected `std::boxed::Box<(dyn Foo + 'b)>`
|
||||
found `std::boxed::Box<dyn Foo>`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
@ -14,8 +14,8 @@ note: ...so that the types are compatible
|
||||
|
|
||||
LL | impl<'a> Foo<'static> for &'a i32 {
|
||||
| ^^^^^^^^^^^^
|
||||
= note: expected `Foo<'static>`
|
||||
found `Foo<'static>`
|
||||
= note: expected `Foo<'static>`
|
||||
found `Foo<'static>`
|
||||
= note: but, the lifetime must be valid for the static lifetime...
|
||||
note: ...so that the type `&i32` will meet its required lifetime bounds
|
||||
--> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:14:10
|
||||
@ -39,8 +39,8 @@ note: ...so that the types are compatible
|
||||
|
|
||||
LL | impl<'a,'b> Foo<'b> for &'a i64 {
|
||||
| ^^^^^^^
|
||||
= note: expected `Foo<'b>`
|
||||
found `Foo<'_>`
|
||||
= note: expected `Foo<'b>`
|
||||
found `Foo<'_>`
|
||||
note: but, the lifetime must be valid for the lifetime `'b` as defined on the impl at 19:9...
|
||||
--> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:19:9
|
||||
|
|
||||
|
@ -14,8 +14,8 @@ note: ...so that the types are compatible
|
||||
|
|
||||
LL | impl<'a> Foo for &'a i32 {
|
||||
| ^^^
|
||||
= note: expected `Foo`
|
||||
found `Foo`
|
||||
= note: expected `Foo`
|
||||
found `Foo`
|
||||
= note: but, the lifetime must be valid for the static lifetime...
|
||||
note: ...so that the type `&i32` will meet its required lifetime bounds
|
||||
--> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:9:10
|
||||
|
@ -20,8 +20,8 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | box B(&*v) as Box<dyn X>
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: expected `std::boxed::Box<(dyn X + 'static)>`
|
||||
found `std::boxed::Box<dyn X>`
|
||||
= note: expected `std::boxed::Box<(dyn X + 'static)>`
|
||||
found `std::boxed::Box<dyn X>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -20,8 +20,8 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | box B(&*v) as Box<dyn X>
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: expected `std::boxed::Box<(dyn X + 'static)>`
|
||||
found `std::boxed::Box<dyn X>`
|
||||
= note: expected `std::boxed::Box<(dyn X + 'static)>`
|
||||
found `std::boxed::Box<dyn X>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -24,8 +24,8 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | box v as Box<dyn SomeTrait + 'a>
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: expected `std::boxed::Box<(dyn SomeTrait + 'c)>`
|
||||
found `std::boxed::Box<dyn SomeTrait>`
|
||||
= note: expected `std::boxed::Box<(dyn SomeTrait + 'c)>`
|
||||
found `std::boxed::Box<dyn SomeTrait>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -14,8 +14,8 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | Ast::Add(x, y)
|
||||
| ^
|
||||
= note: expected `&Ast<'_>`
|
||||
found `&Ast<'a>`
|
||||
= note: expected `&Ast<'_>`
|
||||
found `&Ast<'a>`
|
||||
note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 6:19...
|
||||
--> $DIR/regions-creating-enums4.rs:6:19
|
||||
|
|
||||
@ -26,8 +26,8 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | Ast::Add(x, y)
|
||||
| ^^^^^^^^^^^^^^
|
||||
= note: expected `Ast<'b>`
|
||||
found `Ast<'_>`
|
||||
= note: expected `Ast<'b>`
|
||||
found `Ast<'_>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -39,8 +39,8 @@ LL | | if false { return ay; }
|
||||
LL | | return z;
|
||||
LL | | }));
|
||||
| |_____^
|
||||
= note: expected `&isize`
|
||||
found `&isize`
|
||||
= note: expected `&isize`
|
||||
found `&isize`
|
||||
|
||||
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
|
||||
--> $DIR/regions-nested-fns.rs:14:27
|
||||
|
@ -29,8 +29,8 @@ LL | | where <() as Project<'a, 'b>>::Item : Eq
|
||||
LL | | {
|
||||
LL | | }
|
||||
| |_^
|
||||
= note: expected `Project<'a, 'b>`
|
||||
found `Project<'_, '_>`
|
||||
= note: expected `Project<'a, 'b>`
|
||||
found `Project<'_, '_>`
|
||||
|
||||
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
|
||||
--> $DIR/regions-normalize-in-where-clause-list.rs:22:1
|
||||
|
@ -14,8 +14,8 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | with(|o| o)
|
||||
| ^
|
||||
= note: expected `&isize`
|
||||
found `&isize`
|
||||
= note: expected `&isize`
|
||||
found `&isize`
|
||||
note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 9:14...
|
||||
--> $DIR/regions-ret-borrowed-1.rs:9:14
|
||||
|
|
||||
|
@ -14,8 +14,8 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | with(|o| o)
|
||||
| ^
|
||||
= note: expected `&isize`
|
||||
found `&isize`
|
||||
= note: expected `&isize`
|
||||
found `&isize`
|
||||
note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 12:14...
|
||||
--> $DIR/regions-ret-borrowed.rs:12:14
|
||||
|
|
||||
|
@ -41,8 +41,8 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | x
|
||||
| ^
|
||||
= note: expected `&'b mut (dyn Dummy + 'b)`
|
||||
found `&mut (dyn Dummy + 'b)`
|
||||
= note: expected `&'b mut (dyn Dummy + 'b)`
|
||||
found `&mut (dyn Dummy + 'b)`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/regions-trait-object-subtyping.rs:22:5
|
||||
|
@ -118,8 +118,8 @@ note: ...so that the types are compatible
|
||||
|
|
||||
LL | impl<'lw> Drop for W<'lw,'lw> { fn drop(&mut self) { } } // REJECT
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: expected `W<'l1, 'l2>`
|
||||
found `W<'_, '_>`
|
||||
= note: expected `W<'l1, 'l2>`
|
||||
found `W<'_, '_>`
|
||||
|
||||
error[E0367]: `Drop` impl requires `AddsBnd: Bound` but the enum it is implemented for does not
|
||||
--> $DIR/reject-specialized-drops-8142.rs:61:14
|
||||
|
@ -19,8 +19,8 @@ note: ...so that the types are compatible
|
||||
|
|
||||
LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> {
|
||||
| ^^^^^^^^^^
|
||||
= note: expected `T1<'a>`
|
||||
found `T1<'_>`
|
||||
= note: expected `T1<'a>`
|
||||
found `T1<'_>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -23,8 +23,8 @@ note: ...so that the expression is assignable
|
||||
|
|
||||
LL | Box::new(items.iter())
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: expected `std::boxed::Box<(dyn std::iter::Iterator<Item = &T> + 'static)>`
|
||||
found `std::boxed::Box<dyn std::iter::Iterator<Item = &T>>`
|
||||
= note: expected `std::boxed::Box<(dyn std::iter::Iterator<Item = &T> + 'static)>`
|
||||
found `std::boxed::Box<dyn std::iter::Iterator<Item = &T>>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user