Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/path/lower.rs')
-rw-r--r--crates/hir-def/src/path/lower.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/hir-def/src/path/lower.rs b/crates/hir-def/src/path/lower.rs
index b6a24cd4ab..6a15b1c085 100644
--- a/crates/hir-def/src/path/lower.rs
+++ b/crates/hir-def/src/path/lower.rs
@@ -1,6 +1,9 @@
//! Transforms syntax into `Path` objects, ideally with accounting for hygiene
-use crate::{intern::Interned, type_ref::ConstScalarOrPath};
+use crate::{
+ intern::Interned,
+ type_ref::{ConstScalar, ConstScalarOrPath},
+};
use either::Either;
use hir_expand::name::{name, AsName};
@@ -181,7 +184,10 @@ pub(super) fn lower_generic_args(
}
}
ast::GenericArg::ConstArg(arg) => {
- let arg = ConstScalarOrPath::from_expr_opt(arg.expr());
+ let arg = arg.expr().map_or(
+ ConstScalarOrPath::Scalar(ConstScalar::Unknown),
+ ConstScalarOrPath::from_expr,
+ );
args.push(GenericArg::Const(arg))
}
}