Skip to content

Commit 827d36e

Browse files
committed
moved renamed docs stderr | constructor-lifetime-args.rs
1 parent 55165c0 commit 827d36e

File tree

3 files changed

+32
-34
lines changed

3 files changed

+32
-34
lines changed

tests/ui/constructor-lifetime-args.rs

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//! Tests that all lifetime parameters in struct (`S`) and enum (`E`) constructors are
2+
//! treated as early bound, similar to associated items, rather than late bound as in manual
3+
//! constructors.
4+
//!
5+
//! Related to issue #30904.
6+
7+
struct S<'a, 'b>(&'a u8, &'b u8);
8+
enum E<'a, 'b> {
9+
V(&'a u8),
10+
U(&'b u8),
11+
}
12+
13+
fn main() {
14+
S(&0, &0); // OK
15+
S::<'static>(&0, &0);
16+
//~^ ERROR struct takes 2 lifetime arguments
17+
S::<'static, 'static, 'static>(&0, &0);
18+
//~^ ERROR struct takes 2 lifetime arguments
19+
E::V(&0); // OK
20+
E::V::<'static>(&0);
21+
//~^ ERROR enum takes 2 lifetime arguments
22+
E::V::<'static, 'static, 'static>(&0);
23+
//~^ ERROR enum takes 2 lifetime arguments
24+
}

tests/ui/constructor-lifetime-args.stderr renamed to tests/ui/lifetimes/constructor-lifetime-early-binding-error.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error[E0107]: struct takes 2 lifetime arguments but 1 lifetime argument was supplied
2-
--> $DIR/constructor-lifetime-args.rs:17:5
2+
--> $DIR/constructor-lifetime-early-binding-error.rs:15:5
33
|
44
LL | S::<'static>(&0, &0);
55
| ^ ------- supplied 1 lifetime argument
66
| |
77
| expected 2 lifetime arguments
88
|
99
note: struct defined here, with 2 lifetime parameters: `'a`, `'b`
10-
--> $DIR/constructor-lifetime-args.rs:9:8
10+
--> $DIR/constructor-lifetime-early-binding-error.rs:7:8
1111
|
1212
LL | struct S<'a, 'b>(&'a u8, &'b u8);
1313
| ^ -- --
@@ -17,29 +17,29 @@ LL | S::<'static, 'static>(&0, &0);
1717
| +++++++++
1818

1919
error[E0107]: struct takes 2 lifetime arguments but 3 lifetime arguments were supplied
20-
--> $DIR/constructor-lifetime-args.rs:19:5
20+
--> $DIR/constructor-lifetime-early-binding-error.rs:17:5
2121
|
2222
LL | S::<'static, 'static, 'static>(&0, &0);
2323
| ^ --------- help: remove the lifetime argument
2424
| |
2525
| expected 2 lifetime arguments
2626
|
2727
note: struct defined here, with 2 lifetime parameters: `'a`, `'b`
28-
--> $DIR/constructor-lifetime-args.rs:9:8
28+
--> $DIR/constructor-lifetime-early-binding-error.rs:7:8
2929
|
3030
LL | struct S<'a, 'b>(&'a u8, &'b u8);
3131
| ^ -- --
3232

3333
error[E0107]: enum takes 2 lifetime arguments but 1 lifetime argument was supplied
34-
--> $DIR/constructor-lifetime-args.rs:22:8
34+
--> $DIR/constructor-lifetime-early-binding-error.rs:20:8
3535
|
3636
LL | E::V::<'static>(&0);
3737
| ^ ------- supplied 1 lifetime argument
3838
| |
3939
| expected 2 lifetime arguments
4040
|
4141
note: enum defined here, with 2 lifetime parameters: `'a`, `'b`
42-
--> $DIR/constructor-lifetime-args.rs:10:6
42+
--> $DIR/constructor-lifetime-early-binding-error.rs:8:6
4343
|
4444
LL | enum E<'a, 'b> {
4545
| ^ -- --
@@ -49,15 +49,15 @@ LL | E::V::<'static, 'static>(&0);
4949
| +++++++++
5050

5151
error[E0107]: enum takes 2 lifetime arguments but 3 lifetime arguments were supplied
52-
--> $DIR/constructor-lifetime-args.rs:24:8
52+
--> $DIR/constructor-lifetime-early-binding-error.rs:22:8
5353
|
5454
LL | E::V::<'static, 'static, 'static>(&0);
5555
| ^ --------- help: remove the lifetime argument
5656
| |
5757
| expected 2 lifetime arguments
5858
|
5959
note: enum defined here, with 2 lifetime parameters: `'a`, `'b`
60-
--> $DIR/constructor-lifetime-args.rs:10:6
60+
--> $DIR/constructor-lifetime-early-binding-error.rs:8:6
6161
|
6262
LL | enum E<'a, 'b> {
6363
| ^ -- --

0 commit comments

Comments
 (0)