Rollup merge of #89447 - FabianWolff:issue-89388, r=davidtwco

Improve error message for missing angle brackets in `[_]::method`

Fixes #89388.
This commit is contained in:
Jubilee 2021-10-04 13:58:13 -07:00 committed by GitHub
commit 08dd4148f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 0 deletions

View File

@ -1211,6 +1211,8 @@ impl Expr {
}
}
ExprKind::Underscore => TyKind::Infer,
// This expression doesn't look like a type syntactically.
_ => return None,
};

View File

@ -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
}

View File

@ -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