Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return ty::Error when equating ty::Error #121319

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions compiler/rustc_infer/src/infer/relate/equate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ impl<'tcx> TypeRelation<'tcx> for Equate<'_, '_, 'tcx> {
self.fields.instantiate(a, ty::Invariant, b_id, self.a_is_expected)?;
}

(&ty::Error(e), _) | (_, &ty::Error(e)) => {
infcx.set_tainted_by_errors(e);
return Ok(Ty::new_error(self.tcx(), e));
}

(
&ty::Alias(ty::Opaque, ty::AliasTy { def_id: a_def_id, .. }),
&ty::Alias(ty::Opaque, ty::AliasTy { def_id: b_def_id, .. }),
Expand Down
1 change: 0 additions & 1 deletion tests/ui/generic-associated-types/issue-79636-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ where
//~^ ERROR: missing generics for associated type `Monad::Wrapped`
{
outer.bind(|inner| inner)
//~^ ERROR type annotations needed
}

fn main() {
Expand Down
17 changes: 3 additions & 14 deletions tests/ui/generic-associated-types/issue-79636-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,8 @@ help: function arguments must have a statically known size, borrowed types alway
LL | fn bind<B, F>(&self, f: F) -> Self::Wrapped<B> {
| +

error[E0282]: type annotations needed
--> $DIR/issue-79636-1.rs:17:17
|
LL | outer.bind(|inner| inner)
| ^^^^^
|
help: consider giving this closure parameter an explicit type
|
LL | outer.bind(|inner: /* Type */| inner)
| ++++++++++++

error[E0277]: the trait bound `Option<Option<bool>>: Monad` is not satisfied
--> $DIR/issue-79636-1.rs:22:21
--> $DIR/issue-79636-1.rs:21:21
|
LL | assert_eq!(join(Some(Some(true))), Some(true));
| ---- ^^^^^^^^^^^^^^^^ the trait `Monad` is not implemented for `Option<Option<bool>>`
Expand All @@ -63,7 +52,7 @@ LL | where
LL | MOuter: Monad<Unwrapped = MInner>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `join`

error: aborting due to 4 previous errors
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0107, E0277, E0282.
Some errors have detailed explanations: E0107, E0277.
For more information about an error, try `rustc --explain E0107`.
1 change: 0 additions & 1 deletion tests/ui/impl-trait/where-allowed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() }
fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
//~^ ERROR `impl Trait` is not allowed in the parameters of `Fn` trait bounds
//~| ERROR nested `impl Trait` is not allowed
//~| ERROR: type annotations needed

// Allowed
fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!() }
Expand Down
Loading
Loading