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.
18 lines
334 B
Rust
18 lines
334 B
Rust
//@ dont-require-annotations: NOTE
|
|
//@ compile-flags: -Zcontract-checks=yes
|
|
#![expect(incomplete_features)]
|
|
#![feature(contracts)]
|
|
|
|
extern crate core;
|
|
use core::contracts::requires;
|
|
|
|
#[requires()]
|
|
//~^ ERROR mismatched types [E0308]
|
|
//~| NOTE expected `bool`, found `()`
|
|
fn foo(x: u32) -> u32 {
|
|
x * 2
|
|
}
|
|
|
|
fn main() {
|
|
foo(1);
|
|
}
|