Skip to content

[crater] Remove LArrow #118920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions compiler/rustc_ast/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,6 @@ pub enum TokenKind {
ModSep,
/// `->`
RArrow,
/// `<-`
LArrow,
/// `=>`
FatArrow,
/// `#`
Expand Down Expand Up @@ -376,7 +374,6 @@ impl TokenKind {
DotDotDot => (Dot, DotDot),
ModSep => (Colon, Colon),
RArrow => (BinOp(Minus), Gt),
LArrow => (Lt, BinOp(Minus)),
FatArrow => (Eq, Gt),
_ => return None,
})
Expand Down Expand Up @@ -435,7 +432,7 @@ impl Token {
match self.kind {
Eq | Lt | Le | EqEq | Ne | Ge | Gt | AndAnd | OrOr | Not | Tilde | BinOp(_)
| BinOpEq(_) | At | Dot | DotDot | DotDotDot | DotDotEq | Comma | Semi | Colon
| ModSep | RArrow | LArrow | FatArrow | Pound | Dollar | Question | SingleQuote => true,
| ModSep | RArrow | FatArrow | Pound | Dollar | Question | SingleQuote => true,

OpenDelim(..) | CloseDelim(..) | Literal(..) | DocComment(..) | Ident(..)
| Lifetime(..) | Interpolated(..) | Eof => false,
Expand Down Expand Up @@ -780,7 +777,6 @@ impl Token {
Eq => Le,
Lt => BinOp(Shl),
Le => BinOpEq(Shl),
BinOp(Minus) => LArrow,
_ => return None,
},
Gt => match joint.kind {
Expand Down Expand Up @@ -820,9 +816,9 @@ impl Token {
},

Le | EqEq | Ne | Ge | AndAnd | OrOr | Tilde | BinOpEq(..) | At | DotDotDot
| DotDotEq | Comma | Semi | ModSep | RArrow | LArrow | FatArrow | Pound | Dollar
| Question | OpenDelim(..) | CloseDelim(..) | Literal(..) | Ident(..)
| Lifetime(..) | Interpolated(..) | DocComment(..) | Eof => return None,
| DotDotEq | Comma | Semi | ModSep | RArrow | FatArrow | Pound | Dollar | Question
| OpenDelim(..) | CloseDelim(..) | Literal(..) | Ident(..) | Lifetime(..)
| Interpolated(..) | DocComment(..) | Eof => return None,
};

Some(Token::new(kind, self.span.to(joint.span)))
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_ast/src/util/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ impl AssocOp {
token::DotDotEq => Some(DotDotEq),
// DotDotDot is no longer supported, but we need some way to display the error
token::DotDotDot => Some(DotDotEq),
// `<-` should probably be `< -`
token::LArrow => Some(Less),
_ if t.is_keyword(kw::As) => Some(As),
_ => None,
}
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,6 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
token::Colon => ":".into(),
token::ModSep => "::".into(),
token::RArrow => "->".into(),
token::LArrow => "<-".into(),
token::FatArrow => "=>".into(),
token::OpenDelim(Delimiter::Parenthesis) => "(".into(),
token::CloseDelim(Delimiter::Parenthesis) => ")".into(),
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_expand/src/proc_macro_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ impl FromInternal<(TokenStream, &mut Rustc<'_, '_>)> for Vec<TokenTree<TokenStre
Colon => op(":"),
ModSep => op("::"),
RArrow => op("->"),
LArrow => op("<-"),
FatArrow => op("=>"),
Pound => op("#"),
Dollar => op("$"),
Expand Down
8 changes: 0 additions & 8 deletions compiler/rustc_parse/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,6 @@ impl<'a> Parser<'a> {
self.err_dotdotdot_syntax(self.token.span);
}

if self.token == token::LArrow {
self.err_larrow_operator(self.token.span);
}

self.bump();
if op.node.is_comparison() {
if let Some(expr) = self.check_no_chained_comparison(&lhs, &op)? {
Expand Down Expand Up @@ -3583,10 +3579,6 @@ impl<'a> Parser<'a> {
self.sess.emit_err(errors::DotDotDot { span });
}

fn err_larrow_operator(&self, span: Span) {
self.sess.emit_err(errors::LeftArrowOperator { span });
}

fn mk_assign_op(&self, binop: BinOp, lhs: P<Expr>, rhs: P<Expr>) -> ExprKind {
ExprKind::AssignOp(binop, lhs, rhs)
}
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_parse/src/parser/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,7 @@ impl<'a> Parser<'a> {
let is_args_start = |token: &Token| {
matches!(
token.kind,
token::Lt
| token::BinOp(token::Shl)
| token::OpenDelim(Delimiter::Parenthesis)
| token::LArrow
token::Lt | token::BinOp(token::Shl) | token::OpenDelim(Delimiter::Parenthesis)
)
};
let check_args_start = |this: &mut Self| {
Expand Down