rust/tests/ui/contracts/empty-ensures.rs
Dawid Lachowicz 0bd9a2fafc
contracts: clean up feature flag warning duplicated across tests
There is no need for every contracts test to assert the same warning
for using the `contracts` feature flag, as such use
`#![expect(incomplete_features)]` in the tests, and add one test
to specifically check for the warning.
2025-12-07 17:29:30 +00:00

16 lines
282 B
Rust

//@ compile-flags: -Zcontract-checks=yes
#![expect(incomplete_features)]
#![feature(contracts)]
extern crate core;
use core::contracts::ensures;
#[ensures()]
//~^ ERROR expected a `Fn(&_)` closure, found `()` [E0277]
fn foo(x: u32) -> u32 {
x * 2
}
fn main() {
foo(1);
}