Skip to content

Commit 2e4e983

Browse files
committed
update tests
1 parent ba20806 commit 2e4e983

10 files changed

+178
-5
lines changed

src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: user substs: Canonical { variables: [], value: [u32] }
1+
error: user substs: Canonical { variables: [], value: UserSubsts { substs: [u32], user_self_ty: None } }
22
--> $DIR/dump-adt-brace-struct.rs:28:5
33
|
44
LL | SomeStruct::<u32> { t: 22 }; //~ ERROR [u32]

src/test/ui/nll/user-annotations/dump-fn-method.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
error: user substs: Canonical { variables: [], value: [u32] }
1+
error: user substs: Canonical { variables: [], value: UserSubsts { substs: [u32], user_self_ty: None } }
22
--> $DIR/dump-fn-method.rs:36:13
33
|
44
LL | let x = foo::<u32>; //~ ERROR [u32]
55
| ^^^^^^^^^^
66

7-
error: user substs: Canonical { variables: [CanonicalVarInfo { kind: Ty(General) }, CanonicalVarInfo { kind: Ty(General) }], value: [?0, u32, ?1] }
7+
error: user substs: Canonical { variables: [CanonicalVarInfo { kind: Ty(General) }, CanonicalVarInfo { kind: Ty(General) }], value: UserSubsts { substs: [?0, u32, ?1], user_self_ty: None } }
88
--> $DIR/dump-fn-method.rs:42:13
99
|
1010
LL | let x = <_ as Bazoom<u32>>::method::<_>; //~ ERROR [?0, u32, ?1]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

13-
error: user substs: Canonical { variables: [], value: [u8, u16, u32] }
13+
error: user substs: Canonical { variables: [], value: UserSubsts { substs: [u8, u16, u32], user_self_ty: None } }
1414
--> $DIR/dump-fn-method.rs:46:13
1515
|
1616
LL | let x = <u8 as Bazoom<u16>>::method::<u32>; //~ ERROR [u8, u16, u32]
1717
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1818

19-
error: user substs: Canonical { variables: [CanonicalVarInfo { kind: Ty(General) }, CanonicalVarInfo { kind: Ty(General) }], value: [?0, ?1, u32] }
19+
error: user substs: Canonical { variables: [CanonicalVarInfo { kind: Ty(General) }, CanonicalVarInfo { kind: Ty(General) }], value: UserSubsts { substs: [?0, ?1, u32], user_self_ty: None } }
2020
--> $DIR/dump-fn-method.rs:54:5
2121
|
2222
LL | y.method::<u32>(44, 66); //~ ERROR [?0, ?1, u32]
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![feature(nll)]
2+
3+
// Check that substitutions given on the self type (here, `A`) carry
4+
// through to NLL.
5+
6+
struct A<'a> { x: &'a u32 }
7+
8+
impl<'a> A<'a> {
9+
fn new<'b, T>(x: &'a u32, y: T) -> Self {
10+
Self { x }
11+
}
12+
}
13+
14+
fn foo<'a>() {
15+
let v = 22;
16+
let x = A::<'a>::new(&v, 22);
17+
}
18+
19+
fn main() {}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error[E0597]: `v` does not live long enough
2+
--> $DIR/method-ufcs-inherent-1.rs:16:26
3+
|
4+
LL | let x = A::<'a>::new(&v, 22);
5+
| ^^ borrowed value does not live long enough
6+
LL | }
7+
| - `v` dropped here while still borrowed
8+
|
9+
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 14:8...
10+
--> $DIR/method-ufcs-inherent-1.rs:14:8
11+
|
12+
LL | fn foo<'a>() {
13+
| ^^
14+
15+
error: aborting due to previous error
16+
17+
For more information about this error, try `rustc --explain E0597`.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![feature(nll)]
2+
3+
// Check that substitutions given on the self type (here, `A`) can be
4+
// used in combination with annotations given for method arguments.
5+
6+
struct A<'a> { x: &'a u32 }
7+
8+
impl<'a> A<'a> {
9+
fn new<'b, T>(x: &'a u32, y: T) -> Self {
10+
Self { x }
11+
}
12+
}
13+
14+
fn foo<'a>() {
15+
let v = 22;
16+
let x = A::<'a>::new::<&'a u32>(&v, &v);
17+
}
18+
19+
fn main() {}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
error[E0597]: `v` does not live long enough
2+
--> $DIR/method-ufcs-inherent-2.rs:16:37
3+
|
4+
LL | let x = A::<'a>::new::<&'a u32>(&v, &v);
5+
| ^^ borrowed value does not live long enough
6+
LL | }
7+
| - `v` dropped here while still borrowed
8+
|
9+
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 14:8...
10+
--> $DIR/method-ufcs-inherent-2.rs:14:8
11+
|
12+
LL | fn foo<'a>() {
13+
| ^^
14+
15+
error[E0597]: `v` does not live long enough
16+
--> $DIR/method-ufcs-inherent-2.rs:16:41
17+
|
18+
LL | let x = A::<'a>::new::<&'a u32>(&v, &v);
19+
| ^^ borrowed value does not live long enough
20+
LL | }
21+
| - `v` dropped here while still borrowed
22+
|
23+
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 14:8...
24+
--> $DIR/method-ufcs-inherent-2.rs:14:8
25+
|
26+
LL | fn foo<'a>() {
27+
| ^^
28+
29+
error: aborting due to 2 previous errors
30+
31+
For more information about this error, try `rustc --explain E0597`.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![feature(nll)]
2+
3+
// Check that inherent methods invoked with `<T>::new` style
4+
// carry their annotations through to NLL.
5+
6+
struct A<'a> { x: &'a u32 }
7+
8+
impl<'a> A<'a> {
9+
fn new<'b, T>(x: &'a u32, y: T) -> Self {
10+
Self { x }
11+
}
12+
}
13+
14+
fn foo<'a>() {
15+
let v = 22;
16+
let x = <A<'a>>::new(&v, 22);
17+
}
18+
19+
fn main() {}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error[E0597]: `v` does not live long enough
2+
--> $DIR/method-ufcs-inherent-3.rs:16:26
3+
|
4+
LL | let x = <A<'a>>::new(&v, 22);
5+
| ^^ borrowed value does not live long enough
6+
LL | }
7+
| - `v` dropped here while still borrowed
8+
|
9+
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 14:8...
10+
--> $DIR/method-ufcs-inherent-3.rs:14:8
11+
|
12+
LL | fn foo<'a>() {
13+
| ^^
14+
15+
error: aborting due to previous error
16+
17+
For more information about this error, try `rustc --explain E0597`.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#![feature(nll)]
2+
3+
// Check that inherent methods invoked with `<T>::new` style
4+
// carry their annotations through to NLL in connection with
5+
// method type parameters.
6+
7+
struct A<'a> { x: &'a u32 }
8+
9+
impl<'a> A<'a> {
10+
fn new<'b, T>(x: &'a u32, y: T) -> Self {
11+
Self { x }
12+
}
13+
}
14+
15+
fn foo<'a>() {
16+
let v = 22;
17+
let x = <A<'a>>::new::<&'a u32>(&v, &v);
18+
}
19+
20+
fn main() {}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
error[E0597]: `v` does not live long enough
2+
--> $DIR/method-ufcs-inherent-4.rs:17:37
3+
|
4+
LL | let x = <A<'a>>::new::<&'a u32>(&v, &v);
5+
| ^^ borrowed value does not live long enough
6+
LL | }
7+
| - `v` dropped here while still borrowed
8+
|
9+
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 15:8...
10+
--> $DIR/method-ufcs-inherent-4.rs:15:8
11+
|
12+
LL | fn foo<'a>() {
13+
| ^^
14+
15+
error[E0597]: `v` does not live long enough
16+
--> $DIR/method-ufcs-inherent-4.rs:17:41
17+
|
18+
LL | let x = <A<'a>>::new::<&'a u32>(&v, &v);
19+
| ^^ borrowed value does not live long enough
20+
LL | }
21+
| - `v` dropped here while still borrowed
22+
|
23+
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 15:8...
24+
--> $DIR/method-ufcs-inherent-4.rs:15:8
25+
|
26+
LL | fn foo<'a>() {
27+
| ^^
28+
29+
error: aborting due to 2 previous errors
30+
31+
For more information about this error, try `rustc --explain E0597`.

0 commit comments

Comments
 (0)