Repository navigation
c-variadic: improve implicit &'reg VaList argument diagnostics #160495
Copy link
Copy link
Open
Labels
F-c_variadic`#![feature(c_variadic)]``#![feature(c_variadic)]`needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
Description
cc #160504
see that PR for more detail and the FIXME(#160495) in the code, e.g.
rust/tests/ui/c-variadic/not-async.rs
Lines 2 to 14 in c9ff496
| #![crate_type = "lib"] | |
| async unsafe extern "C" fn fn_cannot_be_async(x: isize, _: ...) {} | |
| //~^ ERROR functions cannot be both `async` and C-variadic | |
| //~| ERROR hidden type for `impl Future<Output = ()>` captures lifetime that does not appear in bounds | |
| struct S; | |
| impl S { | |
| async unsafe extern "C" fn method_cannot_be_async(x: isize, _: ...) {} | |
| //~^ ERROR functions cannot be both `async` and C-variadic | |
| //~| ERROR hidden type for `impl Future<Output = ()>` captures lifetime that does not appear in bounds | |
| } |
results in
error: functions cannot be both `async` and C-variadic
--> $DIR/not-async.rs:4:1
|
LL | async unsafe extern "C" fn fn_cannot_be_async(x: isize, _: ...) {}
| ^^^^^ `async` because of this ^^^^^^ C-variadic because of this
error: functions cannot be both `async` and C-variadic
--> $DIR/not-async.rs:11:5
|
LL | async unsafe extern "C" fn method_cannot_be_async(x: isize, _: ...) {}
| ^^^^^ `async` because of this ^^^^^^ C-variadic because of this
error[E0700]: hidden type for `impl Future<Output = ()>` captures lifetime that does not appear in bounds
--> $DIR/not-async.rs:4:65
|
LL | async unsafe extern "C" fn fn_cannot_be_async(x: isize, _: ...) {}
| ----------------------------------------------------------------^^
| | |
| | opaque type defined here
| hidden type `{async fn body of fn_cannot_be_async()}` captures the anonymous lifetime as defined here
error[E0700]: hidden type for `impl Future<Output = ()>` captures lifetime that does not appear in bounds
--> $DIR/not-async.rs:11:73
|
LL | async unsafe extern "C" fn method_cannot_be_async(x: isize, _: ...) {}
| --------------------------------------------------------------------^^
| | |
| | opaque type defined here
| hidden type `{async fn body of S::method_cannot_be_async()}` captures the anonymous lifetime as defined here
error: aborting due to 4 previous errorswith #160491 but should instead explicitly talk about the fact that we're capturing the &VaList here.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
F-c_variadic`#![feature(c_variadic)]``#![feature(c_variadic)]`needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
Activity
lcnr commentedon Aug 4, 2026
I guess that's not a great example as this is intended to error, but I do feel like ideally we'd have a special late bound var instead of an anonymous here