reserve whitespaces between prefix and pipe

This commit is contained in:
csmoe 2018-11-17 17:57:17 +08:00
parent dbd9abd74d
commit d93e5b04f4
3 changed files with 6 additions and 6 deletions

View File

@ -1097,7 +1097,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
//
// move |_| { ... }
// ^^^^^-- prefix
let prefix_span = self.tcx.sess.source_map().span_until_char(found_span, '|');
let prefix_span = self.tcx.sess.source_map().span_until_non_whitespace(found_span);
// move |_| { ... }
// ^^^-- pipe_span
let pipe_span = if let Some(span) = found_span.trim_start(prefix_span) {

View File

@ -22,7 +22,7 @@ fn main() {
//~^ ERROR closure is expected to take
f(|| panic!());
//~^ ERROR closure is expected to take
f(move || panic!());
f( move || panic!());
//~^ ERROR closure is expected to take
let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i);

View File

@ -63,8 +63,8 @@ LL | f(|_| panic!());
error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
--> $DIR/closure-arg-count.rs:25:5
|
LL | f(move || panic!());
| ^ ------- takes 0 arguments
LL | f( move || panic!());
| ^ ---------- takes 0 arguments
| |
| expected closure that takes 1 argument
|
@ -75,8 +75,8 @@ LL | fn f<F: Fn<usize>>(_: F) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^
help: consider changing the closure to take and ignore the expected argument
|
LL | f(move|_| panic!());
| ^^^
LL | f( move |_| panic!());
| ^^^
error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
--> $DIR/closure-arg-count.rs:28:53