1
Fork 0

Separate contract feature gates for the internal machinery

The extended syntax for function signature that includes contract clauses
should never be user exposed versus the interface we want to ship
externally eventually.
This commit is contained in:
Felix S. Klock II 2024-12-03 16:13:00 +00:00 committed by Celina G. Val
parent b279ff9dcf
commit 6a6c6b891b
20 changed files with 210 additions and 28 deletions

View file

@ -207,6 +207,10 @@ pub struct ParseSess {
pub config: Cfg,
pub check_config: CheckCfg,
pub edition: Edition,
/// Places where contract attributes were expanded into unstable AST forms.
/// This is used to allowlist those spans (so that we only check them against the feature
/// gate for the externally visible interface, and not internal implmentation machinery).
pub contract_attribute_spans: AppendOnlyVec<Span>,
/// Places where raw identifiers were used. This is used to avoid complaining about idents
/// clashing with keywords in new editions.
pub raw_identifier_spans: AppendOnlyVec<Span>,
@ -255,6 +259,7 @@ impl ParseSess {
config: Cfg::default(),
check_config: CheckCfg::default(),
edition: ExpnId::root().expn_data().edition,
contract_attribute_spans: Default::default(),
raw_identifier_spans: Default::default(),
bad_unicode_identifiers: Lock::new(Default::default()),
source_map,