Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 20866c5

Browse files
committedJun 21, 2020
Revert "Rollup merge of #72389 - Aaron1011:feature/move-fn-self-msg, r=nikomatsakis"
This reverts commit 372cb9b, reversing changes made to 5c61a8d.
1 parent 349f6bf commit 20866c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+103
-729
lines changed
 

‎src/librustc_ast_lowering/expr.rs

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_data_structures::thin_vec::ThinVec;
99
use rustc_errors::struct_span_err;
1010
use rustc_hir as hir;
1111
use rustc_hir::def::Res;
12-
use rustc_span::source_map::{respan, DesugaringKind, ForLoopLoc, Span, Spanned};
12+
use rustc_span::source_map::{respan, DesugaringKind, Span, Spanned};
1313
use rustc_span::symbol::{sym, Ident, Symbol};
1414
use rustc_target::asm;
1515
use std::collections::hash_map::Entry;
@@ -25,7 +25,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
2525
}
2626

2727
pub(super) fn lower_expr_mut(&mut self, e: &Expr) -> hir::Expr<'hir> {
28-
let mut span = e.span;
2928
ensure_sufficient_stack(|| {
3029
let kind = match e.kind {
3130
ExprKind::Box(ref inner) => hir::ExprKind::Box(self.lower_expr(inner)),
@@ -54,7 +53,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
5453
hir::ExprKind::MethodCall(hir_seg, seg.ident.span, args, span)
5554
}
5655
ExprKind::Binary(binop, ref lhs, ref rhs) => {
57-
span = self.mark_span_with_reason(DesugaringKind::Operator, e.span, None);
5856
let binop = self.lower_binop(binop);
5957
let lhs = self.lower_expr(lhs);
6058
let rhs = self.lower_expr(rhs);
@@ -224,7 +222,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
224222
hir::Expr {
225223
hir_id: self.lower_node_id(e.id),
226224
kind,
227-
span,
225+
span: e.span,
228226
attrs: e.attrs.iter().map(|a| self.lower_attr(a)).collect::<Vec<_>>().into(),
229227
}
230228
})
@@ -239,7 +237,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
239237
}
240238

241239
fn lower_binop(&mut self, b: BinOp) -> hir::BinOp {
242-
let span = self.mark_span_with_reason(DesugaringKind::Operator, b.span, None);
243240
Spanned {
244241
node: match b.node {
245242
BinOpKind::Add => hir::BinOpKind::Add,
@@ -261,7 +258,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
261258
BinOpKind::Ge => hir::BinOpKind::Ge,
262259
BinOpKind::Gt => hir::BinOpKind::Gt,
263260
},
264-
span,
261+
span: b.span,
265262
}
266263
}
267264

@@ -1363,14 +1360,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
13631360
body: &Block,
13641361
opt_label: Option<Label>,
13651362
) -> hir::Expr<'hir> {
1366-
let orig_head_span = head.span;
13671363
// expand <head>
13681364
let mut head = self.lower_expr_mut(head);
1369-
let desugared_span = self.mark_span_with_reason(
1370-
DesugaringKind::ForLoop(ForLoopLoc::Head),
1371-
orig_head_span,
1372-
None,
1373-
);
1365+
let desugared_span = self.mark_span_with_reason(DesugaringKind::ForLoop, head.span, None);
13741366
head.span = desugared_span;
13751367

13761368
let iter = Ident::with_dummy_span(sym::iter);
@@ -1465,16 +1457,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
14651457
// `mut iter => { ... }`
14661458
let iter_arm = self.arm(iter_pat, loop_expr);
14671459

1468-
let into_iter_span = self.mark_span_with_reason(
1469-
DesugaringKind::ForLoop(ForLoopLoc::IntoIter),
1470-
orig_head_span,
1471-
None,
1472-
);
1473-
14741460
// `match ::std::iter::IntoIterator::into_iter(<head>) { ... }`
14751461
let into_iter_expr = {
14761462
let into_iter_path = &[sym::iter, sym::IntoIterator, sym::into_iter];
1477-
self.expr_call_std_path(into_iter_span, into_iter_path, arena_vec![self; head])
1463+
self.expr_call_std_path(desugared_span, into_iter_path, arena_vec![self; head])
14781464
};
14791465

14801466
let match_expr = self.arena.alloc(self.expr_match(

‎src/librustc_infer/infer/error_reporting/need_type_info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
468468
let msg = if let Some(simple_ident) = pattern.simple_ident() {
469469
match pattern.span.desugaring_kind() {
470470
None => format!("consider giving `{}` {}", simple_ident, suffix),
471-
Some(DesugaringKind::ForLoop(_)) => {
471+
Some(DesugaringKind::ForLoop) => {
472472
"the element type for this iterator is not specified".to_string()
473473
}
474474
_ => format!("this needs {}", suffix),

0 commit comments

Comments
 (0)
Please sign in to comment.