about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-07-17 17:53:02 +0000
committerbors <bors@rust-lang.org>2022-07-17 17:53:02 +0000
commit897a7ec4b826f85ec1626870e734490701138097 (patch)
treead94fbc7950855e2e6a2392b056c69861a78733d
parentdb6a85d3583e472645b03be93bb5763431035008 (diff)
parentd9336a496c666a3b8976e5a475c769f34673aeed (diff)
downloadrust-897a7ec4b826f85ec1626870e734490701138097.tar.gz
rust-897a7ec4b826f85ec1626870e734490701138097.zip
Auto merge of #12785 - Logarithmus:feature/fix-negative-const-generics, r=Veykril
fix: un-inline `ConstScalarOrPath::from_expr_opt`

Sorry, but I missed these from #12778 `@flodiebold`
-rw-r--r--crates/hir-def/src/type_ref.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/crates/hir-def/src/type_ref.rs b/crates/hir-def/src/type_ref.rs
index 867d82f45a7..6be78745f12 100644
--- a/crates/hir-def/src/type_ref.rs
+++ b/crates/hir-def/src/type_ref.rs
@@ -411,9 +411,7 @@ impl ConstScalarOrPath {
             }
             ast::Expr::PrefixExpr(prefix_expr) => match prefix_expr.op_kind() {
                 Some(ast::UnaryOp::Neg) => {
-                    let unsigned = prefix_expr
-                        .expr()
-                        .map_or(Self::Scalar(ConstScalar::Unknown), Self::from_expr);
+                    let unsigned = Self::from_expr_opt(prefix_expr.expr());
                     // Add sign
                     match unsigned {
                         Self::Scalar(ConstScalar::UInt(num)) => {
@@ -422,7 +420,7 @@ impl ConstScalarOrPath {
                         other => other,
                     }
                 }
-                _ => prefix_expr.expr().map_or(Self::Scalar(ConstScalar::Unknown), Self::from_expr),
+                _ => Self::from_expr_opt(prefix_expr.expr()),
             },
             ast::Expr::Literal(literal) => Self::Scalar(match literal.kind() {
                 ast::LiteralKind::IntNumber(num) => {