Skip to content

Commit 897a7ec

Browse files
committed
Auto merge of rust-lang#12785 - Logarithmus:feature/fix-negative-const-generics, r=Veykril
fix: un-inline `ConstScalarOrPath::from_expr_opt` Sorry, but I missed these from rust-lang#12778 `@flodiebold`
2 parents db6a85d + d9336a4 commit 897a7ec

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

crates/hir-def/src/type_ref.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,7 @@ impl ConstScalarOrPath {
411411
}
412412
ast::Expr::PrefixExpr(prefix_expr) => match prefix_expr.op_kind() {
413413
Some(ast::UnaryOp::Neg) => {
414-
let unsigned = prefix_expr
415-
.expr()
416-
.map_or(Self::Scalar(ConstScalar::Unknown), Self::from_expr);
414+
let unsigned = Self::from_expr_opt(prefix_expr.expr());
417415
// Add sign
418416
match unsigned {
419417
Self::Scalar(ConstScalar::UInt(num)) => {
@@ -422,7 +420,7 @@ impl ConstScalarOrPath {
422420
other => other,
423421
}
424422
}
425-
_ => prefix_expr.expr().map_or(Self::Scalar(ConstScalar::Unknown), Self::from_expr),
423+
_ => Self::from_expr_opt(prefix_expr.expr()),
426424
},
427425
ast::Expr::Literal(literal) => Self::Scalar(match literal.kind() {
428426
ast::LiteralKind::IntNumber(num) => {

0 commit comments

Comments
 (0)