mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
reserve whitespaces between prefix and pipe
This commit is contained in:
parent
dbd9abd74d
commit
d93e5b04f4
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user