Skip to content

Commit

Permalink
Auto merge of rust-lang#12785 - Logarithmus:feature/fix-negative-cons…
Browse files Browse the repository at this point in the history
…t-generics, r=Veykril

fix: un-inline `ConstScalarOrPath::from_expr_opt`

Sorry, but I missed these from rust-lang#12778 `@flodiebold`
  • Loading branch information
bors committed Jul 17, 2022
2 parents db6a85d + d9336a4 commit 897a7ec
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions crates/hir-def/src/type_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)) => {
Expand All @@ -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) => {
Expand Down

0 comments on commit 897a7ec

Please sign in to comment.