Skip to content

Commit

Permalink
Remove an unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Sep 18, 2024
1 parent 51149ad commit d3d80f2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions frontend/exporter/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,15 @@ pub mod rustc {
));
};

let Some(trait_clause) = apred.clause.as_trait_clause() else {
return Err(format!(
"Candidate origin for `{tref:?}` is a clause but not a \
trait clause: `{:?}`",
apred.clause
));
};
use rustc_middle::ty::ToPolyTraitRef;
// TODO: unwrap
let r#trait = apred.clause.as_trait_clause().unwrap().to_poly_trait_ref();
let r#trait = trait_clause.to_poly_trait_ref();
if apred.is_extra_self_predicate {
ImplExprAtom::SelfImpl { r#trait, path }
.with_args(impl_exprs(tcx, owner_id, &nested)?, *tref)
Expand Down

0 comments on commit d3d80f2

Please sign in to comment.