Skip to content

Commit db64f3a

Browse files
committed
Auto merge of rust-lang#14285 - HKalbasi:mir, r=Veykril
Evaluate consts in `path_to_const` fix rust-lang#14275
2 parents c951093 + cf47c15 commit db64f3a

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

crates/hir-ty/src/consteval.rs

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ pub(crate) fn path_to_const(
100100
};
101101
Some(ConstData { ty, value }.intern(Interner))
102102
}
103+
Some(ValueNs::ConstId(c)) => db.const_eval(c).ok(),
103104
_ => None,
104105
}
105106
}

crates/hir-ty/src/tests/simple.rs

+14
Original file line numberDiff line numberDiff line change
@@ -3274,3 +3274,17 @@ fn func() {
32743274
"#]],
32753275
);
32763276
}
3277+
3278+
#[test]
3279+
fn issue_14275() {
3280+
check_types(
3281+
r#"
3282+
struct Foo<const T: bool>;
3283+
fn main() {
3284+
const B: bool = false;
3285+
let foo = Foo::<B>;
3286+
//^^^ Foo<false>
3287+
}
3288+
"#,
3289+
);
3290+
}

0 commit comments

Comments
 (0)