mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-16 09:48:10 +00:00
Auto merge of #14285 - HKalbasi:mir, r=Veykril
Evaluate consts in `path_to_const` fix #14275
This commit is contained in:
commit
db64f3aa69
2 changed files with 15 additions and 0 deletions
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue