Skip to content

Commit

Permalink
Skip inner obligations of ImplSource::Builtin
Browse files Browse the repository at this point in the history
As they can lead to infinite recursion.
  • Loading branch information
Nadrieril committed May 15, 2024
1 parent 6cce50e commit 4eae5c6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions frontend/exporter/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,14 @@ impl<'tcx> IntoImplExpr<'tcx> for rustc_middle::ty::PolyTraitRef<'tcx> {
ImplSource::Object(data) => {
ImplExprAtom::Dyn.with_args(impl_exprs(s, &data.nested), trait_ref)
}
ImplSource::Builtin(nested) => ImplExprAtom::Builtin {
// We ignore the contained obligations here. For example for `(): Send`, the
// obligations contained would be `[(): Send]`, which leads to an infinite loop. There
// might be important obligation shere inother cases; we'll have to see if that comes
// up.
ImplSource::Builtin(_ignored) => ImplExprAtom::Builtin {
r#trait: self.skip_binder().sinto(s),
}
.with_args(impl_exprs(s, &nested), trait_ref),
.with_args(vec![], trait_ref),
x => ImplExprAtom::Todo(format!(
"ImplExprAtom::Todo(see https://github.com/hacspec/hax/issues/381) {:#?}\n\n{:#?}",
x, self
Expand Down

0 comments on commit 4eae5c6

Please sign in to comment.