use rustc::hir;
+use rustc_error_codes::*;
+
/// Checks that it is legal to call methods of the trait corresponding
/// to `trait_id` (this only cares about the trait, not the specific
/// method that is called).
if borrow {
if let ty::Ref(region, _, mutbl) = method.sig.inputs()[0].kind {
let mutbl = match mutbl {
- hir::MutImmutable => AutoBorrowMutability::Immutable,
- hir::MutMutable => AutoBorrowMutability::Mutable {
+ hir::Mutability::Immutable => AutoBorrowMutability::Immutable,
+ hir::Mutability::Mutable => AutoBorrowMutability::Mutable {
// For initial two-phase borrow
// deployment, conservatively omit
// overloaded function call ops.
hir::ExprKind::Block(..),
) = (parent_node, callee_node) {
let start = sp.shrink_to_lo();
- let end = self.tcx.sess.source_map().next_point(callee_span);
+ let end = callee_span.shrink_to_hi();
err.multipart_suggestion(
"if you meant to create this closure and immediately call it, surround the \
closure with parenthesis",
let call_is_multiline =
self.tcx.sess.source_map().is_multiline(call_expr.span);
if call_is_multiline {
- let span = self.tcx.sess.source_map().next_point(callee.span);
err.span_suggestion(
- span,
+ callee.span.shrink_to_hi(),
"try adding a semicolon",
";".to_owned(),
Applicability::MaybeIncorrect,