about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr2
-rw-r--r--src/test/ui/nll/user-annotations/dump-fn-method.stderr8
-rw-r--r--src/test/ui/nll/user-annotations/method-ufcs-inherent-1.rs19
-rw-r--r--src/test/ui/nll/user-annotations/method-ufcs-inherent-1.stderr17
-rw-r--r--src/test/ui/nll/user-annotations/method-ufcs-inherent-2.rs19
-rw-r--r--src/test/ui/nll/user-annotations/method-ufcs-inherent-2.stderr31
-rw-r--r--src/test/ui/nll/user-annotations/method-ufcs-inherent-3.rs19
-rw-r--r--src/test/ui/nll/user-annotations/method-ufcs-inherent-3.stderr17
-rw-r--r--src/test/ui/nll/user-annotations/method-ufcs-inherent-4.rs20
-rw-r--r--src/test/ui/nll/user-annotations/method-ufcs-inherent-4.stderr31
10 files changed, 178 insertions, 5 deletions
diff --git a/src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr b/src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr
index 2b0e5039d8d..901ace59d33 100644
--- a/src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr
+++ b/src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr
@@ -1,4 +1,4 @@
-error: user substs: Canonical { variables: [], value: [u32] }
+error: user substs: Canonical { variables: [], value: UserSubsts { substs: [u32], user_self_ty: None } }
   --> $DIR/dump-adt-brace-struct.rs:28:5
    |
 LL |     SomeStruct::<u32> { t: 22 }; //~ ERROR [u32]
diff --git a/src/test/ui/nll/user-annotations/dump-fn-method.stderr b/src/test/ui/nll/user-annotations/dump-fn-method.stderr
index 6531f87dd98..a26be359fc4 100644
--- a/src/test/ui/nll/user-annotations/dump-fn-method.stderr
+++ b/src/test/ui/nll/user-annotations/dump-fn-method.stderr
@@ -1,22 +1,22 @@
-error: user substs: Canonical { variables: [], value: [u32] }
+error: user substs: Canonical { variables: [], value: UserSubsts { substs: [u32], user_self_ty: None } }
   --> $DIR/dump-fn-method.rs:36:13
    |
 LL |     let x = foo::<u32>; //~ ERROR [u32]
    |             ^^^^^^^^^^
 
-error: user substs: Canonical { variables: [CanonicalVarInfo { kind: Ty(General) }, CanonicalVarInfo { kind: Ty(General) }], value: [?0, u32, ?1] }
+error: user substs: Canonical { variables: [CanonicalVarInfo { kind: Ty(General) }, CanonicalVarInfo { kind: Ty(General) }], value: UserSubsts { substs: [?0, u32, ?1], user_self_ty: None } }
   --> $DIR/dump-fn-method.rs:42:13
    |
 LL |     let x = <_ as Bazoom<u32>>::method::<_>; //~ ERROR [?0, u32, ?1]
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: user substs: Canonical { variables: [], value: [u8, u16, u32] }
+error: user substs: Canonical { variables: [], value: UserSubsts { substs: [u8, u16, u32], user_self_ty: None } }
   --> $DIR/dump-fn-method.rs:46:13
    |
 LL |     let x = <u8 as Bazoom<u16>>::method::<u32>; //~ ERROR [u8, u16, u32]
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: user substs: Canonical { variables: [CanonicalVarInfo { kind: Ty(General) }, CanonicalVarInfo { kind: Ty(General) }], value: [?0, ?1, u32] }
+error: user substs: Canonical { variables: [CanonicalVarInfo { kind: Ty(General) }, CanonicalVarInfo { kind: Ty(General) }], value: UserSubsts { substs: [?0, ?1, u32], user_self_ty: None } }
   --> $DIR/dump-fn-method.rs:54:5
    |
 LL |     y.method::<u32>(44, 66); //~ ERROR [?0, ?1, u32]
diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-1.rs b/src/test/ui/nll/user-annotations/method-ufcs-inherent-1.rs
new file mode 100644
index 00000000000..4bca114e953
--- /dev/null
+++ b/src/test/ui/nll/user-annotations/method-ufcs-inherent-1.rs
@@ -0,0 +1,19 @@
+#![feature(nll)]
+
+// Check that substitutions given on the self type (here, `A`) carry
+// through to NLL.
+
+struct A<'a> { x: &'a u32 }
+
+impl<'a> A<'a> {
+    fn new<'b, T>(x: &'a u32, y: T) -> Self {
+        Self { x }
+    }
+}
+
+fn foo<'a>() {
+    let v = 22;
+    let x = A::<'a>::new(&v, 22);
+}
+
+fn main() {}
diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-1.stderr b/src/test/ui/nll/user-annotations/method-ufcs-inherent-1.stderr
new file mode 100644
index 00000000000..68a7684c963
--- /dev/null
+++ b/src/test/ui/nll/user-annotations/method-ufcs-inherent-1.stderr
@@ -0,0 +1,17 @@
+error[E0597]: `v` does not live long enough
+  --> $DIR/method-ufcs-inherent-1.rs:16:26
+   |
+LL |     let x = A::<'a>::new(&v, 22);
+   |                          ^^ borrowed value does not live long enough
+LL | }
+   | - `v` dropped here while still borrowed
+   |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 14:8...
+  --> $DIR/method-ufcs-inherent-1.rs:14:8
+   |
+LL | fn foo<'a>() {
+   |        ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-2.rs b/src/test/ui/nll/user-annotations/method-ufcs-inherent-2.rs
new file mode 100644
index 00000000000..f87f5cba391
--- /dev/null
+++ b/src/test/ui/nll/user-annotations/method-ufcs-inherent-2.rs
@@ -0,0 +1,19 @@
+#![feature(nll)]
+
+// Check that substitutions given on the self type (here, `A`) can be
+// used in combination with annotations given for method arguments.
+
+struct A<'a> { x: &'a u32 }
+
+impl<'a> A<'a> {
+    fn new<'b, T>(x: &'a u32, y: T) -> Self {
+        Self { x }
+    }
+}
+
+fn foo<'a>() {
+    let v = 22;
+    let x = A::<'a>::new::<&'a u32>(&v, &v);
+}
+
+fn main() {}
diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-2.stderr b/src/test/ui/nll/user-annotations/method-ufcs-inherent-2.stderr
new file mode 100644
index 00000000000..0bdff99da9e
--- /dev/null
+++ b/src/test/ui/nll/user-annotations/method-ufcs-inherent-2.stderr
@@ -0,0 +1,31 @@
+error[E0597]: `v` does not live long enough
+  --> $DIR/method-ufcs-inherent-2.rs:16:37
+   |
+LL |     let x = A::<'a>::new::<&'a u32>(&v, &v);
+   |                                     ^^ borrowed value does not live long enough
+LL | }
+   | - `v` dropped here while still borrowed
+   |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 14:8...
+  --> $DIR/method-ufcs-inherent-2.rs:14:8
+   |
+LL | fn foo<'a>() {
+   |        ^^
+
+error[E0597]: `v` does not live long enough
+  --> $DIR/method-ufcs-inherent-2.rs:16:41
+   |
+LL |     let x = A::<'a>::new::<&'a u32>(&v, &v);
+   |                                         ^^ borrowed value does not live long enough
+LL | }
+   | - `v` dropped here while still borrowed
+   |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 14:8...
+  --> $DIR/method-ufcs-inherent-2.rs:14:8
+   |
+LL | fn foo<'a>() {
+   |        ^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-3.rs b/src/test/ui/nll/user-annotations/method-ufcs-inherent-3.rs
new file mode 100644
index 00000000000..d8376e4bdc4
--- /dev/null
+++ b/src/test/ui/nll/user-annotations/method-ufcs-inherent-3.rs
@@ -0,0 +1,19 @@
+#![feature(nll)]
+
+// Check that inherent methods invoked with `<T>::new` style
+// carry their annotations through to NLL.
+
+struct A<'a> { x: &'a u32 }
+
+impl<'a> A<'a> {
+    fn new<'b, T>(x: &'a u32, y: T) -> Self {
+        Self { x }
+    }
+}
+
+fn foo<'a>() {
+    let v = 22;
+    let x = <A<'a>>::new(&v, 22);
+}
+
+fn main() {}
diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-3.stderr b/src/test/ui/nll/user-annotations/method-ufcs-inherent-3.stderr
new file mode 100644
index 00000000000..122b26c72b2
--- /dev/null
+++ b/src/test/ui/nll/user-annotations/method-ufcs-inherent-3.stderr
@@ -0,0 +1,17 @@
+error[E0597]: `v` does not live long enough
+  --> $DIR/method-ufcs-inherent-3.rs:16:26
+   |
+LL |     let x = <A<'a>>::new(&v, 22);
+   |                          ^^ borrowed value does not live long enough
+LL | }
+   | - `v` dropped here while still borrowed
+   |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 14:8...
+  --> $DIR/method-ufcs-inherent-3.rs:14:8
+   |
+LL | fn foo<'a>() {
+   |        ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-4.rs b/src/test/ui/nll/user-annotations/method-ufcs-inherent-4.rs
new file mode 100644
index 00000000000..e0fb9cedd37
--- /dev/null
+++ b/src/test/ui/nll/user-annotations/method-ufcs-inherent-4.rs
@@ -0,0 +1,20 @@
+#![feature(nll)]
+
+// Check that inherent methods invoked with `<T>::new` style
+// carry their annotations through to NLL in connection with
+// method type parameters.
+
+struct A<'a> { x: &'a u32 }
+
+impl<'a> A<'a> {
+    fn new<'b, T>(x: &'a u32, y: T) -> Self {
+        Self { x }
+    }
+}
+
+fn foo<'a>() {
+    let v = 22;
+    let x = <A<'a>>::new::<&'a u32>(&v, &v);
+}
+
+fn main() {}
diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-4.stderr b/src/test/ui/nll/user-annotations/method-ufcs-inherent-4.stderr
new file mode 100644
index 00000000000..b2f4066b2e8
--- /dev/null
+++ b/src/test/ui/nll/user-annotations/method-ufcs-inherent-4.stderr
@@ -0,0 +1,31 @@
+error[E0597]: `v` does not live long enough
+  --> $DIR/method-ufcs-inherent-4.rs:17:37
+   |
+LL |     let x = <A<'a>>::new::<&'a u32>(&v, &v);
+   |                                     ^^ borrowed value does not live long enough
+LL | }
+   | - `v` dropped here while still borrowed
+   |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 15:8...
+  --> $DIR/method-ufcs-inherent-4.rs:15:8
+   |
+LL | fn foo<'a>() {
+   |        ^^
+
+error[E0597]: `v` does not live long enough
+  --> $DIR/method-ufcs-inherent-4.rs:17:41
+   |
+LL |     let x = <A<'a>>::new::<&'a u32>(&v, &v);
+   |                                         ^^ borrowed value does not live long enough
+LL | }
+   | - `v` dropped here while still borrowed
+   |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 15:8...
+  --> $DIR/method-ufcs-inherent-4.rs:15:8
+   |
+LL | fn foo<'a>() {
+   |        ^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0597`.