about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/did_you_mean/bad-assoc-expr.rs6
-rw-r--r--src/test/ui/did_you_mean/bad-assoc-expr.stderr14
-rw-r--r--src/test/ui/did_you_mean/bad-assoc-pat.rs5
-rw-r--r--src/test/ui/did_you_mean/bad-assoc-pat.stderr14
-rw-r--r--src/test/ui/did_you_mean/bad-assoc-ty.rs17
-rw-r--r--src/test/ui/did_you_mean/bad-assoc-ty.stderr44
6 files changed, 97 insertions, 3 deletions
diff --git a/src/test/ui/did_you_mean/bad-assoc-expr.rs b/src/test/ui/did_you_mean/bad-assoc-expr.rs
index 72b616ddd69..779aa952c81 100644
--- a/src/test/ui/did_you_mean/bad-assoc-expr.rs
+++ b/src/test/ui/did_you_mean/bad-assoc-expr.rs
@@ -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
 }
diff --git a/src/test/ui/did_you_mean/bad-assoc-expr.stderr b/src/test/ui/did_you_mean/bad-assoc-expr.stderr
index 1f8fc118f78..1affdc5fda2 100644
--- a/src/test/ui/did_you_mean/bad-assoc-expr.stderr
+++ b/src/test/ui/did_you_mean/bad-assoc-expr.stderr
@@ -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
 
diff --git a/src/test/ui/did_you_mean/bad-assoc-pat.rs b/src/test/ui/did_you_mean/bad-assoc-pat.rs
index e6b7127f100..bf6be0ee985 100644
--- a/src/test/ui/did_you_mean/bad-assoc-pat.rs
+++ b/src/test/ui/did_you_mean/bad-assoc-pat.rs
@@ -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
+    }
 }
diff --git a/src/test/ui/did_you_mean/bad-assoc-pat.stderr b/src/test/ui/did_you_mean/bad-assoc-pat.stderr
index 20f9b96dbaa..1ca4576d88f 100644
--- a/src/test/ui/did_you_mean/bad-assoc-pat.stderr
+++ b/src/test/ui/did_you_mean/bad-assoc-pat.stderr
@@ -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
 
diff --git a/src/test/ui/did_you_mean/bad-assoc-ty.rs b/src/test/ui/did_you_mean/bad-assoc-ty.rs
index 45a52936738..74305b73f99 100644
--- a/src/test/ui/did_you_mean/bad-assoc-ty.rs
+++ b/src/test/ui/did_you_mean/bad-assoc-ty.rs
@@ -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() {}
diff --git a/src/test/ui/did_you_mean/bad-assoc-ty.stderr b/src/test/ui/did_you_mean/bad-assoc-ty.stderr
index 617339a7d92..a11be411fed 100644
--- a/src/test/ui/did_you_mean/bad-assoc-ty.stderr
+++ b/src/test/ui/did_you_mean/bad-assoc-ty.stderr
@@ -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