Add tests checking taht "priority" of qpath recovery is higher than unary and binary operators
This commit is contained in:
parent
9a68098e87
commit
eef85cf0ff
@ -21,4 +21,10 @@ fn main() {
|
||||
|
||||
(u8, u8)::clone(&(0, 0));
|
||||
//~^ ERROR missing angle brackets in associated item path
|
||||
|
||||
&(u8)::clone(&0);
|
||||
//~^ ERROR missing angle brackets in associated item path
|
||||
|
||||
10 + (u8)::clone(&0);
|
||||
//~^ ERROR missing angle brackets in associated item path
|
||||
}
|
||||
|
@ -22,5 +22,17 @@ error: missing angle brackets in associated item path
|
||||
22 | (u8, u8)::clone(&(0, 0));
|
||||
| ^^^^^^^^^^^^^^^ help: try: `<(u8, u8)>::clone`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: missing angle brackets in associated item path
|
||||
--> $DIR/bad-assoc-expr.rs:25:6
|
||||
|
|
||||
25 | &(u8)::clone(&0);
|
||||
| ^^^^^^^^^^^ help: try: `<(u8)>::clone`
|
||||
|
||||
error: missing angle brackets in associated item path
|
||||
--> $DIR/bad-assoc-expr.rs:28:10
|
||||
|
|
||||
28 | 10 + (u8)::clone(&0);
|
||||
| ^^^^^^^^^^^ help: try: `<(u8)>::clone`
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
@ -20,4 +20,9 @@ fn main() {
|
||||
//~^ ERROR missing angle brackets in associated item path
|
||||
//~| ERROR no associated item named `AssocItem` found for type `_` in the current scope
|
||||
}
|
||||
match &0u8 {
|
||||
&(u8,)::AssocItem => {}
|
||||
//~^ ERROR missing angle brackets in associated item path
|
||||
//~| ERROR no associated item named `AssocItem` found for type `(u8,)` in the current scope
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,12 @@ error: missing angle brackets in associated item path
|
||||
19 | _::AssocItem => {}
|
||||
| ^^^^^^^^^^^^ help: try: `<_>::AssocItem`
|
||||
|
||||
error: missing angle brackets in associated item path
|
||||
--> $DIR/bad-assoc-pat.rs:24:10
|
||||
|
|
||||
24 | &(u8,)::AssocItem => {}
|
||||
| ^^^^^^^^^^^^^^^^ help: try: `<(u8,)>::AssocItem`
|
||||
|
||||
error[E0599]: no associated item named `AssocItem` found for type `[u8]` in the current scope
|
||||
--> $DIR/bad-assoc-pat.rs:13:9
|
||||
|
|
||||
@ -34,5 +40,11 @@ error[E0599]: no associated item named `AssocItem` found for type `_` in the cur
|
||||
19 | _::AssocItem => {}
|
||||
| ^^^^^^^^^^^^ associated item not found in `_`
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
error[E0599]: no associated item named `AssocItem` found for type `(u8,)` in the current scope
|
||||
--> $DIR/bad-assoc-pat.rs:24:10
|
||||
|
|
||||
24 | &(u8,)::AssocItem => {}
|
||||
| ^^^^^^^^^^^^^^^^ associated item not found in `(u8,)`
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
|
@ -28,4 +28,21 @@ type E = _::AssocTy;
|
||||
//~^ ERROR missing angle brackets in associated item path
|
||||
//~| ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
|
||||
type F = &'static (u8)::AssocTy;
|
||||
//~^ ERROR missing angle brackets in associated item path
|
||||
//~| ERROR ambiguous associated type
|
||||
|
||||
// Qualified paths cannot appear in bounds, so the recovery
|
||||
// should apply to the whole sum and not `(Send)`.
|
||||
type G = 'static + (Send)::AssocTy;
|
||||
//~^ ERROR missing angle brackets in associated item path
|
||||
//~| ERROR ambiguous associated type
|
||||
|
||||
// FIXME
|
||||
// This is actually a legal path with fn-like generic arguments in the middle!
|
||||
// Recovery should not apply in this context.
|
||||
type H = Fn(u8) -> (u8)::Output;
|
||||
//~^ ERROR missing angle brackets in associated item path
|
||||
//~| ERROR ambiguous associated type
|
||||
|
||||
fn main() {}
|
||||
|
@ -28,6 +28,24 @@ error: missing angle brackets in associated item path
|
||||
27 | type E = _::AssocTy;
|
||||
| ^^^^^^^^^^ help: try: `<_>::AssocTy`
|
||||
|
||||
error: missing angle brackets in associated item path
|
||||
--> $DIR/bad-assoc-ty.rs:31:19
|
||||
|
|
||||
31 | type F = &'static (u8)::AssocTy;
|
||||
| ^^^^^^^^^^^^^ help: try: `<(u8)>::AssocTy`
|
||||
|
||||
error: missing angle brackets in associated item path
|
||||
--> $DIR/bad-assoc-ty.rs:37:10
|
||||
|
|
||||
37 | type G = 'static + (Send)::AssocTy;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `< 'static + Send>::AssocTy`
|
||||
|
||||
error: missing angle brackets in associated item path
|
||||
--> $DIR/bad-assoc-ty.rs:44:20
|
||||
|
|
||||
44 | type H = Fn(u8) -> (u8)::Output;
|
||||
| ^^^^^^^^^^^^ help: try: `<(u8)>::Output`
|
||||
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/bad-assoc-ty.rs:11:10
|
||||
|
|
||||
@ -66,5 +84,29 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signa
|
||||
27 | type E = _::AssocTy;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/bad-assoc-ty.rs:31:19
|
||||
|
|
||||
31 | type F = &'static (u8)::AssocTy;
|
||||
| ^^^^^^^^^^^^^ ambiguous associated type
|
||||
|
|
||||
= note: specify the type using the syntax `<u8 as Trait>::AssocTy`
|
||||
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/bad-assoc-ty.rs:37:10
|
||||
|
|
||||
37 | type G = 'static + (Send)::AssocTy;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous associated type
|
||||
|
|
||||
= note: specify the type using the syntax `<std::marker::Send + 'static as Trait>::AssocTy`
|
||||
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/bad-assoc-ty.rs:44:20
|
||||
|
|
||||
44 | type H = Fn(u8) -> (u8)::Output;
|
||||
| ^^^^^^^^^^^^ ambiguous associated type
|
||||
|
|
||||
= note: specify the type using the syntax `<u8 as Trait>::Output`
|
||||
|
||||
error: aborting due to 16 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user