mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
b17e6680d6
Fixes #109543. When checking paths in HIR typeck, we don't want to check for const predicates since all we want might just be a function pointer. Therefore we move this to MIR constck and check that bounds are met during MIR constck.
12 lines
208 B
Rust
12 lines
208 B
Rust
const fn foo() { (||{})() }
|
|
//~^ ERROR cannot call non-const closure
|
|
//~| ERROR the trait bound
|
|
|
|
const fn bad(input: fn()) {
|
|
input()
|
|
//~^ ERROR function pointer calls are not allowed
|
|
}
|
|
|
|
fn main() {
|
|
}
|