Skip to content

Commit 08ee0df

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 08ee0df

File tree

3 files changed

+6
-34
lines changed

3 files changed

+6
-34
lines changed

crates/wit-parser/src/ast.rs

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,19 +1545,9 @@ fn err_expected(
15451545
}
15461546

15471547
enum Attribute<'a> {
1548-
Since {
1549-
span: Span,
1550-
version: Version,
1551-
feature: Option<Id<'a>>,
1552-
},
1553-
Unstable {
1554-
span: Span,
1555-
feature: Id<'a>,
1556-
},
1557-
Deprecated {
1558-
span: Span,
1559-
version: Version,
1560-
},
1548+
Since { span: Span, version: Version },
1549+
Unstable { span: Span, feature: Id<'a> },
1550+
Deprecated { span: Span, version: Version },
15611551
}
15621552

15631553
impl<'a> Attribute<'a> {
@@ -1571,18 +1561,10 @@ impl<'a> Attribute<'a> {
15711561
eat_id(tokens, "version")?;
15721562
tokens.expect(Token::Equals)?;
15731563
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-
};
15811564
tokens.expect(Token::RightParen)?;
15821565
Attribute::Since {
15831566
span: id.span,
15841567
version,
1585-
feature,
15861568
}
15871569
}
15881570
"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)