File tree 4 files changed +40
-5
lines changed
4 files changed +40
-5
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ macro_rules! assert {
86
86
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
87
87
macro_rules! assert_eq {
88
88
( $left: expr , $right: expr) => ( {
89
- match ( & ( $left) , & ( $right) ) {
89
+ match ( & $left, & $right) {
90
90
( left_val, right_val) => {
91
91
if !( * left_val == * right_val) {
92
92
panic!( "assertion failed: `(left == right)` \
Original file line number Diff line number Diff line change @@ -1286,8 +1286,12 @@ impl<'a> LoweringContext<'a> {
1286
1286
maybe_expr. as_ref ( ) . map ( |x| self . lower_expr ( x) ) )
1287
1287
}
1288
1288
ExprKind :: Paren ( ref ex) => {
1289
- // merge attributes into the inner expression.
1290
1289
return self . lower_expr ( ex) . map ( |mut ex| {
1290
+ // include parens in span, but only if it is a super-span.
1291
+ if e. span . contains ( ex. span ) {
1292
+ ex. span = e. span ;
1293
+ }
1294
+ // merge attributes into the inner expression.
1291
1295
ex. attrs . update ( |attrs| {
1292
1296
attrs. prepend ( e. attrs . clone ( ) )
1293
1297
} ) ;
Original file line number Diff line number Diff line change @@ -81,11 +81,11 @@ impl FuncContainerOuter {
81
81
fn run ( & self ) {
82
82
unsafe {
83
83
( * self . container ) . f1 ( 1 ) ; //~ ERROR no method named `f1` found
84
- //~^ NOTE use `(*self.container.f1)(...)`
84
+ //~^ NOTE use `(( *self.container) .f1)(...)`
85
85
( * self . container ) . f2 ( 1 ) ; //~ ERROR no method named `f2` found
86
- //~^ NOTE use `(*self.container.f2)(...)`
86
+ //~^ NOTE use `(( *self.container) .f2)(...)`
87
87
( * self . container ) . f3 ( 1 ) ; //~ ERROR no method named `f3` found
88
- //~^ NOTE use `(*self.container.f3)(...)`
88
+ //~^ NOTE use `(( *self.container) .f3)(...)`
89
89
}
90
90
}
91
91
}
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 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
+ // Be smart about span of parenthesized expression in macro.
12
+
13
+ macro_rules! paren {
14
+ ( $e: expr) => ( ( $e) )
15
+ // ^^^^ do not highlight here
16
+ }
17
+
18
+ mod m {
19
+ pub struct S {
20
+ x : i32
21
+ }
22
+ pub fn make ( ) -> S {
23
+ S { x : 0 }
24
+ }
25
+ }
26
+
27
+ fn main ( ) {
28
+ let s = m:: make ( ) ;
29
+ paren ! ( s. x) ; //~ ERROR field `x` of struct `m::S` is private
30
+ // ^^^ highlight here
31
+ }
You can’t perform that action at this time.
0 commit comments