Skip to content

Commit

Permalink
Auto merge of rust-lang#14312 - HKalbasi:master, r=lnicola
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Mar 10, 2023
2 parents 552aea5 + 71e1c02 commit 1b5bba4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 0 additions & 1 deletion crates/hir-ty/src/consteval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ pub(crate) fn path_to_const(
};
Some(ConstData { ty, value }.intern(Interner))
}
Some(ValueNs::ConstId(c)) => db.const_eval(c).ok(),
_ => None,
}
}
Expand Down
12 changes: 12 additions & 0 deletions crates/hir-ty/src/tests/regression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1744,3 +1744,15 @@ fn foo(b: Bar) {
"#,
);
}

#[test]
fn regression_14305() {
check_no_mismatches(
r#"
//- minicore: add
trait Tr {}
impl Tr for [u8; C] {}
const C: usize = 2 + 2;
"#,
);
}
3 changes: 2 additions & 1 deletion crates/hir-ty/src/tests/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3277,13 +3277,14 @@ fn func() {

#[test]
fn issue_14275() {
// FIXME: evaluate const generic
check_types(
r#"
struct Foo<const T: bool>;
fn main() {
const B: bool = false;
let foo = Foo::<B>;
//^^^ Foo<false>
//^^^ Foo<_>
}
"#,
);
Expand Down

0 comments on commit 1b5bba4

Please sign in to comment.