mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Add ...
parsing for fn pointer type
This commit is contained in:
parent
1705e5887d
commit
6c913d8fa7
4 changed files with 47 additions and 3 deletions
|
@ -43,7 +43,7 @@ fn list_(p: &mut Parser, flavor: Flavor) {
|
|||
if flavor.type_required() {
|
||||
opt_self_param(p);
|
||||
}
|
||||
while !p.at(EOF) && !p.at(ket) && !(flavor == Flavor::Normal && p.at(DOTDOTDOT)) {
|
||||
while !p.at(EOF) && !p.at(ket) && !(flavor.type_required() && p.at(DOTDOTDOT)) {
|
||||
if !p.at_ts(VALUE_PARAMETER_FIRST) {
|
||||
p.error("expected value parameter");
|
||||
break;
|
||||
|
@ -55,7 +55,7 @@ fn list_(p: &mut Parser, flavor: Flavor) {
|
|||
}
|
||||
// test param_list_vararg
|
||||
// extern "C" { fn printf(format: *const i8, ...) -> i32; }
|
||||
if flavor == Flavor::Normal {
|
||||
if flavor.type_required() {
|
||||
p.eat(DOTDOTDOT);
|
||||
}
|
||||
p.expect(ket);
|
||||
|
|
|
@ -166,6 +166,7 @@ fn placeholder_type(p: &mut Parser) {
|
|||
// type A = fn();
|
||||
// type B = unsafe fn();
|
||||
// type C = unsafe extern "C" fn();
|
||||
// type D = extern "C" fn ( u8 , ... ) -> u8;
|
||||
fn fn_pointer_type(p: &mut Parser) {
|
||||
let m = p.start();
|
||||
p.eat(UNSAFE_KW);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue