Skip to content

Commit

Permalink
Auto merge of rust-lang#14285 - HKalbasi:mir, r=Veykril
Browse files Browse the repository at this point in the history
Evaluate consts in `path_to_const`

fix rust-lang#14275
  • Loading branch information
bors committed Mar 8, 2023
2 parents c951093 + cf47c15 commit db64f3a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/hir-ty/src/consteval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
Expand Down
14 changes: 14 additions & 0 deletions crates/hir-ty/src/tests/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
}
"#,
);
}

0 comments on commit db64f3a

Please sign in to comment.