File tree Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -518,6 +518,11 @@ trait UnusedDelimLint {
518518 ) {
519519 let spans = match value. kind {
520520 ast:: ExprKind :: Block ( ref block, None ) if block. stmts . len ( ) == 1 => {
521+ if let StmtKind :: Expr ( expr) = & block. stmts [ 0 ] . kind
522+ && let ExprKind :: Err = expr. kind
523+ {
524+ return
525+ }
521526 if let Some ( span) = block. stmts [ 0 ] . span . find_ancestor_inside ( value. span ) {
522527 Some ( ( value. span . with_hi ( span. lo ( ) ) , value. span . with_lo ( span. hi ( ) ) ) )
523528 } else {
Original file line number Diff line number Diff line change 1+ fn main ( ) {
2+ { unsafe 92 } //~ ERROR expected `{`, found `92`
3+ }
4+
5+ fn foo ( ) {
6+ { mod 92 } //~ ERROR expected identifier, found `92`
7+ }
8+
9+ fn bar ( ) {
10+ { trait 92 } //~ ERROR expected identifier, found `92`
11+ }
Original file line number Diff line number Diff line change 1+ error: expected `{`, found `92`
2+ --> $DIR/issue-104392.rs:2:14
3+ |
4+ LL | { unsafe 92 }
5+ | ------ ^^ expected `{`
6+ | |
7+ | while parsing this `unsafe` expression
8+ |
9+ help: try placing this code inside a block
10+ |
11+ LL | { unsafe { 92 } }
12+ | + +
13+
14+ error: expected identifier, found `92`
15+ --> $DIR/issue-104392.rs:6:11
16+ |
17+ LL | { mod 92 }
18+ | ^^ expected identifier
19+
20+ error: expected identifier, found `92`
21+ --> $DIR/issue-104392.rs:10:13
22+ |
23+ LL | { trait 92 }
24+ | ^^ expected identifier
25+
26+ error: aborting due to 3 previous errors
27+
You can’t perform that action at this time.
0 commit comments