Skip to content

Commit d239114

Browse files
authored
Rollup merge of #149736 - dawidl022:contracts/chore/cleanup-warning-in-tests, r=Kivooeo,jieyouxu
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. Making this change has been discussed in the comments of #149722. Contracts tracking issue: #128044 r? Kivooeo
2 parents 3c2a5db + 0bd9a2f commit d239114

File tree

71 files changed

+50
-512
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+50
-512
lines changed

tests/ui/contracts/associated-item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
//@ compile-flags: --crate-type=lib
44
//@ check-pass
55

6+
#![expect(incomplete_features)]
67
#![feature(contracts)]
7-
//~^ WARN the feature `contracts` is incomplete and may not be safe to use
88

99
extern crate core;
1010

tests/ui/contracts/async-fn-contract-ice-145333.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@ compile-flags: --crate-type=lib
22
//@ edition: 2021
3+
#![expect(incomplete_features)]
34
#![feature(contracts)]
4-
//~^ WARN the feature `contracts` is incomplete
55

66
#[core::contracts::ensures(|ret| *ret)]
77
//~^ ERROR contract annotations are not yet supported on async or gen functions

tests/ui/contracts/async-fn-contract-ice-145333.stderr

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,5 @@ error: contract annotations are not yet supported on async or gen functions
44
LL | #[core::contracts::ensures(|ret| *ret)]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

7-
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
8-
--> $DIR/async-fn-contract-ice-145333.rs:3:12
9-
|
10-
LL | #![feature(contracts)]
11-
| ^^^^^^^^^
12-
|
13-
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
14-
= note: `#[warn(incomplete_features)]` on by default
15-
16-
error: aborting due to 1 previous error; 1 warning emitted
7+
error: aborting due to 1 previous error
178

tests/ui/contracts/contract-annotation-limitations.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! Test for some of the existing limitations and the current error messages.
22
//! Some of these limitations may be removed in the future.
33
4+
#![expect(incomplete_features)]
45
#![feature(contracts)]
5-
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
66
#![allow(dead_code)]
77

88
/// Represent a 5-star system.

tests/ui/contracts/contract-annotation-limitations.stderr

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,5 @@ error: contract annotations is only supported in functions with bodies
1010
LL | #[core::contracts::ensures(|ret| ret.is_none_or(Stars::is_valid))]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

13-
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
14-
--> $DIR/contract-annotation-limitations.rs:4:12
15-
|
16-
LL | #![feature(contracts)]
17-
| ^^^^^^^^^
18-
|
19-
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
20-
= note: `#[warn(incomplete_features)]` on by default
21-
22-
error: aborting due to 2 previous errors; 1 warning emitted
13+
error: aborting due to 2 previous errors
2314

tests/ui/contracts/contract-attributes-generics.chk_const_fail.stderr

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/ui/contracts/contract-attributes-generics.chk_fail_post.stderr

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/ui/contracts/contract-attributes-generics.chk_fail_pre.stderr

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/ui/contracts/contract-attributes-generics.chk_pass.stderr

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/ui/contracts/contract-attributes-generics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
//@ [chk_fail_post] compile-flags: -Zcontract-checks=yes
1717
//@ [chk_const_fail] compile-flags: -Zcontract-checks=yes
1818

19+
#![expect(incomplete_features)]
1920
#![feature(contracts)]
20-
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
2121

2222
use std::ops::Sub;
2323

0 commit comments

Comments
 (0)