Skip to content

Allow specifying certain types we shouldn't derive/impl Copy for #962

Closed
@fitzgen

Description

@fitzgen

Add --no-copy <regex> and Builder::no_copy(String) to supply regexes for matching against types that we should not derive or implement Copy for.

Adding this feature involves:

  • Adding a new RegexSet member to bindgen::Builder (similar to the whitelisted_types set).

  • A Builder method to add strings to that RegexSet.

  • Plumbing in src/options.rs to convert --no-copy <regex> CLI flags into invocations of the builder method.

  • Making the MonotoneFramework::constrain function in src/ir/analysis/derive_copy.rs check if the given item is explicitly marked not to be Copy, and if so, inserting it into the self.cannot_derive_copy set via return self.insert(id).

  • Tests!

    • When the no-copy type is transitively referenced by a whitelisted item

    • When the no-copy type is explicitly whitelisted

    • When the no-copy type is marked opaque

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions