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.
This commit is contained in:
@@ -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<rustc_ast::ptr::P<ast::FnContract>>> {
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user