diff options
| author | Ethan Brierley <ethanboxx@gmail.com> | 2021-10-19 22:18:13 +0100 |
|---|---|---|
| committer | Ethan Brierley <ethanboxx@gmail.com> | 2021-10-19 22:18:13 +0100 |
| commit | 99b8c016cea9b1f1917d287401b498abd4eabd29 (patch) | |
| tree | b1e86914996552b7203494c759bd5c77b71018df | |
| parent | b7d99983f879696522a5c770241a2fb171071eab (diff) | |
| download | rust-99b8c016cea9b1f1917d287401b498abd4eabd29.tar.gz rust-99b8c016cea9b1f1917d287401b498abd4eabd29.zip | |
Address lcnr review
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/const_evaluatable.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs index 4acde1b2165..2cf7b6b1d93 100644 --- a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs +++ b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs @@ -219,10 +219,12 @@ impl<'tcx> AbstractConst<'tcx> { #[inline] pub fn root(self, tcx: TyCtxt<'tcx>) -> Node<'tcx> { let node = self.inner.last().copied().unwrap(); - if let Node::Leaf(leaf) = node { - return Node::Leaf(leaf.subst(tcx, self.substs)); + match node { + Node::Leaf(leaf) => Node::Leaf(leaf.subst(tcx, self.substs)), + Node::Cast(kind, operand, ty) => Node::Cast(kind, operand, ty.subst(tcx, self.substs)), + // Don't perform substitution on the following as they can't directly contain generic params + Node::Binop(_, _, _) | Node::UnaryOp(_, _) | Node::FunctionCall(_, _) => node, } - node } } |
