summary refs log tree commit diff
path: root/src/test/ui/span
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2017-03-05 23:51:46 -0300
committerAlex Crichton <alex@alexcrichton.com>2017-03-10 08:14:31 -0800
commit7b0dd7bdb80768684195f0175d2feecaefd1f2ac (patch)
tree6c881f7946bda4bfcadc9d04d30d18239d0d7e44 /src/test/ui/span
parentf573db4f80c75f156df8a743f456bf087ec81dc2 (diff)
downloadrust-7b0dd7bdb80768684195f0175d2feecaefd1f2ac.tar.gz
rust-7b0dd7bdb80768684195f0175d2feecaefd1f2ac.zip
Fix incorrect span label formatting
Diffstat (limited to 'src/test/ui/span')
-rw-r--r--src/test/ui/span/issue-40157.rs13
-rw-r--r--src/test/ui/span/issue-40157.stderr14
2 files changed, 27 insertions, 0 deletions
diff --git a/src/test/ui/span/issue-40157.rs b/src/test/ui/span/issue-40157.rs
new file mode 100644
index 00000000000..8f3a7ae3417
--- /dev/null
+++ b/src/test/ui/span/issue-40157.rs
@@ -0,0 +1,13 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main () {
+    {println!("{:?}", match { let foo = vec![1, 2]; foo.get(1) } { x => x });}
+}
diff --git a/src/test/ui/span/issue-40157.stderr b/src/test/ui/span/issue-40157.stderr
new file mode 100644
index 00000000000..ad1c149d2e5
--- /dev/null
+++ b/src/test/ui/span/issue-40157.stderr
@@ -0,0 +1,14 @@
+error: `foo` does not live long enough
+  --> $DIR/issue-40157.rs:12:64
+   |
+12 |     {println!("{:?}", match { let foo = vec![1, 2]; foo.get(1) } { x => x });}
+   |      ----------------------------------------------------------^-------------
+   |      |                                              |          |
+   |      |                                              |          `foo` dropped here while still borrowed
+   |      |                                              borrow occurs here
+   |      borrowed value needs to live until here
+   |
+   = note: this error originates in a macro outside of the current crate
+
+error: aborting due to previous error
+