address review comments

This commit is contained in:
Esteban Küber 2020-10-09 16:51:54 -07:00
parent fdbe4ce5c1
commit 4ae8f6ec7c
4 changed files with 97 additions and 9 deletions

View file

@ -6,4 +6,14 @@ struct Foo<T> where T: Bar, <T as Bar>::Baz: String { //~ ERROR expected trait,
t: T,
}
struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: String { //~ ERROR expected trait, found struct
t: &'a T,
}
fn foo<T: Bar>(_: T) where <T as Bar>::Baz: String { //~ ERROR expected trait, found struct
}
fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: String { //~ ERROR expected trait, found
}
fn main() {}

View file

@ -18,6 +18,66 @@ help: a trait with a similar name exists
LL | struct Foo<T> where T: Bar, <T as Bar>::Baz: ToString {
| ^^^^^^^^
error: aborting due to previous error
error[E0404]: expected trait, found struct `String`
--> $DIR/assoc_type_bound_with_struct.rs:9:54
|
LL | struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: String {
| ^^^^^^ not a trait
|
::: $SRC_DIR/alloc/src/string.rs:LL:COL
|
LL | pub trait ToString {
| ------------------ similarly named trait `ToString` defined here
|
help: constrain the associated type to `String`
|
LL | struct Qux<'a, T> where T: Bar, &'a T: Bar<Baz = String> {
| ^^^^^^^^^^^^^^^^^^^^^^^^
help: a trait with a similar name exists
|
LL | struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: ToString {
| ^^^^^^^^
error[E0404]: expected trait, found struct `String`
--> $DIR/assoc_type_bound_with_struct.rs:13:45
|
LL | fn foo<T: Bar>(_: T) where <T as Bar>::Baz: String {
| ^^^^^^ not a trait
|
::: $SRC_DIR/alloc/src/string.rs:LL:COL
|
LL | pub trait ToString {
| ------------------ similarly named trait `ToString` defined here
|
help: constrain the associated type to `String`
|
LL | fn foo<T: Bar>(_: T) where T: Bar<Baz = String> {
| ^^^^^^^^^^^^^^^^^^^^
help: a trait with a similar name exists
|
LL | fn foo<T: Bar>(_: T) where <T as Bar>::Baz: ToString {
| ^^^^^^^^
error[E0404]: expected trait, found struct `String`
--> $DIR/assoc_type_bound_with_struct.rs:16:57
|
LL | fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: String {
| ^^^^^^ not a trait
|
::: $SRC_DIR/alloc/src/string.rs:LL:COL
|
LL | pub trait ToString {
| ------------------ similarly named trait `ToString` defined here
|
help: constrain the associated type to `String`
|
LL | fn qux<'a, T: Bar>(_: &'a T) where &'a T: Bar<Baz = String> {
| ^^^^^^^^^^^^^^^^^^^^^^^^
help: a trait with a similar name exists
|
LL | fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: ToString {
| ^^^^^^^^
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0404`.