Skip to content

Conversation

@ImadRedwan
Copy link

This PR adds a dedicated parser diagnostic for gen fn used in function pointer types.
Previously, such cases resulted in a generic parse error. The new behavior mirrors the
existing handling for async fn, improving consistency and error clarity.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 20, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 20, 2025

r? @jackh726

rustbot has assigned @jackh726.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Kivooeo
Copy link
Member

Kivooeo commented Dec 20, 2025

why do you put your github account name into commit name

also please squash all commits into one, there is no reason to keep 6 commits for this fix

@ImadRedwan
Copy link
Author

ImadRedwan commented Dec 20, 2025

was a mistake 🤦‍♂️🤦‍♂️
Yes you're absolutely right. actually this is my first PR and I was a little confused :(

@rust-log-analyzer

This comment has been minimized.

@Kivooeo
Copy link
Member

Kivooeo commented Dec 20, 2025

r? me

also could you add a test somewhere in tests/ui/parser to reflect new beahviour

if you have any questions feel free to ask

@rustbot rustbot assigned Kivooeo and unassigned jackh726 Dec 20, 2025
@Kivooeo
Copy link
Member

Kivooeo commented Dec 20, 2025

i see that you added a new two commits that passed a CI, but could you please consider making this

  1. squash all commits into one
  2. add a ui test

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
diff of stderr:

86 help: remove the `gen` qualifier
87    |
88 LL - pub type T6 = gen fn();
- LL + pub type T6 = "C" fn();
+ LL + pub type T6 = fn();
90    |
91 
92 error: an `fn` pointer type cannot be `gen`

142    |
143 
144 error: an `fn` pointer type cannot be `const`
-   --> $DIR/bad-fn-ptr-qualifier.rs:15:25
+   --> $DIR/bad-fn-ptr-qualifier.rs:18:25
146    |
147 LL | pub type FTT0 = for<'a> const fn();
148    |                         ^^^^^ `const` because of this

155    |
156 
157 error: an `fn` pointer type cannot be `const`
-   --> $DIR/bad-fn-ptr-qualifier.rs:16:25
+   --> $DIR/bad-fn-ptr-qualifier.rs:19:25
159    |
160 LL | pub type FTT1 = for<'a> const extern "C" fn();
161    |                         ^^^^^ `const` because of this

168    |
169 
170 error: an `fn` pointer type cannot be `const`
-   --> $DIR/bad-fn-ptr-qualifier.rs:17:25
+   --> $DIR/bad-fn-ptr-qualifier.rs:20:25
172    |
173 LL | pub type FTT2 = for<'a> const unsafe extern "C" fn();
174    |                         ^^^^^ `const` because of this

181    |
182 
183 error: an `fn` pointer type cannot be `async`
-   --> $DIR/bad-fn-ptr-qualifier.rs:18:25
+   --> $DIR/bad-fn-ptr-qualifier.rs:21:25
185    |
186 LL | pub type FTT3 = for<'a> async fn();
187    |                         ^^^^^ `async` because of this

194    |
195 
196 error: an `fn` pointer type cannot be `async`
-   --> $DIR/bad-fn-ptr-qualifier.rs:19:25
+   --> $DIR/bad-fn-ptr-qualifier.rs:22:25
198    |
199 LL | pub type FTT4 = for<'a> async extern "C" fn();
200    |                         ^^^^^ `async` because of this

207    |
208 
209 error: an `fn` pointer type cannot be `async`
-   --> $DIR/bad-fn-ptr-qualifier.rs:20:25
+   --> $DIR/bad-fn-ptr-qualifier.rs:23:25
211    |
212 LL | pub type FTT5 = for<'a> async unsafe extern "C" fn();
213    |                         ^^^^^ `async` because of this

285    |
286 
287 error: an `fn` pointer type cannot be `const`
-   --> $DIR/bad-fn-ptr-qualifier.rs:27:22
+   --> $DIR/bad-fn-ptr-qualifier.rs:34:22
289    |
290 LL | pub type W1 = unsafe const fn();
291    |                      ^^^^^ `const` because of this

298    |
299 
300 error: an `fn` pointer type cannot be `async`
-   --> $DIR/bad-fn-ptr-qualifier.rs:29:22
+   --> $DIR/bad-fn-ptr-qualifier.rs:36:22
302    |
303 LL | pub type W2 = unsafe async fn();
304    |                      ^^^^^ `async` because of this

310 LL + pub type W2 = unsafe fn();
311    |
312 
- error: an `fn` pointer type cannot be `gen`
+ error: expected one of `extern` or `fn`, found reserved keyword `gen`
314   --> $DIR/bad-fn-ptr-qualifier.rs:38:22
315    |
316 LL | pub type W3 = unsafe gen fn();

-    |                      ^^^ `gen` because of this
-    |
-    = note: allowed qualifiers are: `unsafe` and `extern`
- help: remove the `gen` qualifier
-    |
- LL - pub type W3 = unsafe gen fn();
- LL + pub type W3 = unsafe fn();
-    |
+    |                      ^^^ expected one of `extern` or `fn`
325 
- error: an `fn` pointer type cannot be `const`
-   --> $DIR/bad-fn-ptr-qualifier.rs:40:30
-    |
- LL | pub type W4 = for<'a> unsafe const fn();
-    |                              ^^^^^ `const` because of this
-    |
-    = note: allowed qualifiers are: `unsafe` and `extern`
- help: remove the `const` qualifier
-    |
- LL - pub type W4 = for<'a> unsafe const fn();
- LL + pub type W4 = for<'a> unsafe fn();
-    |
- 
- error: aborting due to 19 previous errors
+ error: aborting due to 25 previous errors
340 
---
-   --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:22:25
-   --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:23:25
-   --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:34:22
-   --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:36:22
+ LL + pub type T6 = fn();
+   --> $DIR/bad-fn-ptr-qualifier.rs:18:25
+   --> $DIR/bad-fn-ptr-qualifier.rs:19:25
+   --> $DIR/bad-fn-ptr-qualifier.rs:20:25
+   --> $DIR/bad-fn-ptr-qualifier.rs:21:25
+   --> $DIR/bad-fn-ptr-qualifier.rs:22:25
---
- //@ edition:2018
+ //@ edition:2024
3 // Most of items are taken from ./recover-const-async-fn-ptr.rs but this is able to apply rustfix.
4 
5 pub type T0 = fn(); //~ ERROR an `fn` pointer type cannot be `const`

8 pub type T3 = fn(); //~ ERROR an `fn` pointer type cannot be `async`
9 pub type T4 = extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `async`
10 pub type T5 = unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `async`
- pub type T6 = unsafe extern "C" fn();
+ pub type T6 = fn(); //~ ERROR an `fn` pointer type cannot be `gen`
+ pub type T7 = extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `gen`
+ pub type T8 = unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `gen`
+ pub type T9 = unsafe extern "C" fn();
12 //~^ ERROR an `fn` pointer type cannot be `const`
13 //~| ERROR an `fn` pointer type cannot be `async`
14 

19 pub type FTT4 = for<'a> extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `async`
20 pub type FTT5 = for<'a> unsafe extern "C" fn();
21 //~^ ERROR an `fn` pointer type cannot be `async`
- pub type FTT6 = for<'a> unsafe extern "C" fn();
+ pub type FTT6 = for<'a> fn(); //~ ERROR an `fn` pointer type cannot be `gen`
+ pub type FTT7 = for<'a> extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `gen`
+ pub type FTT8 = for<'a> unsafe extern "C" fn();
+ //~^ ERROR an `fn` pointer type cannot be `gen`
+ pub type FTT9 = for<'a> unsafe extern "C" fn();
23 //~^ ERROR an `fn` pointer type cannot be `const`
24 //~| ERROR an `fn` pointer type cannot be `async`
25 

28 //~^ ERROR an `fn` pointer type cannot be `const`
29 pub type W2 = unsafe fn();
30 //~^ ERROR an `fn` pointer type cannot be `async`
- pub type W3 = for<'a> unsafe fn();
+ pub type W3 = unsafe gen fn();
+ //~^ ERROR an `fn` pointer type cannot be `gen`
+ pub type W4 = for<'a> unsafe const fn();
32 //~^ ERROR an `fn` pointer type cannot be `const`
33 
34 fn main() {}


The actual fixed differed from the expected fixed
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args parser/bad-fn-ptr-qualifier.rs`

error: 2 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/parser/bad-fn-ptr-qualifier" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2024"
stdout: none
--- stderr -------------------------------
error: an `fn` pointer type cannot be `const`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:5:15
   |
LL | pub type T0 = const fn(); //~ ERROR an `fn` pointer type cannot be `const`
   |               ^^^^^ `const` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `const` qualifier
   |
LL - pub type T0 = const fn(); //~ ERROR an `fn` pointer type cannot be `const`
LL + pub type T0 = fn(); //~ ERROR an `fn` pointer type cannot be `const`
   |

error: an `fn` pointer type cannot be `const`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:6:15
   |
LL | pub type T1 = const extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
   |               ^^^^^ `const` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `const` qualifier
   |
LL - pub type T1 = const extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
LL + pub type T1 = extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
   |

error: an `fn` pointer type cannot be `const`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:7:15
   |
LL | pub type T2 = const unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
   |               ^^^^^ `const` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `const` qualifier
   |
LL - pub type T2 = const unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
LL + pub type T2 = unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
   |

error: an `fn` pointer type cannot be `async`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:8:15
   |
LL | pub type T3 = async fn(); //~ ERROR an `fn` pointer type cannot be `async`
   |               ^^^^^ `async` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `async` qualifier
   |
LL - pub type T3 = async fn(); //~ ERROR an `fn` pointer type cannot be `async`
LL + pub type T3 = fn(); //~ ERROR an `fn` pointer type cannot be `async`
   |

error: an `fn` pointer type cannot be `async`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:9:15
   |
LL | pub type T4 = async extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `async`
   |               ^^^^^ `async` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `async` qualifier
   |
LL - pub type T4 = async extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `async`
LL + pub type T4 = extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `async`
   |

error: an `fn` pointer type cannot be `async`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:10:15
   |
LL | pub type T5 = async unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `async`
   |               ^^^^^ `async` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `async` qualifier
   |
LL - pub type T5 = async unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `async`
LL + pub type T5 = unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `async`
   |

error: an `fn` pointer type cannot be `gen`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:11:15
   |
LL | pub type T6 = gen fn(); //~ ERROR an `fn` pointer type cannot be `gen`
   |               ^^^ `gen` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `gen` qualifier
   |
LL - pub type T6 = gen fn(); //~ ERROR an `fn` pointer type cannot be `gen`
LL + pub type T6 = fn(); //~ ERROR an `fn` pointer type cannot be `gen`
   |

error: an `fn` pointer type cannot be `gen`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:12:15
   |
LL | pub type T7 = gen extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `gen`
   |               ^^^ `gen` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `gen` qualifier
   |
LL - pub type T7 = gen extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `gen`
LL + pub type T7 = extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `gen`
   |

error: an `fn` pointer type cannot be `gen`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:13:15
   |
LL | pub type T8 = gen unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `gen`
   |               ^^^ `gen` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `gen` qualifier
   |
LL - pub type T8 = gen unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `gen`
LL + pub type T8 = unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `gen`
   |

error: an `fn` pointer type cannot be `const`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:14:15
   |
LL | pub type T9 = const async unsafe extern "C" fn();
   |               ^^^^^ `const` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `const` qualifier
   |
LL - pub type T9 = const async unsafe extern "C" fn();
LL + pub type T9 = async unsafe extern "C" fn();
   |

error: an `fn` pointer type cannot be `async`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:14:21
   |
---

error: an `fn` pointer type cannot be `const`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:18:25
   |
LL | pub type FTT0 = for<'a> const fn(); //~ ERROR an `fn` pointer type cannot be `const`
   |                         ^^^^^ `const` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `const` qualifier
   |
LL - pub type FTT0 = for<'a> const fn(); //~ ERROR an `fn` pointer type cannot be `const`
LL + pub type FTT0 = for<'a> fn(); //~ ERROR an `fn` pointer type cannot be `const`
   |

error: an `fn` pointer type cannot be `const`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:19:25
   |
LL | pub type FTT1 = for<'a> const extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
   |                         ^^^^^ `const` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `const` qualifier
   |
LL - pub type FTT1 = for<'a> const extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
LL + pub type FTT1 = for<'a> extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
   |

error: an `fn` pointer type cannot be `const`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:20:25
   |
LL | pub type FTT2 = for<'a> const unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
   |                         ^^^^^ `const` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `const` qualifier
   |
LL - pub type FTT2 = for<'a> const unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
LL + pub type FTT2 = for<'a> unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
   |

error: an `fn` pointer type cannot be `async`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:21:25
   |
LL | pub type FTT3 = for<'a> async fn(); //~ ERROR an `fn` pointer type cannot be `async`
   |                         ^^^^^ `async` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `async` qualifier
   |
LL - pub type FTT3 = for<'a> async fn(); //~ ERROR an `fn` pointer type cannot be `async`
LL + pub type FTT3 = for<'a> fn(); //~ ERROR an `fn` pointer type cannot be `async`
   |

error: an `fn` pointer type cannot be `async`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:22:25
   |
LL | pub type FTT4 = for<'a> async extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `async`
   |                         ^^^^^ `async` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `async` qualifier
   |
LL - pub type FTT4 = for<'a> async extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `async`
LL + pub type FTT4 = for<'a> extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `async`
   |

error: an `fn` pointer type cannot be `async`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:23:25
   |
LL | pub type FTT5 = for<'a> async unsafe extern "C" fn();
   |                         ^^^^^ `async` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `async` qualifier
   |
LL - pub type FTT5 = for<'a> async unsafe extern "C" fn();
LL + pub type FTT5 = for<'a> unsafe extern "C" fn();
   |

error: an `fn` pointer type cannot be `gen`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:25:25
   |
LL | pub type FTT6 = for<'a> gen fn(); //~ ERROR an `fn` pointer type cannot be `gen`
   |                         ^^^ `gen` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `gen` qualifier
   |
LL - pub type FTT6 = for<'a> gen fn(); //~ ERROR an `fn` pointer type cannot be `gen`
LL + pub type FTT6 = for<'a> fn(); //~ ERROR an `fn` pointer type cannot be `gen`
   |

error: an `fn` pointer type cannot be `gen`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:26:25
   |
LL | pub type FTT7 = for<'a> gen extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `gen`
   |                         ^^^ `gen` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `gen` qualifier
   |
LL - pub type FTT7 = for<'a> gen extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `gen`
LL + pub type FTT7 = for<'a> extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `gen`
   |

error: an `fn` pointer type cannot be `gen`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:27:25
   |
LL | pub type FTT8 = for<'a> gen unsafe extern "C" fn();
   |                         ^^^ `gen` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `gen` qualifier
   |
LL - pub type FTT8 = for<'a> gen unsafe extern "C" fn();
LL + pub type FTT8 = for<'a> unsafe extern "C" fn();
   |

error: an `fn` pointer type cannot be `const`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:29:25
   |
LL | pub type FTT9 = for<'a> const async unsafe extern "C" fn();
   |                         ^^^^^ `const` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `const` qualifier
   |
LL - pub type FTT9 = for<'a> const async unsafe extern "C" fn();
LL + pub type FTT9 = for<'a> async unsafe extern "C" fn();
   |

error: an `fn` pointer type cannot be `async`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:29:31
   |
LL | pub type FTT9 = for<'a> const async unsafe extern "C" fn();
   |                               ^^^^^ `async` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `async` qualifier
   |
LL - pub type FTT9 = for<'a> const async unsafe extern "C" fn();
LL + pub type FTT9 = for<'a> const unsafe extern "C" fn();
   |

error: an `fn` pointer type cannot be `const`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:34:22
   |
LL | pub type W1 = unsafe const fn();
   |                      ^^^^^ `const` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `const` qualifier
   |
LL - pub type W1 = unsafe const fn();
LL + pub type W1 = unsafe fn();
   |

error: an `fn` pointer type cannot be `async`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:36:22
   |
LL | pub type W2 = unsafe async fn();
   |                      ^^^^^ `async` because of this
   |
   = note: allowed qualifiers are: `unsafe` and `extern`
help: remove the `async` qualifier
   |
LL - pub type W2 = unsafe async fn();
LL + pub type W2 = unsafe fn();
   |

error: expected one of `extern` or `fn`, found reserved keyword `gen`
##[error]  --> /checkout/tests/ui/parser/bad-fn-ptr-qualifier.rs:38:22
   |
LL | pub type W3 = unsafe gen fn();
   |                      ^^^ expected one of `extern` or `fn`

error: aborting due to 25 previous errors
------------------------------------------

---- [ui] tests/ui/parser/bad-fn-ptr-qualifier.rs stdout end ----

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants