Make rustc_attr::parse_version pub

This commit is contained in:
Alex Macleod 2024-07-29 13:11:29 +00:00
parent 8fe0c753f2
commit eb0e71620d

View File

@ -574,7 +574,7 @@ fn gate_cfg(gated_cfg: &GatedCfg, cfg_span: Span, sess: &Session, features: &Fea
/// Parse a rustc version number written inside string literal in an attribute, /// Parse a rustc version number written inside string literal in an attribute,
/// like appears in `since = "1.0.0"`. Suffixes like "-dev" and "-nightly" are /// like appears in `since = "1.0.0"`. Suffixes like "-dev" and "-nightly" are
/// not accepted in this position, unlike when parsing CFG_RELEASE. /// not accepted in this position, unlike when parsing CFG_RELEASE.
fn parse_version(s: Symbol) -> Option<RustcVersion> { pub fn parse_version(s: Symbol) -> Option<RustcVersion> {
let mut components = s.as_str().split('-'); let mut components = s.as_str().split('-');
let d = components.next()?; let d = components.next()?;
if components.next().is_some() { if components.next().is_some() {