Skip to content

Commit ee9bd0f

Browse files
committed
Add a test for skipping all arguments versus just one
1 parent aa3b5c5 commit ee9bd0f

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
struct Foo<'a, T: 'a>(&'a T);
12+
13+
struct Bar<'a>(&'a ());
14+
15+
fn main() {
16+
Foo::<'static, 'static, ()>(&0); //~ ERROR wrong number of lifetime arguments
17+
//~^ ERROR mismatched types
18+
19+
Bar::<'static, 'static, ()>(&()); //~ ERROR wrong number of lifetime arguments
20+
//~^ ERROR wrong number of type arguments
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
error[E0088]: wrong number of lifetime arguments: expected 1, found 2
2+
--> $DIR/generic-arg-mismatch-recover.rs:16:20
3+
|
4+
LL | Foo::<'static, 'static, ()>(&0); //~ ERROR wrong number of lifetime arguments
5+
| ^^^^^^^ unexpected lifetime argument
6+
7+
error[E0308]: mismatched types
8+
--> $DIR/generic-arg-mismatch-recover.rs:16:33
9+
|
10+
LL | Foo::<'static, 'static, ()>(&0); //~ ERROR wrong number of lifetime arguments
11+
| ^^ expected (), found integral variable
12+
|
13+
= note: expected type `&'static ()`
14+
found type `&{integer}`
15+
16+
error[E0088]: wrong number of lifetime arguments: expected 1, found 2
17+
--> $DIR/generic-arg-mismatch-recover.rs:19:20
18+
|
19+
LL | Bar::<'static, 'static, ()>(&()); //~ ERROR wrong number of lifetime arguments
20+
| ^^^^^^^ unexpected lifetime argument
21+
22+
error[E0087]: wrong number of type arguments: expected 0, found 1
23+
--> $DIR/generic-arg-mismatch-recover.rs:19:29
24+
|
25+
LL | Bar::<'static, 'static, ()>(&()); //~ ERROR wrong number of lifetime arguments
26+
| ^^ unexpected type argument
27+
28+
error: aborting due to 4 previous errors
29+
30+
Some errors occurred: E0087, E0088, E0308.
31+
For more information about an error, try `rustc --explain E0087`.

0 commit comments

Comments
 (0)