Skip to content

Commit 49027db

Browse files
authored
Rollup merge of rust-lang#105547 - JohnTitor:issue-104582, r=compiler-errors
Add regression test for rust-lang#104582 Closes rust-lang#104582 r? `@compiler-errors` Signed-off-by: Yuki Okushi <[email protected]>
2 parents f145825 + 8a3005d commit 49027db

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/test/ui/typeck/issue-104582.rs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fn main(){
2+
let my_var: String(String?);
3+
//~^ ERROR: invalid `?` in type
4+
//~| ERROR: parenthesized type parameters may only be used with a `Fn` trait
5+
}
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
error: invalid `?` in type
2+
--> $DIR/issue-104582.rs:2:30
3+
|
4+
LL | let my_var: String(String?);
5+
| ^ `?` is only allowed on expressions, not types
6+
|
7+
help: if you meant to express that the type might not contain a value, use the `Option` wrapper type
8+
|
9+
LL | let my_var: String(Option<String>);
10+
| +++++++ ~
11+
12+
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
13+
--> $DIR/issue-104582.rs:2:17
14+
|
15+
LL | let my_var: String(String?);
16+
| ^^^^^^^^^^^^^^^ only `Fn` traits may use parentheses
17+
|
18+
help: use angle brackets instead
19+
|
20+
LL | let my_var: String<String?>;
21+
| ~ ~
22+
23+
error: aborting due to 2 previous errors
24+
25+
For more information about this error, try `rustc --explain E0214`.

0 commit comments

Comments
 (0)