about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-01-25 15:27:18 +0000
committerbors <bors@rust-lang.org>2018-01-25 15:27:18 +0000
commit9fd7da904b46ff7aa78c2e2cc1986c4975aeccc6 (patch)
tree571e826bfff65a9f2ec98b0d3b63086890e4bbc5 /src/test
parent4cf26f8a133039bfeb5b9f684df9f547278db206 (diff)
parent89ff1226e539252f15d4e33de99fa6410a2c83f1 (diff)
Auto merge of #47740 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 10 pull requests

- Successful merges: #47534, #47609, #47679, #47691, #47700, #47702, #47717, #47721, #47726, #47729
- Failed merges:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/E0522.rs3
-rw-r--r--src/test/run-pass/nll/mutating_references.rs (renamed from src/test/run-pass/borrowck/borrowck-nll-iterating-and-updating.rs)12
-rw-r--r--src/test/ui/impl-trait/no-method-suggested-traits.stderr12
-rw-r--r--src/test/ui/method-call-err-msg.stderr6
-rw-r--r--src/test/ui/owl-import-generates-unused-import-lint.stderr14
-rw-r--r--src/test/ui/suggestions/dont-suggest-private-trait-method.rs (renamed from src/test/ui/owl-import-generates-unused-import-lint.rs)14
-rw-r--r--src/test/ui/suggestions/dont-suggest-private-trait-method.stderr11
-rw-r--r--src/test/ui/suggestions/numeric-cast.rs5
-rw-r--r--src/test/ui/suggestions/numeric-cast.stderr22
-rw-r--r--src/test/ui/unknown-language-item.rs20
-rw-r--r--src/test/ui/unknown-language-item.stderr8
-rw-r--r--src/test/ui/use-nested-groups-unused-imports.rs35
-rw-r--r--src/test/ui/use-nested-groups-unused-imports.stderr26
13 files changed, 144 insertions, 44 deletions
diff --git a/src/test/compile-fail/E0522.rs b/src/test/compile-fail/E0522.rs
index 5103c83cafc..3d437785346 100644
--- a/src/test/compile-fail/E0522.rs
+++ b/src/test/compile-fail/E0522.rs
@@ -11,6 +11,7 @@
 #![feature(lang_items)]
 
 #[lang = "cookie"]
-fn cookie() -> ! { //~ E0522
+fn cookie() -> ! {
+//~^^ ERROR definition of an unknown language item: `cookie` [E0522]
     loop {}
 }
diff --git a/src/test/run-pass/borrowck/borrowck-nll-iterating-and-updating.rs b/src/test/run-pass/nll/mutating_references.rs
index 043f1215ea5..96b7362e4d9 100644
--- a/src/test/run-pass/borrowck/borrowck-nll-iterating-and-updating.rs
+++ b/src/test/run-pass/nll/mutating_references.rs
@@ -1,4 +1,4 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -8,17 +8,14 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags: -Z borrowck=mir -Z nll
-
-// This example comes from the NLL RFC.
+#![feature(nll)]
 
 struct List<T> {
     value: T,
     next: Option<Box<List<T>>>,
 }
 
-fn to_refs<T>(list: &mut List<T>) -> Vec<&mut T> {
-    let mut list = list;
+fn to_refs<T>(mut list: &mut List<T>) -> Vec<&mut T> {
     let mut result = vec![];
     loop {
         result.push(&mut list.value);
@@ -31,4 +28,7 @@ fn to_refs<T>(list: &mut List<T>) -> Vec<&mut T> {
 }
 
 fn main() {
+    let mut list = List { value: 1, next: None };
+    let vec = to_refs(&mut list);
+    assert_eq!(vec![&mut 1], vec);
 }
diff --git a/src/test/ui/impl-trait/no-method-suggested-traits.stderr b/src/test/ui/impl-trait/no-method-suggested-traits.stderr
index 4517f09d07c..882113b8176 100644
--- a/src/test/ui/impl-trait/no-method-suggested-traits.stderr
+++ b/src/test/ui/impl-trait/no-method-suggested-traits.stderr
@@ -95,10 +95,8 @@ error[E0599]: no method named `method` found for type `Foo` in the current scope
    = note: the following traits define an item `method`, perhaps you need to implement one of them:
            candidate #1: `foo::Bar`
            candidate #2: `no_method_suggested_traits::foo::PubPub`
-           candidate #3: `no_method_suggested_traits::bar::PubPriv`
-           candidate #4: `no_method_suggested_traits::qux::PrivPub`
-           candidate #5: `no_method_suggested_traits::quz::PrivPriv`
-           candidate #6: `no_method_suggested_traits::Reexported`
+           candidate #3: `no_method_suggested_traits::qux::PrivPub`
+           candidate #4: `no_method_suggested_traits::Reexported`
 
 error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&Foo>>` in the current scope
   --> $DIR/no-method-suggested-traits.rs:52:43
@@ -110,10 +108,8 @@ error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::box
    = note: the following traits define an item `method`, perhaps you need to implement one of them:
            candidate #1: `foo::Bar`
            candidate #2: `no_method_suggested_traits::foo::PubPub`
-           candidate #3: `no_method_suggested_traits::bar::PubPriv`
-           candidate #4: `no_method_suggested_traits::qux::PrivPub`
-           candidate #5: `no_method_suggested_traits::quz::PrivPriv`
-           candidate #6: `no_method_suggested_traits::Reexported`
+           candidate #3: `no_method_suggested_traits::qux::PrivPub`
+           candidate #4: `no_method_suggested_traits::Reexported`
 
 error[E0599]: no method named `method2` found for type `u64` in the current scope
   --> $DIR/no-method-suggested-traits.rs:55:10
diff --git a/src/test/ui/method-call-err-msg.stderr b/src/test/ui/method-call-err-msg.stderr
index 8685d0fc9c1..f9524696ed7 100644
--- a/src/test/ui/method-call-err-msg.stderr
+++ b/src/test/ui/method-call-err-msg.stderr
@@ -38,10 +38,8 @@ error[E0599]: no method named `take` found for type `Foo` in the current scope
            `&mut Foo : std::iter::Iterator`
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following traits define an item `take`, perhaps you need to implement one of them:
-           candidate #1: `std::collections::hash::Recover`
-           candidate #2: `std::io::Read`
-           candidate #3: `std::iter::Iterator`
-           candidate #4: `alloc::btree::Recover`
+           candidate #1: `std::io::Read`
+           candidate #2: `std::iter::Iterator`
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/owl-import-generates-unused-import-lint.stderr b/src/test/ui/owl-import-generates-unused-import-lint.stderr
deleted file mode 100644
index 79089b2a93c..00000000000
--- a/src/test/ui/owl-import-generates-unused-import-lint.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error: unused import: `*`
-  --> $DIR/owl-import-generates-unused-import-lint.rs:18:14
-   |
-18 | use foo::{*, *}; //~ ERROR unused import: `*`
-   |              ^
-   |
-note: lint level defined here
-  --> $DIR/owl-import-generates-unused-import-lint.rs:12:9
-   |
-12 | #![deny(unused_imports)]
-   |         ^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/owl-import-generates-unused-import-lint.rs b/src/test/ui/suggestions/dont-suggest-private-trait-method.rs
index dc30c318352..99bee0d3c59 100644
--- a/src/test/ui/owl-import-generates-unused-import-lint.rs
+++ b/src/test/ui/suggestions/dont-suggest-private-trait-method.rs
@@ -1,4 +1,4 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -8,15 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(use_nested_groups)]
-#![deny(unused_imports)]
-
-mod foo {
-    pub enum Bar {}
-}
-
-use foo::{*, *}; //~ ERROR unused import: `*`
+struct T;
 
 fn main() {
-    let _: Bar;
+    T::new();
+    //~^ ERROR no function or associated item named `new` found for type `T` in the current scope
 }
diff --git a/src/test/ui/suggestions/dont-suggest-private-trait-method.stderr b/src/test/ui/suggestions/dont-suggest-private-trait-method.stderr
new file mode 100644
index 00000000000..97f424f9fbf
--- /dev/null
+++ b/src/test/ui/suggestions/dont-suggest-private-trait-method.stderr
@@ -0,0 +1,11 @@
+error[E0599]: no function or associated item named `new` found for type `T` in the current scope
+  --> $DIR/dont-suggest-private-trait-method.rs:14:5
+   |
+11 | struct T;
+   | --------- function or associated item `new` not found for this
+...
+14 |     T::new();
+   |     ^^^^^^ function or associated item not found in `T`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/suggestions/numeric-cast.rs b/src/test/ui/suggestions/numeric-cast.rs
index 6e144037ec2..69bfdfa94b1 100644
--- a/src/test/ui/suggestions/numeric-cast.rs
+++ b/src/test/ui/suggestions/numeric-cast.rs
@@ -312,4 +312,9 @@ fn main() {
     foo::<f32>(x_f64);
     //~^ ERROR mismatched types
     foo::<f32>(x_f32);
+
+    foo::<u32>(x_u8 as u16);
+    //~^ ERROR mismatched types
+    foo::<i32>(-x_i8);
+    //~^ ERROR mismatched types
 }
diff --git a/src/test/ui/suggestions/numeric-cast.stderr b/src/test/ui/suggestions/numeric-cast.stderr
index 0ce3d087f35..cef22ad922e 100644
--- a/src/test/ui/suggestions/numeric-cast.stderr
+++ b/src/test/ui/suggestions/numeric-cast.stderr
@@ -882,5 +882,25 @@ error[E0308]: mismatched types
 312 |     foo::<f32>(x_f64);
     |                ^^^^^ expected f32, found f64
 
-error: aborting due to 132 previous errors
+error[E0308]: mismatched types
+   --> $DIR/numeric-cast.rs:316:16
+    |
+316 |     foo::<u32>(x_u8 as u16);
+    |                ^^^^^^^^^^^ expected u32, found u16
+help: you can cast an `u16` to `u32`, which will zero-extend the source value
+    |
+316 |     foo::<u32>((x_u8 as u16).into());
+    |                ^^^^^^^^^^^^^^^^^^^^
+
+error[E0308]: mismatched types
+   --> $DIR/numeric-cast.rs:318:16
+    |
+318 |     foo::<i32>(-x_i8);
+    |                ^^^^^ expected i32, found i8
+help: you can cast an `i8` to `i32`, which will sign-extend the source value
+    |
+318 |     foo::<i32>((-x_i8).into());
+    |                ^^^^^^^^^^^^^^
+
+error: aborting due to 134 previous errors
 
diff --git a/src/test/ui/unknown-language-item.rs b/src/test/ui/unknown-language-item.rs
new file mode 100644
index 00000000000..3c210599712
--- /dev/null
+++ b/src/test/ui/unknown-language-item.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.
+
+#![allow(unused)]
+#![feature(lang_items)]
+
+#[lang = "foo"]
+fn bar() -> ! {
+//~^^ ERROR definition of an unknown language item: `foo`
+    loop {}
+}
+
+fn main() {}
diff --git a/src/test/ui/unknown-language-item.stderr b/src/test/ui/unknown-language-item.stderr
new file mode 100644
index 00000000000..c4b4a789c3d
--- /dev/null
+++ b/src/test/ui/unknown-language-item.stderr
@@ -0,0 +1,8 @@
+error[E0522]: definition of an unknown language item: `foo`
+  --> $DIR/unknown-language-item.rs:14:1
+   |
+14 | #[lang = "foo"]
+   | ^^^^^^^^^^^^^^^ definition of unknown language item `foo`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/use-nested-groups-unused-imports.rs b/src/test/ui/use-nested-groups-unused-imports.rs
new file mode 100644
index 00000000000..ddbf54fdd48
--- /dev/null
+++ b/src/test/ui/use-nested-groups-unused-imports.rs
@@ -0,0 +1,35 @@
+// 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.
+
+#![feature(use_nested_groups)]
+#![allow(dead_code)]
+#![deny(unused_imports)]
+
+mod foo {
+    pub mod bar {
+        pub mod baz {
+            pub struct Bar();
+        }
+        pub mod foobar {}
+    }
+
+    pub struct Foo();
+}
+
+use foo::{Foo, bar::{baz::{}, foobar::*}, *};
+    //~^ ERROR unused imports: `*`, `Foo`, `baz::{}`, `foobar::*`
+use foo::bar::baz::{*, *};
+    //~^ ERROR unused import: `*`
+use foo::{};
+    //~^ ERROR unused import: `use foo::{};`
+
+fn main() {
+    let _: Bar;
+}
diff --git a/src/test/ui/use-nested-groups-unused-imports.stderr b/src/test/ui/use-nested-groups-unused-imports.stderr
new file mode 100644
index 00000000000..0686310dbf5
--- /dev/null
+++ b/src/test/ui/use-nested-groups-unused-imports.stderr
@@ -0,0 +1,26 @@
+error: unused imports: `*`, `Foo`, `baz::{}`, `foobar::*`
+  --> $DIR/use-nested-groups-unused-imports.rs:26:11
+   |
+26 | use foo::{Foo, bar::{baz::{}, foobar::*}, *};
+   |           ^^^        ^^^^^^^  ^^^^^^^^^   ^
+   |
+note: lint level defined here
+  --> $DIR/use-nested-groups-unused-imports.rs:13:9
+   |
+13 | #![deny(unused_imports)]
+   |         ^^^^^^^^^^^^^^
+
+error: unused import: `*`
+  --> $DIR/use-nested-groups-unused-imports.rs:28:24
+   |
+28 | use foo::bar::baz::{*, *};
+   |                        ^
+
+error: unused import: `use foo::{};`
+  --> $DIR/use-nested-groups-unused-imports.rs:30:1
+   |
+30 | use foo::{};
+   | ^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+