Skip to content

Commit d38e700

Browse files
committedJan 20, 2019
Continune parsing after encountering Trait with paren args
·
1.88.01.34.0
1 parent 0c0c585 commit d38e700

File tree

6 files changed

+41
-13
lines changed

6 files changed

+41
-13
lines changed
 

‎src/librustc/hir/lowering.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1826,7 +1826,7 @@ impl<'a> LoweringContext<'a> {
18261826
struct_span_err!(self.sess, data.span, E0214, "{}", msg)
18271827
.span_label(data.span, "only traits may use parentheses")
18281828
.emit();
1829-
(hir::GenericArgs::none(), true)
1829+
(hir::GenericArgs::none(), false)
18301830
}
18311831
},
18321832
}

‎src/test/ui/error-codes/E0214.stderr

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ error[E0214]: parenthesized parameters may only be used with a trait
44
LL | let v: Vec(&str) = vec!["foo"];
55
| ^^^^^^ only traits may use parentheses
66

7-
error: aborting due to previous error
7+
error[E0107]: wrong number of type arguments: expected 1, found 0
8+
--> $DIR/E0214.rs:2:12
9+
|
10+
LL | let v: Vec(&str) = vec!["foo"];
11+
| ^^^^^^^^^ expected 1 type argument
12+
13+
error: aborting due to 2 previous errors
814

9-
For more information about this error, try `rustc --explain E0214`.
15+
Some errors occurred: E0107, E0214.
16+
For more information about an error, try `rustc --explain E0107`.

‎src/test/ui/issues/issue-23589.stderr

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ error[E0214]: parenthesized parameters may only be used with a trait
44
LL | let v: Vec(&str) = vec!['1', '2'];
55
| ^^^^^^ only traits may use parentheses
66

7-
error: aborting due to previous error
7+
error[E0107]: wrong number of type arguments: expected 1, found 0
8+
--> $DIR/issue-23589.rs:2:12
9+
|
10+
LL | let v: Vec(&str) = vec!['1', '2'];
11+
| ^^^^^^^^^ expected 1 type argument
12+
13+
error: aborting due to 2 previous errors
814

9-
For more information about this error, try `rustc --explain E0214`.
15+
Some errors occurred: E0107, E0214.
16+
For more information about an error, try `rustc --explain E0107`.

‎src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ error[E0214]: parenthesized parameters may only be used with a trait
44
LL | let x: Box<Bar()> = panic!();
55
| ^^ only traits may use parentheses
66

7-
error: aborting due to previous error
7+
error[E0107]: wrong number of type arguments: expected 1, found 0
8+
--> $DIR/unboxed-closure-sugar-used-on-struct-1.rs:8:16
9+
|
10+
LL | let x: Box<Bar()> = panic!();
11+
| ^^^^^ expected 1 type argument
12+
13+
error: aborting due to 2 previous errors
814

9-
For more information about this error, try `rustc --explain E0214`.
15+
Some errors occurred: E0107, E0214.
16+
For more information about an error, try `rustc --explain E0107`.

‎src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ error[E0214]: parenthesized parameters may only be used with a trait
44
LL | let b = Bar::(isize, usize)::new(); // OK too (for the parser)
55
| ^^^^^^^^^^^^^^^^ only traits may use parentheses
66

7-
error: aborting due to previous error
7+
error[E0107]: wrong number of type arguments: expected 2, found 0
8+
--> $DIR/unboxed-closure-sugar-used-on-struct-3.rs:14:13
9+
|
10+
LL | let b = Bar::(isize, usize)::new(); // OK too (for the parser)
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^ expected 2 type arguments
12+
13+
error: aborting due to 2 previous errors
814

9-
For more information about this error, try `rustc --explain E0214`.
15+
Some errors occurred: E0107, E0214.
16+
For more information about an error, try `rustc --explain E0107`.

‎src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ error[E0214]: parenthesized parameters may only be used with a trait
44
LL | fn foo(b: Box<Bar()>) {
55
| ^^ only traits may use parentheses
66

7-
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
7+
error[E0107]: wrong number of type arguments: expected 1, found 0
88
--> $DIR/unboxed-closure-sugar-used-on-struct.rs:7:15
99
|
1010
LL | fn foo(b: Box<Bar()>) {
11-
| ^^^^^ not allowed in type signatures
11+
| ^^^^^ expected 1 type argument
1212

1313
error: aborting due to 2 previous errors
1414

15-
Some errors occurred: E0121, E0214.
16-
For more information about an error, try `rustc --explain E0121`.
15+
Some errors occurred: E0107, E0214.
16+
For more information about an error, try `rustc --explain E0107`.

0 commit comments

Comments
 (0)
Please sign in to comment.