Skip to content

Commit 650c1c3

Browse files
committed
Remove ObsoleteInPlace
1 parent 0f40ad9 commit 650c1c3

File tree

9 files changed

+5
-81
lines changed

9 files changed

+5
-81
lines changed

src/librustc/hir/lowering.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4064,10 +4064,6 @@ impl<'a> LoweringContext<'a> {
40644064
fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
40654065
let kind = match e.node {
40664066
ExprKind::Box(ref inner) => hir::ExprKind::Box(P(self.lower_expr(inner))),
4067-
ExprKind::ObsoleteInPlace(..) => {
4068-
self.sess.abort_if_errors();
4069-
span_bug!(e.span, "encountered ObsoleteInPlace expr during lowering");
4070-
}
40714067
ExprKind::Array(ref exprs) => {
40724068
hir::ExprKind::Array(exprs.iter().map(|x| self.lower_expr(x)).collect())
40734069
}

src/librustc_passes/ast_validation.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -454,29 +454,6 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
454454
ExprKind::InlineAsm(..) if !self.session.target.target.options.allow_asm => {
455455
span_err!(self.session, expr.span, E0472, "asm! is unsupported on this target");
456456
}
457-
ExprKind::ObsoleteInPlace(ref place, ref val) => {
458-
let mut err = self.err_handler().struct_span_err(
459-
expr.span,
460-
"emplacement syntax is obsolete (for now, anyway)",
461-
);
462-
err.note(
463-
"for more information, see \
464-
<https://github.com/rust-lang/rust/issues/27779#issuecomment-378416911>"
465-
);
466-
match val.node {
467-
ExprKind::Lit(ref v) if v.node.is_numeric() => {
468-
err.span_suggestion(
469-
place.span.between(val.span),
470-
"if you meant to write a comparison against a negative value, add a \
471-
space in between `<` and `-`",
472-
"< -".to_string(),
473-
Applicability::MaybeIncorrect
474-
);
475-
}
476-
_ => {}
477-
}
478-
err.emit();
479-
}
480457
_ => {}
481458
}
482459

src/libsyntax/ast.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,6 @@ impl Expr {
10401040
pub fn precedence(&self) -> ExprPrecedence {
10411041
match self.node {
10421042
ExprKind::Box(_) => ExprPrecedence::Box,
1043-
ExprKind::ObsoleteInPlace(..) => ExprPrecedence::ObsoleteInPlace,
10441043
ExprKind::Array(_) => ExprPrecedence::Array,
10451044
ExprKind::Call(..) => ExprPrecedence::Call,
10461045
ExprKind::MethodCall(..) => ExprPrecedence::MethodCall,
@@ -1102,8 +1101,6 @@ pub enum RangeLimits {
11021101
pub enum ExprKind {
11031102
/// A `box x` expression.
11041103
Box(P<Expr>),
1105-
/// First expr is the place; second expr is the value.
1106-
ObsoleteInPlace(P<Expr>, P<Expr>),
11071104
/// An array (`[a, b, c, d]`)
11081105
Array(Vec<P<Expr>>),
11091106
/// A function call

src/libsyntax/feature_gate.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2110,9 +2110,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
21102110
"type ascription is experimental");
21112111
}
21122112
}
2113-
ast::ExprKind::ObsoleteInPlace(..) => {
2114-
// these get a hard error in ast-validation
2115-
}
21162113
ast::ExprKind::Yield(..) => {
21172114
gate_feature_post!(&self, generators,
21182115
e.span,

src/libsyntax/mut_visit.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,10 +1096,6 @@ pub fn noop_visit_anon_const<T: MutVisitor>(AnonConst { id, value }: &mut AnonCo
10961096
pub fn noop_visit_expr<T: MutVisitor>(Expr { node, id, span, attrs }: &mut Expr, vis: &mut T) {
10971097
match node {
10981098
ExprKind::Box(expr) => vis.visit_expr(expr),
1099-
ExprKind::ObsoleteInPlace(a, b) => {
1100-
vis.visit_expr(a);
1101-
vis.visit_expr(b);
1102-
}
11031099
ExprKind::Array(exprs) => visit_exprs(exprs, vis),
11041100
ExprKind::Repeat(expr, count) => {
11051101
vis.visit_expr(expr);

src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,8 +1058,7 @@ impl<'a> Parser<'a> {
10581058
}
10591059

10601060
/// Attempts to consume a `<`. If `<<` is seen, replaces it with a single
1061-
/// `<` and continue. If `<-` is seen, replaces it with a single `<`
1062-
/// and continue. If a `<` is not seen, returns false.
1061+
/// `<` and continue. If a `<` is not seen, returns false.
10631062
///
10641063
/// This is meant to be used when parsing generics on a path to get the
10651064
/// starting token.
@@ -1075,11 +1074,6 @@ impl<'a> Parser<'a> {
10751074
self.bump_with(token::Lt, span);
10761075
true
10771076
}
1078-
token::LArrow => {
1079-
let span = self.span.with_lo(self.span.lo() + BytePos(1));
1080-
self.bump_with(token::BinOp(token::Minus), span);
1081-
true
1082-
}
10831077
_ => false,
10841078
};
10851079

@@ -3250,17 +3244,6 @@ impl<'a> Parser<'a> {
32503244
let (span, e) = self.interpolated_or_expr_span(e)?;
32513245
(lo.to(span), ExprKind::AddrOf(m, e))
32523246
}
3253-
token::Ident(..) if self.token.is_keyword(keywords::In) => {
3254-
self.bump();
3255-
let place = self.parse_expr_res(
3256-
Restrictions::NO_STRUCT_LITERAL,
3257-
None,
3258-
)?;
3259-
let blk = self.parse_block()?;
3260-
let span = blk.span;
3261-
let blk_expr = self.mk_expr(span, ExprKind::Block(blk, None), ThinVec::new());
3262-
(lo.to(span), ExprKind::ObsoleteInPlace(place, blk_expr))
3263-
}
32643247
token::Ident(..) if self.token.is_keyword(keywords::Box) => {
32653248
self.bump();
32663249
let e = self.parse_prefix_expr(None);
@@ -3498,8 +3481,6 @@ impl<'a> Parser<'a> {
34983481
self.mk_expr(span, binary, ThinVec::new())
34993482
}
35003483
AssocOp::Assign => self.mk_expr(span, ExprKind::Assign(lhs, rhs), ThinVec::new()),
3501-
AssocOp::ObsoleteInPlace =>
3502-
self.mk_expr(span, ExprKind::ObsoleteInPlace(lhs, rhs), ThinVec::new()),
35033484
AssocOp::AssignOp(k) => {
35043485
let aop = match k {
35053486
token::Plus => BinOpKind::Add,
@@ -3818,9 +3799,6 @@ impl<'a> Parser<'a> {
38183799
String::new(),
38193800
Applicability::MachineApplicable,
38203801
);
3821-
err.note("if you meant to use emplacement syntax, it is obsolete (for now, anyway)");
3822-
err.note("for more information on the status of emplacement syntax, see <\
3823-
https://github.com/rust-lang/rust/issues/27779#issuecomment-378416911>");
38243802
err.emit();
38253803
}
38263804
let expr = self.parse_expr_res(Restrictions::NO_STRUCT_LITERAL, None)?;

src/libsyntax/print/pprust.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,13 +2004,6 @@ impl<'a> State<'a> {
20042004
self.word_space("box")?;
20052005
self.print_expr_maybe_paren(expr, parser::PREC_PREFIX)?;
20062006
}
2007-
ast::ExprKind::ObsoleteInPlace(ref place, ref expr) => {
2008-
let prec = AssocOp::ObsoleteInPlace.precedence() as i8;
2009-
self.print_expr_maybe_paren(place, prec + 1)?;
2010-
self.s.space()?;
2011-
self.word_space("<-")?;
2012-
self.print_expr_maybe_paren(expr, prec)?;
2013-
}
20142007
ast::ExprKind::Array(ref exprs) => {
20152008
self.print_expr_vec(&exprs[..], attrs)?;
20162009
}

src/libsyntax/util/parser.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ pub enum AssocOp {
4545
GreaterEqual,
4646
/// `=`
4747
Assign,
48-
/// `<-`
49-
ObsoleteInPlace,
5048
/// `?=` where ? is one of the BinOpToken
5149
AssignOp(BinOpToken),
5250
/// `as`
@@ -75,7 +73,6 @@ impl AssocOp {
7573
use AssocOp::*;
7674
match *t {
7775
Token::BinOpEq(k) => Some(AssignOp(k)),
78-
Token::LArrow => Some(ObsoleteInPlace),
7976
Token::Eq => Some(Assign),
8077
Token::BinOp(BinOpToken::Star) => Some(Multiply),
8178
Token::BinOp(BinOpToken::Slash) => Some(Divide),
@@ -145,7 +142,6 @@ impl AssocOp {
145142
LAnd => 6,
146143
LOr => 5,
147144
DotDot | DotDotEq => 4,
148-
ObsoleteInPlace => 3,
149145
Assign | AssignOp(_) => 2,
150146
}
151147
}
@@ -155,7 +151,7 @@ impl AssocOp {
155151
use AssocOp::*;
156152
// NOTE: it is a bug to have an operators that has same precedence but different fixities!
157153
match *self {
158-
ObsoleteInPlace | Assign | AssignOp(_) => Fixity::Right,
154+
Assign | AssignOp(_) => Fixity::Right,
159155
As | Multiply | Divide | Modulus | Add | Subtract | ShiftLeft | ShiftRight | BitAnd |
160156
BitXor | BitOr | Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual |
161157
LAnd | LOr | Colon => Fixity::Left,
@@ -167,7 +163,7 @@ impl AssocOp {
167163
use AssocOp::*;
168164
match *self {
169165
Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual => true,
170-
ObsoleteInPlace | Assign | AssignOp(_) | As | Multiply | Divide | Modulus | Add |
166+
Assign | AssignOp(_) | As | Multiply | Divide | Modulus | Add |
171167
Subtract | ShiftLeft | ShiftRight | BitAnd | BitXor | BitOr | LAnd | LOr |
172168
DotDot | DotDotEq | Colon => false
173169
}
@@ -176,7 +172,7 @@ impl AssocOp {
176172
pub fn is_assign_like(&self) -> bool {
177173
use AssocOp::*;
178174
match *self {
179-
Assign | AssignOp(_) | ObsoleteInPlace => true,
175+
Assign | AssignOp(_) => true,
180176
Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual | As | Multiply | Divide |
181177
Modulus | Add | Subtract | ShiftLeft | ShiftRight | BitAnd | BitXor | BitOr | LAnd |
182178
LOr | DotDot | DotDotEq | Colon => false
@@ -204,7 +200,7 @@ impl AssocOp {
204200
BitOr => Some(BinOpKind::BitOr),
205201
LAnd => Some(BinOpKind::And),
206202
LOr => Some(BinOpKind::Or),
207-
ObsoleteInPlace | Assign | AssignOp(_) | As | DotDot | DotDotEq | Colon => None
203+
Assign | AssignOp(_) | As | DotDot | DotDotEq | Colon => None
208204
}
209205
}
210206

@@ -256,7 +252,6 @@ pub enum ExprPrecedence {
256252

257253
Binary(BinOpKind),
258254

259-
ObsoleteInPlace,
260255
Cast,
261256
Type,
262257

@@ -314,7 +309,6 @@ impl ExprPrecedence {
314309

315310
// Binop-like expr kinds, handled by `AssocOp`.
316311
ExprPrecedence::Binary(op) => AssocOp::from_ast_binop(op).precedence() as i8,
317-
ExprPrecedence::ObsoleteInPlace => AssocOp::ObsoleteInPlace.precedence() as i8,
318312
ExprPrecedence::Cast => AssocOp::As.precedence() as i8,
319313
ExprPrecedence::Type => AssocOp::Colon.precedence() as i8,
320314

src/libsyntax/visit.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -676,10 +676,6 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) {
676676
ExprKind::Box(ref subexpression) => {
677677
visitor.visit_expr(subexpression)
678678
}
679-
ExprKind::ObsoleteInPlace(ref place, ref subexpression) => {
680-
visitor.visit_expr(place);
681-
visitor.visit_expr(subexpression)
682-
}
683679
ExprKind::Array(ref subexpressions) => {
684680
walk_list!(visitor, visit_expr, subexpressions);
685681
}

0 commit comments

Comments
 (0)