about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2019-12-13 11:37:31 -0800
committerEsteban Küber <esteban@kuber.com.ar>2019-12-24 22:18:05 -0800
commit83c5b4ec40ceadfbcf3c558f06e04c48f01c1e52 (patch)
treedcc9c207ee9ed074afbe2d19a6130aaf66307d3e
parent8d316a5a67f3039f2437c4bc284d6f954e1d6806 (diff)
downloadrust-83c5b4ec40ceadfbcf3c558f06e04c48f01c1e52.tar.gz
rust-83c5b4ec40ceadfbcf3c558f06e04c48f01c1e52.zip
Avoid output dependency on std spans
-rw-r--r--src/test/ui/issues/issue-21950.rs15
-rw-r--r--src/test/ui/issues/issue-21950.stderr27
-rw-r--r--src/test/ui/issues/issue-22560.rs19
-rw-r--r--src/test/ui/issues/issue-22560.stderr66
4 files changed, 60 insertions, 67 deletions
diff --git a/src/test/ui/issues/issue-21950.rs b/src/test/ui/issues/issue-21950.rs
index 0bc87824cce..72a98bd8ddd 100644
--- a/src/test/ui/issues/issue-21950.rs
+++ b/src/test/ui/issues/issue-21950.rs
@@ -1,8 +1,13 @@
-use std::ops::Add;
+trait Add<Rhs=Self> {
+    type Output;
+}
+
+impl Add for i32 {
+    type Output = i32;
+}
 
 fn main() {
-    let x = &10 as
-            &dyn Add;
-            //~^ ERROR E0393
-            //~| ERROR E0191
+    let x = &10 as &dyn Add;
+    //~^ ERROR E0393
+    //~| ERROR E0191
 }
diff --git a/src/test/ui/issues/issue-21950.stderr b/src/test/ui/issues/issue-21950.stderr
index c904236b31b..93c2444f884 100644
--- a/src/test/ui/issues/issue-21950.stderr
+++ b/src/test/ui/issues/issue-21950.stderr
@@ -1,27 +1,24 @@
 error[E0393]: the type parameter `Rhs` must be explicitly specified
-  --> $DIR/issue-21950.rs:5:18
+  --> $DIR/issue-21950.rs:10:25
    |
-LL |               &dyn Add;
-   |                    ^^^ help: set the type parameter to the desired type: `Add<Rhs>`
-   | 
-  ::: $SRC_DIR/libcore/ops/arith.rs:LL:COL
-   |
-LL | / pub trait Add<Rhs = Self> {
-LL | |     /// The resulting type after applying the `+` operator.
-LL | |     #[stable(feature = "rust1", since = "1.0.0")]
+LL | / trait Add<Rhs=Self> {
 LL | |     type Output;
-...  |
-LL | |     fn add(self, rhs: Rhs) -> Self::Output;
 LL | | }
    | |_- type parameter `Rhs` must be specified for this
+...
+LL |       let x = &10 as &dyn Add;
+   |                           ^^^ help: set the type parameter to the desired type: `Add<Rhs>`
    |
    = note: because of the default `Self` reference, type parameters must be specified on object types
 
-error[E0191]: the value of the associated type `Output` (from trait `std::ops::Add`) must be specified
-  --> $DIR/issue-21950.rs:5:18
+error[E0191]: the value of the associated type `Output` (from trait `Add`) must be specified
+  --> $DIR/issue-21950.rs:10:25
    |
-LL |             &dyn Add;
-   |                  ^^^ help: specify the associated type: `Add<Output = Type>`
+LL |     type Output;
+   |     ------------ `Output` defined here
+...
+LL |     let x = &10 as &dyn Add;
+   |                         ^^^ help: specify the associated type: `Add<Output = Type>`
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/issues/issue-22560.rs b/src/test/ui/issues/issue-22560.rs
index acee99dbedc..44be8817b08 100644
--- a/src/test/ui/issues/issue-22560.rs
+++ b/src/test/ui/issues/issue-22560.rs
@@ -1,10 +1,15 @@
-use std::ops::{Add, Sub};
+trait Add<Rhs=Self> {
+    type Output;
+}
 
-type Test = dyn Add +
-            //~^ ERROR E0393
-            //~| ERROR E0191
-            Sub;
-            //~^ ERROR E0393
-            //~| ERROR E0225
+trait Sub<Rhs=Self> {
+    type Output;
+}
+
+type Test = dyn Add + Sub;
+//~^ ERROR E0393
+//~| ERROR E0191
+//~| ERROR E0393
+//~| ERROR E0225
 
 fn main() { }
diff --git a/src/test/ui/issues/issue-22560.stderr b/src/test/ui/issues/issue-22560.stderr
index bce49aaf16d..4466a40f0da 100644
--- a/src/test/ui/issues/issue-22560.stderr
+++ b/src/test/ui/issues/issue-22560.stderr
@@ -1,65 +1,51 @@
 error[E0393]: the type parameter `Rhs` must be explicitly specified
-  --> $DIR/issue-22560.rs:6:13
+  --> $DIR/issue-22560.rs:9:23
    |
-LL |               Sub;
-   |               ^^^ help: set the type parameter to the desired type: `Sub<Rhs>`
-   | 
-  ::: $SRC_DIR/libcore/ops/arith.rs:LL:COL
-   |
-LL | / pub trait Sub<Rhs = Self> {
-LL | |     /// The resulting type after applying the `-` operator.
-LL | |     #[stable(feature = "rust1", since = "1.0.0")]
+LL | / trait Sub<Rhs=Self> {
 LL | |     type Output;
-...  |
-LL | |     fn sub(self, rhs: Rhs) -> Self::Output;
 LL | | }
    | |_- type parameter `Rhs` must be specified for this
+LL | 
+LL |   type Test = dyn Add + Sub;
+   |                         ^^^ help: set the type parameter to the desired type: `Sub<Rhs>`
    |
    = note: because of the default `Self` reference, type parameters must be specified on object types
 
 error[E0393]: the type parameter `Rhs` must be explicitly specified
-  --> $DIR/issue-22560.rs:3:17
-   |
-LL |   type Test = dyn Add +
-   |                   ^^^ help: set the type parameter to the desired type: `Add<Rhs>`
-   | 
-  ::: $SRC_DIR/libcore/ops/arith.rs:LL:COL
+  --> $DIR/issue-22560.rs:9:17
    |
-LL | / pub trait Add<Rhs = Self> {
-LL | |     /// The resulting type after applying the `+` operator.
-LL | |     #[stable(feature = "rust1", since = "1.0.0")]
+LL | / trait Add<Rhs=Self> {
 LL | |     type Output;
-...  |
-LL | |     fn add(self, rhs: Rhs) -> Self::Output;
 LL | | }
    | |_- type parameter `Rhs` must be specified for this
+...
+LL |   type Test = dyn Add + Sub;
+   |                   ^^^ help: set the type parameter to the desired type: `Add<Rhs>`
    |
    = note: because of the default `Self` reference, type parameters must be specified on object types
 
 error[E0225]: only auto traits can be used as additional traits in a trait object
-  --> $DIR/issue-22560.rs:6:13
+  --> $DIR/issue-22560.rs:9:23
    |
-LL | type Test = dyn Add +
-   |                 ---
-   |                 |
+LL | type Test = dyn Add + Sub;
+   |                 ---   ^^^
+   |                 |     |
+   |                 |     additional non-auto trait
+   |                 |     trait alias used in trait object type (additional use)
    |                 first non-auto trait
    |                 trait alias used in trait object type (first use)
-...
-LL |             Sub;
-   |             ^^^
-   |             |
-   |             additional non-auto trait
-   |             trait alias used in trait object type (additional use)
 
-error[E0191]: the value of the associated types `Output` (from trait `std::ops::Add`), `Output` (from trait `std::ops::Sub`) must be specified
-  --> $DIR/issue-22560.rs:3:13
+error[E0191]: the value of the associated types `Output` (from trait `Add`), `Output` (from trait `Sub`) must be specified
+  --> $DIR/issue-22560.rs:9:13
    |
-LL |   type Test = dyn Add +
-   |  _____________^
-LL | |
-LL | |
-LL | |             Sub;
-   | |_______________^ associated types `Output`, `Output` must be specified
+LL |     type Output;
+   |     ------------ `Output` defined here
+...
+LL |     type Output;
+   |     ------------ `Output` defined here
+...
+LL | type Test = dyn Add + Sub;
+   |             ^^^^^^^^^^^^^ associated types `Output`, `Output` must be specified
 
 error: aborting due to 4 previous errors