about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-05-03 20:45:54 +0000
committerbors <bors@rust-lang.org>2018-05-03 20:45:54 +0000
commite82261dfbb5feaa2d28d2b138f4aabb2aa52c94b (patch)
tree3bade0f4dfbda64eac4eed19227ac3f46acdf373 /src/test
parentd68b0eceaaf719a4702ab13a7ca62dea5d966082 (diff)
parent03a0402dbf3143ab6a8b7166f4d1f74aa68f71df (diff)
downloadrust-e82261dfbb5feaa2d28d2b138f4aabb2aa52c94b.tar.gz
rust-e82261dfbb5feaa2d28d2b138f4aabb2aa52c94b.zip
Auto merge of #50413 - kennytm:rollup, r=kennytm
Rollup of 12 pull requests

Successful merges:

 - #50302 (Add query search order check)
 - #50320 (Fix invalid path generation in rustdoc search)
 - #50349 (Rename "show type declaration" to "show declaration")
 - #50360 (Clarify wordings of the `unstable_name_collision` lint.)
 - #50365 (Use two vectors in nearest_common_ancestor.)
 - #50393 (Allow unaligned reads in constants)
 - #50401 (Revert "Implement FromStr for PathBuf")
 - #50406 (Forbid constructing empty identifiers from concat_idents)
 - #50407 (Always inline simple BytePos and CharPos methods.)
 - #50416 (check if the token is a lifetime before parsing)
 - #50417 (Update Cargo)
 - #50421 (Fix ICE when using a..=b in a closure.)

Failed merges:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/macro-non-lifetime.rs20
-rw-r--r--src/test/run-pass/issue-50415.rs27
-rw-r--r--src/test/rustdoc-js/alias-2.js6
-rw-r--r--src/test/rustdoc-js/alias.js6
-rw-r--r--src/test/rustdoc-js/basic.js2
-rw-r--r--src/test/ui/const-eval/ice-packed.rs28
-rw-r--r--src/test/ui/inference_unstable.rs2
-rw-r--r--src/test/ui/inference_unstable.stderr2
-rw-r--r--src/test/ui/issue-50403.rs15
-rw-r--r--src/test/ui/issue-50403.stderr8
10 files changed, 109 insertions, 7 deletions
diff --git a/src/test/compile-fail/macro-non-lifetime.rs b/src/test/compile-fail/macro-non-lifetime.rs
new file mode 100644
index 00000000000..a2706e83229
--- /dev/null
+++ b/src/test/compile-fail/macro-non-lifetime.rs
@@ -0,0 +1,20 @@
+// Copyright 2018 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.
+
+// Test for issue #50381: non-lifetime passed to :lifetime.
+
+#![feature(macro_lifetime_matcher)]
+
+macro_rules! m { ($x:lifetime) => { } }
+
+fn main() {
+    m!(a);
+    //~^ ERROR expected a lifetime, found `a`
+}
diff --git a/src/test/run-pass/issue-50415.rs b/src/test/run-pass/issue-50415.rs
new file mode 100644
index 00000000000..aa493ce0321
--- /dev/null
+++ b/src/test/run-pass/issue-50415.rs
@@ -0,0 +1,27 @@
+// Copyright 2018 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() {
+    // -------- Simplified test case --------
+
+    let _ = || 0..=1;
+
+    // -------- Original test case --------
+
+    let full_length = 1024;
+    let range = {
+        // do some stuff, omit here
+        None
+    };
+
+    let range = range.map(|(s, t)| s..=t).unwrap_or(0..=(full_length-1));
+
+    assert_eq!(range, 0..=1023);
+}
diff --git a/src/test/rustdoc-js/alias-2.js b/src/test/rustdoc-js/alias-2.js
index f31786df67c..0c5ec4fccbc 100644
--- a/src/test/rustdoc-js/alias-2.js
+++ b/src/test/rustdoc-js/alias-2.js
@@ -8,11 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-order
+
 const QUERY = '+';
 
 const EXPECTED = {
     'others': [
-        { 'path': 'std::ops::AddAssign', 'name': 'AddAssign' },
-        { 'path': 'std::ops::Add', 'name': 'Add' },
+        { 'path': 'std::ops', 'name': 'AddAssign' },
+        { 'path': 'std::ops', 'name': 'Add' },
     ],
 };
diff --git a/src/test/rustdoc-js/alias.js b/src/test/rustdoc-js/alias.js
index a0500f24c17..e7aafe3b9e2 100644
--- a/src/test/rustdoc-js/alias.js
+++ b/src/test/rustdoc-js/alias.js
@@ -8,12 +8,14 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-order
+
 const QUERY = '[';
 
 const EXPECTED = {
     'others': [
         { 'path': 'std', 'name': 'slice' },
-        { 'path': 'std::ops::IndexMut', 'name': 'IndexMut' },
-        { 'path': 'std::ops::Index', 'name': 'Index' },
+        { 'path': 'std::ops', 'name': 'IndexMut' },
+        { 'path': 'std::ops', 'name': 'Index' },
     ],
 };
diff --git a/src/test/rustdoc-js/basic.js b/src/test/rustdoc-js/basic.js
index 863437cac91..d7ba1253eab 100644
--- a/src/test/rustdoc-js/basic.js
+++ b/src/test/rustdoc-js/basic.js
@@ -13,8 +13,8 @@ const QUERY = 'String';
 const EXPECTED = {
     'others': [
         { 'path': 'std::string', 'name': 'String' },
-        { 'path': 'std::ffi', 'name': 'OsString' },
         { 'path': 'std::ffi', 'name': 'CString' },
+        { 'path': 'std::ffi', 'name': 'OsString' },
     ],
     'in_args': [
         { 'path': 'std::str', 'name': 'eq' },
diff --git a/src/test/ui/const-eval/ice-packed.rs b/src/test/ui/const-eval/ice-packed.rs
new file mode 100644
index 00000000000..1db12a06b03
--- /dev/null
+++ b/src/test/ui/const-eval/ice-packed.rs
@@ -0,0 +1,28 @@
+// Copyright 2018 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.
+
+// compile-pass
+#[derive(Copy, Clone, PartialEq, Eq)]
+#[repr(packed)]
+pub struct Num(u64);
+
+impl Num {
+    pub const ZERO: Self = Num(0);
+}
+
+pub fn decrement(a: Num) -> Num {
+    match a {
+        Num::ZERO => Num::ZERO,
+        a => Num(a.0 - 1)
+    }
+}
+
+fn main() {
+}
diff --git a/src/test/ui/inference_unstable.rs b/src/test/ui/inference_unstable.rs
index 816c443a06c..5a70dffd4c8 100644
--- a/src/test/ui/inference_unstable.rs
+++ b/src/test/ui/inference_unstable.rs
@@ -25,5 +25,5 @@ use inference_unstable_itertools::IpuItertools;
 fn main() {
     assert_eq!('x'.ipu_flatten(), 1);
     //~^ WARN a method with this name may be added to the standard library in the future
-    //~^^ WARN once this method is added to the standard library, there will be ambiguity here
+    //~^^ WARN once this method is added to the standard library, the ambiguity may cause an error
 }
diff --git a/src/test/ui/inference_unstable.stderr b/src/test/ui/inference_unstable.stderr
index 9c614d659d3..a217bc57b36 100644
--- a/src/test/ui/inference_unstable.stderr
+++ b/src/test/ui/inference_unstable.stderr
@@ -5,7 +5,7 @@ LL |     assert_eq!('x'.ipu_flatten(), 1);
    |                    ^^^^^^^^^^^
    |
    = note: #[warn(unstable_name_collision)] on by default
-   = warning: once this method is added to the standard library, there will be ambiguity here, which will cause a hard error!
+   = warning: once this method is added to the standard library, the ambiguity may cause an error or change in behavior!
    = note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919>
    = help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_flatten(...)` to keep using the current method
    = note: add #![feature(ipu_flatten)] to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_flatten`
diff --git a/src/test/ui/issue-50403.rs b/src/test/ui/issue-50403.rs
new file mode 100644
index 00000000000..8d4c6c5140f
--- /dev/null
+++ b/src/test/ui/issue-50403.rs
@@ -0,0 +1,15 @@
+// Copyright 2016 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.
+
+#![feature(concat_idents)]
+
+fn main() {
+    let x = concat_idents!(); //~ ERROR concat_idents! takes 1 or more arguments
+}
diff --git a/src/test/ui/issue-50403.stderr b/src/test/ui/issue-50403.stderr
new file mode 100644
index 00000000000..f2871c72e25
--- /dev/null
+++ b/src/test/ui/issue-50403.stderr
@@ -0,0 +1,8 @@
+error: concat_idents! takes 1 or more arguments.
+  --> $DIR/issue-50403.rs:14:13
+   |
+LL |     let x = concat_idents!(); //~ ERROR concat_idents! takes 1 or more arguments
+   |             ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+