Special case the situation where the previous span is the same as the new one
This commit is contained in:
parent
d5b6510bfb
commit
3136bfef93
@ -610,7 +610,11 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> {
|
|||||||
concrete_type.span,
|
concrete_type.span,
|
||||||
format!("expected `{}`, got `{}`", prev.ty, concrete_type.ty),
|
format!("expected `{}`, got `{}`", prev.ty, concrete_type.ty),
|
||||||
);
|
);
|
||||||
|
if prev.span == concrete_type.span {
|
||||||
|
err.span_label(prev.span, "this expression supplies two conflicting concrete types for the same opaque type");
|
||||||
|
} else {
|
||||||
err.span_note(prev.span, "previous use here");
|
err.span_note(prev.span, "previous use here");
|
||||||
|
}
|
||||||
err.emit();
|
err.emit();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
error: concrete type differs from previous defining opaque type use
|
error: concrete type differs from previous defining opaque type use
|
||||||
--> $DIR/issue-86465.rs:6:5
|
--> $DIR/issue-86465.rs:6:5
|
||||||
|
|
|
|
||||||
LL | (a, a)
|
|
||||||
| ^^^^^^ expected `&'a u32`, got `&'b u32`
|
|
||||||
|
|
|
||||||
note: previous use here
|
|
||||||
--> $DIR/issue-86465.rs:6:5
|
|
||||||
|
|
|
||||||
LL | (a, a)
|
LL | (a, a)
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
| |
|
||||||
|
| expected `&'a u32`, got `&'b u32`
|
||||||
|
| this expression supplies two conflicting concrete types for the same opaque type
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
error: concrete type differs from previous defining opaque type use
|
error: concrete type differs from previous defining opaque type use
|
||||||
--> $DIR/multiple-def-uses-in-one-fn-infer.rs:10:5
|
--> $DIR/multiple-def-uses-in-one-fn-infer.rs:10:5
|
||||||
|
|
|
|
||||||
LL | (42_i64, 60)
|
|
||||||
| ^^^^^^^^^^^^ expected `i64`, got `i32`
|
|
||||||
|
|
|
||||||
note: previous use here
|
|
||||||
--> $DIR/multiple-def-uses-in-one-fn-infer.rs:10:5
|
|
||||||
|
|
|
||||||
LL | (42_i64, 60)
|
LL | (42_i64, 60)
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
| |
|
||||||
|
| expected `i64`, got `i32`
|
||||||
|
| this expression supplies two conflicting concrete types for the same opaque type
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
error: concrete type differs from previous defining opaque type use
|
error: concrete type differs from previous defining opaque type use
|
||||||
--> $DIR/multiple-def-uses-in-one-fn-lifetimes.rs:6:5
|
--> $DIR/multiple-def-uses-in-one-fn-lifetimes.rs:6:5
|
||||||
|
|
|
|
||||||
LL | (i, i)
|
|
||||||
| ^^^^^^ expected `&'a i32`, got `&'b i32`
|
|
||||||
|
|
|
||||||
note: previous use here
|
|
||||||
--> $DIR/multiple-def-uses-in-one-fn-lifetimes.rs:6:5
|
|
||||||
|
|
|
||||||
LL | (i, i)
|
LL | (i, i)
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
| |
|
||||||
|
| expected `&'a i32`, got `&'b i32`
|
||||||
|
| this expression supplies two conflicting concrete types for the same opaque type
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
error: concrete type differs from previous defining opaque type use
|
error: concrete type differs from previous defining opaque type use
|
||||||
--> $DIR/multiple-def-uses-in-one-fn2.rs:10:5
|
--> $DIR/multiple-def-uses-in-one-fn2.rs:10:5
|
||||||
|
|
|
|
||||||
LL | (a.clone(), a)
|
|
||||||
| ^^^^^^^^^^^^^^ expected `A`, got `B`
|
|
||||||
|
|
|
||||||
note: previous use here
|
|
||||||
--> $DIR/multiple-def-uses-in-one-fn2.rs:10:5
|
|
||||||
|
|
|
||||||
LL | (a.clone(), a)
|
LL | (a.clone(), a)
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^
|
||||||
|
| |
|
||||||
|
| expected `A`, got `B`
|
||||||
|
| this expression supplies two conflicting concrete types for the same opaque type
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user