about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-11-15 12:43:01 +0000
committerbors <bors@rust-lang.org>2018-11-15 12:43:01 +0000
commit9649c1f70fddd01843024932df97fb5a2b10bfe8 (patch)
treebc6af666244208eb4354636428ac26731935cbdc /src/test
parent99e3fca27d141e2d100ebaf5d5a4104234ae201a (diff)
parentd0e08ce88e0926e8e2bc393d3d7982fd767f37b8 (diff)
downloadrust-9649c1f70fddd01843024932df97fb5a2b10bfe8.tar.gz
rust-9649c1f70fddd01843024932df97fb5a2b10bfe8.zip
Auto merge of #55974 - pietroalbini:rollup, r=pietroalbini
Rollup of 17 pull requests

Successful merges:

 - #55182 (Redox: Update to new changes)
 - #55211 (Add BufWriter::buffer method)
 - #55507 (Add link to std::mem::size_of to size_of intrinsic documentation)
 - #55530 (Speed up String::from_utf16)
 - #55556 (Use `Mmap` to open the rmeta file.)
 - #55622 (NetBSD: link libstd with librt in addition to libpthread)
 - #55750 (Make `NodeId` and `HirLocalId` `newtype_index`)
 - #55778 (Wrap some query results in `Lrc`.)
 - #55781 (More precise spans for temps and their drops)
 - #55785 (Add mem::forget_unsized() for forgetting unsized values)
 - #55852 (Rewrite `...` as `..=` as a `MachineApplicable` 2018 idiom lint)
 - #55865 (Unix RwLock: avoid racy access to write_locked)
 - #55901 (fix various typos in doc comments)
 - #55926 (Change sidebar selector to fix compatibility with docs.rs)
 - #55930 (A handful of hir tweaks)
 - #55932 (core/char: Speed up `to_digit()` for `radix <= 10`)
 - #55956 (add tests for some fixed ICEs)

Failed merges:

r? @ghost
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass-fulldeps/auxiliary/procedural_mbe_matching.rs2
-rw-r--r--src/test/ui/issues/issue-54348.rs5
-rw-r--r--src/test/ui/issues/issue-54348.stderr16
-rw-r--r--src/test/ui/issues/issue-55587.rs5
-rw-r--r--src/test/ui/issues/issue-55587.stderr9
-rw-r--r--src/test/ui/lint/inclusive-range-pattern-syntax.fixed6
-rw-r--r--src/test/ui/lint/inclusive-range-pattern-syntax.rs6
-rw-r--r--src/test/ui/lint/inclusive-range-pattern-syntax.stderr6
-rw-r--r--src/test/ui/nll/issue-54382-use-span-of-tail-of-block.nll.stderr20
-rw-r--r--src/test/ui/nll/issue-54382-use-span-of-tail-of-block.rs28
-rw-r--r--src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr15
-rw-r--r--src/test/ui/range/range-inclusive-pattern-precedence.stderr4
12 files changed, 119 insertions, 3 deletions
diff --git a/src/test/run-pass-fulldeps/auxiliary/procedural_mbe_matching.rs b/src/test/run-pass-fulldeps/auxiliary/procedural_mbe_matching.rs
index f2f14f84923..2c5de332327 100644
--- a/src/test/run-pass-fulldeps/auxiliary/procedural_mbe_matching.rs
+++ b/src/test/run-pass-fulldeps/auxiliary/procedural_mbe_matching.rs
@@ -43,7 +43,7 @@ fn expand_mbe_matches(cx: &mut ExtCtxt, _: Span, args: &[TokenTree])
                                     &[],
                                     Edition::Edition2015,
                                     // not used...
-                                    NodeId::new(0));
+                                    NodeId::from_u32(0));
     let map = match TokenTree::parse(cx, &mbe_matcher, args.iter().cloned().collect()) {
         Success(map) => map,
         Failure(_, tok) => {
diff --git a/src/test/ui/issues/issue-54348.rs b/src/test/ui/issues/issue-54348.rs
new file mode 100644
index 00000000000..b980290391d
--- /dev/null
+++ b/src/test/ui/issues/issue-54348.rs
@@ -0,0 +1,5 @@
+fn main() {
+    [1][0u64 as usize];
+    [1][1.5 as usize]; // ERROR index out of bounds
+    [1][1u64 as usize]; // ERROR index out of bounds
+}
diff --git a/src/test/ui/issues/issue-54348.stderr b/src/test/ui/issues/issue-54348.stderr
new file mode 100644
index 00000000000..a9f1b494258
--- /dev/null
+++ b/src/test/ui/issues/issue-54348.stderr
@@ -0,0 +1,16 @@
+error: index out of bounds: the len is 1 but the index is 1
+  --> $DIR/issue-54348.rs:3:5
+   |
+LL |     [1][1.5 as usize]; // ERROR index out of bounds
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: #[deny(const_err)] on by default
+
+error: index out of bounds: the len is 1 but the index is 1
+  --> $DIR/issue-54348.rs:4:5
+   |
+LL |     [1][1u64 as usize]; // ERROR index out of bounds
+   |     ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/issues/issue-55587.rs b/src/test/ui/issues/issue-55587.rs
new file mode 100644
index 00000000000..8b78749f652
--- /dev/null
+++ b/src/test/ui/issues/issue-55587.rs
@@ -0,0 +1,5 @@
+use std::path::Path;
+
+fn main() {
+    let Path::new(); //~ ERROR expected tuple struct/variant
+}
diff --git a/src/test/ui/issues/issue-55587.stderr b/src/test/ui/issues/issue-55587.stderr
new file mode 100644
index 00000000000..876fb4391b1
--- /dev/null
+++ b/src/test/ui/issues/issue-55587.stderr
@@ -0,0 +1,9 @@
+error[E0164]: expected tuple struct/variant, found method `<Path>::new`
+  --> $DIR/issue-55587.rs:4:9
+   |
+LL |     let Path::new(); //~ ERROR expected tuple struct/variant
+   |         ^^^^^^^^^^^ not a tuple variant or struct
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0164`.
diff --git a/src/test/ui/lint/inclusive-range-pattern-syntax.fixed b/src/test/ui/lint/inclusive-range-pattern-syntax.fixed
index d16859df79e..f0aee8a51f1 100644
--- a/src/test/ui/lint/inclusive-range-pattern-syntax.fixed
+++ b/src/test/ui/lint/inclusive-range-pattern-syntax.fixed
@@ -20,4 +20,10 @@ fn main() {
         //~^ WARN `...` range patterns are deprecated
         _ => {}
     }
+
+    match &despondency {
+        &(1..=2) => {}
+        //~^ WARN `...` range patterns are deprecated
+        _ => {}
+    }
 }
diff --git a/src/test/ui/lint/inclusive-range-pattern-syntax.rs b/src/test/ui/lint/inclusive-range-pattern-syntax.rs
index 9d418aec085..97bc04faa77 100644
--- a/src/test/ui/lint/inclusive-range-pattern-syntax.rs
+++ b/src/test/ui/lint/inclusive-range-pattern-syntax.rs
@@ -20,4 +20,10 @@ fn main() {
         //~^ WARN `...` range patterns are deprecated
         _ => {}
     }
+
+    match &despondency {
+        &1...2 => {}
+        //~^ WARN `...` range patterns are deprecated
+        _ => {}
+    }
 }
diff --git a/src/test/ui/lint/inclusive-range-pattern-syntax.stderr b/src/test/ui/lint/inclusive-range-pattern-syntax.stderr
index de04fed589b..b13afdbc023 100644
--- a/src/test/ui/lint/inclusive-range-pattern-syntax.stderr
+++ b/src/test/ui/lint/inclusive-range-pattern-syntax.stderr
@@ -10,3 +10,9 @@ note: lint level defined here
 LL | #![warn(ellipsis_inclusive_range_patterns)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
+warning: `...` range patterns are deprecated
+  --> $DIR/inclusive-range-pattern-syntax.rs:25:9
+   |
+LL |         &1...2 => {}
+   |         ^^^^^^ help: use `..=` for an inclusive range: `&(1..=2)`
+
diff --git a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.nll.stderr b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.nll.stderr
new file mode 100644
index 00000000000..c308562c0cc
--- /dev/null
+++ b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.nll.stderr
@@ -0,0 +1,20 @@
+error[E0597]: `_thing1` does not live long enough
+  --> $DIR/issue-54382-use-span-of-tail-of-block.rs:7:29
+   |
+LL |             D("other").next(&_thing1)
+   |             ----------------^^^^^^^^-
+   |             |               |
+   |             |               borrowed value does not live long enough
+   |             a temporary with access to the borrow is created here ...
+LL |         }
+LL |     }
+   |     - `_thing1` dropped here while still borrowed
+LL | 
+LL |     ;
+   |     - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+   |
+   = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped.
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.rs b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.rs
new file mode 100644
index 00000000000..99eafe0e9d1
--- /dev/null
+++ b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.rs
@@ -0,0 +1,28 @@
+fn main() {
+    {
+        let mut _thing1 = D(Box::new("thing1"));
+        {
+            let _thing2 = D("thing2");
+            side_effects();
+            D("other").next(&_thing1)
+        }
+    }
+
+    ;
+}
+
+#[derive(Debug)]
+struct D<T: std::fmt::Debug>(T);
+
+impl<T: std::fmt::Debug>  Drop for D<T> {
+    fn drop(&mut self) {
+        println!("dropping {:?})", self);
+    }
+}
+
+impl<T: std::fmt::Debug> D<T> {
+    fn next<U: std::fmt::Debug>(&self, _other: U) -> D<U> { D(_other) }
+    fn end(&self) { }
+}
+
+fn side_effects() { }
diff --git a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr
new file mode 100644
index 00000000000..eeba7d6bb44
--- /dev/null
+++ b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr
@@ -0,0 +1,15 @@
+error[E0597]: `_thing1` does not live long enough
+  --> $DIR/issue-54382-use-span-of-tail-of-block.rs:7:30
+   |
+LL |             D("other").next(&_thing1)
+   |                              ^^^^^^^ borrowed value does not live long enough
+LL |         }
+LL |     }
+   |     - `_thing1` dropped here while still borrowed
+LL | 
+LL |     ;
+   |     - borrowed value needs to live until here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/range/range-inclusive-pattern-precedence.stderr b/src/test/ui/range/range-inclusive-pattern-precedence.stderr
index cd5ce3035c6..6fa67a5d4fa 100644
--- a/src/test/ui/range/range-inclusive-pattern-precedence.stderr
+++ b/src/test/ui/range/range-inclusive-pattern-precedence.stderr
@@ -11,10 +11,10 @@ LL |         box 10..=15 => {}
    |             ^^^^^^^ help: add parentheses to clarify the precedence: `(10 ..=15)`
 
 warning: `...` range patterns are deprecated
-  --> $DIR/range-inclusive-pattern-precedence.rs:24:11
+  --> $DIR/range-inclusive-pattern-precedence.rs:24:9
    |
 LL |         &0...9 => {}
-   |           ^^^ help: use `..=` for an inclusive range
+   |         ^^^^^^ help: use `..=` for an inclusive range: `&(0..=9)`
    |
 note: lint level defined here
   --> $DIR/range-inclusive-pattern-precedence.rs:19:9