about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-09-22 14:26:15 +0000
committerbors <bors@rust-lang.org>2018-09-22 14:26:15 +0000
commitaf50e3822c4ceda60445c4a2adbb3bfa480ebd39 (patch)
tree34fd72c893b38708f648f92b4222ebc7ea625b9a /src/test
parente7b5ba8661aa844a06c37f22d7af0afb1807d347 (diff)
parent48ec53ccaebe555832114612b6c3f8df183c0a91 (diff)
downloadrust-af50e3822c4ceda60445c4a2adbb3bfa480ebd39.tar.gz
rust-af50e3822c4ceda60445c4a2adbb3bfa480ebd39.zip
Auto merge of #54457 - pietroalbini:rollup, r=pietroalbini
Rollup of 16 pull requests

Successful merges:

 - #53652 (define copy_within on slices)
 - #54261 (Make `dyn` a keyword in the 2018 edition)
 - #54280 (remove (more) CAS API from Atomic* types where not natively supported)
 - #54323 (rustbuild: drop color handling)
 - #54350 (Support specifying edition in doc test)
 - #54370 (Improve handling of type bounds in `bit_set.rs`.)
 - #54371 (add -Zui-testing to rustdoc)
 - #54374 (Make 'proc_macro::MultiSpan' public.)
 - #54402 (Use no_default_libraries for all NetBSD flavors)
 - #54409 (Detect `for _ in in bar {}` typo)
 - #54412 (add applicability to span_suggestion call)
 - #54413 (Add UI test for deref recursion limit printing twice)
 - #54415 (parser: Tweak function parameter parsing to avoid rollback on succesfull path)
 - #54420 (Compress `Liveness` data some more.)
 - #54422 (Simplify slice's first(_mut) and last(_mut) with get)
 - #54446 (Unify christianpoveda's emails)

Failed merges:

 - #54058 (Introduce the partition_dedup/by/by_key methods for slices)

r? @ghost
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr4
-rw-r--r--src/test/rustdoc-ui/deprecated-attrs.stderr10
-rw-r--r--src/test/rustdoc-ui/intra-doc-alias-ice.stderr4
-rw-r--r--src/test/rustdoc-ui/intra-links-warning.stderr44
-rw-r--r--src/test/rustdoc/edition-doctest.rs54
-rw-r--r--src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr12
-rw-r--r--src/test/ui/issues/issue-38940.rs46
-rw-r--r--src/test/ui/issues/issue-38940.stderr21
-rw-r--r--src/test/ui/parser/if-in-in.rs5
-rw-r--r--src/test/ui/parser/if-in-in.stderr13
-rw-r--r--src/test/ui/rust-2018/dyn-keyword.fixed10
-rw-r--r--src/test/ui/rust-2018/dyn-keyword.rs10
-rw-r--r--src/test/ui/rust-2018/dyn-keyword.stderr16
-rw-r--r--src/test/ui/rust-2018/dyn-trait-compatibility.rs8
-rw-r--r--src/test/ui/rust-2018/dyn-trait-compatibility.stderr14
15 files changed, 236 insertions, 35 deletions
diff --git a/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr b/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr
index 66ee48ed4c9..b82cbc1ab36 100644
--- a/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr
+++ b/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr
@@ -1,13 +1,13 @@
 error: `[v2]` cannot be resolved, ignoring it...
   --> $DIR/deny-intra-link-resolution-failure.rs:13:6
    |
-13 | /// [v2] //~ ERROR
+LL | /// [v2] //~ ERROR
    |      ^^ cannot be resolved, ignoring
    |
 note: lint level defined here
   --> $DIR/deny-intra-link-resolution-failure.rs:11:9
    |
-11 | #![deny(intra_doc_link_resolution_failure)]
+LL | #![deny(intra_doc_link_resolution_failure)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
 
diff --git a/src/test/rustdoc-ui/deprecated-attrs.stderr b/src/test/rustdoc-ui/deprecated-attrs.stderr
index 77ba4b2a2b6..5bd62d60b48 100644
--- a/src/test/rustdoc-ui/deprecated-attrs.stderr
+++ b/src/test/rustdoc-ui/deprecated-attrs.stderr
@@ -1,9 +1,9 @@
 warning: the `#![doc(no_default_passes)]` attribute is considered deprecated
-  |
-  = warning: please see https://github.com/rust-lang/rust/issues/44136
-  = help: you may want to use `#![doc(document_private_items)]`
+   |
+   = warning: please see https://github.com/rust-lang/rust/issues/44136
+   = help: you may want to use `#![doc(document_private_items)]`
 
 warning: the `#![doc(passes = "...")]` attribute is considered deprecated
-  |
-  = warning: please see https://github.com/rust-lang/rust/issues/44136
+   |
+   = warning: please see https://github.com/rust-lang/rust/issues/44136
 
diff --git a/src/test/rustdoc-ui/intra-doc-alias-ice.stderr b/src/test/rustdoc-ui/intra-doc-alias-ice.stderr
index 231963976ea..498d02a7d1c 100644
--- a/src/test/rustdoc-ui/intra-doc-alias-ice.stderr
+++ b/src/test/rustdoc-ui/intra-doc-alias-ice.stderr
@@ -1,13 +1,13 @@
 error: `[TypeAlias::hoge]` cannot be resolved, ignoring it...
   --> $DIR/intra-doc-alias-ice.rs:15:30
    |
-15 | /// [broken cross-reference](TypeAlias::hoge) //~ ERROR
+LL | /// [broken cross-reference](TypeAlias::hoge) //~ ERROR
    |                              ^^^^^^^^^^^^^^^ cannot be resolved, ignoring
    |
 note: lint level defined here
   --> $DIR/intra-doc-alias-ice.rs:11:9
    |
-11 | #![deny(intra_doc_link_resolution_failure)]
+LL | #![deny(intra_doc_link_resolution_failure)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
 
diff --git a/src/test/rustdoc-ui/intra-links-warning.stderr b/src/test/rustdoc-ui/intra-links-warning.stderr
index 2a51e94b1f5..c05f99fadc9 100644
--- a/src/test/rustdoc-ui/intra-links-warning.stderr
+++ b/src/test/rustdoc-ui/intra-links-warning.stderr
@@ -1,7 +1,7 @@
 warning: `[Foo::baz]` cannot be resolved, ignoring it...
   --> $DIR/intra-links-warning.rs:13:23
    |
-13 |        //! Test with [Foo::baz], [Bar::foo], ...
+LL |        //! Test with [Foo::baz], [Bar::foo], ...
    |                       ^^^^^^^^ cannot be resolved, ignoring
    |
    = note: #[warn(intra_doc_link_resolution_failure)] on by default
@@ -10,7 +10,7 @@ warning: `[Foo::baz]` cannot be resolved, ignoring it...
 warning: `[Bar::foo]` cannot be resolved, ignoring it...
   --> $DIR/intra-links-warning.rs:13:35
    |
-13 |        //! Test with [Foo::baz], [Bar::foo], ...
+LL |        //! Test with [Foo::baz], [Bar::foo], ...
    |                                   ^^^^^^^^ cannot be resolved, ignoring
    |
    = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
@@ -18,7 +18,7 @@ warning: `[Bar::foo]` cannot be resolved, ignoring it...
 warning: `[Uniooon::X]` cannot be resolved, ignoring it...
   --> $DIR/intra-links-warning.rs:14:13
    |
-14 |      //! , [Uniooon::X] and [Qux::Z].
+LL |      //! , [Uniooon::X] and [Qux::Z].
    |             ^^^^^^^^^^ cannot be resolved, ignoring
    |
    = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
@@ -26,7 +26,7 @@ warning: `[Uniooon::X]` cannot be resolved, ignoring it...
 warning: `[Qux::Z]` cannot be resolved, ignoring it...
   --> $DIR/intra-links-warning.rs:14:30
    |
-14 |      //! , [Uniooon::X] and [Qux::Z].
+LL |      //! , [Uniooon::X] and [Qux::Z].
    |                              ^^^^^^ cannot be resolved, ignoring
    |
    = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
@@ -34,7 +34,7 @@ warning: `[Qux::Z]` cannot be resolved, ignoring it...
 warning: `[Uniooon::X]` cannot be resolved, ignoring it...
   --> $DIR/intra-links-warning.rs:16:14
    |
-16 |       //! , [Uniooon::X] and [Qux::Z].
+LL |       //! , [Uniooon::X] and [Qux::Z].
    |              ^^^^^^^^^^ cannot be resolved, ignoring
    |
    = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
@@ -42,7 +42,7 @@ warning: `[Uniooon::X]` cannot be resolved, ignoring it...
 warning: `[Qux::Z]` cannot be resolved, ignoring it...
   --> $DIR/intra-links-warning.rs:16:31
    |
-16 |       //! , [Uniooon::X] and [Qux::Z].
+LL |       //! , [Uniooon::X] and [Qux::Z].
    |                               ^^^^^^ cannot be resolved, ignoring
    |
    = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
@@ -50,7 +50,7 @@ warning: `[Qux::Z]` cannot be resolved, ignoring it...
 warning: `[Qux:Y]` cannot be resolved, ignoring it...
   --> $DIR/intra-links-warning.rs:18:13
    |
-18 |        /// [Qux:Y]
+LL |        /// [Qux:Y]
    |             ^^^^^ cannot be resolved, ignoring
    |
    = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
@@ -58,7 +58,7 @@ warning: `[Qux:Y]` cannot be resolved, ignoring it...
 warning: `[BarA]` cannot be resolved, ignoring it...
   --> $DIR/intra-links-warning.rs:24:10
    |
-24 | /// bar [BarA] bar
+LL | /// bar [BarA] bar
    |          ^^^^ cannot be resolved, ignoring
    |
    = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
@@ -66,11 +66,11 @@ warning: `[BarA]` cannot be resolved, ignoring it...
 warning: `[BarB]` cannot be resolved, ignoring it...
   --> $DIR/intra-links-warning.rs:28:1
    |
-28 | / /**
-29 | |  * Foo
-30 | |  * bar [BarB] bar
-31 | |  * baz
-32 | |  */
+LL | / /**
+LL | |  * Foo
+LL | |  * bar [BarB] bar
+LL | |  * baz
+LL | |  */
    | |___^
    |
    = note: the link appears in this line:
@@ -82,13 +82,13 @@ warning: `[BarB]` cannot be resolved, ignoring it...
 warning: `[BarC]` cannot be resolved, ignoring it...
   --> $DIR/intra-links-warning.rs:35:1
    |
-35 | / /** Foo
-36 | |
-37 | | bar [BarC] bar
-38 | | baz
+LL | / /** Foo
+LL | |
+LL | | bar [BarC] bar
+LL | | baz
 ...  |
-44 | |
-45 | | */
+LL | |
+LL | | */
    | |__^
    |
    = note: the link appears in this line:
@@ -100,7 +100,7 @@ warning: `[BarC]` cannot be resolved, ignoring it...
 warning: `[BarD]` cannot be resolved, ignoring it...
   --> $DIR/intra-links-warning.rs:48:1
    |
-48 | #[doc = "Foo/nbar [BarD] bar/nbaz"]
+LL | #[doc = "Foo/nbar [BarD] bar/nbaz"]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: the link appears in this line:
@@ -112,10 +112,10 @@ warning: `[BarD]` cannot be resolved, ignoring it...
 warning: `[BarF]` cannot be resolved, ignoring it...
   --> $DIR/intra-links-warning.rs:53:9
    |
-53 |         #[doc = $f]
+LL |         #[doc = $f]
    |         ^^^^^^^^^^^
 ...
-57 | f!("Foo/nbar [BarF] bar/nbaz");
+LL | f!("Foo/nbar [BarF] bar/nbaz");
    | ------------------------------- in this macro invocation
    |
    = note: the link appears in this line:
diff --git a/src/test/rustdoc/edition-doctest.rs b/src/test/rustdoc/edition-doctest.rs
new file mode 100644
index 00000000000..322d461f854
--- /dev/null
+++ b/src/test/rustdoc/edition-doctest.rs
@@ -0,0 +1,54 @@
+// 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-flags:--test
+
+/// ```rust,edition2018
+/// #![feature(try_blocks)]
+///
+/// use std::num::ParseIntError;
+///
+/// let result: Result<i32, ParseIntError> = try {
+///     "1".parse::<i32>()?
+///         + "2".parse::<i32>()?
+///         + "3".parse::<i32>()?
+/// };
+/// assert_eq!(result, Ok(6));
+///
+/// let result: Result<i32, ParseIntError> = try {
+///     "1".parse::<i32>()?
+///         + "foo".parse::<i32>()?
+///         + "3".parse::<i32>()?
+/// };
+/// assert!(result.is_err());
+/// ```
+
+
+/// ```rust,edition2015,compile_fail,E0574
+/// #![feature(try_blocks)]
+///
+/// use std::num::ParseIntError;
+///
+/// let result: Result<i32, ParseIntError> = try {
+///     "1".parse::<i32>()?
+///         + "2".parse::<i32>()?
+///         + "3".parse::<i32>()?
+/// };
+/// assert_eq!(result, Ok(6));
+///
+/// let result: Result<i32, ParseIntError> = try {
+///     "1".parse::<i32>()?
+///         + "foo".parse::<i32>()?
+///         + "3".parse::<i32>()?
+/// };
+/// assert!(result.is_err());
+/// ```
+
+pub fn foo() {}
diff --git a/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr b/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr
index 22845775aed..aa54425efa3 100644
--- a/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr
+++ b/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr
@@ -2,16 +2,20 @@ error: expected `{`, found `and`
   --> $DIR/issue-54109-and_instead_of_ampersands.rs:14:10
    |
 LL |     if a and b {
-   |     --   ^^^ help: use `&&` instead of `and` for the boolean operator
-   |     |
+   |     --   ^^^
+   |     |    |
+   |     |    expected `{`
+   |     |    help: use `&&` instead of `and` for the boolean operator
    |     this `if` statement has a condition, but no block
 
 error: expected `{`, found `or`
   --> $DIR/issue-54109-and_instead_of_ampersands.rs:23:10
    |
 LL |     if a or b {
-   |     --   ^^ help: use `||` instead of `or` for the boolean operator
-   |     |
+   |     --   ^^
+   |     |    |
+   |     |    expected `{`
+   |     |    help: use `||` instead of `or` for the boolean operator
    |     this `if` statement has a condition, but no block
 
 error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `and`
diff --git a/src/test/ui/issues/issue-38940.rs b/src/test/ui/issues/issue-38940.rs
new file mode 100644
index 00000000000..7f9b141e02e
--- /dev/null
+++ b/src/test/ui/issues/issue-38940.rs
@@ -0,0 +1,46 @@
+// issue-38940: error printed twice for deref recursion limit exceeded
+// Test that the recursion limit can be changed. In this case, we have
+// deeply nested types that will fail the `Send` check by overflow
+// when the recursion limit is set very low.
+#![allow(dead_code)]
+#![recursion_limit="10"]
+macro_rules! link {
+    ($outer:ident, $inner:ident) => {
+        struct $outer($inner);
+        impl $outer {
+            fn new() -> $outer {
+                $outer($inner::new())
+            }
+        }
+        impl std::ops::Deref for $outer {
+            type Target = $inner;
+            fn deref(&self) -> &$inner {
+                &self.0
+            }
+        }
+    }
+}
+struct Bottom;
+impl Bottom {
+    fn new() -> Bottom {
+        Bottom
+    }
+}
+link!(Top, A);
+link!(A, B);
+link!(B, C);
+link!(C, D);
+link!(D, E);
+link!(E, F);
+link!(F, G);
+link!(G, H);
+link!(H, I);
+link!(I, J);
+link!(J, K);
+link!(K, Bottom);
+fn main() {
+    let t = Top::new();
+    let x: &Bottom = &t;
+    //~^ ERROR mismatched types
+    //~| ERROR reached the recursion limit while auto-dereferencing I
+}
diff --git a/src/test/ui/issues/issue-38940.stderr b/src/test/ui/issues/issue-38940.stderr
new file mode 100644
index 00000000000..2d3cfda9a5f
--- /dev/null
+++ b/src/test/ui/issues/issue-38940.stderr
@@ -0,0 +1,21 @@
+error[E0055]: reached the recursion limit while auto-dereferencing I
+  --> $DIR/issue-38940.rs:43:22
+   |
+LL |     let x: &Bottom = &t;
+   |                      ^^ deref recursion limit reached
+   |
+   = help: consider adding a `#![recursion_limit="20"]` attribute to your crate
+
+error[E0308]: mismatched types
+  --> $DIR/issue-38940.rs:43:22
+   |
+LL |     let x: &Bottom = &t;
+   |                      ^^ expected struct `Bottom`, found struct `Top`
+   |
+   = note: expected type `&Bottom`
+              found type `&Top`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0055, E0308.
+For more information about an error, try `rustc --explain E0055`.
diff --git a/src/test/ui/parser/if-in-in.rs b/src/test/ui/parser/if-in-in.rs
new file mode 100644
index 00000000000..9bc9aaff298
--- /dev/null
+++ b/src/test/ui/parser/if-in-in.rs
@@ -0,0 +1,5 @@
+fn main() {
+    for i in in 1..2 {
+        println!("{}", i);
+    }
+}
diff --git a/src/test/ui/parser/if-in-in.stderr b/src/test/ui/parser/if-in-in.stderr
new file mode 100644
index 00000000000..9926fcc0858
--- /dev/null
+++ b/src/test/ui/parser/if-in-in.stderr
@@ -0,0 +1,13 @@
+error: expected iterable, found keyword `in`
+  --> $DIR/if-in-in.rs:2:14
+   |
+LL |     for i in in 1..2 {
+   |           ---^^
+   |           |
+   |           help: remove the duplicated `in`
+   |
+   = note: if you meant to use emplacement syntax, it is obsolete (for now, anyway)
+   = note: for more information on the status of emplacement syntax, see <https://github.com/rust-lang/rust/issues/27779#issuecomment-378416911>
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/rust-2018/dyn-keyword.fixed b/src/test/ui/rust-2018/dyn-keyword.fixed
new file mode 100644
index 00000000000..e9cda1af939
--- /dev/null
+++ b/src/test/ui/rust-2018/dyn-keyword.fixed
@@ -0,0 +1,10 @@
+// edition:2015
+// run-rustfix
+
+#![allow(unused_variables)]
+#![deny(keyword_idents)]
+
+fn main() {
+    let r#dyn = (); //~ ERROR dyn
+    //~^ WARN hard error in the 2018 edition
+}
diff --git a/src/test/ui/rust-2018/dyn-keyword.rs b/src/test/ui/rust-2018/dyn-keyword.rs
new file mode 100644
index 00000000000..bdd3a90cab9
--- /dev/null
+++ b/src/test/ui/rust-2018/dyn-keyword.rs
@@ -0,0 +1,10 @@
+// edition:2015
+// run-rustfix
+
+#![allow(unused_variables)]
+#![deny(keyword_idents)]
+
+fn main() {
+    let dyn = (); //~ ERROR dyn
+    //~^ WARN hard error in the 2018 edition
+}
diff --git a/src/test/ui/rust-2018/dyn-keyword.stderr b/src/test/ui/rust-2018/dyn-keyword.stderr
new file mode 100644
index 00000000000..5a3e00ab1d9
--- /dev/null
+++ b/src/test/ui/rust-2018/dyn-keyword.stderr
@@ -0,0 +1,16 @@
+error: `dyn` is a keyword in the 2018 edition
+  --> $DIR/dyn-keyword.rs:8:9
+   |
+LL |     let dyn = (); //~ ERROR dyn
+   |         ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
+   |
+note: lint level defined here
+  --> $DIR/dyn-keyword.rs:5:9
+   |
+LL | #![deny(keyword_idents)]
+   |         ^^^^^^^^^^^^^^
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
+   = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/rust-2018/dyn-trait-compatibility.rs b/src/test/ui/rust-2018/dyn-trait-compatibility.rs
new file mode 100644
index 00000000000..9548df5959b
--- /dev/null
+++ b/src/test/ui/rust-2018/dyn-trait-compatibility.rs
@@ -0,0 +1,8 @@
+// edition:2018
+
+type A0 = dyn;
+type A1 = dyn::dyn; //~ERROR expected identifier, found reserved keyword
+type A2 = dyn<dyn, dyn>; //~ERROR expected identifier, found `<`
+type A3 = dyn<<dyn as dyn>::dyn>;
+
+fn main() {}
diff --git a/src/test/ui/rust-2018/dyn-trait-compatibility.stderr b/src/test/ui/rust-2018/dyn-trait-compatibility.stderr
new file mode 100644
index 00000000000..ea0483394b5
--- /dev/null
+++ b/src/test/ui/rust-2018/dyn-trait-compatibility.stderr
@@ -0,0 +1,14 @@
+error: expected identifier, found reserved keyword `dyn`
+  --> $DIR/dyn-trait-compatibility.rs:4:16
+   |
+LL | type A1 = dyn::dyn; //~ERROR expected identifier, found reserved keyword
+   |                ^^^ expected identifier, found reserved keyword
+
+error: expected identifier, found `<`
+  --> $DIR/dyn-trait-compatibility.rs:5:14
+   |
+LL | type A2 = dyn<dyn, dyn>; //~ERROR expected identifier, found `<`
+   |              ^ expected identifier
+
+error: aborting due to 2 previous errors
+