Skip to content

Commit 33573bc

Browse files
committed
syntax: Clean out obsolete syntax parsing
All of these features have been obsolete since February 2014, where most have been obsolete since 2013. There shouldn't be any more need to keep around the parser hacks after this length of time.
1 parent 0dd4c1e commit 33573bc

File tree

14 files changed

+61
-284
lines changed

14 files changed

+61
-284
lines changed

src/librustc/middle/privacy.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,10 @@ impl<'a> SanePrivacyVisitor<'a> {
10941094
check_inherited(m.span, m.vis,
10951095
"unnecessary visibility");
10961096
}
1097-
ast::Required(..) => {}
1097+
ast::Required(ref m) => {
1098+
check_inherited(m.span, m.vis,
1099+
"unnecessary visibility");
1100+
}
10981101
}
10991102
}
11001103
}

src/librustdoc/html/highlight.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ fn doit(sess: &parse::ParseSess, mut lexer: lexer::StringReader, class: Option<&
102102

103103
// miscellaneous, no highlighting
104104
t::DOT | t::DOTDOT | t::DOTDOTDOT | t::COMMA | t::SEMI |
105-
t::COLON | t::MOD_SEP | t::LARROW | t::DARROW | t::LPAREN |
105+
t::COLON | t::MOD_SEP | t::LARROW | t::LPAREN |
106106
t::RPAREN | t::LBRACKET | t::LBRACE | t::RBRACE => "",
107107
t::DOLLAR => {
108108
if t::is_ident(&lexer.peek().tok) {

src/libsyntax/ast.rs

+1
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,7 @@ pub struct TypeMethod {
689689
pub explicit_self: ExplicitSelf,
690690
pub id: NodeId,
691691
pub span: Span,
692+
pub vis: Visibility,
692693
}
693694

694695
// A trait method is either required (meaning it doesn't have an

src/libsyntax/ast_util.rs

+1
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ pub fn trait_method_to_ty_method(method: &TraitMethod) -> TypeMethod {
305305
explicit_self: m.explicit_self,
306306
id: m.id,
307307
span: m.span,
308+
vis: m.vis,
308309
}
309310
}
310311
}

src/libsyntax/ext/quote.rs

-1
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,6 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr {
543543
MOD_SEP => "MOD_SEP",
544544
RARROW => "RARROW",
545545
LARROW => "LARROW",
546-
DARROW => "DARROW",
547546
FAT_ARROW => "FAT_ARROW",
548547
LPAREN => "LPAREN",
549548
RPAREN => "RPAREN",

src/libsyntax/fold.rs

+1
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ pub fn noop_fold_type_method<T: Folder>(m: &TypeMethod, fld: &mut T) -> TypeMeth
648648
generics: fold_generics(&m.generics, fld),
649649
explicit_self: fld.fold_explicit_self(&m.explicit_self),
650650
span: fld.new_span(m.span),
651+
vis: m.vis,
651652
}
652653
}
653654

src/libsyntax/parse/lexer.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -790,10 +790,7 @@ fn next_token_inner(rdr: &mut StringReader) -> token::Token {
790790
'<' => { return binop(rdr, token::SHL); }
791791
'-' => {
792792
bump(rdr);
793-
match rdr.curr.unwrap_or('\x00') {
794-
'>' => { bump(rdr); return token::DARROW; }
795-
_ => { return token::LARROW; }
796-
}
793+
return token::LARROW;
797794
}
798795
_ => { return token::LT; }
799796
}

src/libsyntax/parse/obsolete.rs

-80
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,6 @@ use parse::token;
2525
/// The specific types of unsupported syntax
2626
#[deriving(Eq, TotalEq, Hash)]
2727
pub enum ObsoleteSyntax {
28-
ObsoleteSwap,
29-
ObsoleteUnsafeBlock,
30-
ObsoleteBareFnType,
31-
ObsoleteMultipleLocalDecl,
32-
ObsoleteUnsafeExternFn,
33-
ObsoleteTraitFuncVisibility,
34-
ObsoleteConstPointer,
35-
ObsoleteLoopAsContinue,
36-
ObsoleteEnumWildcard,
37-
ObsoleteStructWildcard,
38-
ObsoleteVecDotDotWildcard,
39-
ObsoleteMultipleImport,
40-
ObsoleteManagedPattern,
41-
ObsoleteManagedString,
42-
ObsoleteManagedVec,
4328
ObsoleteOwnedType,
4429
ObsoleteOwnedExpr,
4530
ObsoleteOwnedPattern,
@@ -64,71 +49,6 @@ impl<'a> ParserObsoleteMethods for Parser<'a> {
6449
/// Reports an obsolete syntax non-fatal error.
6550
fn obsolete(&mut self, sp: Span, kind: ObsoleteSyntax) {
6651
let (kind_str, desc) = match kind {
67-
ObsoleteSwap => (
68-
"swap",
69-
"use std::mem::{swap, replace} instead"
70-
),
71-
ObsoleteUnsafeBlock => (
72-
"non-standalone unsafe block",
73-
"use an inner `unsafe { ... }` block instead"
74-
),
75-
ObsoleteBareFnType => (
76-
"bare function type",
77-
"use `|A| -> B` or `extern fn(A) -> B` instead"
78-
),
79-
ObsoleteMultipleLocalDecl => (
80-
"declaration of multiple locals at once",
81-
"instead of e.g. `let a = 1, b = 2`, write \
82-
`let (a, b) = (1, 2)`."
83-
),
84-
ObsoleteUnsafeExternFn => (
85-
"unsafe external function",
86-
"external functions are always unsafe; remove the `unsafe` \
87-
keyword"
88-
),
89-
ObsoleteTraitFuncVisibility => (
90-
"visibility not necessary",
91-
"trait functions inherit the visibility of the trait itself"
92-
),
93-
ObsoleteConstPointer => (
94-
"const pointer",
95-
"instead of `&const Foo` or `@const Foo`, write `&Foo` or \
96-
`@Foo`"
97-
),
98-
ObsoleteLoopAsContinue => (
99-
"`loop` instead of `continue`",
100-
"`loop` is now only used for loops and `continue` is used for \
101-
skipping iterations"
102-
),
103-
ObsoleteEnumWildcard => (
104-
"enum wildcard",
105-
"use `..` instead of `*` for matching all enum fields"
106-
),
107-
ObsoleteStructWildcard => (
108-
"struct wildcard",
109-
"use `..` instead of `_` for matching trailing struct fields"
110-
),
111-
ObsoleteVecDotDotWildcard => (
112-
"vec slice wildcard",
113-
"use `..` instead of `.._` for matching slices"
114-
),
115-
ObsoleteMultipleImport => (
116-
"multiple imports",
117-
"only one import is allowed per `use` statement"
118-
),
119-
ObsoleteManagedPattern => (
120-
"managed pointer pattern",
121-
"use a nested `match` expression instead of a managed box \
122-
pattern"
123-
),
124-
ObsoleteManagedString => (
125-
"managed string",
126-
"use `Rc<StrBuf>` instead of a managed string"
127-
),
128-
ObsoleteManagedVec => (
129-
"managed vector",
130-
"use `Rc<~[T]>` instead of a managed vector"
131-
),
13252
ObsoleteOwnedType => (
13353
"`~` notation for owned pointers",
13454
"use `Box<T>` in `std::owned` instead"

0 commit comments

Comments
 (0)