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.
17 lines
532 B
Rust
17 lines
532 B
Rust
//@ run-pass
|
|
//@ compile-flags: -Zcontract-checks=yes
|
|
|
|
// This test specifically checks that the [incomplete_features] warning is
|
|
// emitted when the `contracts` feature gate is enabled, so that it can be
|
|
// marked as `expect`ed in other tests in order to reduce duplication.
|
|
#![feature(contracts)]
|
|
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
|
|
extern crate core;
|
|
use core::contracts::requires;
|
|
|
|
#[requires(true)]
|
|
fn foo() {}
|
|
|
|
fn main() {
|
|
foo()
|
|
}
|