File tree Expand file tree Collapse file tree 3 files changed +27
-2
lines changed 
compiler/rustc_parse/src/parser Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -1013,9 +1013,15 @@ impl<'a> Parser<'a> {
10131013    } 
10141014
10151015    fn  error_unexpected_after_dot ( & self )  { 
1016-         // FIXME Could factor this out into non_fatal_unexpected or something. 
10171016        let  actual = pprust:: token_to_string ( & self . token ) ; 
1018-         self . sess . emit_err ( errors:: UnexpectedTokenAfterDot  {  span :  self . token . span ,  actual } ) ; 
1017+         let  span = self . token . span ; 
1018+         let  sm = self . sess . source_map ( ) ; 
1019+         let  ( span,  actual)  = match  ( & self . token . kind ,  self . subparser_name )  { 
1020+             ( token:: Eof ,  Some ( _) )  if  let  Ok ( actual)  = sm. span_to_snippet ( sm. next_point ( span) )  =>
1021+                 ( span. shrink_to_hi ( ) ,  actual. into ( ) ) , 
1022+             _ => ( span,  actual) , 
1023+         } ; 
1024+         self . sess . emit_err ( errors:: UnexpectedTokenAfterDot  {  span,  actual } ) ; 
10191025    } 
10201026
10211027    // We need an identifier or integer, but the next token is a float. 
Original file line number Diff line number Diff line change 1+ fn  main ( )  { 
2+     println ! ( "{}" ,  x. ) ;  //~ ERROR unexpected token: `)` 
3+     //~^ ERROR cannot find value `x` in this scope 
4+ } 
Original file line number Diff line number Diff line change 1+ error: unexpected token: `)`
2+   --> $DIR/issue-112458.rs:2:22
3+    |
4+ LL |     println!("{}", x.);
5+    |                      ^
6+ 
7+ error[E0425]: cannot find value `x` in this scope
8+   --> $DIR/issue-112458.rs:2:20
9+    |
10+ LL |     println!("{}", x.);
11+    |                    ^ not found in this scope
12+ 
13+ error: aborting due to 2 previous errors
14+ 
15+ For more information about this error, try `rustc --explain E0425`.
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments