Skip to content

Commit eb0f4d5

Browse files
committed
Tweak output for mismatched impl item
Detect type parameter that might require lifetime constraint. Do not name `ReVar`s in expected/found output. Reword text suggesting to check the lifetimes.
1 parent 5ba2220 commit eb0f4d5

38 files changed

+126
-56
lines changed

src/librustc_infer/infer/error_reporting/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -993,10 +993,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
993993
s: &mut DiagnosticStyledString,
994994
) {
995995
let mut r = region.to_string();
996-
if let ty::RegionKind::ReVar(var) = region {
997-
// Show these named, not as `'_` or elide them in "expected/found" notes.
998-
r = format!("'z{} ", var.index());
999-
} else if r == "'_" {
996+
if r == "'_" {
1000997
r.clear();
1001998
} else {
1002999
r.push(' ');

src/librustc_infer/infer/error_reporting/nice_region_error/trait_impl_difference.rs

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! Error Reporting for `impl` items that do not match the obligations from their `trait`.
22
3+
use crate::hir;
34
use crate::hir::def_id::DefId;
45
use crate::infer::error_reporting::nice_region_error::NiceRegionError;
56
use crate::infer::lexical_region_resolve::RegionResolutionError;
@@ -40,7 +41,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
4041
var_origin.span(),
4142
sub_expected_found.expected,
4243
sub_expected_found.found,
43-
self.tcx().def_span(*trait_item_def_id),
44+
*trait_item_def_id,
4445
);
4546
return Some(ErrorReported);
4647
}
@@ -51,23 +52,56 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
5152
None
5253
}
5354

54-
fn emit_err(&self, sp: Span, expected: Ty<'tcx>, found: Ty<'tcx>, impl_sp: Span) {
55+
fn emit_err(&self, sp: Span, expected: Ty<'tcx>, found: Ty<'tcx>, trait_def_id: DefId) {
56+
let tcx = self.tcx();
57+
let trait_sp = self.tcx().def_span(trait_def_id);
5558
let mut err = self
5659
.tcx()
5760
.sess
5861
.struct_span_err(sp, "`impl` item signature doesn't match `trait` item signature");
5962
err.span_label(sp, &format!("found {:?}", found));
60-
err.span_label(impl_sp, &format!("expected {:?}", expected));
63+
err.span_label(trait_sp, &format!("expected {:?}", expected));
64+
let trait_fn_sig = tcx.fn_sig(trait_def_id);
65+
66+
struct AssocTypeFinder(FxHashSet<ty::ParamTy>);
67+
impl<'tcx> ty::fold::TypeVisitor<'tcx> for AssocTypeFinder {
68+
fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
69+
debug!("assoc type finder ty {:?} {:?}", ty, ty.kind);
70+
match ty.kind {
71+
ty::Param(param) => {
72+
self.0.insert(param);
73+
}
74+
_ => {}
75+
}
76+
ty.super_visit_with(self)
77+
}
78+
}
79+
let mut visitor = AssocTypeFinder(FxHashSet::default());
80+
trait_fn_sig.output().visit_with(&mut visitor);
81+
82+
if let Some(id) = tcx.hir().as_local_hir_id(trait_def_id) {
83+
let parent_id = tcx.hir().get_parent_item(id);
84+
let trait_item = tcx.hir().expect_item(parent_id);
85+
if let hir::ItemKind::Trait(_, _, generics, _, _) = &trait_item.kind {
86+
for param_ty in visitor.0 {
87+
if let Some(generic) = generics.get_named(param_ty.name) {
88+
err.span_label(generic.span, &format!(
89+
"in order for `impl` items to be able to implement the method, this \
90+
type parameter might need a lifetime restriction like `{}: 'a`",
91+
param_ty.name,
92+
));
93+
}
94+
}
95+
}
96+
}
6197

6298
struct EarlyBoundRegionHighlighter(FxHashSet<DefId>);
6399
impl<'tcx> ty::fold::TypeVisitor<'tcx> for EarlyBoundRegionHighlighter {
64100
fn visit_region(&mut self, r: ty::Region<'tcx>) -> bool {
65-
debug!("LateBoundRegionNameCollector visit_region {:?}", r);
66101
match *r {
67102
ty::ReFree(free) => {
68103
self.0.insert(free.scope);
69104
}
70-
71105
ty::ReEarlyBound(bound) => {
72106
self.0.insert(bound.def_id);
73107
}
@@ -94,12 +128,11 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
94128
}
95129
if note {
96130
err.note(
97-
"the lifetime requirements from the `trait` could not be fulfilled by the \
98-
`impl`",
131+
"the lifetime requirements from the `trait` could not be fulfilled by the `impl`",
99132
);
100133
err.help(
101-
"consider adding a named lifetime to the `trait` that constrains the item's \
102-
`self` argument, its inputs and its output with it",
134+
"verify the lifetime relationships in the `trait` and `impl` between the \
135+
`self` argument, the other inputs and its output",
103136
);
104137
}
105138
err.emit();

src/test/ui/coercion/coerce-mut.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fn main() {
44
let x = 0;
55
f(&x);
66
//~^ ERROR mismatched types
7-
//~| expected mutable reference `&'z1 mut i32`
8-
//~| found reference `&'z2 {integer}`
7+
//~| expected mutable reference `&mut i32`
8+
//~| found reference `&{integer}`
99
//~| types differ in mutability
1010
}

src/test/ui/coercion/coerce-mut.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error[E0308]: mismatched types
44
LL | f(&x);
55
| ^^ types differ in mutability
66
|
7-
= note: expected mutable reference `&'z1 mut i32`
8-
found reference `&'z2 {integer}`
7+
= note: expected mutable reference `&mut i32`
8+
found reference `&{integer}`
99

1010
error: aborting due to previous error
1111

src/test/ui/compare-method/reordered-type-param.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LL | fn b<F:Clone,G>(&self, _x: G) -> G { panic!() }
1111
| expected type parameter
1212
|
1313
= note: expected fn pointer `fn(&E, F) -> F`
14-
found fn pointer `fn(&'z0 E, G) -> G`
14+
found fn pointer `fn(&E, G) -> G`
1515
= note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
1616
= note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
1717

src/test/ui/hrtb/hrtb-exists-forall-fn.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | let _: for<'b> fn(&'b u32) = foo();
77
| expected due to this
88
|
99
= note: expected fn pointer `for<'b> fn(&'b u32)`
10-
found fn pointer `fn(&'z0 u32)`
10+
found fn pointer `fn(&u32)`
1111

1212
error: aborting due to previous error
1313

src/test/ui/impl-trait/impl-generic-mismatch-ab.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ LL | fn foo<B: Debug>(&self, a: &impl Debug, b: &B) { }
1010
| expected type parameter
1111
|
1212
= note: expected fn pointer `fn(&(), &B, &impl Debug)`
13-
found fn pointer `fn(&'z0 (), &impl Debug, &B)`
13+
found fn pointer `fn(&(), &impl Debug, &B)`
1414
= note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
1515
= note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
1616

src/test/ui/impl-trait/trait_type.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | fn fmt(&self, x: &str) -> () { }
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability
66
|
77
= note: expected fn pointer `fn(&MyType, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>`
8-
found fn pointer `fn(&'z0 MyType, &str)`
8+
found fn pointer `fn(&MyType, &str)`
99

1010
error[E0050]: method `fmt` has 1 parameter but the declaration in trait `std::fmt::Display::fmt` has 2
1111
--> $DIR/trait_type.rs:12:11

src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ LL | fn deref(&self) -> &Self::Target;
1010
| --------------------------------- expected fn(&Struct) -> &(dyn Trait + 'static)
1111
|
1212
= note: expected `fn(&Struct) -> &(dyn Trait + 'static)`
13-
found `fn(&'z0 Struct) -> &dyn Trait`
13+
found `fn(&Struct) -> &dyn Trait`
1414
= note: the lifetime requirements from the `trait` could not be fulfilled by the `impl`
15-
= help: consider adding a named lifetime to the `trait` that constrains the item's `self` argument, its inputs and its output with it
15+
= help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output
1616

1717
error: aborting due to previous error
1818

src/test/ui/in-band-lifetimes/mismatched_trait_impl.nll.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
99
|
1010
= note: expected `fn(&i32, &'a u32, &u32) -> &'a u32`
1111
found `fn(&i32, &u32, &u32) -> &u32`
12+
= note: the lifetime requirements from the `trait` could not be fulfilled by the `impl`
13+
= help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output
1214

1315
error: aborting due to previous error
1416

src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
88
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found fn(&i32, &u32, &u32) -> &u32
99
|
1010
= note: expected `fn(&i32, &'a u32, &u32) -> &'a u32`
11-
found `fn(&'z0 i32, &'z1 u32, &'z2 u32) -> &'z2 u32`
11+
found `fn(&i32, &u32, &u32) -> &u32`
1212
= note: the lifetime requirements from the `trait` could not be fulfilled by the `impl`
13-
= help: consider adding a named lifetime to the `trait` that constrains the item's `self` argument, its inputs and its output with it
13+
= help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output
1414

1515
error[E0623]: lifetime mismatch
1616
--> $DIR/mismatched_trait_impl.rs:10:9

src/test/ui/issues/issue-13033.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ impl Foo for Baz {
88
fn bar(&mut self, other: &dyn Foo) {}
99
//~^ ERROR method `bar` has an incompatible type for trait
1010
//~| expected fn pointer `fn(&mut Baz, &mut dyn Foo)`
11-
//~| found fn pointer `fn(&'z0 mut Baz, &dyn Foo)`
11+
//~| found fn pointer `fn(&mut Baz, &dyn Foo)`
1212
}
1313

1414
fn main() {}

src/test/ui/issues/issue-13033.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LL | fn bar(&mut self, other: &dyn Foo) {}
88
| ^^^^^^^^ types differ in mutability
99
|
1010
= note: expected fn pointer `fn(&mut Baz, &mut dyn Foo)`
11-
found fn pointer `fn(&'z0 mut Baz, &dyn Foo)`
11+
found fn pointer `fn(&mut Baz, &dyn Foo)`
1212
help: consider change the type to match the mutability in trait
1313
|
1414
LL | fn bar(&mut self, other: &mut dyn Foo) {}

src/test/ui/issues/issue-16683.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ note: ...so that the types are compatible
2727
LL | self.a();
2828
| ^
2929
= note: expected `&'a Self`
30-
found `&'z0 Self`
30+
found `&Self`
3131

3232
error: aborting due to previous error
3333

src/test/ui/issues/issue-17758.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ note: ...so that the types are compatible
2828
LL | self.foo();
2929
| ^^^
3030
= note: expected `&'a Self`
31-
found `&'z0 Self`
31+
found `&Self`
3232

3333
error: aborting due to previous error
3434

src/test/ui/issues/issue-20225.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | extern "rust-call" fn call(&self, (_,): (T,)) {}
77
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&T`, found type parameter `T`
88
|
99
= note: expected fn pointer `extern "rust-call" fn(&Foo, (&'a T,))`
10-
found fn pointer `extern "rust-call" fn(&'z0 Foo, (T,))`
10+
found fn pointer `extern "rust-call" fn(&Foo, (T,))`
1111
= help: type parameters must be constrained to match other types
1212
= note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
1313

@@ -20,7 +20,7 @@ LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
2020
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&T`, found type parameter `T`
2121
|
2222
= note: expected fn pointer `extern "rust-call" fn(&mut Foo, (&'a T,))`
23-
found fn pointer `extern "rust-call" fn(&'z0 mut Foo, (T,))`
23+
found fn pointer `extern "rust-call" fn(&mut Foo, (T,))`
2424
= help: type parameters must be constrained to match other types
2525
= note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
2626

src/test/ui/issues/issue-21332.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | fn next(&mut self) -> Result<i32, i32> { Ok(7) }
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `std::option::Option`, found enum `std::result::Result`
66
|
77
= note: expected fn pointer `fn(&mut S) -> std::option::Option<i32>`
8-
found fn pointer `fn(&'z0 mut S) -> std::result::Result<i32, i32>`
8+
found fn pointer `fn(&mut S) -> std::result::Result<i32, i32>`
99

1010
error: aborting due to previous error
1111

src/test/ui/lifetimes/lifetime-mismatch-between-trait-and-impl.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ LL | fn foo<'a>(x: &'a i32, y: &'a i32) -> &'a i32 {
88
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found fn(&i32, &i32) -> &i32
99
|
1010
= note: expected `fn(&i32, &'a i32) -> &'a i32`
11-
found `fn(&'z0 i32, &'z0 i32) -> &'z0 i32`
11+
found `fn(&i32, &i32) -> &i32`
1212
= note: the lifetime requirements from the `trait` could not be fulfilled by the `impl`
13-
= help: consider adding a named lifetime to the `trait` that constrains the item's `self` argument, its inputs and its output with it
13+
= help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output
1414

1515
error: aborting due to previous error
1616

src/test/ui/mismatched_types/E0053.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ LL | fn bar(&mut self) { }
2020
| ^^^^^^^^^ types differ in mutability
2121
|
2222
= note: expected fn pointer `fn(&Bar)`
23-
found fn pointer `fn(&'z0 mut Bar)`
23+
found fn pointer `fn(&mut Bar)`
2424
help: consider change the type to match the mutability in trait
2525
|
2626
LL | fn bar(&self) { }

src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ LL | fn bar(&mut self, bar: &Bar) { }
2020
| ^^^^ types differ in mutability
2121
|
2222
= note: expected fn pointer `fn(&mut Bar, &mut Bar)`
23-
found fn pointer `fn(&'z0 mut Bar, &'z1 Bar)`
23+
found fn pointer `fn(&mut Bar, &Bar)`
2424
help: consider change the type to match the mutability in trait
2525
|
2626
LL | fn bar(&mut self, bar: &mut Bar) { }

src/test/ui/nll/type-alias-free-regions.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ note: ...so that the expression is assignable
1616
|
1717
LL | C { f: b }
1818
| ^
19-
= note: expected `std::boxed::Box<std::boxed::Box<&'z0 isize>>`
19+
= note: expected `std::boxed::Box<std::boxed::Box<&isize>>`
2020
found `std::boxed::Box<std::boxed::Box<&isize>>`
2121
note: but, the lifetime must be valid for the lifetime `'a` as defined on the impl at 15:6...
2222
--> $DIR/type-alias-free-regions.rs:15:6
@@ -49,7 +49,7 @@ note: ...so that the expression is assignable
4949
|
5050
LL | C { f: Box::new(b.0) }
5151
| ^^^
52-
= note: expected `std::boxed::Box<&'z1 isize>`
52+
= note: expected `std::boxed::Box<&isize>`
5353
found `std::boxed::Box<&isize>`
5454
note: but, the lifetime must be valid for the lifetime `'a` as defined on the impl at 25:6...
5555
--> $DIR/type-alias-free-regions.rs:25:6

src/test/ui/regions-fn-subtyping-return-static-fail.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | want_F(bar);
55
| ^^^ expected concrete lifetime, found bound lifetime parameter 'cx
66
|
77
= note: expected fn pointer `for<'cx> fn(&'cx S) -> &'cx S`
8-
found fn item `for<'a> fn(&'a S) -> &'z2 S {bar::<'_>}`
8+
found fn item `for<'a> fn(&'a S) -> &S {bar::<'_>}`
99

1010
error[E0308]: mismatched types
1111
--> $DIR/regions-fn-subtyping-return-static-fail.rs:48:12

src/test/ui/regions/region-object-lifetime-in-coercion.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ note: ...so that the expression is assignable
3939
|
4040
LL | Box::new(v)
4141
| ^
42-
= note: expected `&'z1 [u8]`
42+
= note: expected `&[u8]`
4343
found `&'a [u8]`
4444
note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 25:9...
4545
--> $DIR/region-object-lifetime-in-coercion.rs:25:9

src/test/ui/regions/regions-fn-subtyping-return-static.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | want_F(bar);
55
| ^^^ expected concrete lifetime, found bound lifetime parameter 'cx
66
|
77
= note: expected fn pointer `for<'cx> fn(&'cx S) -> &'cx S`
8-
found fn item `for<'a> fn(&'a S) -> &'z2 S {bar::<'_>}`
8+
found fn item `for<'a> fn(&'a S) -> &S {bar::<'_>}`
99

1010
error: aborting due to previous error
1111

src/test/ui/regions/regions-nested-fns.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ LL | | return z;
4040
LL | | }));
4141
| |_____^
4242
= note: expected `&isize`
43-
found `&'z13 isize`
43+
found `&isize`
4444

4545
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
4646
--> $DIR/regions-nested-fns.rs:14:27

src/test/ui/regions/regions-ret-borrowed-1.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ note: ...so that the expression is assignable
1414
|
1515
LL | with(|o| o)
1616
| ^
17-
= note: expected `&'z0 isize`
17+
= note: expected `&isize`
1818
found `&isize`
1919
note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 9:14...
2020
--> $DIR/regions-ret-borrowed-1.rs:9:14

src/test/ui/regions/regions-ret-borrowed.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ note: ...so that the expression is assignable
1414
|
1515
LL | with(|o| o)
1616
| ^
17-
= note: expected `&'z0 isize`
17+
= note: expected `&isize`
1818
found `&isize`
1919
note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 12:14...
2020
--> $DIR/regions-ret-borrowed.rs:12:14

src/test/ui/regions/regions-trait-1.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | fn get_ctxt(&self) -> &'a Ctxt {
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
66
|
77
= note: expected fn pointer `fn(&HasCtxt<'a>) -> &Ctxt`
8-
found fn pointer `fn(&'z0 HasCtxt<'a>) -> &'a Ctxt`
8+
found fn pointer `fn(&HasCtxt<'a>) -> &'a Ctxt`
99
note: the lifetime `'a` as defined on the impl at 12:6...
1010
--> $DIR/regions-trait-1.rs:12:6
1111
|

src/test/ui/regions/regions-trait-object-subtyping.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ note: ...so that the expression is assignable
4242
LL | x
4343
| ^
4444
= note: expected `&'b mut (dyn Dummy + 'b)`
45-
found `&'z1 mut (dyn Dummy + 'b)`
45+
found `&mut (dyn Dummy + 'b)`
4646

4747
error[E0308]: mismatched types
4848
--> $DIR/regions-trait-object-subtyping.rs:22:5

src/test/ui/resolve/resolve-inconsistent-binding-mode.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ LL | Opts::A(ref mut i) | Opts::B(ref i) => {}
5454
| |
5555
| first introduced with type `&mut isize` here
5656
|
57-
= note: expected type `&'z0 mut isize`
58-
found type `&'z1 isize`
57+
= note: expected type `&mut isize`
58+
found type `&isize`
5959
= note: in the same arm, a binding must have the same type in all alternatives
6060

6161
error: aborting due to 6 previous errors

src/test/ui/span/coerce-suggestions.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ error[E0308]: mismatched types
2222
LL | test(&y);
2323
| ^^ types differ in mutability
2424
|
25-
= note: expected mutable reference `&'z2 mut std::string::String`
26-
found reference `&'z3 std::string::String`
25+
= note: expected mutable reference `&mut std::string::String`
26+
found reference `&std::string::String`
2727

2828
error[E0308]: mismatched types
2929
--> $DIR/coerce-suggestions.rs:14:11

0 commit comments

Comments
 (0)