File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 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+ } 
Original file line number Diff line number Diff line change 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`.
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments