Skip to content

C-variadic function definitions stabilization allows ... without pattern with immediate FCW #160109

Closed

Description

@traviscross

In #155697, we stabilized C-variadic function definitions (and C-variadic function declarations in traits).

While reviewing and revising the Reference PR for this, rust-lang/reference#2177, I noticed that we're stabilizing allowance of a behavior that we document as disallowed (with an immediate FCW against it). Prior to the stabilization, we gave a hard error for both of:

unsafe extern "C" fn f(...) {} // ERROR.

trait Tr {
    unsafe extern "C" fn f(...); // ERROR.
}

After the stabilization, these are both accepted:

#![allow(varargs_without_pattern)]
unsafe extern "C" fn f(...) {} // OK.
#![allow(varargs_without_pattern)]
trait Tr {
    unsafe extern "C" fn f(...); // OK.
}

That is, we're accepting ... in parameter position without a preceding pattern (with a deny-by-default FCW).

This is a bit unusual for us. Normally we don't stabilize new behavior only to issue an immediately FCW. Presumably we want to ask for this to continue to give a hard error (semantically — this was already accepted in parsing).

cc @folkertdev @rust-lang/lang-docs @rust-lang/lang

Activity

  1. added
    T-langRelevant to the language team
    I-lang-nominatedNominated for discussion during a lang team meeting.
    I-lang-radarItems that are on lang's radar and will need eventual work or consideration.
    P-lang-drag-1Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang
    on Jul 28, 2026
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jul 28, 2026
  3. added
    C-discussionCategory: Discussion or questions that doesn't represent real issues.
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jul 28, 2026
  4. folkertdev commented on Jul 29, 2026

    @folkertdev
    Contributor

    For the record I agree that we should just reject bare ... in trait method declarations and definitions (it is still allowed in foreign function declarations), probably just with an error in rustc_ast_passes.

    We could also decide to just deny this pre-expansion now. Relevant links

    Quoting from that last one

    Based on #143619 (comment) there was only one actual impacted crate https://crates.io/crates/binrw. The issue was fixed in jam1garner/binrw#342, and has since been released jam1garner/binrw#342 (comment).

    So, the impact is likely extremely low, but it is a breaking change.

  5. added 3 commits that reference this issue on Aug 3, 2026
  6. added 2 commits that reference this issue on Aug 4, 2026
  7. added a commit that references this issue on Aug 4, 2026
  8. added a commit that references this issue on Aug 4, 2026
  9. removed
    I-lang-nominatedNominated for discussion during a lang team meeting.
    P-lang-drag-1Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang
    on Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-discussionCategory: Discussion or questions that doesn't represent real issues.I-lang-radarItems that are on lang's radar and will need eventual work or consideration.T-langRelevant to the language team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions