Skip to content

Commit 17072a4

Browse files
Remove feature flag from post-stabilization feature gates
This commit removes the optional `feature` specification from feature gates (`@since`, in particular). This change should simplify the usage of feature gates (see WebAssembly/component-model#387) for more discussion. This is a breaking change for those who were depending on `wit-parser` as `feature` now no longer present. Signed-off-by: Victor Adossi <[email protected]>
1 parent 1d20e5b commit 17072a4

File tree

3 files changed

+3
-22
lines changed

3 files changed

+3
-22
lines changed

crates/wit-parser/src/ast.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,7 +1548,6 @@ enum Attribute<'a> {
15481548
Since {
15491549
span: Span,
15501550
version: Version,
1551-
feature: Option<Id<'a>>,
15521551
},
15531552
Unstable {
15541553
span: Span,
@@ -1571,18 +1570,10 @@ impl<'a> Attribute<'a> {
15711570
eat_id(tokens, "version")?;
15721571
tokens.expect(Token::Equals)?;
15731572
let (_span, version) = parse_version(tokens)?;
1574-
let feature = if tokens.eat(Token::Comma)? {
1575-
eat_id(tokens, "feature")?;
1576-
tokens.expect(Token::Equals)?;
1577-
Some(parse_id(tokens)?)
1578-
} else {
1579-
None
1580-
};
15811573
tokens.expect(Token::RightParen)?;
15821574
Attribute::Since {
15831575
span: id.span,
15841576
version,
1585-
feature,
15861577
}
15871578
}
15881579
"unstable" => {

crates/wit-parser/src/ast/resolve.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,28 +1386,20 @@ impl<'a> Resolver<'a> {
13861386
match attrs {
13871387
[] => Ok(Stability::Unknown),
13881388

1389-
[ast::Attribute::Since {
1390-
version, feature, ..
1391-
}] => Ok(Stability::Stable {
1389+
[ast::Attribute::Since { version, .. }] => Ok(Stability::Stable {
13921390
since: version.clone(),
1393-
feature: feature.as_ref().map(|s| s.name.to_string()),
13941391
deprecated: None,
13951392
}),
13961393

1397-
[ast::Attribute::Since {
1398-
version, feature, ..
1399-
}, ast::Attribute::Deprecated {
1394+
[ast::Attribute::Since { version, .. }, ast::Attribute::Deprecated {
14001395
version: deprecated,
14011396
..
14021397
}]
14031398
| [ast::Attribute::Deprecated {
14041399
version: deprecated,
14051400
..
1406-
}, ast::Attribute::Since {
1407-
version, feature, ..
1408-
}] => Ok(Stability::Stable {
1401+
}, ast::Attribute::Since { version, .. }] => Ok(Stability::Stable {
14091402
since: version.clone(),
1410-
feature: feature.as_ref().map(|s| s.name.to_string()),
14111403
deprecated: Some(deprecated.clone()),
14121404
}),
14131405

crates/wit-parser/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -845,8 +845,6 @@ pub enum Stability {
845845
#[cfg_attr(feature = "serde", serde(serialize_with = "serialize_version"))]
846846
#[cfg_attr(feature = "serde", serde(deserialize_with = "deserialize_version"))]
847847
since: Version,
848-
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
849-
feature: Option<String>,
850848
#[cfg_attr(
851849
feature = "serde",
852850
serde(

0 commit comments

Comments
 (0)