Skip to content

Random musing on the library-level UB casting problem #139036

Closed as not planned
Closed as not planned
@traviscross

Description

@traviscross

Over in:

We're talking about how safe lifetime casts can allow library-level UB. It's interesting to think about other things that fit this pattern that also might be said to cause library-level UB under certain expectations.

steffahn described in #136702 (comment) a plan for using dyn Trait and nightly features for triggering library-level UB. It looks like this:

Playground link

Translating this to a non-dyn context, we get this, which has a similar shape to it:

Playground link

@rustbot labels +T-lang +T-types +C-discussion

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-discussionCategory: Discussion or questions that doesn't represent real issues.T-langRelevant to the language team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions