Skip to content

Commit 03164da

Browse files
authored
Unrolled build for rust-lang#121319
Rollup merge of rust-lang#121319 - compiler-errors:err, r=oli-obk return `ty::Error` when equating `ty::Error` This helps iron out a difference in diagnostics between `Sub` and `Equate` relations, which I'm currently trying to unify. r? oli-obk
2 parents bcea3cb + 84baf2f commit 03164da

File tree

9 files changed

+54
-95
lines changed

9 files changed

+54
-95
lines changed

compiler/rustc_infer/src/infer/relate/equate.rs

+5
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ impl<'tcx> TypeRelation<'tcx> for Equate<'_, '_, 'tcx> {
9090
infcx.instantiate_ty_var(self, !self.a_is_expected, b_vid, ty::Invariant, a)?;
9191
}
9292

93+
(&ty::Error(e), _) | (_, &ty::Error(e)) => {
94+
infcx.set_tainted_by_errors(e);
95+
return Ok(Ty::new_error(self.tcx(), e));
96+
}
97+
9398
(
9499
&ty::Alias(ty::Opaque, ty::AliasTy { def_id: a_def_id, .. }),
95100
&ty::Alias(ty::Opaque, ty::AliasTy { def_id: b_def_id, .. }),

tests/ui/generic-associated-types/issue-79636-1.rs

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ where
1515
//~^ ERROR: missing generics for associated type `Monad::Wrapped`
1616
{
1717
outer.bind(|inner| inner)
18-
//~^ ERROR type annotations needed
1918
}
2019

2120
fn main() {

tests/ui/generic-associated-types/issue-79636-1.stderr

+3-14
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,8 @@ help: function arguments must have a statically known size, borrowed types alway
3030
LL | fn bind<B, F>(&self, f: F) -> Self::Wrapped<B> {
3131
| +
3232

33-
error[E0282]: type annotations needed
34-
--> $DIR/issue-79636-1.rs:17:17
35-
|
36-
LL | outer.bind(|inner| inner)
37-
| ^^^^^
38-
|
39-
help: consider giving this closure parameter an explicit type
40-
|
41-
LL | outer.bind(|inner: /* Type */| inner)
42-
| ++++++++++++
43-
4433
error[E0277]: the trait bound `Option<Option<bool>>: Monad` is not satisfied
45-
--> $DIR/issue-79636-1.rs:22:21
34+
--> $DIR/issue-79636-1.rs:21:21
4635
|
4736
LL | assert_eq!(join(Some(Some(true))), Some(true));
4837
| ---- ^^^^^^^^^^^^^^^^ the trait `Monad` is not implemented for `Option<Option<bool>>`
@@ -63,7 +52,7 @@ LL | where
6352
LL | MOuter: Monad<Unwrapped = MInner>,
6453
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `join`
6554

66-
error: aborting due to 4 previous errors
55+
error: aborting due to 3 previous errors
6756

68-
Some errors have detailed explanations: E0107, E0277, E0282.
57+
Some errors have detailed explanations: E0107, E0277.
6958
For more information about an error, try `rustc --explain E0107`.

tests/ui/impl-trait/where-allowed.rs

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() }
5959
fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
6060
//~^ ERROR `impl Trait` is not allowed in the parameters of `Fn` trait bounds
6161
//~| ERROR nested `impl Trait` is not allowed
62-
//~| ERROR: type annotations needed
6362

6463
// Allowed
6564
fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!() }

0 commit comments

Comments
 (0)