Avoid output dependency on std spans
This commit is contained in:
parent
8d316a5a67
commit
83c5b4ec40
4 changed files with 60 additions and 67 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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() { }
|
||||
|
|
|
@ -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
|
||||
--> $DIR/issue-22560.rs:9: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
|
||||
|
|
||||
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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue