diff options
| author | csmoe <csmoe@msn.com> | 2018-11-17 17:57:17 +0800 |
|---|---|---|
| committer | csmoe <csmoe@msn.com> | 2018-11-17 17:57:17 +0800 |
| commit | d93e5b04f4817718480d17eafa0ee5e7bbe1f019 (patch) | |
| tree | 44e22fe39416d20f38ef7e7d5698c485b96dabd9 | |
| parent | dbd9abd74d1ca8329f483c30ba04526d8c45a5ac (diff) | |
| download | rust-d93e5b04f4817718480d17eafa0ee5e7bbe1f019.tar.gz rust-d93e5b04f4817718480d17eafa0ee5e7bbe1f019.zip | |
reserve whitespaces between prefix and pipe
| -rw-r--r-- | src/librustc/traits/error_reporting.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/mismatched_types/closure-arg-count.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/mismatched_types/closure-arg-count.stderr | 8 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index d08a4b47b31..48b2b25d6ad 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -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) { diff --git a/src/test/ui/mismatched_types/closure-arg-count.rs b/src/test/ui/mismatched_types/closure-arg-count.rs index ed9162d2348..2dcc7a25c84 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.rs +++ b/src/test/ui/mismatched_types/closure-arg-count.rs @@ -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); diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr index 89977aadf88..eeadf07262c 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.stderr +++ b/src/test/ui/mismatched_types/closure-arg-count.stderr @@ -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 |
