Don't cancel stashed OpaqueHiddenTypeMismatch
errors.
This gives one extra error message on one test, but is necessary to fix bigger problems caused by the cancellation of stashed errors. (Note: why not just avoid stashing altogether? Because that resulted in additional output changes.)
This commit is contained in:
parent
c475e2303b
commit
c4ec196c7e
3 changed files with 19 additions and 2 deletions
|
@ -852,7 +852,11 @@ impl<'tcx> OpaqueHiddenType<'tcx> {
|
||||||
.dcx()
|
.dcx()
|
||||||
.steal_diagnostic(tcx.def_span(opaque_def_id), StashKey::OpaqueHiddenTypeMismatch)
|
.steal_diagnostic(tcx.def_span(opaque_def_id), StashKey::OpaqueHiddenTypeMismatch)
|
||||||
{
|
{
|
||||||
diag.cancel();
|
// We used to cancel here for slightly better error messages, but
|
||||||
|
// cancelling stashed diagnostics is no longer allowed because it
|
||||||
|
// causes problems when tracking whether errors have actually
|
||||||
|
// occurred.
|
||||||
|
diag.emit();
|
||||||
}
|
}
|
||||||
(self.ty, other.ty).error_reported()?;
|
(self.ty, other.ty).error_reported()?;
|
||||||
// Found different concrete types for the opaque type.
|
// Found different concrete types for the opaque type.
|
||||||
|
|
|
@ -11,6 +11,7 @@ fn foo<'a, 'b>() -> Tait<'a> {
|
||||||
}
|
}
|
||||||
let x: Tait<'a> = ();
|
let x: Tait<'a> = ();
|
||||||
x
|
x
|
||||||
|
//~^ ERROR concrete type differs from previous defining opaque type use
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -1,3 +1,15 @@
|
||||||
|
error: concrete type differs from previous defining opaque type use
|
||||||
|
--> $DIR/different_defining_uses_never_type-2.rs:13:5
|
||||||
|
|
|
||||||
|
LL | x
|
||||||
|
| ^ expected `i32`, got `()`
|
||||||
|
|
|
||||||
|
note: previous use here
|
||||||
|
--> $DIR/different_defining_uses_never_type-2.rs:8:31
|
||||||
|
|
|
||||||
|
LL | let y: Tait<'b> = 1i32;
|
||||||
|
| ^^^^
|
||||||
|
|
||||||
error: concrete type differs from previous defining opaque type use
|
error: concrete type differs from previous defining opaque type use
|
||||||
--> $DIR/different_defining_uses_never_type-2.rs:8:31
|
--> $DIR/different_defining_uses_never_type-2.rs:8:31
|
||||||
|
|
|
|
||||||
|
@ -10,5 +22,5 @@ note: previous use here
|
||||||
LL | if { return } {
|
LL | if { return } {
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue