Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/validation.rs')
| -rw-r--r-- | crates/syntax/src/validation.rs | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/crates/syntax/src/validation.rs b/crates/syntax/src/validation.rs index af5e173900..a0a0bab5b3 100644 --- a/crates/syntax/src/validation.rs +++ b/crates/syntax/src/validation.rs @@ -245,8 +245,6 @@ fn validate_range_expr(expr: ast::RangeExpr, errors: &mut Vec<SyntaxError>) { } fn validate_path_keywords(segment: ast::PathSegment, errors: &mut Vec<SyntaxError>) { - use ast::PathSegmentKind; - let path = segment.parent_path(); let is_path_start = segment.coloncolon_token().is_none() && path.qualifier().is_none(); @@ -264,26 +262,6 @@ fn validate_path_keywords(segment: ast::PathSegment, errors: &mut Vec<SyntaxErro token.text_range(), )); } - } else if let Some(token) = segment.super_token() { - if segment.coloncolon_token().is_some() || !all_supers(&path) { - errors.push(SyntaxError::new( - "The `super` keyword may only be preceded by other `super`s", - token.text_range(), - )); - return; - } - - let mut curr_path = path; - while let Some(prefix) = use_prefix(curr_path) { - if !all_supers(&prefix) { - errors.push(SyntaxError::new( - "The `super` keyword may only be preceded by other `super`s", - token.text_range(), - )); - return; - } - curr_path = prefix; - } } fn use_prefix(mut path: ast::Path) -> Option<ast::Path> { @@ -305,23 +283,6 @@ fn validate_path_keywords(segment: ast::PathSegment, errors: &mut Vec<SyntaxErro } None } - - fn all_supers(path: &ast::Path) -> bool { - let segment = match path.segment() { - Some(it) => it, - None => return false, - }; - - if segment.kind() != Some(PathSegmentKind::SuperKw) { - return false; - } - - if let Some(ref subpath) = path.qualifier() { - return all_supers(subpath); - } - - true - } } fn validate_trait_object_ref_ty(ty: ast::RefType, errors: &mut Vec<SyntaxError>) { |