Skip to content

Commit 99b8c01

Browse files
committed
Address lcnr review
1 parent b7d9998 commit 99b8c01

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

compiler/rustc_trait_selection/src/traits/const_evaluatable.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,12 @@ impl<'tcx> AbstractConst<'tcx> {
219219
#[inline]
220220
pub fn root(self, tcx: TyCtxt<'tcx>) -> Node<'tcx> {
221221
let node = self.inner.last().copied().unwrap();
222-
if let Node::Leaf(leaf) = node {
223-
return Node::Leaf(leaf.subst(tcx, self.substs));
222+
match node {
223+
Node::Leaf(leaf) => Node::Leaf(leaf.subst(tcx, self.substs)),
224+
Node::Cast(kind, operand, ty) => Node::Cast(kind, operand, ty.subst(tcx, self.substs)),
225+
// Don't perform substitution on the following as they can't directly contain generic params
226+
Node::Binop(_, _, _) | Node::UnaryOp(_, _) | Node::FunctionCall(_, _) => node,
224227
}
225-
node
226228
}
227229
}
228230

0 commit comments

Comments
 (0)