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() {
|
fn main() {
|
||||||
let x = &10 as
|
let x = &10 as &dyn Add;
|
||||||
&dyn Add;
|
|
||||||
//~^ ERROR E0393
|
//~^ ERROR E0393
|
||||||
//~| ERROR E0191
|
//~| ERROR E0191
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,23 @@
|
||||||
error[E0393]: the type parameter `Rhs` must be explicitly specified
|
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;
|
LL | / trait Add<Rhs=Self> {
|
||||||
| ^^^ 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 | | type Output;
|
LL | | type Output;
|
||||||
... |
|
|
||||||
LL | | fn add(self, rhs: Rhs) -> Self::Output;
|
|
||||||
LL | | }
|
LL | | }
|
||||||
| |_- type parameter `Rhs` must be specified for this
|
| |_- 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
|
= 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
|
error[E0191]: the value of the associated type `Output` (from trait `Add`) must be specified
|
||||||
--> $DIR/issue-21950.rs:5:18
|
--> $DIR/issue-21950.rs:10:25
|
||||||
|
|
|
|
||||||
LL | &dyn Add;
|
LL | type Output;
|
||||||
|
| ------------ `Output` defined here
|
||||||
|
...
|
||||||
|
LL | let x = &10 as &dyn Add;
|
||||||
| ^^^ help: specify the associated type: `Add<Output = Type>`
|
| ^^^ help: specify the associated type: `Add<Output = Type>`
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
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 +
|
trait Sub<Rhs=Self> {
|
||||||
//~^ ERROR E0393
|
type Output;
|
||||||
//~| ERROR E0191
|
}
|
||||||
Sub;
|
|
||||||
//~^ ERROR E0393
|
type Test = dyn Add + Sub;
|
||||||
//~| ERROR E0225
|
//~^ ERROR E0393
|
||||||
|
//~| ERROR E0191
|
||||||
|
//~| ERROR E0393
|
||||||
|
//~| ERROR E0225
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -1,65 +1,51 @@
|
||||||
error[E0393]: the type parameter `Rhs` must be explicitly specified
|
error[E0393]: the type parameter `Rhs` must be explicitly specified
|
||||||
--> $DIR/issue-22560.rs:6:13
|
--> $DIR/issue-22560.rs:9:23
|
||||||
|
|
|
|
||||||
LL | Sub;
|
LL | / trait Sub<Rhs=Self> {
|
||||||
| ^^^ 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 | | type Output;
|
LL | | type Output;
|
||||||
... |
|
|
||||||
LL | | fn sub(self, rhs: Rhs) -> Self::Output;
|
|
||||||
LL | | }
|
LL | | }
|
||||||
| |_- type parameter `Rhs` must be specified for this
|
| |_- 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
|
= 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
|
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 +
|
LL | / trait Add<Rhs=Self> {
|
||||||
| ^^^ 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 | | type Output;
|
LL | | type Output;
|
||||||
... |
|
|
||||||
LL | | fn add(self, rhs: Rhs) -> Self::Output;
|
|
||||||
LL | | }
|
LL | | }
|
||||||
| |_- type parameter `Rhs` must be specified for this
|
| |_- 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
|
= 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
|
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
|
| first non-auto trait
|
||||||
| trait alias used in trait object type (first use)
|
| 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
|
error[E0191]: the value of the associated types `Output` (from trait `Add`), `Output` (from trait `Sub`) must be specified
|
||||||
--> $DIR/issue-22560.rs:3:13
|
--> $DIR/issue-22560.rs:9:13
|
||||||
|
|
|
|
||||||
LL | type Test = dyn Add +
|
LL | type Output;
|
||||||
| _____________^
|
| ------------ `Output` defined here
|
||||||
LL | |
|
...
|
||||||
LL | |
|
LL | type Output;
|
||||||
LL | | Sub;
|
| ------------ `Output` defined here
|
||||||
| |_______________^ associated types `Output`, `Output` must be specified
|
...
|
||||||
|
LL | type Test = dyn Add + Sub;
|
||||||
|
| ^^^^^^^^^^^^^ associated types `Output`, `Output` must be specified
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue