From ddbf54b67d9befcf1fb90613d2a6f7f6aa03141e Mon Sep 17 00:00:00 2001 From: "Celina G. Val" Date: Thu, 30 Jan 2025 17:06:09 -0800 Subject: [PATCH] Rename rustc_contract to contract This has now been approved as a language feature and no longer needs a `rustc_` prefix. Also change the `contracts` feature to be marked as incomplete and `contracts_internals` as internal. --- compiler/rustc_ast_passes/src/feature_gate.rs | 4 +- .../rustc_builtin_macros/src/contracts.rs | 6 +-- compiler/rustc_feature/src/unstable.rs | 10 ++--- compiler/rustc_parse/src/parser/generics.rs | 12 ++--- compiler/rustc_parse/src/parser/token_type.rs | 16 +++---- compiler/rustc_span/src/symbol.rs | 8 ++-- library/core/src/contracts.rs | 2 +- library/core/src/intrinsics/mod.rs | 8 ++-- library/core/src/lib.rs | 2 +- library/core/src/macros/mod.rs | 8 ++-- .../contract-annotation-limitations.rs | 3 +- .../contract-annotation-limitations.stderr | 15 +++++-- ...-attributes-generics.chk_const_fail.stderr | 11 +++++ ...t-attributes-generics.chk_fail_post.stderr | 11 +++++ ...ct-attributes-generics.chk_fail_pre.stderr | 11 +++++ ...ntract-attributes-generics.chk_pass.stderr | 11 +++++ .../contracts/contract-attributes-generics.rs | 3 +- ...ract-attributes-generics.unchk_pass.stderr | 11 +++++ ...tract-attributes-nest.chk_fail_post.stderr | 11 +++++ ...ntract-attributes-nest.chk_fail_pre.stderr | 11 +++++ .../contract-attributes-nest.chk_pass.stderr | 11 +++++ .../ui/contracts/contract-attributes-nest.rs | 3 +- ...act-attributes-nest.unchk_fail_post.stderr | 11 +++++ ...ract-attributes-nest.unchk_fail_pre.stderr | 11 +++++ ...contract-attributes-nest.unchk_pass.stderr | 11 +++++ ...tract-attributes-tail.chk_fail_post.stderr | 11 +++++ ...ntract-attributes-tail.chk_fail_pre.stderr | 11 +++++ .../contract-attributes-tail.chk_pass.stderr | 11 +++++ .../ui/contracts/contract-attributes-tail.rs | 3 +- ...act-attributes-tail.unchk_fail_post.stderr | 11 +++++ ...ract-attributes-tail.unchk_fail_pre.stderr | 11 +++++ ...contract-attributes-tail.unchk_pass.stderr | 11 +++++ .../contract-captures-via-closure-copy.rs | 3 +- .../contract-captures-via-closure-copy.stderr | 11 +++++ .../contract-captures-via-closure-noncopy.rs | 3 +- ...ntract-captures-via-closure-noncopy.stderr | 23 +++++++--- ...-ensures-early-fn-exit.chk_fail_ret.stderr | 11 +++++ ...-ensures-early-fn-exit.chk_fail_try.stderr | 11 +++++ ...ensures-early-fn-exit.chk_fail_yeet.stderr | 11 +++++ ...acts-ensures-early-fn-exit.chk_pass.stderr | 11 +++++ .../contracts-ensures-early-fn-exit.rs | 3 +- ...ts-ensures-early-fn-exit.unchk_pass.stderr | 11 +++++ ...s-ensures-is-not-inherited-when-nesting.rs | 3 +- ...sures-is-not-inherited-when-nesting.stderr | 11 +++++ ...-requires-is-not-inherited-when-nesting.rs | 3 +- ...uires-is-not-inherited-when-nesting.stderr | 11 +++++ .../disallow-contract-annotation-on-non-fn.rs | 3 +- ...allow-contract-annotation-on-non-fn.stderr | 25 +++++++---- .../contract-ast-extensions-nest.rs | 6 +-- .../contract-ast-extensions-tail.rs | 6 +-- .../internal_machinery/contract-intrinsics.rs | 2 +- .../contract-lang-items.chk_fail_post.stderr | 11 +++++ .../contract-lang-items.chk_pass.stderr | 11 +++++ .../internal_machinery/contract-lang-items.rs | 5 ++- ...contract-lang-items.unchk_fail_post.stderr | 11 +++++ .../contract-lang-items.unchk_pass.stderr | 11 +++++ ...g-ensures-is-not-inherited-when-nesting.rs | 4 +- ...-requires-is-not-inherited-when-nesting.rs | 4 +- .../internal-feature-gating.rs | 18 ++++---- .../internal-feature-gating.stderr | 44 +++++++++---------- .../feature-gate-cfg-contract-checks.stderr | 2 +- .../feature-gates/feature-gate-contracts.rs | 11 +++++ .../feature-gate-contracts.stderr | 43 ++++++++++++++++++ .../feature-gate-rustc-contracts.rs | 11 ----- .../feature-gate-rustc-contracts.stderr | 43 ------------------ 65 files changed, 522 insertions(+), 165 deletions(-) create mode 100644 tests/ui/contracts/contract-attributes-generics.chk_const_fail.stderr create mode 100644 tests/ui/contracts/contract-attributes-generics.chk_fail_post.stderr create mode 100644 tests/ui/contracts/contract-attributes-generics.chk_fail_pre.stderr create mode 100644 tests/ui/contracts/contract-attributes-generics.chk_pass.stderr create mode 100644 tests/ui/contracts/contract-attributes-generics.unchk_pass.stderr create mode 100644 tests/ui/contracts/contract-attributes-nest.chk_fail_post.stderr create mode 100644 tests/ui/contracts/contract-attributes-nest.chk_fail_pre.stderr create mode 100644 tests/ui/contracts/contract-attributes-nest.chk_pass.stderr create mode 100644 tests/ui/contracts/contract-attributes-nest.unchk_fail_post.stderr create mode 100644 tests/ui/contracts/contract-attributes-nest.unchk_fail_pre.stderr create mode 100644 tests/ui/contracts/contract-attributes-nest.unchk_pass.stderr create mode 100644 tests/ui/contracts/contract-attributes-tail.chk_fail_post.stderr create mode 100644 tests/ui/contracts/contract-attributes-tail.chk_fail_pre.stderr create mode 100644 tests/ui/contracts/contract-attributes-tail.chk_pass.stderr create mode 100644 tests/ui/contracts/contract-attributes-tail.unchk_fail_post.stderr create mode 100644 tests/ui/contracts/contract-attributes-tail.unchk_fail_pre.stderr create mode 100644 tests/ui/contracts/contract-attributes-tail.unchk_pass.stderr create mode 100644 tests/ui/contracts/contract-captures-via-closure-copy.stderr create mode 100644 tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_ret.stderr create mode 100644 tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_try.stderr create mode 100644 tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_yeet.stderr create mode 100644 tests/ui/contracts/contracts-ensures-early-fn-exit.chk_pass.stderr create mode 100644 tests/ui/contracts/contracts-ensures-early-fn-exit.unchk_pass.stderr create mode 100644 tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.stderr create mode 100644 tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.stderr create mode 100644 tests/ui/contracts/internal_machinery/contract-lang-items.chk_fail_post.stderr create mode 100644 tests/ui/contracts/internal_machinery/contract-lang-items.chk_pass.stderr create mode 100644 tests/ui/contracts/internal_machinery/contract-lang-items.unchk_fail_post.stderr create mode 100644 tests/ui/contracts/internal_machinery/contract-lang-items.unchk_pass.stderr create mode 100644 tests/ui/feature-gates/feature-gate-contracts.rs create mode 100644 tests/ui/feature-gates/feature-gate-contracts.stderr delete mode 100644 tests/ui/feature-gates/feature-gate-rustc-contracts.rs delete mode 100644 tests/ui/feature-gates/feature-gate-rustc-contracts.stderr diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index a3af942a10f17..62e451fa8764f 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -548,8 +548,8 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) { gate_all!(pin_ergonomics, "pinned reference syntax is experimental"); gate_all!(unsafe_fields, "`unsafe` fields are experimental"); gate_all!(unsafe_binders, "unsafe binder types are experimental"); - gate_all!(rustc_contracts, "contracts are experimental"); - gate_all!(rustc_contracts_internals, "contract internal machinery is for internal use only"); + gate_all!(contracts, "contracts are incomplete"); + gate_all!(contracts_internals, "contract internal machinery is for internal use only"); if !visitor.features.never_patterns() { if let Some(spans) = spans.get(&sym::never_patterns) { diff --git a/compiler/rustc_builtin_macros/src/contracts.rs b/compiler/rustc_builtin_macros/src/contracts.rs index fbdd8af99542d..85a30f7bdc9b4 100644 --- a/compiler/rustc_builtin_macros/src/contracts.rs +++ b/compiler/rustc_builtin_macros/src/contracts.rs @@ -123,7 +123,7 @@ fn expand_contract_clause( // Record the span as a contract attribute expansion. // This is used later to stop users from using the extended syntax directly - // which is gated via `rustc_contracts_internals`. + // which is gated via `contracts_internals`. ecx.psess().contract_attribute_spans.push(attr_span); Ok(new_tts) @@ -137,7 +137,7 @@ fn expand_requires_tts( ) -> Result { expand_contract_clause(_ecx, attr_span, annotated, |new_tts| { new_tts.push_tree(TokenTree::Token( - token::Token::from_ast_ident(Ident::new(kw::RustcContractRequires, attr_span)), + token::Token::from_ast_ident(Ident::new(kw::ContractRequires, attr_span)), Spacing::Joint, )); new_tts.push_tree(TokenTree::Token( @@ -162,7 +162,7 @@ fn expand_ensures_tts( ) -> Result { expand_contract_clause(_ecx, attr_span, annotated, |new_tts| { new_tts.push_tree(TokenTree::Token( - token::Token::from_ast_ident(Ident::new(kw::RustcContractEnsures, attr_span)), + token::Token::from_ast_ident(Ident::new(kw::ContractEnsures, attr_span)), Spacing::Joint, )); new_tts.push_tree(TokenTree::Delimited( diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 57bcd8c5eca22..5699d4ce3b9b6 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -404,7 +404,7 @@ declare_features! ( /// Allows the use of `#[cfg()]`. (unstable, cfg_boolean_literals, "1.83.0", Some(131204)), /// Allows the use of `#[cfg(contract_checks)` to check if contract checks are enabled. - (unstable, cfg_contract_checks, "CURRENT_RUSTC_VERSION", Some(133866)), + (unstable, cfg_contract_checks, "CURRENT_RUSTC_VERSION", Some(128044)), /// Allows the use of `#[cfg(overflow_checks)` to check if integer overflow behaviour. (unstable, cfg_overflow_checks, "1.71.0", Some(111466)), /// Provides the relocation model information as cfg entry @@ -447,6 +447,10 @@ declare_features! ( (unstable, const_trait_impl, "1.42.0", Some(67792)), /// Allows the `?` operator in const contexts. (unstable, const_try, "1.56.0", Some(74935)), + /// Allows use of contracts attributes. + (incomplete, contracts, "CURRENT_RUSTC_VERSION", Some(128044)), + /// Allows access to internal machinery used to implement contracts. + (internal, contracts_internals, "CURRENT_RUSTC_VERSION", Some(128044)), /// Allows coroutines to be cloned. (unstable, coroutine_clone, "1.65.0", Some(95360)), /// Allows defining coroutines. @@ -608,10 +612,6 @@ declare_features! ( (unstable, return_type_notation, "1.70.0", Some(109417)), /// Allows `extern "rust-cold"`. (unstable, rust_cold_cc, "1.63.0", Some(97544)), - /// Allows use of contracts attributes. - (unstable, rustc_contracts, "CURRENT_RUSTC_VERSION", Some(133866)), - /// Allows access to internal machinery used to implement contracts. - (unstable, rustc_contracts_internals, "CURRENT_RUSTC_VERSION", Some(133866)), /// Allows use of x86 SHA512, SM3 and SM4 target-features and intrinsics (unstable, sha512_sm_x86, "1.82.0", Some(126624)), /// Allows the use of SIMD types in functions declared in `extern` blocks. diff --git a/compiler/rustc_parse/src/parser/generics.rs b/compiler/rustc_parse/src/parser/generics.rs index 14b949dbc3d57..86816819be275 100644 --- a/compiler/rustc_parse/src/parser/generics.rs +++ b/compiler/rustc_parse/src/parser/generics.rs @@ -297,29 +297,29 @@ impl<'a> Parser<'a> { }) } - /// Parses a rustc-internal fn contract - /// (`rustc_contract_requires(WWW) rustc_contract_ensures(ZZZ)`) + /// Parses an experimental fn contract + /// (`contract_requires(WWW) contract_ensures(ZZZ)`) pub(super) fn parse_contract( &mut self, ) -> PResult<'a, Option>> { let gate = |span| { if self.psess.contract_attribute_spans.contains(span) { // span was generated via a builtin contracts attribute, so gate as end-user visible - self.psess.gated_spans.gate(sym::rustc_contracts, span); + self.psess.gated_spans.gate(sym::contracts, span); } else { // span was not generated via a builtin contracts attribute, so gate as internal machinery - self.psess.gated_spans.gate(sym::rustc_contracts_internals, span); + self.psess.gated_spans.gate(sym::contracts_internals, span); } }; - let requires = if self.eat_keyword_noexpect(exp!(RustcContractRequires).kw) { + let requires = if self.eat_keyword_noexpect(exp!(ContractRequires).kw) { let precond = self.parse_expr()?; gate(precond.span); Some(precond) } else { None }; - let ensures = if self.eat_keyword_noexpect(exp!(RustcContractEnsures).kw) { + let ensures = if self.eat_keyword_noexpect(exp!(ContractEnsures).kw) { let postcond = self.parse_expr()?; gate(postcond.span); Some(postcond) diff --git a/compiler/rustc_parse/src/parser/token_type.rs b/compiler/rustc_parse/src/parser/token_type.rs index 50f03e72f82dc..40631d9154d37 100644 --- a/compiler/rustc_parse/src/parser/token_type.rs +++ b/compiler/rustc_parse/src/parser/token_type.rs @@ -83,6 +83,8 @@ pub enum TokenType { KwCatch, KwConst, KwContinue, + KwContractEnsures, + KwContractRequires, KwCrate, KwDefault, KwDyn, @@ -108,8 +110,6 @@ pub enum TokenType { KwRef, KwReturn, KwReuse, - KwRustcContractEnsures, - KwRustcContractRequires, KwSafe, KwSelfUpper, KwStatic, @@ -219,6 +219,8 @@ impl TokenType { KwCatch, KwConst, KwContinue, + KwContractEnsures, + KwContractRequires, KwCrate, KwDefault, KwDyn, @@ -244,8 +246,6 @@ impl TokenType { KwRef, KwReturn, KwReuse, - KwRustcContractEnsures, - KwRustcContractRequires, KwSafe, KwSelfUpper, KwStatic, @@ -293,6 +293,8 @@ impl TokenType { TokenType::KwCatch => Some(kw::Catch), TokenType::KwConst => Some(kw::Const), TokenType::KwContinue => Some(kw::Continue), + TokenType::KwContractEnsures => Some(kw::ContractEnsures), + TokenType::KwContractRequires => Some(kw::ContractRequires), TokenType::KwCrate => Some(kw::Crate), TokenType::KwDefault => Some(kw::Default), TokenType::KwDyn => Some(kw::Dyn), @@ -318,8 +320,6 @@ impl TokenType { TokenType::KwRef => Some(kw::Ref), TokenType::KwReturn => Some(kw::Return), TokenType::KwReuse => Some(kw::Reuse), - TokenType::KwRustcContractEnsures => Some(kw::RustcContractEnsures), - TokenType::KwRustcContractRequires => Some(kw::RustcContractRequires), TokenType::KwSafe => Some(kw::Safe), TokenType::KwSelfUpper => Some(kw::SelfUpper), TokenType::KwStatic => Some(kw::Static), @@ -525,6 +525,8 @@ macro_rules! exp { (Catch) => { exp!(@kw, Catch, KwCatch) }; (Const) => { exp!(@kw, Const, KwConst) }; (Continue) => { exp!(@kw, Continue, KwContinue) }; + (ContractEnsures) => { exp!(@kw, ContractEnsures, KwContractEnsures) }; + (ContractRequires) => { exp!(@kw, ContractRequires, KwContractRequires) }; (Crate) => { exp!(@kw, Crate, KwCrate) }; (Default) => { exp!(@kw, Default, KwDefault) }; (Dyn) => { exp!(@kw, Dyn, KwDyn) }; @@ -550,8 +552,6 @@ macro_rules! exp { (Ref) => { exp!(@kw, Ref, KwRef) }; (Return) => { exp!(@kw, Return, KwReturn) }; (Reuse) => { exp!(@kw, Reuse, KwReuse) }; - (RustcContractEnsures) => { exp!(@kw, RustcContractEnsures, KwRustcContractEnsures) }; - (RustcContractRequires) => { exp!(@kw, RustcContractRequires, KwRustcContractRequires) }; (Safe) => { exp!(@kw, Safe, KwSafe) }; (SelfUpper) => { exp!(@kw, SelfUpper, KwSelfUpper) }; (Static) => { exp!(@kw, Static, KwStatic) }; diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index ea2ce5475c264..529dfc6ff7a03 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -118,8 +118,8 @@ symbols! { MacroRules: "macro_rules", Raw: "raw", Reuse: "reuse", - RustcContractEnsures: "rustc_contract_ensures", - RustcContractRequires: "rustc_contract_requires", + ContractEnsures: "contract_ensures", + ContractRequires: "contract_requires", Safe: "safe", Union: "union", Yeet: "yeet", @@ -682,7 +682,9 @@ symbols! { contract_check_ensures, contract_check_requires, contract_checks, + contracts, contracts_ensures, + contracts_internals, contracts_requires, convert_identity, copy, @@ -1716,8 +1718,6 @@ symbols! { rustc_const_stable, rustc_const_stable_indirect, rustc_const_unstable, - rustc_contracts, - rustc_contracts_internals, rustc_conversion_suggestion, rustc_deallocator, rustc_def_path, diff --git a/library/core/src/contracts.rs b/library/core/src/contracts.rs index 0668cacb92c60..c769e219e4d49 100644 --- a/library/core/src/contracts.rs +++ b/library/core/src/contracts.rs @@ -6,7 +6,7 @@ pub use crate::macros::builtin::{contracts_ensures as ensures, contracts_require /// Emitted by rustc as a desugaring of `#[ensures(PRED)] fn foo() -> R { ... [return R;] ... }` /// into: `fn foo() { let _check = build_check_ensures(|ret| PRED) ... [return _check(R);] ... }` /// (including the implicit return of the tail expression, if any). -#[unstable(feature = "rustc_contracts_internals", issue = "133866" /* compiler-team#759 */)] +#[unstable(feature = "contracts_internals", issue = "128044" /* compiler-team#759 */)] #[lang = "contract_build_check_ensures"] #[track_caller] pub fn build_check_ensures(cond: C) -> impl (Fn(Ret) -> Ret) + Copy diff --git a/library/core/src/intrinsics/mod.rs b/library/core/src/intrinsics/mod.rs index 14f8645d6f1e5..1e4dc12f9b617 100644 --- a/library/core/src/intrinsics/mod.rs +++ b/library/core/src/intrinsics/mod.rs @@ -4051,8 +4051,8 @@ pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) /// checking is turned on, so that we can specify contracts in libstd /// and let an end user opt into turning them on. #[cfg(not(bootstrap))] -#[rustc_const_unstable(feature = "rustc_contracts_internals", issue = "133866" /* compiler-team#759 */)] -#[unstable(feature = "rustc_contracts_internals", issue = "133866" /* compiler-team#759 */)] +#[rustc_const_unstable(feature = "contracts_internals", issue = "128044" /* compiler-team#759 */)] +#[unstable(feature = "contracts_internals", issue = "128044" /* compiler-team#759 */)] #[inline(always)] #[rustc_intrinsic] pub const fn contract_checks() -> bool { @@ -4067,7 +4067,7 @@ pub const fn contract_checks() -> bool { /// By default, if `contract_checks` is enabled, this will panic with no unwind if the condition /// returns false. #[cfg(not(bootstrap))] -#[unstable(feature = "rustc_contracts_internals", issue = "133866" /* compiler-team#759 */)] +#[unstable(feature = "contracts_internals", issue = "128044" /* compiler-team#759 */)] #[lang = "contract_check_requires"] #[rustc_intrinsic] pub fn contract_check_requires bool>(cond: C) { @@ -4082,7 +4082,7 @@ pub fn contract_check_requires bool>(cond: C) { /// By default, if `contract_checks` is enabled, this will panic with no unwind if the condition /// returns false. #[cfg(not(bootstrap))] -#[unstable(feature = "rustc_contracts_internals", issue = "133866" /* compiler-team#759 */)] +#[unstable(feature = "contracts_internals", issue = "128044" /* compiler-team#759 */)] #[rustc_intrinsic] pub fn contract_check_ensures<'a, Ret, C: Fn(&'a Ret) -> bool>(ret: &'a Ret, cond: C) { if contract_checks() && !cond(ret) { diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 6a0051244f062..de8e85f7b36ed 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -248,7 +248,7 @@ pub mod autodiff { } #[cfg(not(bootstrap))] -#[unstable(feature = "rustc_contracts", issue = "133866")] +#[unstable(feature = "contracts", issue = "128044")] pub mod contracts; #[unstable(feature = "cfg_match", issue = "115585")] diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index cb37530e90db8..4c6fd196bd31c 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -1783,8 +1783,8 @@ pub(crate) mod builtin { /// eventually parsed as a unary closure expression that is /// invoked on a reference to the return value. #[cfg(not(bootstrap))] - #[unstable(feature = "rustc_contracts", issue = "133866")] - #[allow_internal_unstable(rustc_contracts_internals)] + #[unstable(feature = "contracts", issue = "128044")] + #[allow_internal_unstable(contracts_internals)] #[rustc_builtin_macro] pub macro contracts_ensures($item:item) { /* compiler built-in */ @@ -1796,8 +1796,8 @@ pub(crate) mod builtin { /// eventually parsed as an boolean expression with access to the /// function's formal parameters #[cfg(not(bootstrap))] - #[unstable(feature = "rustc_contracts", issue = "133866")] - #[allow_internal_unstable(rustc_contracts_internals)] + #[unstable(feature = "contracts", issue = "128044")] + #[allow_internal_unstable(contracts_internals)] #[rustc_builtin_macro] pub macro contracts_requires($item:item) { /* compiler built-in */ diff --git a/tests/ui/contracts/contract-annotation-limitations.rs b/tests/ui/contracts/contract-annotation-limitations.rs index f01d526e3f70e..10b3bacab5cfa 100644 --- a/tests/ui/contracts/contract-annotation-limitations.rs +++ b/tests/ui/contracts/contract-annotation-limitations.rs @@ -1,7 +1,8 @@ //! Test for some of the existing limitations and the current error messages. //! Some of these limitations may be removed in the future. -#![feature(rustc_contracts)] +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] #![allow(dead_code)] /// Represent a 5-star system. diff --git a/tests/ui/contracts/contract-annotation-limitations.stderr b/tests/ui/contracts/contract-annotation-limitations.stderr index 25b01744aac8e..14338cf4b8687 100644 --- a/tests/ui/contracts/contract-annotation-limitations.stderr +++ b/tests/ui/contracts/contract-annotation-limitations.stderr @@ -1,14 +1,23 @@ error: contract annotations is only supported in functions with bodies - --> $DIR/contract-annotation-limitations.rs:17:5 + --> $DIR/contract-annotation-limitations.rs:18:5 | LL | #[core::contracts::ensures(|ret| ret.is_none_or(Stars::is_valid))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: contract annotations is only supported in functions with bodies - --> $DIR/contract-annotation-limitations.rs:21:5 + --> $DIR/contract-annotation-limitations.rs:22:5 | LL | #[core::contracts::ensures(|ret| ret.is_none_or(Stars::is_valid))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-annotation-limitations.rs:4:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: aborting due to 2 previous errors; 1 warning emitted diff --git a/tests/ui/contracts/contract-attributes-generics.chk_const_fail.stderr b/tests/ui/contracts/contract-attributes-generics.chk_const_fail.stderr new file mode 100644 index 0000000000000..0630811d4f7ea --- /dev/null +++ b/tests/ui/contracts/contract-attributes-generics.chk_const_fail.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-generics.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-generics.chk_fail_post.stderr b/tests/ui/contracts/contract-attributes-generics.chk_fail_post.stderr new file mode 100644 index 0000000000000..0630811d4f7ea --- /dev/null +++ b/tests/ui/contracts/contract-attributes-generics.chk_fail_post.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-generics.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-generics.chk_fail_pre.stderr b/tests/ui/contracts/contract-attributes-generics.chk_fail_pre.stderr new file mode 100644 index 0000000000000..0630811d4f7ea --- /dev/null +++ b/tests/ui/contracts/contract-attributes-generics.chk_fail_pre.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-generics.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-generics.chk_pass.stderr b/tests/ui/contracts/contract-attributes-generics.chk_pass.stderr new file mode 100644 index 0000000000000..0630811d4f7ea --- /dev/null +++ b/tests/ui/contracts/contract-attributes-generics.chk_pass.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-generics.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-generics.rs b/tests/ui/contracts/contract-attributes-generics.rs index 87088ce9de2ce..fd79c6abedd85 100644 --- a/tests/ui/contracts/contract-attributes-generics.rs +++ b/tests/ui/contracts/contract-attributes-generics.rs @@ -16,7 +16,8 @@ //@ [chk_fail_post] compile-flags: -Zcontract-checks=yes //@ [chk_const_fail] compile-flags: -Zcontract-checks=yes -#![feature(rustc_contracts)] +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] use std::ops::Sub; diff --git a/tests/ui/contracts/contract-attributes-generics.unchk_pass.stderr b/tests/ui/contracts/contract-attributes-generics.unchk_pass.stderr new file mode 100644 index 0000000000000..0630811d4f7ea --- /dev/null +++ b/tests/ui/contracts/contract-attributes-generics.unchk_pass.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-generics.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-nest.chk_fail_post.stderr b/tests/ui/contracts/contract-attributes-nest.chk_fail_post.stderr new file mode 100644 index 0000000000000..9ca95b8bb01a4 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-nest.chk_fail_post.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-nest.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-nest.chk_fail_pre.stderr b/tests/ui/contracts/contract-attributes-nest.chk_fail_pre.stderr new file mode 100644 index 0000000000000..9ca95b8bb01a4 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-nest.chk_fail_pre.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-nest.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-nest.chk_pass.stderr b/tests/ui/contracts/contract-attributes-nest.chk_pass.stderr new file mode 100644 index 0000000000000..9ca95b8bb01a4 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-nest.chk_pass.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-nest.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-nest.rs b/tests/ui/contracts/contract-attributes-nest.rs index 1cda21f10d7ec..e1e61b88f282e 100644 --- a/tests/ui/contracts/contract-attributes-nest.rs +++ b/tests/ui/contracts/contract-attributes-nest.rs @@ -16,7 +16,8 @@ //@ [chk_fail_pre] compile-flags: -Zcontract-checks=yes //@ [chk_fail_post] compile-flags: -Zcontract-checks=yes -#![feature(rustc_contracts)] +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] #[core::contracts::requires(x.baz > 0)] #[core::contracts::ensures(|ret| *ret > 100)] diff --git a/tests/ui/contracts/contract-attributes-nest.unchk_fail_post.stderr b/tests/ui/contracts/contract-attributes-nest.unchk_fail_post.stderr new file mode 100644 index 0000000000000..9ca95b8bb01a4 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-nest.unchk_fail_post.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-nest.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-nest.unchk_fail_pre.stderr b/tests/ui/contracts/contract-attributes-nest.unchk_fail_pre.stderr new file mode 100644 index 0000000000000..9ca95b8bb01a4 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-nest.unchk_fail_pre.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-nest.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-nest.unchk_pass.stderr b/tests/ui/contracts/contract-attributes-nest.unchk_pass.stderr new file mode 100644 index 0000000000000..9ca95b8bb01a4 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-nest.unchk_pass.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-nest.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-tail.chk_fail_post.stderr b/tests/ui/contracts/contract-attributes-tail.chk_fail_post.stderr new file mode 100644 index 0000000000000..f87e7e19fa3db --- /dev/null +++ b/tests/ui/contracts/contract-attributes-tail.chk_fail_post.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-tail.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-tail.chk_fail_pre.stderr b/tests/ui/contracts/contract-attributes-tail.chk_fail_pre.stderr new file mode 100644 index 0000000000000..f87e7e19fa3db --- /dev/null +++ b/tests/ui/contracts/contract-attributes-tail.chk_fail_pre.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-tail.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-tail.chk_pass.stderr b/tests/ui/contracts/contract-attributes-tail.chk_pass.stderr new file mode 100644 index 0000000000000..f87e7e19fa3db --- /dev/null +++ b/tests/ui/contracts/contract-attributes-tail.chk_pass.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-tail.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-tail.rs b/tests/ui/contracts/contract-attributes-tail.rs index 26855bfa82ac4..ce4a6be5b82f7 100644 --- a/tests/ui/contracts/contract-attributes-tail.rs +++ b/tests/ui/contracts/contract-attributes-tail.rs @@ -16,7 +16,8 @@ //@ [chk_fail_pre] compile-flags: -Zcontract-checks=yes //@ [chk_fail_post] compile-flags: -Zcontract-checks=yes -#![feature(rustc_contracts)] +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] #[core::contracts::requires(x.baz > 0)] #[core::contracts::ensures(|ret| *ret > 100)] diff --git a/tests/ui/contracts/contract-attributes-tail.unchk_fail_post.stderr b/tests/ui/contracts/contract-attributes-tail.unchk_fail_post.stderr new file mode 100644 index 0000000000000..f87e7e19fa3db --- /dev/null +++ b/tests/ui/contracts/contract-attributes-tail.unchk_fail_post.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-tail.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-tail.unchk_fail_pre.stderr b/tests/ui/contracts/contract-attributes-tail.unchk_fail_pre.stderr new file mode 100644 index 0000000000000..f87e7e19fa3db --- /dev/null +++ b/tests/ui/contracts/contract-attributes-tail.unchk_fail_pre.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-tail.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-tail.unchk_pass.stderr b/tests/ui/contracts/contract-attributes-tail.unchk_pass.stderr new file mode 100644 index 0000000000000..f87e7e19fa3db --- /dev/null +++ b/tests/ui/contracts/contract-attributes-tail.unchk_pass.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-tail.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-captures-via-closure-copy.rs b/tests/ui/contracts/contract-captures-via-closure-copy.rs index 742895ab0ad80..32c6d2bf4fe17 100644 --- a/tests/ui/contracts/contract-captures-via-closure-copy.rs +++ b/tests/ui/contracts/contract-captures-via-closure-copy.rs @@ -1,7 +1,8 @@ //@ run-fail //@ compile-flags: -Zcontract-checks=yes -#![feature(rustc_contracts)] +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] struct Baz { baz: i32 diff --git a/tests/ui/contracts/contract-captures-via-closure-copy.stderr b/tests/ui/contracts/contract-captures-via-closure-copy.stderr new file mode 100644 index 0000000000000..d92db601608f5 --- /dev/null +++ b/tests/ui/contracts/contract-captures-via-closure-copy.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-captures-via-closure-copy.rs:4:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-captures-via-closure-noncopy.rs b/tests/ui/contracts/contract-captures-via-closure-noncopy.rs index 8d7f2fd200e2c..976f64c7fd911 100644 --- a/tests/ui/contracts/contract-captures-via-closure-noncopy.rs +++ b/tests/ui/contracts/contract-captures-via-closure-noncopy.rs @@ -1,6 +1,7 @@ //@ compile-flags: -Zcontract-checks=yes -#![feature(rustc_contracts)] +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] struct Baz { baz: i32 diff --git a/tests/ui/contracts/contract-captures-via-closure-noncopy.stderr b/tests/ui/contracts/contract-captures-via-closure-noncopy.stderr index b53809827f987..4a47671fee191 100644 --- a/tests/ui/contracts/contract-captures-via-closure-noncopy.stderr +++ b/tests/ui/contracts/contract-captures-via-closure-noncopy.stderr @@ -1,16 +1,25 @@ -error[E0277]: the trait bound `Baz: std::marker::Copy` is not satisfied in `{closure@$DIR/contract-captures-via-closure-noncopy.rs:11:42: 11:57}` - --> $DIR/contract-captures-via-closure-noncopy.rs:11:1 +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-captures-via-closure-noncopy.rs:3:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0277]: the trait bound `Baz: std::marker::Copy` is not satisfied in `{closure@$DIR/contract-captures-via-closure-noncopy.rs:12:42: 12:57}` + --> $DIR/contract-captures-via-closure-noncopy.rs:12:1 | LL | #[core::contracts::ensures({let old = x; move |ret:&Baz| ret.baz == old.baz*2 })] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^^ | | | - | | within this `{closure@$DIR/contract-captures-via-closure-noncopy.rs:11:42: 11:57}` - | | this tail expression is of type `{closure@contract-captures-via-closure-noncopy.rs:11:42}` + | | within this `{closure@$DIR/contract-captures-via-closure-noncopy.rs:12:42: 12:57}` + | | this tail expression is of type `{closure@contract-captures-via-closure-noncopy.rs:12:42}` | unsatisfied trait bound | - = help: within `{closure@$DIR/contract-captures-via-closure-noncopy.rs:11:42: 11:57}`, the trait `std::marker::Copy` is not implemented for `Baz` + = help: within `{closure@$DIR/contract-captures-via-closure-noncopy.rs:12:42: 12:57}`, the trait `std::marker::Copy` is not implemented for `Baz` note: required because it's used within this closure - --> $DIR/contract-captures-via-closure-noncopy.rs:11:42 + --> $DIR/contract-captures-via-closure-noncopy.rs:12:42 | LL | #[core::contracts::ensures({let old = x; move |ret:&Baz| ret.baz == old.baz*2 })] | ^^^^^^^^^^^^^^^ @@ -22,6 +31,6 @@ LL + #[derive(Copy)] LL | struct Baz { | -error: aborting due to 1 previous error +error: aborting due to 1 previous error; 1 warning emitted For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_ret.stderr b/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_ret.stderr new file mode 100644 index 0000000000000..d693fad446a4d --- /dev/null +++ b/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_ret.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contracts-ensures-early-fn-exit.rs:16:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_try.stderr b/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_try.stderr new file mode 100644 index 0000000000000..d693fad446a4d --- /dev/null +++ b/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_try.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contracts-ensures-early-fn-exit.rs:16:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_yeet.stderr b/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_yeet.stderr new file mode 100644 index 0000000000000..d693fad446a4d --- /dev/null +++ b/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_yeet.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contracts-ensures-early-fn-exit.rs:16:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_pass.stderr b/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_pass.stderr new file mode 100644 index 0000000000000..d693fad446a4d --- /dev/null +++ b/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_pass.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contracts-ensures-early-fn-exit.rs:16:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contracts-ensures-early-fn-exit.rs b/tests/ui/contracts/contracts-ensures-early-fn-exit.rs index faf97473a90f2..034cead3b4e9f 100644 --- a/tests/ui/contracts/contracts-ensures-early-fn-exit.rs +++ b/tests/ui/contracts/contracts-ensures-early-fn-exit.rs @@ -13,7 +13,8 @@ //@ [chk_fail_yeet] compile-flags: -Zcontract-checks=yes //! This test ensures that ensures clauses are checked for different return points of a function. -#![feature(rustc_contracts)] +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] #![feature(yeet_expr)] /// This ensures will fail in different return points depending on the input. diff --git a/tests/ui/contracts/contracts-ensures-early-fn-exit.unchk_pass.stderr b/tests/ui/contracts/contracts-ensures-early-fn-exit.unchk_pass.stderr new file mode 100644 index 0000000000000..d693fad446a4d --- /dev/null +++ b/tests/ui/contracts/contracts-ensures-early-fn-exit.unchk_pass.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contracts-ensures-early-fn-exit.rs:16:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.rs b/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.rs index 9872fdb1a1852..f01a852fbff34 100644 --- a/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.rs +++ b/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.rs @@ -1,6 +1,7 @@ //@ run-pass //@ compile-flags: -Zcontract-checks=yes -#![feature(rustc_contracts)] +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] #[core::contracts::ensures(|ret| *ret > 0)] fn outer() -> i32 { diff --git a/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.stderr b/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.stderr new file mode 100644 index 0000000000000..49a372b53c7d8 --- /dev/null +++ b/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contracts-ensures-is-not-inherited-when-nesting.rs:3:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.rs b/tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.rs index 75124259b0d72..2c2a4a6978550 100644 --- a/tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.rs +++ b/tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.rs @@ -1,6 +1,7 @@ //@ run-pass //@ compile-flags: -Zcontract-checks=yes -#![feature(rustc_contracts)] +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] struct Outer { outer: std::cell::Cell } diff --git a/tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.stderr b/tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.stderr new file mode 100644 index 0000000000000..48898c4434ad5 --- /dev/null +++ b/tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contracts-requires-is-not-inherited-when-nesting.rs:3:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/disallow-contract-annotation-on-non-fn.rs b/tests/ui/contracts/disallow-contract-annotation-on-non-fn.rs index 76ed30e856462..69be906782a67 100644 --- a/tests/ui/contracts/disallow-contract-annotation-on-non-fn.rs +++ b/tests/ui/contracts/disallow-contract-annotation-on-non-fn.rs @@ -1,6 +1,7 @@ //! Checks for compilation errors related to adding contracts to non-function items. -#![feature(rustc_contracts)] +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] #![allow(dead_code)] #[core::contracts::requires(true)] diff --git a/tests/ui/contracts/disallow-contract-annotation-on-non-fn.stderr b/tests/ui/contracts/disallow-contract-annotation-on-non-fn.stderr index 4d6d23340ac0e..0a7fff8183e09 100644 --- a/tests/ui/contracts/disallow-contract-annotation-on-non-fn.stderr +++ b/tests/ui/contracts/disallow-contract-annotation-on-non-fn.stderr @@ -1,44 +1,53 @@ error: contract annotations can only be used on functions - --> $DIR/disallow-contract-annotation-on-non-fn.rs:6:1 + --> $DIR/disallow-contract-annotation-on-non-fn.rs:7:1 | LL | #[core::contracts::requires(true)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: contract annotations can only be used on functions - --> $DIR/disallow-contract-annotation-on-non-fn.rs:10:1 + --> $DIR/disallow-contract-annotation-on-non-fn.rs:11:1 | LL | #[core::contracts::ensures(|v| v == 100)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: contract annotations is only supported in functions with bodies - --> $DIR/disallow-contract-annotation-on-non-fn.rs:15:1 + --> $DIR/disallow-contract-annotation-on-non-fn.rs:16:1 | LL | #[core::contracts::ensures(|v| v == 100)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: contract annotations is only supported in functions with bodies - --> $DIR/disallow-contract-annotation-on-non-fn.rs:19:1 + --> $DIR/disallow-contract-annotation-on-non-fn.rs:20:1 | LL | #[core::contracts::ensures(|v| v == 100)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: contract annotations can only be used on functions - --> $DIR/disallow-contract-annotation-on-non-fn.rs:23:1 + --> $DIR/disallow-contract-annotation-on-non-fn.rs:24:1 | LL | #[core::contracts::requires(true)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: contract annotations can only be used on functions - --> $DIR/disallow-contract-annotation-on-non-fn.rs:34:1 + --> $DIR/disallow-contract-annotation-on-non-fn.rs:35:1 | LL | #[core::contracts::ensures(|dummy| dummy.0 > 0)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: contract annotations can only be used on functions - --> $DIR/disallow-contract-annotation-on-non-fn.rs:45:1 + --> $DIR/disallow-contract-annotation-on-non-fn.rs:46:1 | LL | #[core::contracts::requires(true)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 7 previous errors +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/disallow-contract-annotation-on-non-fn.rs:3:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: aborting due to 7 previous errors; 1 warning emitted diff --git a/tests/ui/contracts/internal_machinery/contract-ast-extensions-nest.rs b/tests/ui/contracts/internal_machinery/contract-ast-extensions-nest.rs index d95ccd4f7b9b6..6d8cd3949eedb 100644 --- a/tests/ui/contracts/internal_machinery/contract-ast-extensions-nest.rs +++ b/tests/ui/contracts/internal_machinery/contract-ast-extensions-nest.rs @@ -16,11 +16,11 @@ //@ [chk_fail_pre] compile-flags: -Zcontract-checks=yes //@ [chk_fail_post] compile-flags: -Zcontract-checks=yes -#![feature(rustc_contracts_internals)] +#![feature(contracts_internals)] fn nest(x: Baz) -> i32 - rustc_contract_requires(|| x.baz > 0) - rustc_contract_ensures(|ret| *ret > 100) + contract_requires(|| x.baz > 0) + contract_ensures(|ret| *ret > 100) { loop { return x.baz + 50; diff --git a/tests/ui/contracts/internal_machinery/contract-ast-extensions-tail.rs b/tests/ui/contracts/internal_machinery/contract-ast-extensions-tail.rs index 636a595e06adb..07ec26f921b80 100644 --- a/tests/ui/contracts/internal_machinery/contract-ast-extensions-tail.rs +++ b/tests/ui/contracts/internal_machinery/contract-ast-extensions-tail.rs @@ -16,11 +16,11 @@ //@ [chk_fail_pre] compile-flags: -Zcontract-checks=yes //@ [chk_fail_post] compile-flags: -Zcontract-checks=yes -#![feature(rustc_contracts_internals)] +#![feature(contracts_internals)] fn tail(x: Baz) -> i32 - rustc_contract_requires(|| x.baz > 0) - rustc_contract_ensures(|ret| *ret > 100) + contract_requires(|| x.baz > 0) + contract_ensures(|ret| *ret > 100) { x.baz + 50 } diff --git a/tests/ui/contracts/internal_machinery/contract-intrinsics.rs b/tests/ui/contracts/internal_machinery/contract-intrinsics.rs index 8c70c1a85f6d3..ae692afd146fe 100644 --- a/tests/ui/contracts/internal_machinery/contract-intrinsics.rs +++ b/tests/ui/contracts/internal_machinery/contract-intrinsics.rs @@ -10,7 +10,7 @@ //@ [chk_pass] compile-flags: -Zcontract-checks=yes //@ [chk_fail_requires] compile-flags: -Zcontract-checks=yes //@ [chk_fail_ensures] compile-flags: -Zcontract-checks=yes -#![feature(cfg_contract_checks, rustc_contracts_internals, core_intrinsics)] +#![feature(cfg_contract_checks, contracts_internals, core_intrinsics)] fn main() { #[cfg(any(default, unchk_pass))] // default: disabled diff --git a/tests/ui/contracts/internal_machinery/contract-lang-items.chk_fail_post.stderr b/tests/ui/contracts/internal_machinery/contract-lang-items.chk_fail_post.stderr new file mode 100644 index 0000000000000..a60ce1602659b --- /dev/null +++ b/tests/ui/contracts/internal_machinery/contract-lang-items.chk_fail_post.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-lang-items.rs:15:12 + | +LL | #![feature(contracts)] // to access core::contracts + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/internal_machinery/contract-lang-items.chk_pass.stderr b/tests/ui/contracts/internal_machinery/contract-lang-items.chk_pass.stderr new file mode 100644 index 0000000000000..a60ce1602659b --- /dev/null +++ b/tests/ui/contracts/internal_machinery/contract-lang-items.chk_pass.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-lang-items.rs:15:12 + | +LL | #![feature(contracts)] // to access core::contracts + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/internal_machinery/contract-lang-items.rs b/tests/ui/contracts/internal_machinery/contract-lang-items.rs index ff569e011f206..e91bbed294d12 100644 --- a/tests/ui/contracts/internal_machinery/contract-lang-items.rs +++ b/tests/ui/contracts/internal_machinery/contract-lang-items.rs @@ -12,8 +12,9 @@ //@ [chk_pass] compile-flags: -Zcontract-checks=yes //@ [chk_fail_post] compile-flags: -Zcontract-checks=yes -#![feature(rustc_contracts)] // to access core::contracts -#![feature(rustc_contracts_internals)] // to access check_requires lang item +#![feature(contracts)] // to access core::contracts +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] +#![feature(contracts_internals)] // to access check_requires lang item fn foo(x: Baz) -> i32 { let injected_checker = { diff --git a/tests/ui/contracts/internal_machinery/contract-lang-items.unchk_fail_post.stderr b/tests/ui/contracts/internal_machinery/contract-lang-items.unchk_fail_post.stderr new file mode 100644 index 0000000000000..a60ce1602659b --- /dev/null +++ b/tests/ui/contracts/internal_machinery/contract-lang-items.unchk_fail_post.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-lang-items.rs:15:12 + | +LL | #![feature(contracts)] // to access core::contracts + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/internal_machinery/contract-lang-items.unchk_pass.stderr b/tests/ui/contracts/internal_machinery/contract-lang-items.unchk_pass.stderr new file mode 100644 index 0000000000000..a60ce1602659b --- /dev/null +++ b/tests/ui/contracts/internal_machinery/contract-lang-items.unchk_pass.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-lang-items.rs:15:12 + | +LL | #![feature(contracts)] // to access core::contracts + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/internal_machinery/contracts-lowering-ensures-is-not-inherited-when-nesting.rs b/tests/ui/contracts/internal_machinery/contracts-lowering-ensures-is-not-inherited-when-nesting.rs index 0b0151c6df742..960ccaed3588a 100644 --- a/tests/ui/contracts/internal_machinery/contracts-lowering-ensures-is-not-inherited-when-nesting.rs +++ b/tests/ui/contracts/internal_machinery/contracts-lowering-ensures-is-not-inherited-when-nesting.rs @@ -1,9 +1,9 @@ //@ run-pass //@ compile-flags: -Zcontract-checks=yes -#![feature(rustc_contracts_internals)] +#![feature(contracts_internals)] fn outer() -> i32 - rustc_contract_ensures(|ret| *ret > 0) + contract_ensures(|ret| *ret > 0) { let inner_closure = || -> i32 { 0 }; inner_closure(); diff --git a/tests/ui/contracts/internal_machinery/contracts-lowering-requires-is-not-inherited-when-nesting.rs b/tests/ui/contracts/internal_machinery/contracts-lowering-requires-is-not-inherited-when-nesting.rs index 79c50a18f7056..bee703de16a0b 100644 --- a/tests/ui/contracts/internal_machinery/contracts-lowering-requires-is-not-inherited-when-nesting.rs +++ b/tests/ui/contracts/internal_machinery/contracts-lowering-requires-is-not-inherited-when-nesting.rs @@ -1,11 +1,11 @@ //@ run-pass //@ compile-flags: -Zcontract-checks=yes -#![feature(rustc_contracts_internals)] +#![feature(contracts_internals)] struct Outer { outer: std::cell::Cell } fn outer(x: Outer) - rustc_contract_requires(|| x.outer.get() > 0) + contract_requires(|| x.outer.get() > 0) { let inner_closure = || { }; x.outer.set(0); diff --git a/tests/ui/contracts/internal_machinery/internal-feature-gating.rs b/tests/ui/contracts/internal_machinery/internal-feature-gating.rs index ee9edf3ebb0c2..1b76eef6780fe 100644 --- a/tests/ui/contracts/internal_machinery/internal-feature-gating.rs +++ b/tests/ui/contracts/internal_machinery/internal-feature-gating.rs @@ -1,20 +1,20 @@ -// gate-test-rustc_contracts_internals +// gate-test-contracts_internals fn main() { - // intrinsics are guarded by rustc_contracts_internals feature gate. + // intrinsics are guarded by contracts_internals feature gate. core::intrinsics::contract_checks(); - //~^ ERROR use of unstable library feature `rustc_contracts_internals` + //~^ ERROR use of unstable library feature `contracts_internals` core::intrinsics::contract_check_requires(|| true); - //~^ ERROR use of unstable library feature `rustc_contracts_internals` + //~^ ERROR use of unstable library feature `contracts_internals` core::intrinsics::contract_check_ensures(&1, |_|true); - //~^ ERROR use of unstable library feature `rustc_contracts_internals` + //~^ ERROR use of unstable library feature `contracts_internals` core::contracts::build_check_ensures(|_: &()| true); - //~^ ERROR use of unstable library feature `rustc_contracts_internals` + //~^ ERROR use of unstable library feature `contracts_internals` - // ast extensions are guarded by rustc_contracts_internals feature gate - fn identity_1() -> i32 rustc_contract_requires(|| true) { 10 } + // ast extensions are guarded by contracts_internals feature gate + fn identity_1() -> i32 contract_requires(|| true) { 10 } //~^ ERROR contract internal machinery is for internal use only - fn identity_2() -> i32 rustc_contract_ensures(|_| true) { 10 } + fn identity_2() -> i32 contract_ensures(|_| true) { 10 } //~^ ERROR contract internal machinery is for internal use only } diff --git a/tests/ui/contracts/internal_machinery/internal-feature-gating.stderr b/tests/ui/contracts/internal_machinery/internal-feature-gating.stderr index 5f9263e03e85a..c0e1522f54c61 100644 --- a/tests/ui/contracts/internal_machinery/internal-feature-gating.stderr +++ b/tests/ui/contracts/internal_machinery/internal-feature-gating.stderr @@ -1,61 +1,61 @@ error[E0658]: contract internal machinery is for internal use only - --> $DIR/internal-feature-gating.rs:16:51 + --> $DIR/internal-feature-gating.rs:16:45 | -LL | fn identity_1() -> i32 rustc_contract_requires(|| true) { 10 } - | ^^^^^^^^^ +LL | fn identity_1() -> i32 contract_requires(|| true) { 10 } + | ^^^^^^^^^ | - = note: see issue #133866 for more information - = help: add `#![feature(rustc_contracts_internals)]` to the crate attributes to enable + = note: see issue #128044 for more information + = help: add `#![feature(contracts_internals)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: contract internal machinery is for internal use only - --> $DIR/internal-feature-gating.rs:18:50 + --> $DIR/internal-feature-gating.rs:18:44 | -LL | fn identity_2() -> i32 rustc_contract_ensures(|_| true) { 10 } - | ^^^^^^^^^^ +LL | fn identity_2() -> i32 contract_ensures(|_| true) { 10 } + | ^^^^^^^^^^ | - = note: see issue #133866 for more information - = help: add `#![feature(rustc_contracts_internals)]` to the crate attributes to enable + = note: see issue #128044 for more information + = help: add `#![feature(contracts_internals)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature `rustc_contracts_internals` +error[E0658]: use of unstable library feature `contracts_internals` --> $DIR/internal-feature-gating.rs:5:5 | LL | core::intrinsics::contract_checks(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: see issue #133866 for more information - = help: add `#![feature(rustc_contracts_internals)]` to the crate attributes to enable + = note: see issue #128044 for more information + = help: add `#![feature(contracts_internals)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature `rustc_contracts_internals` +error[E0658]: use of unstable library feature `contracts_internals` --> $DIR/internal-feature-gating.rs:7:5 | LL | core::intrinsics::contract_check_requires(|| true); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: see issue #133866 for more information - = help: add `#![feature(rustc_contracts_internals)]` to the crate attributes to enable + = note: see issue #128044 for more information + = help: add `#![feature(contracts_internals)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature `rustc_contracts_internals` +error[E0658]: use of unstable library feature `contracts_internals` --> $DIR/internal-feature-gating.rs:9:5 | LL | core::intrinsics::contract_check_ensures(&1, |_|true); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: see issue #133866 for more information - = help: add `#![feature(rustc_contracts_internals)]` to the crate attributes to enable + = note: see issue #128044 for more information + = help: add `#![feature(contracts_internals)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature `rustc_contracts_internals` +error[E0658]: use of unstable library feature `contracts_internals` --> $DIR/internal-feature-gating.rs:12:5 | LL | core::contracts::build_check_ensures(|_: &()| true); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: see issue #133866 for more information - = help: add `#![feature(rustc_contracts_internals)]` to the crate attributes to enable + = note: see issue #128044 for more information + = help: add `#![feature(contracts_internals)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: aborting due to 6 previous errors diff --git a/tests/ui/feature-gates/feature-gate-cfg-contract-checks.stderr b/tests/ui/feature-gates/feature-gate-cfg-contract-checks.stderr index af4e605e57098..89c6d077f97eb 100644 --- a/tests/ui/feature-gates/feature-gate-cfg-contract-checks.stderr +++ b/tests/ui/feature-gates/feature-gate-cfg-contract-checks.stderr @@ -4,7 +4,7 @@ error[E0658]: `cfg(contract_checks)` is experimental and subject to change LL | cfg!(contract_checks) | ^^^^^^^^^^^^^^^ | - = note: see issue #133866 for more information + = note: see issue #128044 for more information = help: add `#![feature(cfg_contract_checks)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date diff --git a/tests/ui/feature-gates/feature-gate-contracts.rs b/tests/ui/feature-gates/feature-gate-contracts.rs new file mode 100644 index 0000000000000..5544f1d82ee4c --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-contracts.rs @@ -0,0 +1,11 @@ +#![crate_type = "lib"] + +#[core::contracts::requires(x > 0)] +pub fn requires_needs_it(x: i32) { } +//~^^ ERROR use of unstable library feature `contracts` +//~^^^ ERROR contracts are incomplete + +#[core::contracts::ensures(|ret| *ret > 0)] +pub fn ensures_needs_it() -> i32 { 10 } +//~^^ ERROR use of unstable library feature `contracts` +//~^^^ ERROR contracts are incomplete diff --git a/tests/ui/feature-gates/feature-gate-contracts.stderr b/tests/ui/feature-gates/feature-gate-contracts.stderr new file mode 100644 index 0000000000000..4403e7df50b49 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-contracts.stderr @@ -0,0 +1,43 @@ +error[E0658]: use of unstable library feature `contracts` + --> $DIR/feature-gate-contracts.rs:3:3 + | +LL | #[core::contracts::requires(x > 0)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #128044 for more information + = help: add `#![feature(contracts)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: use of unstable library feature `contracts` + --> $DIR/feature-gate-contracts.rs:8:3 + | +LL | #[core::contracts::ensures(|ret| *ret > 0)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #128044 for more information + = help: add `#![feature(contracts)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: contracts are incomplete + --> $DIR/feature-gate-contracts.rs:3:1 + | +LL | #[core::contracts::requires(x > 0)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #128044 for more information + = help: add `#![feature(contracts)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: contracts are incomplete + --> $DIR/feature-gate-contracts.rs:8:1 + | +LL | #[core::contracts::ensures(|ret| *ret > 0)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #128044 for more information + = help: add `#![feature(contracts)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-rustc-contracts.rs b/tests/ui/feature-gates/feature-gate-rustc-contracts.rs deleted file mode 100644 index d4249c252cda3..0000000000000 --- a/tests/ui/feature-gates/feature-gate-rustc-contracts.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![crate_type = "lib"] - -#[core::contracts::requires(x > 0)] -pub fn requires_needs_it(x: i32) { } -//~^^ ERROR use of unstable library feature `rustc_contracts` -//~^^^ ERROR contracts are experimental - -#[core::contracts::ensures(|ret| *ret > 0)] -pub fn ensures_needs_it() -> i32 { 10 } -//~^^ ERROR use of unstable library feature `rustc_contracts` -//~^^^ ERROR contracts are experimental diff --git a/tests/ui/feature-gates/feature-gate-rustc-contracts.stderr b/tests/ui/feature-gates/feature-gate-rustc-contracts.stderr deleted file mode 100644 index eb7777a4a5179..0000000000000 --- a/tests/ui/feature-gates/feature-gate-rustc-contracts.stderr +++ /dev/null @@ -1,43 +0,0 @@ -error[E0658]: use of unstable library feature `rustc_contracts` - --> $DIR/feature-gate-rustc-contracts.rs:3:3 - | -LL | #[core::contracts::requires(x > 0)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #133866 for more information - = help: add `#![feature(rustc_contracts)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: use of unstable library feature `rustc_contracts` - --> $DIR/feature-gate-rustc-contracts.rs:8:3 - | -LL | #[core::contracts::ensures(|ret| *ret > 0)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #133866 for more information - = help: add `#![feature(rustc_contracts)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: contracts are experimental - --> $DIR/feature-gate-rustc-contracts.rs:3:1 - | -LL | #[core::contracts::requires(x > 0)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #133866 for more information - = help: add `#![feature(rustc_contracts)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: contracts are experimental - --> $DIR/feature-gate-rustc-contracts.rs:8:1 - | -LL | #[core::contracts::ensures(|ret| *ret > 0)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #133866 for more information - = help: add `#![feature(rustc_contracts)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0658`.