Evaluate consts in path_to_const

This commit is contained in:
hkalbasi 2023-03-08 16:40:58 +03:30
parent c9510933a5
commit cf47c15821
2 changed files with 15 additions and 0 deletions

View File

@ -100,6 +100,7 @@ pub(crate) fn path_to_const(
};
Some(ConstData { ty, value }.intern(Interner))
}
Some(ValueNs::ConstId(c)) => db.const_eval(c).ok(),
_ => None,
}
}

View File

@ -3274,3 +3274,17 @@ fn func() {
"#]],
);
}
#[test]
fn issue_14275() {
check_types(
r#"
struct Foo<const T: bool>;
fn main() {
const B: bool = false;
let foo = Foo::<B>;
//^^^ Foo<false>
}
"#,
);
}