Skip to content

Commit

Permalink
Rollup merge of #89447 - FabianWolff:issue-89388, r=davidtwco
Browse files Browse the repository at this point in the history
Improve error message for missing angle brackets in `[_]::method`

Fixes #89388.
  • Loading branch information
workingjubilee committed Oct 4, 2021
2 parents b115a16 + d92c683 commit 08dd414
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,8 @@ impl Expr {
}
}

ExprKind::Underscore => TyKind::Infer,

// This expression doesn't look like a type syntactically.
_ => return None,
};
Expand Down
7 changes: 7 additions & 0 deletions src/test/ui/parser/issue-89388.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Regression test for #89388.

fn main() {
let option: Option<&[u8]> = Some(b"...");
let _ = option.map([_]::to_vec);
//~^ ERROR: missing angle brackets in associated item path
}
8 changes: 8 additions & 0 deletions src/test/ui/parser/issue-89388.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: missing angle brackets in associated item path
--> $DIR/issue-89388.rs:5:24
|
LL | let _ = option.map([_]::to_vec);
| ^^^^^^^^^^^ help: try: `<[_]>::to_vec`

error: aborting due to previous error

0 comments on commit 08dd414

Please sign in to comment.