update tests

This commit is contained in:
Niko Matsakis 2018-10-15 06:14:08 -04:00
parent ba20806e46
commit 2e4e983356
10 changed files with 178 additions and 5 deletions

View file

@ -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]

View file

@ -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]

View file

@ -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() {}

View file

@ -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`.

View file

@ -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() {}

View file

@ -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`.

View file

@ -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() {}

View file

@ -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`.

View file

@ -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() {}

View file

@ -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`.